]> git.proxmox.com Git - rustc.git/blob - vendor/winapi/src/um/wct.rs
d067846173a537e3cda0115dbed9a3d49170d48c
[rustc.git] / vendor / winapi / src / um / wct.rs
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.
7 use ctypes::c_int;
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,
14 WctSendMessageType,
15 WctMutexType,
16 WctAlpcType,
17 WctComType,
18 WctThreadWaitType,
19 WctProcessWaitType,
20 WctThreadType,
21 WctComActivationType,
22 WctUnknownType,
23 WctSocketIoType,
24 WctSmbIoType,
25 WctMaxType,
26 }}
27 ENUM!{enum WCT_OBJECT_STATUS {
28 WctStatusNoAccess = 1,
29 WctStatusRunning,
30 WctStatusBlocked,
31 WctStatusPidOnly,
32 WctStatusPidOnlyRpcss,
33 WctStatusOwned,
34 WctStatusNotOwned,
35 WctStatusAbandoned,
36 WctStatusUnknown,
37 WctStatusError,
38 WctStatusMax,
39 }}
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,
45 Alertable: BOOL,
46 }}
47 STRUCT!{struct WAITCHAIN_NODE_INFO_THREAD_OBJECT {
48 ProcessId: DWORD,
49 ThreadId: DWORD,
50 WaitTime: DWORD,
51 ContextSwitches: DWORD,
52 }}
53 UNION!{union WAITCHAIN_NODE_INFO_u {
54 [u64; 34],
55 LockObject LockObject_mut: WAITCHAIN_NODE_INFO_LOCK_OBJECT,
56 ThreadObject ThreadObject_mut: WAITCHAIN_NODE_INFO_THREAD_OBJECT,
57 }}
58 STRUCT!{struct WAITCHAIN_NODE_INFO {
59 ObjectType: WCT_OBJECT_TYPE,
60 ObjectStatus: WCT_OBJECT_STATUS,
61 u: WAITCHAIN_NODE_INFO_u,
62 }}
63 pub type PWAITCHAIN_NODE_INFO = *mut WAITCHAIN_NODE_INFO;
64 DECLARE_HANDLE!{HWCT, HWCT__}
65 FN!{cdecl PWAITCHAINCALLBACK(
66 WctHandle: HWCT,
67 Context: DWORD_PTR,
68 CallbackStatus: DWORD,
69 NodeCount: LPDWORD,
70 NodeInfoArray: PWAITCHAIN_NODE_INFO,
71 IsCycle: LPBOOL,
72 ) -> ()}
73 pub const WCT_ASYNC_OPEN_FLAG: DWORD = 1;
74 pub const WCTP_OPEN_ALL_FLAGS: DWORD = WCT_ASYNC_OPEN_FLAG;
75 extern "system" {
76 pub fn OpenThreadWaitChainSession(
77 Flags: DWORD,
78 callback: PWAITCHAINCALLBACK,
79 ) -> HWCT;
80 pub fn CloseThreadWaitChainSession(
81 WctHandle: HWCT,
82 );
83 }
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;
90 extern "system" {
91 pub fn GetThreadWaitChain(
92 WctHandle: HWCT,
93 Context: DWORD_PTR,
94 Flags: DWORD,
95 ThreadId: DWORD,
96 NodeCount: LPDWORD,
97 NodeInfoArray: PWAITCHAIN_NODE_INFO,
98 IsCycle: LPBOOL,
99 ) -> BOOL;
100 }
101 FN!{cdecl PCOGETCALLSTATE(
102 c_int,
103 PULONG,
104 ) -> HRESULT}
105 FN!{cdecl PCOGETACTIVATIONSTATE(
106 GUID,
107 DWORD,
108 *mut DWORD,
109 ) -> HRESULT}
110 extern "system" {
111 pub fn RegisterWaitChainCOMCallback(
112 CallStateCallback: PCOGETCALLSTATE,
113 ActivationStateCallback: PCOGETACTIVATIONSTATE,
114 );
115 }