T
TyBreaker
I'm using the following declaration for the PROCESSENTRY32 data
structure obtained from http://pinvoke.net:
<StructLayout(LayoutKind.Sequential)> Public Structure PROCESSENTRY32
Public dwSize As Int32
Public cntUsage As Int32
Public th32ProcessID As Int32
Public th32DefaultHeapID As Int32
Public th32ModuleID As Int32
Public cntThreads As Int32
Public th32ParentProcessID As Int32
Public pcPriClassBase As Int32
Public dwFlags As Int32
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public
szExeFile As String
End Structure
But when I use it in my API call thus:
Declare Function CreateToolhelp32Snapshot Lib "kernel32.dll" (ByVal
dwFlags As Long, ByVal th32ProcessID As Long) As Long
Dim beforeSnapshot as Long
beforeSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
I get a run-time error in VB.Net saying "A call to PInvoke function
'CreateToolhelp32Snapshot' has unbalanced the stack. This is likely
because the managed PInvoke signature does not match the unmanaged
target signature. Check that the calling convention and parameters of
the PInvoke signature match the target unmanaged signature."
Does this mean the declarations for the data structure or the API
function are incorrect?
--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/
There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.
There's no place like 127.0.0.1.
ASCII a silly question, get a silly ANSI.
structure obtained from http://pinvoke.net:
<StructLayout(LayoutKind.Sequential)> Public Structure PROCESSENTRY32
Public dwSize As Int32
Public cntUsage As Int32
Public th32ProcessID As Int32
Public th32DefaultHeapID As Int32
Public th32ModuleID As Int32
Public cntThreads As Int32
Public th32ParentProcessID As Int32
Public pcPriClassBase As Int32
Public dwFlags As Int32
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public
szExeFile As String
End Structure
But when I use it in my API call thus:
Declare Function CreateToolhelp32Snapshot Lib "kernel32.dll" (ByVal
dwFlags As Long, ByVal th32ProcessID As Long) As Long
Dim beforeSnapshot as Long
beforeSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
I get a run-time error in VB.Net saying "A call to PInvoke function
'CreateToolhelp32Snapshot' has unbalanced the stack. This is likely
because the managed PInvoke signature does not match the unmanaged
target signature. Check that the calling convention and parameters of
the PInvoke signature match the target unmanaged signature."
Does this mean the declarations for the data structure or the API
function are incorrect?
--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/
There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.
There's no place like 127.0.0.1.
ASCII a silly question, get a silly ANSI.