1 // Copyright © 2017 winapi-rs developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5 // All files in the project carrying such notice may not be copied, modified, or distributed
6 // except according to those terms.
8 use shared
::basetsd
::{DWORD_PTR, SIZE_T}
;
9 use shared
::guiddef
::GUID
;
10 use shared
::minwindef
::{BOOL, DWORD, LPBOOL, LPDWORD, PULONG}
;
11 use um
::winnt
::{HRESULT, LARGE_INTEGER, WCHAR}
;
12 ENUM
!{enum WCT_OBJECT_TYPE
{
13 WctCriticalSectionType
= 1,
27 ENUM
!{enum WCT_OBJECT_STATUS
{
28 WctStatusNoAccess
= 1,
32 WctStatusPidOnlyRpcss
,
40 pub const WCT_MAX_NODE_COUNT
: SIZE_T
= 16;
41 pub const WCT_OBJNAME_LENGTH
: SIZE_T
= 128;
42 STRUCT
!{struct WAITCHAIN_NODE_INFO_LOCK_OBJECT
{
43 ObjectName
: [WCHAR
; WCT_OBJNAME_LENGTH
],
44 Timeout
: LARGE_INTEGER
,
47 STRUCT
!{struct WAITCHAIN_NODE_INFO_THREAD_OBJECT
{
51 ContextSwitches
: DWORD
,
53 UNION
!{union WAITCHAIN_NODE_INFO_u
{
55 LockObject LockObject_mut
: WAITCHAIN_NODE_INFO_LOCK_OBJECT
,
56 ThreadObject ThreadObject_mut
: WAITCHAIN_NODE_INFO_THREAD_OBJECT
,
58 STRUCT
!{struct WAITCHAIN_NODE_INFO
{
59 ObjectType
: WCT_OBJECT_TYPE
,
60 ObjectStatus
: WCT_OBJECT_STATUS
,
61 u
: WAITCHAIN_NODE_INFO_u
,
63 pub type PWAITCHAIN_NODE_INFO
= *mut WAITCHAIN_NODE_INFO
;
64 DECLARE_HANDLE
!{HWCT, HWCT__}
65 FN
!{cdecl
PWAITCHAINCALLBACK(
68 CallbackStatus
: DWORD
,
70 NodeInfoArray
: PWAITCHAIN_NODE_INFO
,
73 pub const WCT_ASYNC_OPEN_FLAG
: DWORD
= 1;
74 pub const WCTP_OPEN_ALL_FLAGS
: DWORD
= WCT_ASYNC_OPEN_FLAG
;
76 pub fn OpenThreadWaitChainSession(
78 callback
: PWAITCHAINCALLBACK
,
80 pub fn CloseThreadWaitChainSession(
84 pub const WCT_OUT_OF_PROC_FLAG
: DWORD
= 0x1;
85 pub const WCT_OUT_OF_PROC_COM_FLAG
: DWORD
= 0x2;
86 pub const WCT_OUT_OF_PROC_CS_FLAG
: DWORD
= 0x4;
87 pub const WCT_NETWORK_IO_FLAG
: DWORD
= 0x8;
88 pub const WCTP_GETINFO_ALL_FLAGS
: DWORD
= WCT_OUT_OF_PROC_FLAG
| WCT_OUT_OF_PROC_COM_FLAG
89 | WCT_OUT_OF_PROC_CS_FLAG
;
91 pub fn GetThreadWaitChain(
97 NodeInfoArray
: PWAITCHAIN_NODE_INFO
,
101 FN
!{cdecl
PCOGETCALLSTATE(
105 FN
!{cdecl
PCOGETACTIVATIONSTATE(
111 pub fn RegisterWaitChainCOMCallback(
112 CallStateCallback
: PCOGETCALLSTATE
,
113 ActivationStateCallback
: PCOGETACTIVATIONSTATE
,