7
7
8
8
use crate :: ffi:: CStr ;
9
9
use crate :: mem;
10
- use crate :: num:: NonZero ;
11
- pub use crate :: os:: raw:: c_int;
12
- use crate :: os:: raw:: { c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void} ;
10
+ use crate :: os:: raw:: { c_char, c_int, c_uint, c_ulong, c_ushort, c_void} ;
13
11
use crate :: os:: windows:: io:: { AsRawHandle , BorrowedHandle } ;
14
12
use crate :: ptr;
15
13
@@ -18,30 +16,10 @@ pub(super) mod windows_targets;
18
16
mod windows_sys;
19
17
pub use windows_sys:: * ;
20
18
21
- pub type DWORD = c_ulong ;
22
- pub type NonZeroDWORD = NonZero < c_ulong > ;
23
- pub type LARGE_INTEGER = c_longlong ;
24
- #[ cfg_attr( target_vendor = "uwp" , allow( unused) ) ]
25
- pub type LONG = c_long ;
26
- pub type UINT = c_uint ;
27
19
pub type WCHAR = u16 ;
28
- pub type USHORT = c_ushort ;
29
- pub type SIZE_T = usize ;
30
- pub type CHAR = c_char ;
31
- pub type ULONG = c_ulong ;
32
-
33
- pub type LPCVOID = * const c_void ;
34
- pub type LPOVERLAPPED = * mut OVERLAPPED ;
35
- pub type LPSECURITY_ATTRIBUTES = * mut SECURITY_ATTRIBUTES ;
36
- pub type LPVOID = * mut c_void ;
37
- pub type LPWCH = * mut WCHAR ;
38
- pub type LPWSTR = * mut WCHAR ;
39
-
40
- #[ cfg( target_vendor = "win7" ) ]
41
- pub type PSRWLOCK = * mut SRWLOCK ;
42
20
43
21
pub type socklen_t = c_int ;
44
- pub type ADDRESS_FAMILY = USHORT ;
22
+ pub type ADDRESS_FAMILY = c_ushort ;
45
23
pub use FD_SET as fd_set;
46
24
pub use LINGER as linger;
47
25
pub use TIMEVAL as timeval;
@@ -151,25 +129,25 @@ pub struct MOUNT_POINT_REPARSE_BUFFER {
151
129
#[ repr( C ) ]
152
130
pub struct SOCKADDR_STORAGE_LH {
153
131
pub ss_family : ADDRESS_FAMILY ,
154
- pub __ss_pad1 : [ CHAR ; 6 ] ,
132
+ pub __ss_pad1 : [ c_char ; 6 ] ,
155
133
pub __ss_align : i64 ,
156
- pub __ss_pad2 : [ CHAR ; 112 ] ,
134
+ pub __ss_pad2 : [ c_char ; 112 ] ,
157
135
}
158
136
159
137
#[ repr( C ) ]
160
138
#[ derive( Copy , Clone ) ]
161
139
pub struct sockaddr_in {
162
140
pub sin_family : ADDRESS_FAMILY ,
163
- pub sin_port : USHORT ,
141
+ pub sin_port : c_ushort ,
164
142
pub sin_addr : in_addr ,
165
- pub sin_zero : [ CHAR ; 8 ] ,
143
+ pub sin_zero : [ c_char ; 8 ] ,
166
144
}
167
145
168
146
#[ repr( C ) ]
169
147
#[ derive( Copy , Clone ) ]
170
148
pub struct sockaddr_in6 {
171
149
pub sin6_family : ADDRESS_FAMILY ,
172
- pub sin6_port : USHORT ,
150
+ pub sin6_port : c_ushort ,
173
151
pub sin6_flowinfo : c_ulong ,
174
152
pub sin6_addr : in6_addr ,
175
153
pub sin6_scope_id : c_ulong ,
@@ -271,9 +249,9 @@ pub unsafe fn NtReadFile(
271
249
apccontext: * mut c_void,
272
250
iostatusblock: & mut IO_STATUS_BLOCK ,
273
251
buffer: * mut crate :: mem:: MaybeUninit <u8 >,
274
- length: ULONG ,
275
- byteoffset: Option <& LARGE_INTEGER >,
276
- key: Option <& ULONG >,
252
+ length: u32 ,
253
+ byteoffset: Option <& i64 >,
254
+ key: Option <& u32 >,
277
255
) -> NTSTATUS {
278
256
windows_sys:: NtReadFile (
279
257
filehandle. as_raw_handle( ) ,
@@ -294,9 +272,9 @@ pub unsafe fn NtWriteFile(
294
272
apccontext: * mut c_void,
295
273
iostatusblock: & mut IO_STATUS_BLOCK ,
296
274
buffer: * const u8 ,
297
- length: ULONG ,
298
- byteoffset: Option <& LARGE_INTEGER >,
299
- key: Option <& ULONG >,
275
+ length: u32 ,
276
+ byteoffset: Option <& i64 >,
277
+ key: Option <& u32 >,
300
278
) -> NTSTATUS {
301
279
windows_sys:: NtWriteFile (
302
280
filehandle. as_raw_handle( ) ,
@@ -336,13 +314,13 @@ compat_fn_with_fallback! {
336
314
// >= Win10 1607
337
315
// https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
338
316
pub fn SetThreadDescription ( hthread: HANDLE , lpthreaddescription: PCWSTR ) -> HRESULT {
339
- SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; E_NOTIMPL
317
+ SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as u32 ) ; E_NOTIMPL
340
318
}
341
319
342
320
// >= Win10 1607
343
321
// https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreaddescription
344
322
pub fn GetThreadDescription ( hthread: HANDLE , lpthreaddescription: * mut PWSTR ) -> HRESULT {
345
- SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; E_NOTIMPL
323
+ SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as u32 ) ; E_NOTIMPL
346
324
}
347
325
348
326
// >= Win8 / Server 2012
@@ -403,27 +381,27 @@ compat_fn_with_fallback! {
403
381
#[ cfg( target_vendor = "win7" ) ]
404
382
pub fn NtCreateKeyedEvent (
405
383
KeyedEventHandle : * mut HANDLE ,
406
- DesiredAccess : DWORD ,
407
- ObjectAttributes : LPVOID ,
408
- Flags : ULONG
384
+ DesiredAccess : u32 ,
385
+ ObjectAttributes : * mut c_void ,
386
+ Flags : u32
409
387
) -> NTSTATUS {
410
388
panic!( "keyed events not available" )
411
389
}
412
390
#[ cfg( target_vendor = "win7" ) ]
413
391
pub fn NtReleaseKeyedEvent (
414
392
EventHandle : HANDLE ,
415
- Key : LPVOID ,
393
+ Key : * const c_void ,
416
394
Alertable : BOOLEAN ,
417
- Timeout : * mut c_longlong
395
+ Timeout : * mut i64
418
396
) -> NTSTATUS {
419
397
panic!( "keyed events not available" )
420
398
}
421
399
#[ cfg( target_vendor = "win7" ) ]
422
400
pub fn NtWaitForKeyedEvent (
423
401
EventHandle : HANDLE ,
424
- Key : LPVOID ,
402
+ Key : * const c_void ,
425
403
Alertable : BOOLEAN ,
426
- Timeout : * mut c_longlong
404
+ Timeout : * mut i64
427
405
) -> NTSTATUS {
428
406
panic!( "keyed events not available" )
429
407
}
@@ -453,9 +431,9 @@ compat_fn_with_fallback! {
453
431
apccontext: * mut c_void,
454
432
iostatusblock: & mut IO_STATUS_BLOCK ,
455
433
buffer: * mut crate :: mem:: MaybeUninit <u8 >,
456
- length: ULONG ,
457
- byteoffset: Option <& LARGE_INTEGER >,
458
- key: Option <& ULONG >
434
+ length: u32 ,
435
+ byteoffset: Option <& i64 >,
436
+ key: Option <& u32 >
459
437
) -> NTSTATUS {
460
438
STATUS_NOT_IMPLEMENTED
461
439
}
@@ -467,9 +445,9 @@ compat_fn_with_fallback! {
467
445
apccontext: * mut c_void,
468
446
iostatusblock: & mut IO_STATUS_BLOCK ,
469
447
buffer: * const u8 ,
470
- length: ULONG ,
471
- byteoffset: Option <& LARGE_INTEGER >,
472
- key: Option <& ULONG >
448
+ length: u32 ,
449
+ byteoffset: Option <& i64 >,
450
+ key: Option <& u32 >
473
451
) -> NTSTATUS {
474
452
STATUS_NOT_IMPLEMENTED
475
453
}
0 commit comments