Reputation: 1259
When i send:
Result = CInt(NetApiBufferFree(pBuffer))
I receive (SOME TIMES) this error:
Arithmetic operation resulted in an overflow.
What exactly means that? and how i can resolve it?
Upvotes: 7
Views: 54014
Reputation: 41
Best answer is replace 'double' in place of 'Int16/Int32/Int64'
some times file conversion takes huge numbers.. double never has maximum range.
Upvotes: 0
Reputation: 12918
It means that CInt
argument is out of range of Integer
, -0x80000000 to 0x7FFFFFFF
And it happens when NetApiBufferFree
returns an error: error codes are bigger than 0x80000000.
There is no unsigned int32 type, so use CLng
instead of CInt
.
About source of error. You should find out code of error which you get: call MsgBox or log it to file, or use breakpoint. Next find its description. If it won't help you (for example error would be E_FAIL), add code to check that pBuffer
value is valid - that it wasn't modified by something, and wasn't already freed. Add logging for NetApiBuffer*
calls.
Upvotes: 15