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