I am new to this concept of calling C++ methods from C#.
Assuming that I want to call a C++ function GetThreadWaitChain
from C#:
https://msdn.micr
The GetThreadWaitChain function prototype is incorrect. It should be:
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool GetThreadWaitChain(
IntPtr WctHandle,
IntPtr Context,
UInt32 Flags,
int ThreadId,
ref int NodeCount,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)]
[In, Out]
WAITCHAIN_NODE_INFO[] NodeInfoArray,
out int IsCycle
);
When calling first allocate the WAITCHAIN_NODE_INFO array.
WAITCHAIN_NODE_INFO[] data = new WAITCHAIN_NODE_INFO[16];