wct.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the mingw-w64 runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  5. */
  6. #ifndef _INC_WCT
  7. #define _INC_WCT
  8. #if (_WIN32_WINNT >= 0x0600)
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. typedef LPVOID HWCT;
  13. typedef enum _WCT_OBJECT_TYPE {
  14. WctCriticalSectionType = 1,
  15. WctSendMessageType,
  16. WctMutexType,
  17. WctAlpcType,
  18. WctComType,
  19. WctThreadWaitType,
  20. WctProcessWaitType,
  21. WctThreadType,
  22. WctComActivationType,
  23. WctUnknownType
  24. } WCT_OBJECT_TYPE;
  25. typedef enum _WCT_OBJECT_STATUS {
  26. WctStatusNoAccess = 1,
  27. WctStatusRunning,
  28. WctStatusBlocked,
  29. WctStatusPidOnly,
  30. WctStatusPidOnlyRpcss,
  31. WctStatusOwned,
  32. WctStatusNotOwned,
  33. WctStatusAbandoned,
  34. WctStatusUnknown,
  35. WctStatusError
  36. } WCT_OBJECT_STATUS;
  37. /* According to http://msdn.microsoft.com/en-us/magazine/cc163395.aspx
  38. RealObjectName has 0x8 offset and TimeOutLowPart has 0x108
  39. WCT_OBJNAME_LENGTH assumed to be 128 ((0x108-0x8)/sizeof (ushort) = 128)
  40. */
  41. #define WCT_OBJNAME_LENGTH 128
  42. typedef struct _WAITCHAIN_NODE_INFO {
  43. WCT_OBJECT_TYPE ObjectType;
  44. WCT_OBJECT_STATUS ObjectStatus;
  45. __C89_NAMELESS union {
  46. struct {
  47. WCHAR ObjectName[WCT_OBJNAME_LENGTH];
  48. LARGE_INTEGER Timeout;
  49. WINBOOL Alertable;
  50. } LockObject;
  51. struct {
  52. DWORD ProcessId;
  53. DWORD ThreadId;
  54. DWORD WaitTime;
  55. DWORD ContextSwitches;
  56. } ThreadObject;
  57. };
  58. } WAITCHAIN_NODE_INFO, *PWAITCHAIN_NODE_INFO;
  59. typedef VOID (CALLBACK *PWAITCHAINCALLBACK)(HWCT WctHandle,DWORD_PTR Context,DWORD CallbackStatus,LPDWORD NodeCount,PWAITCHAIN_NODE_INFO NodeInfoArray,LPBOOL IsCycle);
  60. HWCT WINAPI OpenThreadWaitChainSession(DWORD Flags,PWAITCHAINCALLBACK callback);
  61. VOID WINAPI CloseThreadWaitChainSession(HWCT WctHandle);
  62. WINBOOL WINAPI GetThreadWaitChain(HWCT WctHandle,DWORD_PTR Context,DWORD Flags,DWORD ThreadId,LPDWORD NodeCount,PWAITCHAIN_NODE_INFO NodeInfoArray,LPBOOL IsCycle);
  63. /* Unknown Callbacks */
  64. typedef LPVOID (WINAPI *PCOGETCALLSTATE)();
  65. typedef LPVOID (WINAPI *PCOGETACTIVATIONSTATE)();
  66. VOID WINAPI RegisterWaitChainCOMCallback(PCOGETCALLSTATE CallStateCallback,PCOGETACTIVATIONSTATE ActivationStateCallback);
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* (_WIN32_WINNT >= 0x0600) */
  71. #endif /*_INC_WCT*/