]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/windows/c.rs
Update const_forget.rs
[rust.git] / src / libstd / sys / windows / c.rs
1 //! C definitions used by libnative that don't belong in liblibc
2
3 #![allow(nonstandard_style)]
4 #![cfg_attr(test, allow(dead_code))]
5 #![unstable(issue = "none", feature = "windows_c")]
6
7 use crate::os::raw::{c_char, c_int, c_long, c_longlong, c_uint, c_ulong, c_ushort};
8 use crate::ptr;
9
10 use libc::{c_void, size_t, wchar_t};
11
12 pub use self::EXCEPTION_DISPOSITION::*;
13 pub use self::FILE_INFO_BY_HANDLE_CLASS::*;
14
15 pub type DWORD = c_ulong;
16 pub type HANDLE = LPVOID;
17 pub type HINSTANCE = HANDLE;
18 pub type HMODULE = HINSTANCE;
19 pub type HRESULT = LONG;
20 pub type BOOL = c_int;
21 pub type BYTE = u8;
22 pub type BOOLEAN = BYTE;
23 pub type GROUP = c_uint;
24 pub type LARGE_INTEGER = c_longlong;
25 pub type LONG = c_long;
26 pub type UINT = c_uint;
27 pub type WCHAR = u16;
28 pub type USHORT = c_ushort;
29 pub type SIZE_T = usize;
30 pub type WORD = u16;
31 pub type CHAR = c_char;
32 pub type ULONG_PTR = usize;
33 pub type ULONG = c_ulong;
34
35 pub type LPBOOL = *mut BOOL;
36 pub type LPBYTE = *mut BYTE;
37 pub type LPCSTR = *const CHAR;
38 pub type LPCWSTR = *const WCHAR;
39 pub type LPDWORD = *mut DWORD;
40 pub type LPHANDLE = *mut HANDLE;
41 pub type LPOVERLAPPED = *mut OVERLAPPED;
42 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
43 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
44 pub type LPSTARTUPINFO = *mut STARTUPINFO;
45 pub type LPVOID = *mut c_void;
46 pub type LPWCH = *mut WCHAR;
47 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
48 pub type LPWSADATA = *mut WSADATA;
49 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
50 pub type LPSTR = *mut CHAR;
51 pub type LPWSTR = *mut WCHAR;
52 pub type LPFILETIME = *mut FILETIME;
53 pub type LPWSABUF = *mut WSABUF;
54 pub type LPWSAOVERLAPPED = *mut c_void;
55 pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = *mut c_void;
56
57 pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE;
58 pub type PLARGE_INTEGER = *mut c_longlong;
59 pub type PSRWLOCK = *mut SRWLOCK;
60
61 pub type SOCKET = crate::os::windows::raw::SOCKET;
62 pub type socklen_t = c_int;
63 pub type ADDRESS_FAMILY = USHORT;
64
65 pub const TRUE: BOOL = 1;
66 pub const FALSE: BOOL = 0;
67
68 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
69 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
70 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
71
72 pub const FILE_SHARE_DELETE: DWORD = 0x4;
73 pub const FILE_SHARE_READ: DWORD = 0x1;
74 pub const FILE_SHARE_WRITE: DWORD = 0x2;
75
76 pub const CREATE_ALWAYS: DWORD = 2;
77 pub const CREATE_NEW: DWORD = 1;
78 pub const OPEN_ALWAYS: DWORD = 4;
79 pub const OPEN_EXISTING: DWORD = 3;
80 pub const TRUNCATE_EXISTING: DWORD = 5;
81
82 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
83 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
84 pub const FILE_WRITE_EA: DWORD = 0x00000010;
85 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
86 pub const READ_CONTROL: DWORD = 0x00020000;
87 pub const SYNCHRONIZE: DWORD = 0x00100000;
88 pub const GENERIC_READ: DWORD = 0x80000000;
89 pub const GENERIC_WRITE: DWORD = 0x40000000;
90 pub const STANDARD_RIGHTS_WRITE: DWORD = READ_CONTROL;
91 pub const FILE_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE
92     | FILE_WRITE_DATA
93     | FILE_WRITE_ATTRIBUTES
94     | FILE_WRITE_EA
95     | FILE_APPEND_DATA
96     | SYNCHRONIZE;
97
98 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
99 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
100 pub const SECURITY_SQOS_PRESENT: DWORD = 0x00100000;
101
102 pub const FIONBIO: c_ulong = 0x8004667e;
103
104 #[repr(C)]
105 #[derive(Copy)]
106 pub struct WIN32_FIND_DATAW {
107     pub dwFileAttributes: DWORD,
108     pub ftCreationTime: FILETIME,
109     pub ftLastAccessTime: FILETIME,
110     pub ftLastWriteTime: FILETIME,
111     pub nFileSizeHigh: DWORD,
112     pub nFileSizeLow: DWORD,
113     pub dwReserved0: DWORD,
114     pub dwReserved1: DWORD,
115     pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
116     pub cAlternateFileName: [wchar_t; 14],
117 }
118 impl Clone for WIN32_FIND_DATAW {
119     fn clone(&self) -> Self {
120         *self
121     }
122 }
123
124 pub const WSA_FLAG_OVERLAPPED: DWORD = 0x01;
125 pub const WSA_FLAG_NO_HANDLE_INHERIT: DWORD = 0x80;
126
127 pub const WSADESCRIPTION_LEN: usize = 256;
128 pub const WSASYS_STATUS_LEN: usize = 128;
129 pub const WSAPROTOCOL_LEN: DWORD = 255;
130 pub const INVALID_SOCKET: SOCKET = !0;
131
132 pub const WSAEACCES: c_int = 10013;
133 pub const WSAEINVAL: c_int = 10022;
134 pub const WSAEWOULDBLOCK: c_int = 10035;
135 pub const WSAEPROTOTYPE: c_int = 10041;
136 pub const WSAEADDRINUSE: c_int = 10048;
137 pub const WSAEADDRNOTAVAIL: c_int = 10049;
138 pub const WSAECONNABORTED: c_int = 10053;
139 pub const WSAECONNRESET: c_int = 10054;
140 pub const WSAENOTCONN: c_int = 10057;
141 pub const WSAESHUTDOWN: c_int = 10058;
142 pub const WSAETIMEDOUT: c_int = 10060;
143 pub const WSAECONNREFUSED: c_int = 10061;
144
145 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
146
147 pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: usize = 16 * 1024;
148 pub const FSCTL_GET_REPARSE_POINT: DWORD = 0x900a8;
149 pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xa000000c;
150 pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xa0000003;
151 pub const SYMLINK_FLAG_RELATIVE: DWORD = 0x00000001;
152 pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4;
153
154 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 0x1;
155 pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: DWORD = 0x2;
156
157 // Note that these are not actually HANDLEs, just values to pass to GetStdHandle
158 pub const STD_INPUT_HANDLE: DWORD = -10i32 as DWORD;
159 pub const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
160 pub const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
161
162 pub const PROGRESS_CONTINUE: DWORD = 0;
163
164 pub const ERROR_FILE_NOT_FOUND: DWORD = 2;
165 pub const ERROR_PATH_NOT_FOUND: DWORD = 3;
166 pub const ERROR_ACCESS_DENIED: DWORD = 5;
167 pub const ERROR_INVALID_HANDLE: DWORD = 6;
168 pub const ERROR_NO_MORE_FILES: DWORD = 18;
169 pub const ERROR_HANDLE_EOF: DWORD = 38;
170 pub const ERROR_FILE_EXISTS: DWORD = 80;
171 pub const ERROR_INVALID_PARAMETER: DWORD = 87;
172 pub const ERROR_BROKEN_PIPE: DWORD = 109;
173 pub const ERROR_CALL_NOT_IMPLEMENTED: DWORD = 120;
174 pub const ERROR_INSUFFICIENT_BUFFER: DWORD = 122;
175 pub const ERROR_ALREADY_EXISTS: DWORD = 183;
176 pub const ERROR_NO_DATA: DWORD = 232;
177 pub const ERROR_ENVVAR_NOT_FOUND: DWORD = 203;
178 pub const ERROR_OPERATION_ABORTED: DWORD = 995;
179 pub const ERROR_IO_PENDING: DWORD = 997;
180 pub const ERROR_TIMEOUT: DWORD = 0x5B4;
181
182 pub const E_NOTIMPL: HRESULT = 0x80004001u32 as HRESULT;
183
184 pub const INVALID_HANDLE_VALUE: HANDLE = !0 as HANDLE;
185
186 pub const FACILITY_NT_BIT: DWORD = 0x1000_0000;
187
188 pub const FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000;
189 pub const FORMAT_MESSAGE_FROM_HMODULE: DWORD = 0x00000800;
190 pub const FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200;
191
192 pub const TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF;
193
194 pub const DLL_THREAD_DETACH: DWORD = 3;
195 pub const DLL_PROCESS_DETACH: DWORD = 0;
196
197 pub const INFINITE: DWORD = !0;
198
199 pub const DUPLICATE_SAME_ACCESS: DWORD = 0x00000002;
200
201 pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { ptr: ptr::null_mut() };
202 pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { ptr: ptr::null_mut() };
203
204 pub const DETACHED_PROCESS: DWORD = 0x00000008;
205 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
206 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
207 pub const STARTF_USESTDHANDLES: DWORD = 0x00000100;
208
209 pub const AF_INET: c_int = 2;
210 pub const AF_INET6: c_int = 23;
211 pub const SD_BOTH: c_int = 2;
212 pub const SD_RECEIVE: c_int = 0;
213 pub const SD_SEND: c_int = 1;
214 pub const SOCK_DGRAM: c_int = 2;
215 pub const SOCK_STREAM: c_int = 1;
216 pub const SOL_SOCKET: c_int = 0xffff;
217 pub const SO_RCVTIMEO: c_int = 0x1006;
218 pub const SO_SNDTIMEO: c_int = 0x1005;
219 pub const SO_REUSEADDR: c_int = 0x0004;
220 pub const IPPROTO_IP: c_int = 0;
221 pub const IPPROTO_TCP: c_int = 6;
222 pub const IPPROTO_IPV6: c_int = 41;
223 pub const TCP_NODELAY: c_int = 0x0001;
224 pub const IP_TTL: c_int = 4;
225 pub const IPV6_V6ONLY: c_int = 27;
226 pub const SO_ERROR: c_int = 0x1007;
227 pub const SO_BROADCAST: c_int = 0x0020;
228 pub const IP_MULTICAST_LOOP: c_int = 11;
229 pub const IPV6_MULTICAST_LOOP: c_int = 11;
230 pub const IP_MULTICAST_TTL: c_int = 10;
231 pub const IP_ADD_MEMBERSHIP: c_int = 12;
232 pub const IP_DROP_MEMBERSHIP: c_int = 13;
233 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
234 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
235 pub const MSG_PEEK: c_int = 0x2;
236
237 #[repr(C)]
238 pub struct ip_mreq {
239     pub imr_multiaddr: in_addr,
240     pub imr_interface: in_addr,
241 }
242
243 #[repr(C)]
244 pub struct ipv6_mreq {
245     pub ipv6mr_multiaddr: in6_addr,
246     pub ipv6mr_interface: c_uint,
247 }
248
249 pub const VOLUME_NAME_DOS: DWORD = 0x0;
250 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
251
252 pub const FILE_BEGIN: DWORD = 0;
253 pub const FILE_CURRENT: DWORD = 1;
254 pub const FILE_END: DWORD = 2;
255
256 pub const WAIT_OBJECT_0: DWORD = 0x00000000;
257 pub const WAIT_TIMEOUT: DWORD = 258;
258 pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
259
260 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
261 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
262 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
263 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
264 pub const PIPE_WAIT: DWORD = 0x00000000;
265 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
266 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
267 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
268
269 pub const FD_SETSIZE: usize = 64;
270
271 pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
272
273 pub const HEAP_ZERO_MEMORY: DWORD = 0x00000008;
274
275 #[repr(C)]
276 #[cfg(not(target_pointer_width = "64"))]
277 pub struct WSADATA {
278     pub wVersion: WORD,
279     pub wHighVersion: WORD,
280     pub szDescription: [u8; WSADESCRIPTION_LEN + 1],
281     pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1],
282     pub iMaxSockets: u16,
283     pub iMaxUdpDg: u16,
284     pub lpVendorInfo: *mut u8,
285 }
286 #[repr(C)]
287 #[cfg(target_pointer_width = "64")]
288 pub struct WSADATA {
289     pub wVersion: WORD,
290     pub wHighVersion: WORD,
291     pub iMaxSockets: u16,
292     pub iMaxUdpDg: u16,
293     pub lpVendorInfo: *mut u8,
294     pub szDescription: [u8; WSADESCRIPTION_LEN + 1],
295     pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1],
296 }
297
298 #[repr(C)]
299 pub struct WSABUF {
300     pub len: ULONG,
301     pub buf: *mut CHAR,
302 }
303
304 #[repr(C)]
305 pub struct WSAPROTOCOL_INFO {
306     pub dwServiceFlags1: DWORD,
307     pub dwServiceFlags2: DWORD,
308     pub dwServiceFlags3: DWORD,
309     pub dwServiceFlags4: DWORD,
310     pub dwProviderFlags: DWORD,
311     pub ProviderId: GUID,
312     pub dwCatalogEntryId: DWORD,
313     pub ProtocolChain: WSAPROTOCOLCHAIN,
314     pub iVersion: c_int,
315     pub iAddressFamily: c_int,
316     pub iMaxSockAddr: c_int,
317     pub iMinSockAddr: c_int,
318     pub iSocketType: c_int,
319     pub iProtocol: c_int,
320     pub iProtocolMaxOffset: c_int,
321     pub iNetworkByteOrder: c_int,
322     pub iSecurityScheme: c_int,
323     pub dwMessageSize: DWORD,
324     pub dwProviderReserved: DWORD,
325     pub szProtocol: [u16; (WSAPROTOCOL_LEN as usize) + 1],
326 }
327
328 #[repr(C)]
329 #[derive(Copy, Clone)]
330 pub struct WIN32_FILE_ATTRIBUTE_DATA {
331     pub dwFileAttributes: DWORD,
332     pub ftCreationTime: FILETIME,
333     pub ftLastAccessTime: FILETIME,
334     pub ftLastWriteTime: FILETIME,
335     pub nFileSizeHigh: DWORD,
336     pub nFileSizeLow: DWORD,
337 }
338
339 #[repr(C)]
340 #[allow(dead_code)] // we only use some variants
341 pub enum FILE_INFO_BY_HANDLE_CLASS {
342     FileBasicInfo = 0,
343     FileStandardInfo = 1,
344     FileNameInfo = 2,
345     FileRenameInfo = 3,
346     FileDispositionInfo = 4,
347     FileAllocationInfo = 5,
348     FileEndOfFileInfo = 6,
349     FileStreamInfo = 7,
350     FileCompressionInfo = 8,
351     FileAttributeTagInfo = 9,
352     FileIdBothDirectoryInfo = 10,        // 0xA
353     FileIdBothDirectoryRestartInfo = 11, // 0xB
354     FileIoPriorityHintInfo = 12,         // 0xC
355     FileRemoteProtocolInfo = 13,         // 0xD
356     FileFullDirectoryInfo = 14,          // 0xE
357     FileFullDirectoryRestartInfo = 15,   // 0xF
358     FileStorageInfo = 16,                // 0x10
359     FileAlignmentInfo = 17,              // 0x11
360     FileIdInfo = 18,                     // 0x12
361     FileIdExtdDirectoryInfo = 19,        // 0x13
362     FileIdExtdDirectoryRestartInfo = 20, // 0x14
363     MaximumFileInfoByHandlesClass,
364 }
365
366 #[repr(C)]
367 pub struct FILE_BASIC_INFO {
368     pub CreationTime: LARGE_INTEGER,
369     pub LastAccessTime: LARGE_INTEGER,
370     pub LastWriteTime: LARGE_INTEGER,
371     pub ChangeTime: LARGE_INTEGER,
372     pub FileAttributes: DWORD,
373 }
374
375 #[repr(C)]
376 pub struct FILE_END_OF_FILE_INFO {
377     pub EndOfFile: LARGE_INTEGER,
378 }
379
380 #[repr(C)]
381 pub struct REPARSE_DATA_BUFFER {
382     pub ReparseTag: c_uint,
383     pub ReparseDataLength: c_ushort,
384     pub Reserved: c_ushort,
385     pub rest: (),
386 }
387
388 #[repr(C)]
389 pub struct SYMBOLIC_LINK_REPARSE_BUFFER {
390     pub SubstituteNameOffset: c_ushort,
391     pub SubstituteNameLength: c_ushort,
392     pub PrintNameOffset: c_ushort,
393     pub PrintNameLength: c_ushort,
394     pub Flags: c_ulong,
395     pub PathBuffer: WCHAR,
396 }
397
398 #[repr(C)]
399 pub struct MOUNT_POINT_REPARSE_BUFFER {
400     pub SubstituteNameOffset: c_ushort,
401     pub SubstituteNameLength: c_ushort,
402     pub PrintNameOffset: c_ushort,
403     pub PrintNameLength: c_ushort,
404     pub PathBuffer: WCHAR,
405 }
406
407 pub type LPPROGRESS_ROUTINE = crate::option::Option<
408     unsafe extern "system" fn(
409         TotalFileSize: LARGE_INTEGER,
410         TotalBytesTransferred: LARGE_INTEGER,
411         StreamSize: LARGE_INTEGER,
412         StreamBytesTransferred: LARGE_INTEGER,
413         dwStreamNumber: DWORD,
414         dwCallbackReason: DWORD,
415         hSourceFile: HANDLE,
416         hDestinationFile: HANDLE,
417         lpData: LPVOID,
418     ) -> DWORD,
419 >;
420
421 #[repr(C)]
422 pub struct CONDITION_VARIABLE {
423     pub ptr: LPVOID,
424 }
425 #[repr(C)]
426 pub struct SRWLOCK {
427     pub ptr: LPVOID,
428 }
429 #[repr(C)]
430 pub struct CRITICAL_SECTION {
431     CriticalSectionDebug: LPVOID,
432     LockCount: LONG,
433     RecursionCount: LONG,
434     OwningThread: HANDLE,
435     LockSemaphore: HANDLE,
436     SpinCount: ULONG_PTR,
437 }
438
439 #[repr(C)]
440 pub struct REPARSE_MOUNTPOINT_DATA_BUFFER {
441     pub ReparseTag: DWORD,
442     pub ReparseDataLength: DWORD,
443     pub Reserved: WORD,
444     pub ReparseTargetLength: WORD,
445     pub ReparseTargetMaximumLength: WORD,
446     pub Reserved1: WORD,
447     pub ReparseTarget: WCHAR,
448 }
449
450 #[repr(C)]
451 pub struct GUID {
452     pub Data1: DWORD,
453     pub Data2: WORD,
454     pub Data3: WORD,
455     pub Data4: [BYTE; 8],
456 }
457
458 #[repr(C)]
459 pub struct WSAPROTOCOLCHAIN {
460     pub ChainLen: c_int,
461     pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
462 }
463
464 #[repr(C)]
465 pub struct SECURITY_ATTRIBUTES {
466     pub nLength: DWORD,
467     pub lpSecurityDescriptor: LPVOID,
468     pub bInheritHandle: BOOL,
469 }
470
471 #[repr(C)]
472 pub struct PROCESS_INFORMATION {
473     pub hProcess: HANDLE,
474     pub hThread: HANDLE,
475     pub dwProcessId: DWORD,
476     pub dwThreadId: DWORD,
477 }
478
479 #[repr(C)]
480 pub struct STARTUPINFO {
481     pub cb: DWORD,
482     pub lpReserved: LPWSTR,
483     pub lpDesktop: LPWSTR,
484     pub lpTitle: LPWSTR,
485     pub dwX: DWORD,
486     pub dwY: DWORD,
487     pub dwXSize: DWORD,
488     pub dwYSize: DWORD,
489     pub dwXCountChars: DWORD,
490     pub dwYCountCharts: DWORD,
491     pub dwFillAttribute: DWORD,
492     pub dwFlags: DWORD,
493     pub wShowWindow: WORD,
494     pub cbReserved2: WORD,
495     pub lpReserved2: LPBYTE,
496     pub hStdInput: HANDLE,
497     pub hStdOutput: HANDLE,
498     pub hStdError: HANDLE,
499 }
500
501 #[repr(C)]
502 pub struct SOCKADDR {
503     pub sa_family: ADDRESS_FAMILY,
504     pub sa_data: [CHAR; 14],
505 }
506
507 #[repr(C)]
508 #[derive(Copy, Clone)]
509 pub struct FILETIME {
510     pub dwLowDateTime: DWORD,
511     pub dwHighDateTime: DWORD,
512 }
513
514 #[repr(C)]
515 pub struct OVERLAPPED {
516     pub Internal: *mut c_ulong,
517     pub InternalHigh: *mut c_ulong,
518     pub Offset: DWORD,
519     pub OffsetHigh: DWORD,
520     pub hEvent: HANDLE,
521 }
522
523 #[repr(C)]
524 #[allow(dead_code)] // we only use some variants
525 pub enum ADDRESS_MODE {
526     AddrMode1616,
527     AddrMode1632,
528     AddrModeReal,
529     AddrModeFlat,
530 }
531
532 #[repr(C)]
533 pub struct SOCKADDR_STORAGE_LH {
534     pub ss_family: ADDRESS_FAMILY,
535     pub __ss_pad1: [CHAR; 6],
536     pub __ss_align: i64,
537     pub __ss_pad2: [CHAR; 112],
538 }
539
540 #[repr(C)]
541 pub struct ADDRINFOA {
542     pub ai_flags: c_int,
543     pub ai_family: c_int,
544     pub ai_socktype: c_int,
545     pub ai_protocol: c_int,
546     pub ai_addrlen: size_t,
547     pub ai_canonname: *mut c_char,
548     pub ai_addr: *mut SOCKADDR,
549     pub ai_next: *mut ADDRINFOA,
550 }
551
552 #[repr(C)]
553 #[derive(Copy, Clone)]
554 pub struct sockaddr_in {
555     pub sin_family: ADDRESS_FAMILY,
556     pub sin_port: USHORT,
557     pub sin_addr: in_addr,
558     pub sin_zero: [CHAR; 8],
559 }
560
561 #[repr(C)]
562 #[derive(Copy, Clone)]
563 pub struct sockaddr_in6 {
564     pub sin6_family: ADDRESS_FAMILY,
565     pub sin6_port: USHORT,
566     pub sin6_flowinfo: c_ulong,
567     pub sin6_addr: in6_addr,
568     pub sin6_scope_id: c_ulong,
569 }
570
571 #[repr(C)]
572 #[derive(Copy, Clone)]
573 pub struct in_addr {
574     pub s_addr: u32,
575 }
576
577 #[repr(C)]
578 #[derive(Copy, Clone)]
579 pub struct in6_addr {
580     pub s6_addr: [u8; 16],
581 }
582
583 #[repr(C)]
584 #[derive(Copy, Clone)]
585 #[allow(dead_code)] // we only use some variants
586 pub enum EXCEPTION_DISPOSITION {
587     ExceptionContinueExecution,
588     ExceptionContinueSearch,
589     ExceptionNestedException,
590     ExceptionCollidedUnwind,
591 }
592
593 #[repr(C)]
594 #[derive(Copy)]
595 pub struct fd_set {
596     pub fd_count: c_uint,
597     pub fd_array: [SOCKET; FD_SETSIZE],
598 }
599
600 impl Clone for fd_set {
601     fn clone(&self) -> fd_set {
602         *self
603     }
604 }
605
606 #[repr(C)]
607 #[derive(Copy, Clone)]
608 pub struct timeval {
609     pub tv_sec: c_long,
610     pub tv_usec: c_long,
611 }
612
613 // Functions forbidden when targeting UWP
614 cfg_if::cfg_if! {
615 if #[cfg(not(target_vendor = "uwp"))] {
616     pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
617     pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
618     pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
619
620     #[repr(C)]
621     pub struct EXCEPTION_RECORD {
622         pub ExceptionCode: DWORD,
623         pub ExceptionFlags: DWORD,
624         pub ExceptionRecord: *mut EXCEPTION_RECORD,
625         pub ExceptionAddress: LPVOID,
626         pub NumberParameters: DWORD,
627         pub ExceptionInformation: [LPVOID; EXCEPTION_MAXIMUM_PARAMETERS]
628     }
629
630     pub enum CONTEXT {}
631
632     #[repr(C)]
633     pub struct EXCEPTION_POINTERS {
634         pub ExceptionRecord: *mut EXCEPTION_RECORD,
635         pub ContextRecord: *mut CONTEXT,
636     }
637
638     pub type PVECTORED_EXCEPTION_HANDLER = extern "system"
639             fn(ExceptionInfo: *mut EXCEPTION_POINTERS) -> LONG;
640
641     #[repr(C)]
642     #[derive(Copy, Clone)]
643     pub struct CONSOLE_READCONSOLE_CONTROL {
644         pub nLength: ULONG,
645         pub nInitialChars: ULONG,
646         pub dwCtrlWakeupMask: ULONG,
647         pub dwControlKeyState: ULONG,
648     }
649
650     pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL;
651
652     #[repr(C)]
653     pub struct BY_HANDLE_FILE_INFORMATION {
654         pub dwFileAttributes: DWORD,
655         pub ftCreationTime: FILETIME,
656         pub ftLastAccessTime: FILETIME,
657         pub ftLastWriteTime: FILETIME,
658         pub dwVolumeSerialNumber: DWORD,
659         pub nFileSizeHigh: DWORD,
660         pub nFileSizeLow: DWORD,
661         pub nNumberOfLinks: DWORD,
662         pub nFileIndexHigh: DWORD,
663         pub nFileIndexLow: DWORD,
664     }
665
666     pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION;
667     pub type LPCVOID = *const c_void;
668
669     pub const HANDLE_FLAG_INHERIT: DWORD = 0x00000001;
670
671     pub const TOKEN_READ: DWORD = 0x20008;
672
673     extern "system" {
674         #[link_name = "SystemFunction036"]
675         pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN;
676
677         pub fn ReadConsoleW(hConsoleInput: HANDLE,
678                             lpBuffer: LPVOID,
679                             nNumberOfCharsToRead: DWORD,
680                             lpNumberOfCharsRead: LPDWORD,
681                             pInputControl: PCONSOLE_READCONSOLE_CONTROL) -> BOOL;
682
683         pub fn WriteConsoleW(hConsoleOutput: HANDLE,
684                              lpBuffer: LPCVOID,
685                              nNumberOfCharsToWrite: DWORD,
686                              lpNumberOfCharsWritten: LPDWORD,
687                              lpReserved: LPVOID) -> BOOL;
688
689         pub fn GetConsoleMode(hConsoleHandle: HANDLE,
690                               lpMode: LPDWORD) -> BOOL;
691         // Allowed but unused by UWP
692         pub fn OpenProcessToken(ProcessHandle: HANDLE,
693                                 DesiredAccess: DWORD,
694                                 TokenHandle: *mut HANDLE) -> BOOL;
695         pub fn GetUserProfileDirectoryW(hToken: HANDLE,
696                                         lpProfileDir: LPWSTR,
697                                         lpcchSize: *mut DWORD) -> BOOL;
698         pub fn GetFileInformationByHandle(hFile: HANDLE,
699                             lpFileInformation: LPBY_HANDLE_FILE_INFORMATION)
700                             -> BOOL;
701         pub fn SetHandleInformation(hObject: HANDLE,
702                                     dwMask: DWORD,
703                                     dwFlags: DWORD) -> BOOL;
704         pub fn AddVectoredExceptionHandler(FirstHandler: ULONG,
705                                            VectoredHandler: PVECTORED_EXCEPTION_HANDLER)
706                                            -> LPVOID;
707         pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
708                                lpTargetFileName: LPCWSTR,
709                                lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
710                                -> BOOL;
711     }
712 }
713 }
714
715 // UWP specific functions & types
716 cfg_if::cfg_if! {
717 if #[cfg(target_vendor = "uwp")] {
718     pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD = 0x00000002;
719
720     #[repr(C)]
721     pub struct FILE_STANDARD_INFO {
722         pub AllocationSize: LARGE_INTEGER,
723         pub EndOfFile: LARGE_INTEGER,
724         pub NumberOfLinks: DWORD,
725         pub DeletePending: BOOLEAN,
726         pub Directory: BOOLEAN,
727     }
728
729     extern "system" {
730         pub fn GetFileInformationByHandleEx(hFile: HANDLE,
731                                             fileInfoClass: FILE_INFO_BY_HANDLE_CLASS,
732                                             lpFileInformation: LPVOID,
733                                             dwBufferSize: DWORD) -> BOOL;
734         pub fn BCryptGenRandom(hAlgorithm: LPVOID, pBuffer: *mut u8,
735                                cbBuffer: ULONG, dwFlags: ULONG) -> LONG;
736     }
737 }
738 }
739
740 // Shared between Desktop & UWP
741 extern "system" {
742     pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int;
743     pub fn WSACleanup() -> c_int;
744     pub fn WSAGetLastError() -> c_int;
745     pub fn WSADuplicateSocketW(
746         s: SOCKET,
747         dwProcessId: DWORD,
748         lpProtocolInfo: LPWSAPROTOCOL_INFO,
749     ) -> c_int;
750     pub fn WSASend(
751         s: SOCKET,
752         lpBuffers: LPWSABUF,
753         dwBufferCount: DWORD,
754         lpNumberOfBytesSent: LPDWORD,
755         dwFlags: DWORD,
756         lpOverlapped: LPWSAOVERLAPPED,
757         lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
758     ) -> c_int;
759     pub fn WSARecv(
760         s: SOCKET,
761         lpBuffers: LPWSABUF,
762         dwBufferCount: DWORD,
763         lpNumberOfBytesRecvd: LPDWORD,
764         lpFlags: LPDWORD,
765         lpOverlapped: LPWSAOVERLAPPED,
766         lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
767     ) -> c_int;
768     pub fn GetCurrentProcessId() -> DWORD;
769     pub fn WSASocketW(
770         af: c_int,
771         kind: c_int,
772         protocol: c_int,
773         lpProtocolInfo: LPWSAPROTOCOL_INFO,
774         g: GROUP,
775         dwFlags: DWORD,
776     ) -> SOCKET;
777     pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
778     pub fn InitializeCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
779     pub fn EnterCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
780     pub fn TryEnterCriticalSection(CriticalSection: *mut CRITICAL_SECTION) -> BOOLEAN;
781     pub fn LeaveCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
782     pub fn DeleteCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
783
784     pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
785     pub fn SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: DWORD) -> BOOL;
786     pub fn SetLastError(dwErrCode: DWORD);
787     pub fn GetCommandLineW() -> *mut LPCWSTR;
788     pub fn GetTempPathW(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD;
789     pub fn GetCurrentProcess() -> HANDLE;
790     pub fn GetCurrentThread() -> HANDLE;
791     pub fn GetStdHandle(which: DWORD) -> HANDLE;
792     pub fn ExitProcess(uExitCode: c_uint) -> !;
793     pub fn DeviceIoControl(
794         hDevice: HANDLE,
795         dwIoControlCode: DWORD,
796         lpInBuffer: LPVOID,
797         nInBufferSize: DWORD,
798         lpOutBuffer: LPVOID,
799         nOutBufferSize: DWORD,
800         lpBytesReturned: LPDWORD,
801         lpOverlapped: LPOVERLAPPED,
802     ) -> BOOL;
803     pub fn CreateThread(
804         lpThreadAttributes: LPSECURITY_ATTRIBUTES,
805         dwStackSize: SIZE_T,
806         lpStartAddress: extern "system" fn(*mut c_void) -> DWORD,
807         lpParameter: LPVOID,
808         dwCreationFlags: DWORD,
809         lpThreadId: LPDWORD,
810     ) -> HANDLE;
811     pub fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD;
812     pub fn SwitchToThread() -> BOOL;
813     pub fn Sleep(dwMilliseconds: DWORD);
814     pub fn GetProcessId(handle: HANDLE) -> DWORD;
815     pub fn CopyFileExW(
816         lpExistingFileName: LPCWSTR,
817         lpNewFileName: LPCWSTR,
818         lpProgressRoutine: LPPROGRESS_ROUTINE,
819         lpData: LPVOID,
820         pbCancel: LPBOOL,
821         dwCopyFlags: DWORD,
822     ) -> BOOL;
823     pub fn FormatMessageW(
824         flags: DWORD,
825         lpSrc: LPVOID,
826         msgId: DWORD,
827         langId: DWORD,
828         buf: LPWSTR,
829         nsize: DWORD,
830         args: *const c_void,
831     ) -> DWORD;
832     pub fn TlsAlloc() -> DWORD;
833     pub fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID;
834     pub fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL;
835     pub fn GetLastError() -> DWORD;
836     pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL;
837     pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
838     pub fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: LPDWORD) -> BOOL;
839     pub fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) -> BOOL;
840     pub fn CreateProcessW(
841         lpApplicationName: LPCWSTR,
842         lpCommandLine: LPWSTR,
843         lpProcessAttributes: LPSECURITY_ATTRIBUTES,
844         lpThreadAttributes: LPSECURITY_ATTRIBUTES,
845         bInheritHandles: BOOL,
846         dwCreationFlags: DWORD,
847         lpEnvironment: LPVOID,
848         lpCurrentDirectory: LPCWSTR,
849         lpStartupInfo: LPSTARTUPINFO,
850         lpProcessInformation: LPPROCESS_INFORMATION,
851     ) -> BOOL;
852     pub fn GetEnvironmentVariableW(n: LPCWSTR, v: LPWSTR, nsize: DWORD) -> DWORD;
853     pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR) -> BOOL;
854     pub fn GetEnvironmentStringsW() -> LPWCH;
855     pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
856     pub fn GetModuleFileNameW(hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) -> DWORD;
857     pub fn CreateDirectoryW(
858         lpPathName: LPCWSTR,
859         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
860     ) -> BOOL;
861     pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
862     pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD;
863     pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
864     pub fn WideCharToMultiByte(
865         CodePage: UINT,
866         dwFlags: DWORD,
867         lpWideCharStr: LPCWSTR,
868         cchWideChar: c_int,
869         lpMultiByteStr: LPSTR,
870         cbMultiByte: c_int,
871         lpDefaultChar: LPCSTR,
872         lpUsedDefaultChar: LPBOOL,
873     ) -> c_int;
874
875     pub fn closesocket(socket: SOCKET) -> c_int;
876     pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int;
877     pub fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int;
878     pub fn recvfrom(
879         socket: SOCKET,
880         buf: *mut c_void,
881         len: c_int,
882         flags: c_int,
883         addr: *mut SOCKADDR,
884         addrlen: *mut c_int,
885     ) -> c_int;
886     pub fn sendto(
887         socket: SOCKET,
888         buf: *const c_void,
889         len: c_int,
890         flags: c_int,
891         addr: *const SOCKADDR,
892         addrlen: c_int,
893     ) -> c_int;
894     pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
895     pub fn accept(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> SOCKET;
896     pub fn DuplicateHandle(
897         hSourceProcessHandle: HANDLE,
898         hSourceHandle: HANDLE,
899         hTargetProcessHandle: HANDLE,
900         lpTargetHandle: LPHANDLE,
901         dwDesiredAccess: DWORD,
902         bInheritHandle: BOOL,
903         dwOptions: DWORD,
904     ) -> BOOL;
905     pub fn ReadFile(
906         hFile: HANDLE,
907         lpBuffer: LPVOID,
908         nNumberOfBytesToRead: DWORD,
909         lpNumberOfBytesRead: LPDWORD,
910         lpOverlapped: LPOVERLAPPED,
911     ) -> BOOL;
912     pub fn WriteFile(
913         hFile: HANDLE,
914         lpBuffer: LPVOID,
915         nNumberOfBytesToWrite: DWORD,
916         lpNumberOfBytesWritten: LPDWORD,
917         lpOverlapped: LPOVERLAPPED,
918     ) -> BOOL;
919     pub fn CloseHandle(hObject: HANDLE) -> BOOL;
920     pub fn MoveFileExW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, dwFlags: DWORD)
921     -> BOOL;
922     pub fn SetFilePointerEx(
923         hFile: HANDLE,
924         liDistanceToMove: LARGE_INTEGER,
925         lpNewFilePointer: PLARGE_INTEGER,
926         dwMoveMethod: DWORD,
927     ) -> BOOL;
928     pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
929     pub fn CreateFileW(
930         lpFileName: LPCWSTR,
931         dwDesiredAccess: DWORD,
932         dwShareMode: DWORD,
933         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
934         dwCreationDisposition: DWORD,
935         dwFlagsAndAttributes: DWORD,
936         hTemplateFile: HANDLE,
937     ) -> HANDLE;
938
939     pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW) -> HANDLE;
940     pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW) -> BOOL;
941     pub fn FindClose(findFile: HANDLE) -> BOOL;
942     pub fn getsockopt(
943         s: SOCKET,
944         level: c_int,
945         optname: c_int,
946         optval: *mut c_char,
947         optlen: *mut c_int,
948     ) -> c_int;
949     pub fn setsockopt(
950         s: SOCKET,
951         level: c_int,
952         optname: c_int,
953         optval: *const c_void,
954         optlen: c_int,
955     ) -> c_int;
956     pub fn getsockname(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> c_int;
957     pub fn getpeername(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> c_int;
958     pub fn bind(socket: SOCKET, address: *const SOCKADDR, address_len: socklen_t) -> c_int;
959     pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
960     pub fn connect(socket: SOCKET, address: *const SOCKADDR, len: c_int) -> c_int;
961     pub fn getaddrinfo(
962         node: *const c_char,
963         service: *const c_char,
964         hints: *const ADDRINFOA,
965         res: *mut *mut ADDRINFOA,
966     ) -> c_int;
967     pub fn freeaddrinfo(res: *mut ADDRINFOA);
968
969     pub fn GetProcAddress(handle: HMODULE, name: LPCSTR) -> *mut c_void;
970     pub fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE;
971
972     pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME);
973
974     pub fn CreateEventW(
975         lpEventAttributes: LPSECURITY_ATTRIBUTES,
976         bManualReset: BOOL,
977         bInitialState: BOOL,
978         lpName: LPCWSTR,
979     ) -> HANDLE;
980     pub fn WaitForMultipleObjects(
981         nCount: DWORD,
982         lpHandles: *const HANDLE,
983         bWaitAll: BOOL,
984         dwMilliseconds: DWORD,
985     ) -> DWORD;
986     pub fn CreateNamedPipeW(
987         lpName: LPCWSTR,
988         dwOpenMode: DWORD,
989         dwPipeMode: DWORD,
990         nMaxInstances: DWORD,
991         nOutBufferSize: DWORD,
992         nInBufferSize: DWORD,
993         nDefaultTimeOut: DWORD,
994         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
995     ) -> HANDLE;
996     pub fn CancelIo(handle: HANDLE) -> BOOL;
997     pub fn GetOverlappedResult(
998         hFile: HANDLE,
999         lpOverlapped: LPOVERLAPPED,
1000         lpNumberOfBytesTransferred: LPDWORD,
1001         bWait: BOOL,
1002     ) -> BOOL;
1003     pub fn select(
1004         nfds: c_int,
1005         readfds: *mut fd_set,
1006         writefds: *mut fd_set,
1007         exceptfds: *mut fd_set,
1008         timeout: *const timeval,
1009     ) -> c_int;
1010
1011     pub fn GetProcessHeap() -> HANDLE;
1012     pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID;
1013     pub fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID;
1014     pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
1015 }
1016
1017 // Functions that aren't available on every version of Windows that we support,
1018 // but we still use them and just provide some form of a fallback implementation.
1019 compat_fn! {
1020     kernel32:
1021
1022     pub fn CreateSymbolicLinkW(_lpSymlinkFileName: LPCWSTR,
1023                                _lpTargetFileName: LPCWSTR,
1024                                _dwFlags: DWORD) -> BOOLEAN {
1025         SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0
1026     }
1027     pub fn GetFinalPathNameByHandleW(_hFile: HANDLE,
1028                                      _lpszFilePath: LPCWSTR,
1029                                      _cchFilePath: DWORD,
1030                                      _dwFlags: DWORD) -> DWORD {
1031         SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0
1032     }
1033     #[cfg(not(target_vendor = "uwp"))]
1034     pub fn SetThreadStackGuarantee(_size: *mut c_ulong) -> BOOL {
1035         SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0
1036     }
1037     pub fn SetThreadDescription(hThread: HANDLE,
1038                                 lpThreadDescription: LPCWSTR) -> HRESULT {
1039         SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); E_NOTIMPL
1040     }
1041     pub fn SetFileInformationByHandle(_hFile: HANDLE,
1042                     _FileInformationClass: FILE_INFO_BY_HANDLE_CLASS,
1043                     _lpFileInformation: LPVOID,
1044                     _dwBufferSize: DWORD) -> BOOL {
1045         SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0
1046     }
1047     pub fn SleepConditionVariableSRW(ConditionVariable: PCONDITION_VARIABLE,
1048                                      SRWLock: PSRWLOCK,
1049                                      dwMilliseconds: DWORD,
1050                                      Flags: ULONG) -> BOOL {
1051         panic!("condition variables not available")
1052     }
1053     pub fn WakeConditionVariable(ConditionVariable: PCONDITION_VARIABLE)
1054                                  -> () {
1055         panic!("condition variables not available")
1056     }
1057     pub fn WakeAllConditionVariable(ConditionVariable: PCONDITION_VARIABLE)
1058                                     -> () {
1059         panic!("condition variables not available")
1060     }
1061     pub fn AcquireSRWLockExclusive(SRWLock: PSRWLOCK) -> () {
1062         panic!("rwlocks not available")
1063     }
1064     pub fn AcquireSRWLockShared(SRWLock: PSRWLOCK) -> () {
1065         panic!("rwlocks not available")
1066     }
1067     pub fn ReleaseSRWLockExclusive(SRWLock: PSRWLOCK) -> () {
1068         panic!("rwlocks not available")
1069     }
1070     pub fn ReleaseSRWLockShared(SRWLock: PSRWLOCK) -> () {
1071         panic!("rwlocks not available")
1072     }
1073     pub fn TryAcquireSRWLockExclusive(SRWLock: PSRWLOCK) -> BOOLEAN {
1074         panic!("rwlocks not available")
1075     }
1076     pub fn TryAcquireSRWLockShared(SRWLock: PSRWLOCK) -> BOOLEAN {
1077         panic!("rwlocks not available")
1078     }
1079 }