77
88use crate :: ffi:: CStr ;
99use 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} ;
1311use crate :: os:: windows:: io:: { AsRawHandle , BorrowedHandle } ;
1412use crate :: ptr;
1513
@@ -18,30 +16,10 @@ pub(super) mod windows_targets;
1816mod windows_sys;
1917pub use windows_sys:: * ;
2018
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 ;
2719pub 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 ;
4220
4321pub type socklen_t = c_int ;
44- pub type ADDRESS_FAMILY = USHORT ;
22+ pub type ADDRESS_FAMILY = c_ushort ;
4523pub use FD_SET as fd_set;
4624pub use LINGER as linger;
4725pub use TIMEVAL as timeval;
@@ -151,25 +129,25 @@ pub struct MOUNT_POINT_REPARSE_BUFFER {
151129#[ repr( C ) ]
152130pub struct SOCKADDR_STORAGE_LH {
153131 pub ss_family : ADDRESS_FAMILY ,
154- pub __ss_pad1 : [ CHAR ; 6 ] ,
132+ pub __ss_pad1 : [ c_char ; 6 ] ,
155133 pub __ss_align : i64 ,
156- pub __ss_pad2 : [ CHAR ; 112 ] ,
134+ pub __ss_pad2 : [ c_char ; 112 ] ,
157135}
158136
159137#[ repr( C ) ]
160138#[ derive( Copy , Clone ) ]
161139pub struct sockaddr_in {
162140 pub sin_family : ADDRESS_FAMILY ,
163- pub sin_port : USHORT ,
141+ pub sin_port : c_ushort ,
164142 pub sin_addr : in_addr ,
165- pub sin_zero : [ CHAR ; 8 ] ,
143+ pub sin_zero : [ c_char ; 8 ] ,
166144}
167145
168146#[ repr( C ) ]
169147#[ derive( Copy , Clone ) ]
170148pub struct sockaddr_in6 {
171149 pub sin6_family : ADDRESS_FAMILY ,
172- pub sin6_port : USHORT ,
150+ pub sin6_port : c_ushort ,
173151 pub sin6_flowinfo : c_ulong ,
174152 pub sin6_addr : in6_addr ,
175153 pub sin6_scope_id : c_ulong ,
@@ -271,9 +249,9 @@ pub unsafe fn NtReadFile(
271249 apccontext: * mut c_void,
272250 iostatusblock: & mut IO_STATUS_BLOCK ,
273251 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 >,
277255) -> NTSTATUS {
278256 windows_sys:: NtReadFile (
279257 filehandle. as_raw_handle( ) ,
@@ -294,9 +272,9 @@ pub unsafe fn NtWriteFile(
294272 apccontext: * mut c_void,
295273 iostatusblock: & mut IO_STATUS_BLOCK ,
296274 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 >,
300278) -> NTSTATUS {
301279 windows_sys:: NtWriteFile (
302280 filehandle. as_raw_handle( ) ,
@@ -336,13 +314,13 @@ compat_fn_with_fallback! {
336314 // >= Win10 1607
337315 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
338316 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
340318 }
341319
342320 // >= Win10 1607
343321 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreaddescription
344322 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
346324 }
347325
348326 // >= Win8 / Server 2012
@@ -403,27 +381,27 @@ compat_fn_with_fallback! {
403381 #[ cfg( target_vendor = "win7" ) ]
404382 pub fn NtCreateKeyedEvent (
405383 KeyedEventHandle : * mut HANDLE ,
406- DesiredAccess : DWORD ,
407- ObjectAttributes : LPVOID ,
408- Flags : ULONG
384+ DesiredAccess : u32 ,
385+ ObjectAttributes : * mut c_void ,
386+ Flags : u32
409387 ) -> NTSTATUS {
410388 panic!( "keyed events not available" )
411389 }
412390 #[ cfg( target_vendor = "win7" ) ]
413391 pub fn NtReleaseKeyedEvent (
414392 EventHandle : HANDLE ,
415- Key : LPVOID ,
393+ Key : * const c_void ,
416394 Alertable : BOOLEAN ,
417- Timeout : * mut c_longlong
395+ Timeout : * mut i64
418396 ) -> NTSTATUS {
419397 panic!( "keyed events not available" )
420398 }
421399 #[ cfg( target_vendor = "win7" ) ]
422400 pub fn NtWaitForKeyedEvent (
423401 EventHandle : HANDLE ,
424- Key : LPVOID ,
402+ Key : * const c_void ,
425403 Alertable : BOOLEAN ,
426- Timeout : * mut c_longlong
404+ Timeout : * mut i64
427405 ) -> NTSTATUS {
428406 panic!( "keyed events not available" )
429407 }
@@ -453,9 +431,9 @@ compat_fn_with_fallback! {
453431 apccontext: * mut c_void,
454432 iostatusblock: & mut IO_STATUS_BLOCK ,
455433 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 >
459437 ) -> NTSTATUS {
460438 STATUS_NOT_IMPLEMENTED
461439 }
@@ -467,9 +445,9 @@ compat_fn_with_fallback! {
467445 apccontext: * mut c_void,
468446 iostatusblock: & mut IO_STATUS_BLOCK ,
469447 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 >
473451 ) -> NTSTATUS {
474452 STATUS_NOT_IMPLEMENTED
475453 }
0 commit comments