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