blob: 91d00996899295dfeb36633233207022f3910810 [file] [log] [blame]
Alex Crichtond3d77922015-09-11 17:03:39 -07001//! Windows CRT definitions
2
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -07003pub type c_char = i8;
4pub type c_schar = i8;
5pub type c_uchar = u8;
6pub type c_short = i16;
7pub type c_ushort = u16;
8pub type c_int = i32;
9pub type c_uint = u32;
10pub type c_long = i32;
11pub type c_ulong = u32;
12pub type c_float = f32;
13pub type c_double = f64;
14pub type wchar_t = u16;
15pub type c_longlong = i64;
16pub type c_ulonglong = u64;
17pub type intmax_t = i64;
18pub type uintmax_t = u64;
Alex Crichton5d6cf052015-09-11 14:52:34 -070019
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -070020cfg_if! {
21 if #[cfg(target_arch = "x86")] {
22 pub type intptr_t = i32;
23 pub type ptrdiff_t = i32;
24 pub type size_t = u32;
25 pub type ssize_t = i32;
26 pub type uintptr_t = u32;
27 pub type LONG_PTR = c_long;
28 } else if #[cfg(target_arch = "x86_64")] {
29 pub type intptr_t = i64;
30 pub type ptrdiff_t = i64;
31 pub type size_t = u64;
32 pub type ssize_t = i64;
33 pub type uintptr_t = u64;
34 pub type LONG_PTR = i64;
35 } else {
36 // unknown arch
Alex Crichton5d6cf052015-09-11 14:52:34 -070037 }
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -070038}
Alex Crichton5d6cf052015-09-11 14:52:34 -070039
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -070040pub type clock_t = i32;
Alex Crichton5d6cf052015-09-11 14:52:34 -070041
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -070042cfg_if! {
43 if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
44 pub type time_t = i32;
45 } else {
46 pub type time_t = i64;
47 }
48}
Alex Crichton5d6cf052015-09-11 14:52:34 -070049
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -070050pub type off_t = i32;
51pub type dev_t = u32;
52pub type ino_t = u16;
53pub enum timezone {}
54pub type time64_t = i64;
Alex Crichton5d6cf052015-09-11 14:52:34 -070055
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -070056pub type BOOL = c_int;
57pub type BYTE = u8;
58pub type BOOLEAN = BYTE;
59pub type CCHAR = c_char;
60pub type CHAR = c_char;
61pub type DWORD = c_ulong;
62pub type DWORDLONG = c_ulonglong;
63pub type HANDLE = LPVOID;
64pub type HINSTANCE = HANDLE;
65pub type HMODULE = HINSTANCE;
66pub type LONG = c_long;
67pub type PLONG = *mut c_long;
68pub type LARGE_INTEGER = c_longlong;
69pub type PLARGE_INTEGER = *mut c_longlong;
70pub type LPCWSTR = *const WCHAR;
71pub type LPCSTR = *const CHAR;
72pub type LPWSTR = *mut WCHAR;
73pub type LPSTR = *mut CHAR;
74pub type LPWCH = *mut WCHAR;
75pub type LPCH = *mut CHAR;
76pub type SOCKET = uintptr_t;
77pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
78pub type LPVOID = *mut ::c_void;
79pub type LPCVOID = *const ::c_void;
80pub type LPBYTE = *mut BYTE;
81pub type LPWORD = *mut WORD;
82pub type LPDWORD = *mut DWORD;
83pub type LPHANDLE = *mut HANDLE;
84pub type LRESULT = LONG_PTR;
85pub type PBOOL = *mut BOOL;
86pub type WCHAR = wchar_t;
87pub type WORD = u16;
88pub type SIZE_T = size_t;
89pub type GROUP = c_uint;
90pub type LPSTARTUPINFOW = *mut STARTUPINFOW;
91pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
92pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
93pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
94pub type LPOVERLAPPED = *mut OVERLAPPED;
95pub type LPFILETIME = *mut FILETIME;
96pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
97pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
98pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
Alex Crichton2de0b8b2015-09-16 18:43:20 -070099pub type UCHAR = c_uchar;
100pub type ULONG = c_ulong;
101cfg_if! {
102 if #[cfg(target_arch = "x86_64")] {
103 pub type ULONG_PTR = u64;
104 } else {
105 pub type ULONG_PTR = c_ulong;
106 }
107}
Alex Crichton5d6cf052015-09-11 14:52:34 -0700108
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700109s! {
110 // note this is the struct called stat64 in Windows. Not stat, nor stati64.
111 pub struct stat {
112 pub st_dev: dev_t,
113 pub st_ino: ino_t,
114 pub st_mode: u16,
115 pub st_nlink: c_short,
116 pub st_uid: c_short,
117 pub st_gid: c_short,
118 pub st_rdev: dev_t,
119 pub st_size: i64,
120 pub st_atime: time64_t,
121 pub st_mtime: time64_t,
122 pub st_ctime: time64_t,
Alex Crichton5d6cf052015-09-11 14:52:34 -0700123 }
124
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700125 // note that this is called utimbuf64 in Windows
126 pub struct utimbuf {
127 pub actime: time64_t,
128 pub modtime: time64_t,
Alex Crichton5d6cf052015-09-11 14:52:34 -0700129 }
130
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700131 pub struct timeval {
132 pub tv_sec: c_long,
133 pub tv_usec: c_long,
134 }
Alex Crichton5d6cf052015-09-11 14:52:34 -0700135
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700136 pub struct timespec {
137 pub tv_sec: time_t,
138 pub tv_nsec: c_long,
139 }
Alex Crichton5d6cf052015-09-11 14:52:34 -0700140
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700141 pub struct sockaddr {
142 pub sa_family: u16,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700143 pub sa_data: [CHAR; 14],
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700144 }
Alex Crichton5d6cf052015-09-11 14:52:34 -0700145
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700146 pub struct sockaddr_storage {
147 pub ss_family: u16,
148 __ss_pad1: [u8; 6],
149 __ss_align: i64,
150 __ss_pad2: [u8; 112],
151 }
152
153 pub struct sockaddr_in {
154 pub sin_family: u16,
155 pub sin_port: u16,
156 pub sin_addr: in_addr,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700157 pub sin_zero: [CHAR; 8],
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700158 }
159
160 pub struct in_addr {
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700161 pub s_addr: ULONG,
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700162 }
163
164 pub struct sockaddr_in6 {
165 pub sin6_family: u16,
166 pub sin6_port: u16,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700167 pub sin6_flowinfo: ULONG,
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700168 pub sin6_addr: in6_addr,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700169 pub sin6_scope_id: ULONG,
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700170 }
171
172 pub struct in6_addr {
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700173 pub s6_addr: [UCHAR; 16],
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700174 }
175
176 pub struct ip_mreq {
177 pub imr_multiaddr: in_addr,
178 pub imr_interface: in_addr,
179 }
180
181 pub struct ipv6_mreq {
182 pub ipv6mr_multiaddr: in6_addr,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700183 pub ipv6mr_interface: ULONG,
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700184 }
185
186 pub struct addrinfo {
187 pub ai_flags: c_int,
188 pub ai_family: c_int,
189 pub ai_socktype: c_int,
190 pub ai_protocol: c_int,
191 pub ai_addrlen: size_t,
192 pub ai_canonname: *mut c_char,
193 pub ai_addr: *mut sockaddr,
194 pub ai_next: *mut addrinfo,
195 }
196
197 pub struct SECURITY_ATTRIBUTES {
198 pub nLength: DWORD,
199 pub lpSecurityDescriptor: LPVOID,
200 pub bInheritHandle: BOOL,
201 }
202
203 pub struct STARTUPINFOW {
204 pub cb: DWORD,
205 pub lpReserved: LPWSTR,
206 pub lpDesktop: LPWSTR,
207 pub lpTitle: LPWSTR,
208 pub dwX: DWORD,
209 pub dwY: DWORD,
210 pub dwXSize: DWORD,
211 pub dwYSize: DWORD,
212 pub dwXCountChars: DWORD,
213 pub dwYCountChars: DWORD,
214 pub dwFillAttribute: DWORD,
215 pub dwFlags: DWORD,
216 pub wShowWindow: WORD,
217 pub cbReserved2: WORD,
218 pub lpReserved2: LPBYTE,
219 pub hStdInput: HANDLE,
220 pub hStdOutput: HANDLE,
221 pub hStdError: HANDLE,
222 }
223
224 pub struct PROCESS_INFORMATION {
225 pub hProcess: HANDLE,
226 pub hThread: HANDLE,
227 pub dwProcessId: DWORD,
228 pub dwThreadId: DWORD,
229 }
230
231 pub struct SYSTEM_INFO {
232 pub wProcessorArchitecture: WORD,
233 pub wReserved: WORD,
234 pub dwPageSize: DWORD,
235 pub lpMinimumApplicationAddress: LPVOID,
236 pub lpMaximumApplicationAddress: LPVOID,
237 pub dwActiveProcessorMask: uintptr_t,
238 pub dwNumberOfProcessors: DWORD,
239 pub dwProcessorType: DWORD,
240 pub dwAllocationGranularity: DWORD,
241 pub wProcessorLevel: WORD,
242 pub wProcessorRevision: WORD,
243 }
244
245 pub struct MEMORY_BASIC_INFORMATION {
246 pub BaseAddress: LPVOID,
247 pub AllocationBase: LPVOID,
248 pub AllocationProtect: DWORD,
249 pub RegionSize: SIZE_T,
250 pub State: DWORD,
251 pub Protect: DWORD,
252 pub Type: DWORD,
253 }
254
255 pub struct OVERLAPPED {
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700256 pub Internal: ULONG_PTR,
257 pub InternalHigh: ULONG_PTR,
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700258 pub Offset: DWORD,
259 pub OffsetHigh: DWORD,
260 pub hEvent: HANDLE,
261 }
262
263 pub struct FILETIME {
264 pub dwLowDateTime: DWORD,
265 pub dwHighDateTime: DWORD,
266 }
267
268 pub struct GUID {
269 pub Data1: DWORD,
270 pub Data2: WORD,
271 pub Data3: WORD,
272 pub Data4: [BYTE; 8],
273 }
274
275 pub struct WSAPROTOCOLCHAIN {
276 pub ChainLen: c_int,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700277 pub ChainEntries: [DWORD; 7],
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700278 }
279
280 pub struct WSAPROTOCOL_INFO {
281 pub dwServiceFlags1: DWORD,
282 pub dwServiceFlags2: DWORD,
283 pub dwServiceFlags3: DWORD,
284 pub dwServiceFlags4: DWORD,
285 pub dwProviderFlags: DWORD,
286 pub ProviderId: GUID,
287 pub dwCatalogEntryId: DWORD,
288 pub ProtocolChain: WSAPROTOCOLCHAIN,
289 pub iVersion: c_int,
290 pub iAddressFamily: c_int,
291 pub iMaxSockAddr: c_int,
292 pub iMinSockAddr: c_int,
293 pub iSocketType: c_int,
294 pub iProtocol: c_int,
295 pub iProtocolMaxOffset: c_int,
296 pub iNetworkByteOrder: c_int,
297 pub iSecurityScheme: c_int,
298 pub dwMessageSize: DWORD,
299 pub dwProviderReserved: DWORD,
Alex Crichton2de0b8b2015-09-16 18:43:20 -0700300 pub szProtocol: [CHAR; 256],
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700301 }
302
303 pub struct WIN32_FIND_DATAW {
304 pub dwFileAttributes: DWORD,
305 pub ftCreationTime: FILETIME,
306 pub ftLastAccessTime: FILETIME,
307 pub ftLastWriteTime: FILETIME,
308 pub nFileSizeHigh: DWORD,
309 pub nFileSizeLow: DWORD,
310 pub dwReserved0: DWORD,
311 pub dwReserved1: DWORD,
312 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
313 pub cAlternateFileName: [wchar_t; 14],
314 }
315}
316
317pub const EXIT_FAILURE: c_int = 1;
318pub const EXIT_SUCCESS: c_int = 0;
319pub const RAND_MAX: c_int = 32767;
320pub const EOF: c_int = -1;
321pub const SEEK_SET: c_int = 0;
322pub const SEEK_CUR: c_int = 1;
323pub const SEEK_END: c_int = 2;
324pub const _IOFBF: c_int = 0;
325pub const _IONBF: c_int = 4;
326pub const _IOLBF: c_int = 64;
327pub const BUFSIZ: c_uint = 512;
328pub const FOPEN_MAX: c_uint = 20;
329pub const FILENAME_MAX: c_uint = 260;
330
331pub const WSAEINTR: c_int = 10004;
332pub const WSAEBADF: c_int = 10009;
333pub const WSAEACCES: c_int = 10013;
334pub const WSAEFAULT: c_int = 10014;
335pub const WSAEINVAL: c_int = 10022;
336pub const WSAEMFILE: c_int = 10024;
337pub const WSAEWOULDBLOCK: c_int = 10035;
338pub const WSAEINPROGRESS: c_int = 10036;
339pub const WSAEALREADY: c_int = 10037;
340pub const WSAENOTSOCK: c_int = 10038;
341pub const WSAEDESTADDRREQ: c_int = 10039;
342pub const WSAEMSGSIZE: c_int = 10040;
343pub const WSAEPROTOTYPE: c_int = 10041;
344pub const WSAENOPROTOOPT: c_int = 10042;
345pub const WSAEPROTONOSUPPORT: c_int = 10043;
346pub const WSAESOCKTNOSUPPORT: c_int = 10044;
347pub const WSAEOPNOTSUPP: c_int = 10045;
348pub const WSAEPFNOSUPPORT: c_int = 10046;
349pub const WSAEAFNOSUPPORT: c_int = 10047;
350pub const WSAEADDRINUSE: c_int = 10048;
351pub const WSAEADDRNOTAVAIL: c_int = 10049;
352pub const WSAENETDOWN: c_int = 10050;
353pub const WSAENETUNREACH: c_int = 10051;
354pub const WSAENETRESET: c_int = 10052;
355pub const WSAECONNABORTED: c_int = 10053;
356pub const WSAECONNRESET: c_int = 10054;
357pub const WSAENOBUFS: c_int = 10055;
358pub const WSAEISCONN: c_int = 10056;
359pub const WSAENOTCONN: c_int = 10057;
360pub const WSAESHUTDOWN: c_int = 10058;
361pub const WSAETOOMANYREFS: c_int = 10059;
362pub const WSAETIMEDOUT: c_int = 10060;
363pub const WSAECONNREFUSED: c_int = 10061;
364pub const WSAELOOP: c_int = 10062;
365pub const WSAENAMETOOLONG: c_int = 10063;
366pub const WSAEHOSTDOWN: c_int = 10064;
367pub const WSAEHOSTUNREACH: c_int = 10065;
368pub const WSAENOTEMPTY: c_int = 10066;
369pub const WSAEPROCLIM: c_int = 10067;
370pub const WSAEUSERS: c_int = 10068;
371pub const WSAEDQUOT: c_int = 10069;
372pub const WSAESTALE: c_int = 10070;
373pub const WSAEREMOTE: c_int = 10071;
374pub const WSASYSNOTREADY: c_int = 10091;
375pub const WSAVERNOTSUPPORTED: c_int = 10092;
376pub const WSANOTINITIALISED: c_int = 10093;
377pub const WSAEDISCON: c_int = 10101;
378pub const WSAENOMORE: c_int = 10102;
379pub const WSAECANCELLED: c_int = 10103;
380pub const WSAEINVALIDPROCTABLE: c_int = 10104;
381pub const WSAEINVALIDPROVIDER: c_int = 10105;
382pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
383
384cfg_if! {
385 if #[cfg(all(target_env = "gnu"))] {
386 pub const L_tmpnam: c_uint = 14;
387 pub const TMP_MAX: c_uint = 0x7fff;
388 } else {
389 pub const L_tmpnam: c_uint = 260;
390 pub const TMP_MAX: c_uint = 0x7fff_ffff;
391 }
392}
393
394pub const O_RDONLY: c_int = 0;
395pub const O_WRONLY: c_int = 1;
396pub const O_RDWR: c_int = 2;
397pub const O_APPEND: c_int = 8;
398pub const O_CREAT: c_int = 256;
399pub const O_EXCL: c_int = 1024;
400pub const O_TRUNC: c_int = 512;
401pub const S_IFCHR: c_int = 8192;
402pub const S_IFDIR: c_int = 16384;
403pub const S_IFREG: c_int = 32768;
404pub const S_IFMT: c_int = 61440;
405pub const S_IEXEC: c_int = 64;
406pub const S_IWRITE: c_int = 128;
407pub const S_IREAD: c_int = 256;
408
409pub const AF_INET: c_int = 2;
410pub const AF_INET6: c_int = 23;
411pub const SOCK_STREAM: c_int = 1;
412pub const SOCK_DGRAM: c_int = 2;
413pub const SOCK_RAW: c_int = 3;
414pub const IPPROTO_TCP: c_int = 6;
415pub const IPPROTO_IP: c_int = 0;
416pub const IPPROTO_IPV6: c_int = 41;
417pub const IP_MULTICAST_TTL: c_int = 10;
418pub const IP_MULTICAST_LOOP: c_int = 11;
419pub const IP_ADD_MEMBERSHIP: c_int = 12;
420pub const IP_DROP_MEMBERSHIP: c_int = 13;
421pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
422pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
423pub const IP_TTL: c_int = 4;
424pub const IP_HDRINCL: c_int = 2;
425
426pub const TCP_NODELAY: c_int = 0x0001;
427pub const SOL_SOCKET: c_int = 0xffff;
428
429pub const SO_DEBUG: c_int = 0x0001;
430pub const SO_ACCEPTCONN: c_int = 0x0002;
431pub const SO_REUSEADDR: c_int = 0x0004;
432pub const SO_KEEPALIVE: c_int = 0x0008;
433pub const SO_DONTROUTE: c_int = 0x0010;
434pub const SO_BROADCAST: c_int = 0x0020;
435pub const SO_USELOOPBACK: c_int = 0x0040;
436pub const SO_LINGER: c_int = 0x0080;
437pub const SO_OOBINLINE: c_int = 0x0100;
438pub const SO_SNDBUF: c_int = 0x1001;
439pub const SO_RCVBUF: c_int = 0x1002;
440pub const SO_SNDLOWAT: c_int = 0x1003;
441pub const SO_RCVLOWAT: c_int = 0x1004;
442pub const SO_SNDTIMEO: c_int = 0x1005;
443pub const SO_RCVTIMEO: c_int = 0x1006;
444pub const SO_ERROR: c_int = 0x1007;
445pub const SO_TYPE: c_int = 0x1008;
446
447pub const IFF_LOOPBACK: c_int = 4;
448
449pub const SD_RECEIVE: c_int = 0;
450pub const SD_SEND: c_int = 1;
451pub const SD_BOTH: c_int = 2;
452
453pub const TRUE: BOOL = 1;
454pub const FALSE: BOOL = 0;
455
456pub const O_TEXT: c_int = 16384;
457pub const O_BINARY: c_int = 32768;
458pub const O_NOINHERIT: c_int = 128;
459
460pub const ERROR_SUCCESS: c_int = 0;
461pub const ERROR_INVALID_FUNCTION: c_int = 1;
462pub const ERROR_FILE_NOT_FOUND: c_int = 2;
463pub const ERROR_ACCESS_DENIED: c_int = 5;
464pub const ERROR_INVALID_HANDLE: c_int = 6;
465pub const ERROR_BROKEN_PIPE: c_int = 109;
466pub const ERROR_DISK_FULL: c_int = 112;
467pub const ERROR_CALL_NOT_IMPLEMENTED: c_int = 120;
468pub const ERROR_INSUFFICIENT_BUFFER: c_int = 122;
469pub const ERROR_INVALID_NAME: c_int = 123;
470pub const ERROR_ALREADY_EXISTS: c_int = 183;
471pub const ERROR_PIPE_BUSY: c_int = 231;
472pub const ERROR_NO_DATA: c_int = 232;
473pub const ERROR_INVALID_ADDRESS: c_int = 487;
474pub const ERROR_PIPE_CONNECTED: c_int = 535;
475pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
476pub const ERROR_OPERATION_ABORTED: c_int = 995;
477pub const ERROR_IO_PENDING: c_int = 997;
478pub const ERROR_FILE_INVALID: c_int = 1006;
479pub const ERROR_NOT_FOUND: c_int = 1168;
480pub const INVALID_HANDLE_VALUE: HANDLE = !0 as HANDLE;
481
482pub const DELETE: DWORD = 0x00010000;
483pub const READ_CONTROL: DWORD = 0x00020000;
484pub const SYNCHRONIZE: DWORD = 0x00100000;
485pub const WRITE_DAC: DWORD = 0x00040000;
486pub const WRITE_OWNER: DWORD = 0x00080000;
487
488pub const PROCESS_CREATE_PROCESS: DWORD = 0x0080;
489pub const PROCESS_CREATE_THREAD: DWORD = 0x0002;
490pub const PROCESS_DUP_HANDLE: DWORD = 0x0040;
491pub const PROCESS_QUERY_INFORMATION: DWORD = 0x0400;
492pub const PROCESS_QUERY_LIMITED_INFORMATION: DWORD = 0x1000;
493pub const PROCESS_SET_INFORMATION: DWORD = 0x0200;
494pub const PROCESS_SET_QUOTA: DWORD = 0x0100;
495pub const PROCESS_SUSPEND_RESUME: DWORD = 0x0800;
496pub const PROCESS_TERMINATE: DWORD = 0x0001;
497pub const PROCESS_VM_OPERATION: DWORD = 0x0008;
498pub const PROCESS_VM_READ: DWORD = 0x0010;
499pub const PROCESS_VM_WRITE: DWORD = 0x0020;
500
501pub const STARTF_FORCEONFEEDBACK: DWORD = 0x00000040;
502pub const STARTF_FORCEOFFFEEDBACK: DWORD = 0x00000080;
503pub const STARTF_PREVENTPINNING: DWORD = 0x00002000;
504pub const STARTF_RUNFULLSCREEN: DWORD = 0x00000020;
505pub const STARTF_TITLEISAPPID: DWORD = 0x00001000;
506pub const STARTF_TITLEISLINKNAME: DWORD = 0x00000800;
507pub const STARTF_USECOUNTCHARS: DWORD = 0x00000008;
508pub const STARTF_USEFILLATTRIBUTE: DWORD = 0x00000010;
509pub const STARTF_USEHOTKEY: DWORD = 0x00000200;
510pub const STARTF_USEPOSITION: DWORD = 0x00000004;
511pub const STARTF_USESHOWWINDOW: DWORD = 0x00000001;
512pub const STARTF_USESIZE: DWORD = 0x00000002;
513pub const STARTF_USESTDHANDLES: DWORD = 0x00000100;
514
515pub const WAIT_ABANDONED: DWORD = 0x00000080;
516pub const WAIT_OBJECT_0: DWORD = 0x00000000;
517pub const WAIT_TIMEOUT: DWORD = 0x00000102;
518pub const WAIT_FAILED: DWORD = !0;
519
520pub const DUPLICATE_CLOSE_SOURCE: DWORD = 0x00000001;
521pub const DUPLICATE_SAME_ACCESS: DWORD = 0x00000002;
522
523pub const INFINITE: DWORD = !0;
524pub const STILL_ACTIVE: DWORD = 259;
525
526pub const MEM_COMMIT: DWORD = 0x00001000;
527pub const MEM_RESERVE: DWORD = 0x00002000;
528pub const MEM_DECOMMIT: DWORD = 0x00004000;
529pub const MEM_RELEASE: DWORD = 0x00008000;
530pub const MEM_RESET: DWORD = 0x00080000;
531pub const MEM_RESET_UNDO: DWORD = 0x1000000;
532pub const MEM_LARGE_PAGES: DWORD = 0x20000000;
533pub const MEM_PHYSICAL: DWORD = 0x00400000;
534pub const MEM_TOP_DOWN: DWORD = 0x00100000;
535pub const MEM_WRITE_WATCH: DWORD = 0x00200000;
536
537pub const PAGE_EXECUTE: DWORD = 0x10;
538pub const PAGE_EXECUTE_READ: DWORD = 0x20;
539pub const PAGE_EXECUTE_READWRITE: DWORD = 0x40;
540pub const PAGE_EXECUTE_WRITECOPY: DWORD = 0x80;
541pub const PAGE_NOACCESS: DWORD = 0x01;
542pub const PAGE_READONLY: DWORD = 0x02;
543pub const PAGE_READWRITE: DWORD = 0x04;
544pub const PAGE_WRITECOPY: DWORD = 0x08;
545pub const PAGE_GUARD: DWORD = 0x100;
546pub const PAGE_NOCACHE: DWORD = 0x200;
547pub const PAGE_WRITECOMBINE: DWORD = 0x400;
548
549pub const SEC_COMMIT: DWORD = 0x8000000;
550pub const SEC_IMAGE: DWORD = 0x1000000;
551pub const SEC_IMAGE_NO_EXECUTE: DWORD = 0x11000000;
552pub const SEC_LARGE_PAGES: DWORD = 0x80000000;
553pub const SEC_NOCACHE: DWORD = 0x10000000;
554pub const SEC_RESERVE: DWORD = 0x4000000;
555pub const SEC_WRITECOMBINE: DWORD = 0x40000000;
556
557pub const FILE_MAP_ALL_ACCESS: DWORD = 0xf001f;
558pub const FILE_MAP_READ: DWORD = 0x4;
559pub const FILE_MAP_WRITE: DWORD = 0x2;
560pub const FILE_MAP_COPY: DWORD = 0x1;
561pub const FILE_MAP_EXECUTE: DWORD = 0x20;
562
563pub const PROCESSOR_ARCHITECTURE_INTEL: WORD = 0;
564pub const PROCESSOR_ARCHITECTURE_ARM: WORD = 5;
565pub const PROCESSOR_ARCHITECTURE_IA64: WORD = 6;
566pub const PROCESSOR_ARCHITECTURE_AMD64: WORD = 9;
567pub const PROCESSOR_ARCHITECTURE_UNKNOWN: WORD = 0xffff;
568
569pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
570pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
571pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
572pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
573pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
574pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
575
576pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
577
578pub const FILE_SHARE_DELETE: DWORD = 0x4;
579pub const FILE_SHARE_READ: DWORD = 0x1;
580pub const FILE_SHARE_WRITE: DWORD = 0x2;
581
582pub const CREATE_ALWAYS: DWORD = 2;
583pub const CREATE_NEW: DWORD = 1;
584pub const OPEN_ALWAYS: DWORD = 4;
585pub const OPEN_EXISTING: DWORD = 3;
586pub const TRUNCATE_EXISTING: DWORD = 5;
587
588pub const FILE_APPEND_DATA: DWORD = 0x00000004;
589pub const FILE_READ_DATA: DWORD = 0x00000001;
590pub const FILE_WRITE_DATA: DWORD = 0x00000002;
591
592pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
593pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
594pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
595pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
596pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
597pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
598pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
599pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
600pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
601pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
602pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
603pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
604pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
605pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
606pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
607pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
608pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
609
610pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
611pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
612pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
613pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
614pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
615pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
616pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x1000000;
617pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
618pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
619pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
620pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
621pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
622
623pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
624pub const FILE_NAME_OPENED: DWORD = 0x8;
625
626pub const VOLUME_NAME_DOS: DWORD = 0x0;
627pub const VOLUME_NAME_GUID: DWORD = 0x1;
628pub const VOLUME_NAME_NONE: DWORD = 0x4;
629pub const VOLUME_NAME_NT: DWORD = 0x2;
630
631pub const GENERIC_READ: DWORD = 0x80000000;
632pub const GENERIC_WRITE: DWORD = 0x40000000;
633pub const GENERIC_EXECUTE: DWORD = 0x20000000;
634pub const GENERIC_ALL: DWORD = 0x10000000;
635pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
636pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
637
638pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
639pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
640pub const FILE_WRITE_EA: DWORD = 0x00000010;
641pub const FILE_READ_EA: DWORD = 0x00000008;
642pub const FILE_GENERIC_READ: DWORD =
643 STANDARD_RIGHTS_READ | FILE_READ_DATA |
644 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
645pub const FILE_GENERIC_WRITE: DWORD =
646 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
647 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
648 SYNCHRONIZE;
649
650pub const FILE_BEGIN: DWORD = 0;
651pub const FILE_CURRENT: DWORD = 1;
652pub const FILE_END: DWORD = 2;
653
654pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
655pub const WSAPROTOCOL_LEN: DWORD = 255;
656pub const INVALID_SOCKET: SOCKET = !0;
657
658pub const DETACHED_PROCESS: DWORD = 0x00000008;
659pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
660pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
661
662pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
663pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
664pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
665pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
666pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
667pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
668pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
669pub const PIPE_WAIT: DWORD = 0x00000000;
670pub const PIPE_NOWAIT: DWORD = 0x00000001;
671pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
672pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
673pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
674
675pub const IPPROTO_RAW: c_int = 255;
676
677pub const FIONBIO: c_long = -0x7FFB9982;
678
Alex Crichton2c57e362015-09-15 17:30:53 -0700679#[cfg(target_env = "msvc")]
680#[link(name = "kernel32")]
681#[link(name = "shell32")]
682#[link(name = "msvcrt")]
683extern {}
684
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700685extern {
686 #[link_name = "_chmod"]
687 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
688 #[link_name = "_wchmod"]
689 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
690 #[link_name = "_mkdir"]
691 pub fn mkdir(path: *const c_char) -> c_int;
692 #[link_name = "_wrmdir"]
693 pub fn wrmdir(path: *const wchar_t) -> c_int;
694 #[link_name = "_fstat64"]
695 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
696 #[link_name = "_stat64"]
697 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
698 #[link_name = "_wstat64"]
699 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
700 #[link_name = "_wutime64"]
701 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
702 #[link_name = "_popen"]
703 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
704 #[link_name = "_pclose"]
705 pub fn pclose(stream: *mut ::FILE) -> c_int;
706 #[link_name = "_fdopen"]
707 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut ::FILE;
708 #[link_name = "_fileno"]
709 pub fn fileno(stream: *mut ::FILE) -> c_int;
710 #[link_name = "_open"]
711 pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
712 #[link_name = "_wopen"]
713 pub fn wopen(path: *const wchar_t, oflag: c_int, ...) -> c_int;
714 #[link_name = "_creat"]
715 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
716 #[link_name = "_access"]
717 pub fn access(path: *const c_char, amode: c_int) -> c_int;
718 #[link_name = "_chdir"]
719 pub fn chdir(dir: *const c_char) -> c_int;
720 #[link_name = "_close"]
721 pub fn close(fd: c_int) -> c_int;
722 #[link_name = "_dup"]
723 pub fn dup(fd: c_int) -> c_int;
724 #[link_name = "_dup2"]
725 pub fn dup2(src: c_int, dst: c_int) -> c_int;
726 #[link_name = "_execv"]
727 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> intptr_t;
728 #[link_name = "_execve"]
729 pub fn execve(prog: *const c_char, argv: *const *const c_char,
730 envp: *const *const c_char) -> c_int;
731 #[link_name = "_execvp"]
732 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> c_int;
733 #[link_name = "_execvpe"]
734 pub fn execvpe(c: *const c_char, argv: *const *const c_char,
735 envp: *const *const c_char) -> c_int;
736 #[link_name = "_getcwd"]
737 pub fn getcwd(buf: *mut c_char, size: c_int) -> *mut c_char;
738 #[link_name = "_getpid"]
739 pub fn getpid() -> c_int;
740 #[link_name = "_isatty"]
741 pub fn isatty(fd: c_int) -> c_int;
742 #[link_name = "_lseek"]
743 pub fn lseek(fd: c_int, offset: c_long, origin: c_int) -> c_long;
744 #[link_name = "_pipe"]
745 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int) -> c_int;
746 #[link_name = "_read"]
747 pub fn read(fd: c_int, buf: *mut ::c_void, count: c_uint) -> c_int;
748 #[link_name = "_rmdir"]
749 pub fn rmdir(path: *const c_char) -> c_int;
750 #[link_name = "_unlink"]
751 pub fn unlink(c: *const c_char) -> c_int;
752 #[link_name = "_write"]
753 pub fn write(fd: c_int, buf: *const ::c_void, count: c_uint) -> c_int;
754 #[link_name = "_commit"]
755 pub fn commit(fd: c_int) -> c_int;
756 #[link_name = "_get_osfhandle"]
757 pub fn get_osfhandle(fd: c_int) -> intptr_t;
758 #[link_name = "_open_osfhandle"]
759 pub fn open_osfhandle(osfhandle: intptr_t, flags: c_int) -> c_int;
760}
761
762extern "system" {
763 pub fn GetEnvironmentVariableW(n: LPCWSTR,
764 v: LPWSTR,
765 nsize: DWORD)
766 -> DWORD;
767 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
Alex Crichton5d6cf052015-09-11 14:52:34 -0700768 -> BOOL;
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700769 pub fn GetEnvironmentStringsW() -> LPWCH;
770 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
771 pub fn GetModuleFileNameW(hModule: HMODULE,
772 lpFilename: LPWSTR,
773 nSize: DWORD)
774 -> DWORD;
775 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
776 lpSecurityAttributes:
777 LPSECURITY_ATTRIBUTES)
778 -> BOOL;
779 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
780 lpNewFileName: LPCWSTR,
781 bFailIfExists: BOOL)
782 -> BOOL;
783 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
784 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
785 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
786 lpBuffer: LPWSTR)
787 -> DWORD;
788 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
789 pub fn GetLastError() -> DWORD;
790 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
791 -> HANDLE;
792 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
793 -> BOOL;
794 pub fn FindClose(findFile: HANDLE) -> BOOL;
795 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
796 hSourceHandle: HANDLE,
797 hTargetProcessHandle: HANDLE,
798 lpTargetHandle: LPHANDLE,
799 dwDesiredAccess: DWORD,
800 bInheritHandle: BOOL,
801 dwOptions: DWORD)
802 -> BOOL;
803 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
804 pub fn OpenProcess(dwDesiredAccess: DWORD,
805 bInheritHandle: BOOL,
806 dwProcessId: DWORD)
807 -> HANDLE;
808 pub fn GetCurrentProcess() -> HANDLE;
809 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
810 lpCommandLine: LPWSTR,
811 lpProcessAttributes:
812 LPSECURITY_ATTRIBUTES,
813 lpThreadAttributes:
814 LPSECURITY_ATTRIBUTES,
815 bInheritHandles: BOOL,
816 dwCreationFlags: DWORD,
817 lpEnvironment: LPVOID,
818 lpCurrentDirectory: LPCWSTR,
819 lpStartupInfo: LPSTARTUPINFOW,
820 lpProcessInformation:
821 LPPROCESS_INFORMATION)
822 -> BOOL;
823 pub fn WaitForSingleObject(hHandle: HANDLE,
824 dwMilliseconds: DWORD)
825 -> DWORD;
826 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
827 -> BOOL;
828 pub fn GetExitCodeProcess(hProcess: HANDLE,
829 lpExitCode: LPDWORD)
830 -> BOOL;
831 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
832 pub fn VirtualAlloc(lpAddress: LPVOID,
833 dwSize: SIZE_T,
834 flAllocationType: DWORD,
835 flProtect: DWORD)
836 -> LPVOID;
837 pub fn VirtualFree(lpAddress: LPVOID,
838 dwSize: SIZE_T,
839 dwFreeType: DWORD)
840 -> BOOL;
841 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
842 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
843 -> BOOL;
844 pub fn VirtualProtect(lpAddress: LPVOID,
845 dwSize: SIZE_T,
846 flNewProtect: DWORD,
847 lpflOldProtect: LPDWORD)
848 -> BOOL;
849 pub fn VirtualQuery(lpAddress: LPCVOID,
850 lpBuffer: PMEMORY_BASIC_INFORMATION,
851 dwLength: SIZE_T)
852 -> SIZE_T;
853 pub fn CreateFileMappingW(hFile: HANDLE,
854 lpAttributes: LPSECURITY_ATTRIBUTES,
855 flProtect: DWORD,
856 dwMaximumSizeHigh: DWORD,
857 dwMaximumSizeLow: DWORD,
858 lpName: LPCWSTR)
859 -> HANDLE;
860 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
861 dwDesiredAccess: DWORD,
862 dwFileOffsetHigh: DWORD,
863 dwFileOffsetLow: DWORD,
864 dwNumberOfBytesToMap: SIZE_T)
865 -> LPVOID;
866 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
867 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
868 lpNewFileName: LPCWSTR,
869 dwFlags: DWORD) -> BOOL;
870 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
871 lpTargetFileName: LPCWSTR,
872 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
873 -> BOOL;
874 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
875 pub fn CreateFileW(lpFileName: LPCWSTR,
876 dwDesiredAccess: DWORD,
877 dwShareMode: DWORD,
878 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
879 dwCreationDisposition: DWORD,
880 dwFlagsAndAttributes: DWORD,
881 hTemplateFile: HANDLE) -> HANDLE;
882 pub fn ReadFile(hFile: HANDLE,
883 lpBuffer: LPVOID,
884 nNumberOfBytesToRead: DWORD,
885 lpNumberOfBytesRead: LPDWORD,
886 lpOverlapped: LPOVERLAPPED) -> BOOL;
887 pub fn WriteFile(hFile: HANDLE,
888 lpBuffer: LPCVOID,
889 nNumberOfBytesToWrite: DWORD,
890 lpNumberOfBytesWritten: LPDWORD,
891 lpOverlapped: LPOVERLAPPED) -> BOOL;
892 pub fn SetFilePointerEx(hFile: HANDLE,
893 liDistanceToMove: LARGE_INTEGER,
894 lpNewFilePointer: PLARGE_INTEGER,
895 dwMoveMethod: DWORD) -> BOOL;
896 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700897
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700898 pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME);
Alex Crichton5d6cf052015-09-11 14:52:34 -0700899
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700900 pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL;
901 pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER)
902 -> BOOL;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700903
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700904 pub fn GetCurrentProcessId() -> DWORD;
905 pub fn CreateNamedPipeW(
906 lpName: LPCWSTR,
907 dwOpenMode: DWORD,
908 dwPipeMode: DWORD,
909 nMaxInstances: DWORD,
910 nOutBufferSize: DWORD,
911 nInBufferSize: DWORD,
912 nDefaultTimeOut: DWORD,
913 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
914 ) -> HANDLE;
915 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
916 lpOverlapped: LPOVERLAPPED) -> BOOL;
917 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
918 nTimeOut: DWORD) -> BOOL;
919 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
920 lpMode: LPDWORD,
921 lpMaxCollectionCount: LPDWORD,
922 lpCollectDataTimeout: LPDWORD)
923 -> BOOL;
924 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
925 bManualReset: BOOL,
926 bInitialState: BOOL,
927 lpName: LPCWSTR) -> HANDLE;
928 pub fn GetOverlappedResult(hFile: HANDLE,
929 lpOverlapped: LPOVERLAPPED,
930 lpNumberOfBytesTransferred: LPDWORD,
931 bWait: BOOL) -> BOOL;
932 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700933
Alex Crichtonbfc6ebc2015-09-11 15:29:40 -0700934 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
935 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
936 pub fn connect(socket: SOCKET, address: *const sockaddr,
937 len: c_int) -> c_int;
938 pub fn bind(socket: SOCKET, address: *const sockaddr,
939 address_len: c_int) -> c_int;
940 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
941 pub fn accept(socket: SOCKET, address: *mut sockaddr,
942 address_len: *mut c_int) -> SOCKET;
943 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
944 address_len: *mut c_int) -> c_int;
945 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
946 address_len: *mut c_int) -> c_int;
947 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
948 value: *const c_char,
949 option_len: c_int) -> c_int;
950 pub fn closesocket(socket: SOCKET) -> c_int;
951 pub fn recv(socket: SOCKET, buf: *mut c_char, len: c_int,
952 flags: c_int) -> c_int;
953 pub fn send(socket: SOCKET, buf: *const c_char, len: c_int,
954 flags: c_int) -> c_int;
955 pub fn recvfrom(socket: SOCKET, buf: *mut c_char, len: c_int,
956 flags: c_int, addr: *mut sockaddr,
957 addrlen: *mut c_int) -> c_int;
958 pub fn sendto(socket: SOCKET, buf: *const c_char, len: c_int,
959 flags: c_int, addr: *const sockaddr,
960 addrlen: c_int) -> c_int;
961 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
962}