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