Declaring C struct with union on C#
问题 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;