I want to declare _WAITCHAIN_NODE_INFO struct declaration in my code - for WCT usage. I've tried to follow the tutorials from :
https://msdn.microsoft.com/en-us/library/eshywdt7(v=vs.110).aspx
But every time then I use WCT call with my managed struct declaration I get heap corruption.
typedef struct _WAITCHAIN_NODE_INFO {
WCT_OBJECT_TYPE ObjectType;
WCT_OBJECT_STATUS ObjectStatus;
union {
struct {
WCHAR ObjectName[WCT_OBJNAME_LENGTH];
LARGE_INTEGER Timeout;
BOOL Alertable;
} LockObject;
struct {
DWORD ProcessId;
DWORD ThreadId;
DWORD WaitTime;
DWORD ContextSwitches;
} ThreadObject;
};
} WAITCHAIN_NODE_INFO, *PWAITCHAIN_NODE_INFO;
MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681422(v=vs.85).aspx
The only declaration that doesn't get me a heap corruption is this:
public struct WAITCHAIN_NODE_INFO
{
public WCT_OBJECT_TYPE ObjectType;
public WCT_OBJECT_STATUS ObjectStatus;
}
Obviously, I am missing here the union of LockObject and ThreadObject structs.
How can I convert this C struct to C# managed declaration?
Any help will be appreciated.