quote:
Originally posted by DJeX
Would that work?
I don't know. Maybe. Note that when you pass the pointer pTablePtr (just allocated by AllocateAndGetTcpExTableFromStack) to LocalFree, that API (LocalFree) has to know how much memory it has to free, and it will only be able to know that if the memory was allocated by another API "relative" to it. I mean, if AllocateAndGetTcpExTableFromStack calls internally some API that LocalFree knows, then yes, you'll be able to use it else you can't.
Anyway, I've searched a bit, and I've found this. Try it. It looks nice, so I think it'll work, but i don't know:
code:
Declare Function HeapFree Lib "kernel32" Alias "HeapFree" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long
Declare Function GetProcessHeap Lib "kernel32" Alias "GetProcessHeap" () As Long
public sub freemem()
HeapFree GetProcessHeap(), 0&, ByVal pTablePtr
' if it doesn't work, try to remove the ByVal keyword
end sub