I'm guessing you are defining BUFSIZE as an Int32? If the win32.dll expects an integer, than it's actually expecting a 16-bit integer, and not a 32-bit integer.
When BUFSIZE = 9999, this value is less than the maximum size of a 16-bit value of 32,767.
When BUFSIZE = 99999, this value is greater than the maximum size of a 16-bit value of 32,767.
EDIT: After re-reading where you using BUFSIZE, I see that it's for defining an array. I'm thinking that the maximum size the P/Invoke method will accept for that array is an array size that does NOT exceed the 16-bit value, so Int16.