@@ -19,6 +19,7 @@ pub use windows_sys::*;
1919pub type DWORD = c_ulong ;
2020pub type NonZeroDWORD = NonZero_c_ulong ;
2121pub type LARGE_INTEGER = c_longlong ;
22+ #[ cfg_attr( target_vendor = "uwp" , allow( unused) ) ]
2223pub type LONG = c_long ;
2324pub type UINT = c_uint ;
2425pub type WCHAR = u16 ;
@@ -50,6 +51,9 @@ pub type CONDITION_VARIABLE = RTL_CONDITION_VARIABLE;
5051pub type SRWLOCK = RTL_SRWLOCK ;
5152pub type INIT_ONCE = RTL_RUN_ONCE ;
5253
54+ #[ cfg( target_vendor = "uwp" ) ]
55+ pub const STATUS_NOT_IMPLEMENTED : NTSTATUS = 0xC0000002_u32 as _ ;
56+
5357pub const CONDITION_VARIABLE_INIT : CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr : ptr:: null_mut ( ) } ;
5458pub const SRWLOCK_INIT : SRWLOCK = SRWLOCK { Ptr : ptr:: null_mut ( ) } ;
5559pub const INIT_ONCE_STATIC_INIT : INIT_ONCE = INIT_ONCE { Ptr : ptr:: null_mut ( ) } ;
@@ -267,6 +271,8 @@ pub unsafe fn getaddrinfo(
267271 windows_sys:: getaddrinfo ( node. cast :: < u8 > ( ) , service. cast :: < u8 > ( ) , hints, res)
268272}
269273
274+ cfg_if:: cfg_if! {
275+ if #[ cfg( not( target_vendor = "uwp" ) ) ] {
270276pub unsafe fn NtReadFile (
271277 filehandle: BorrowedHandle <' _>,
272278 event: HANDLE ,
@@ -313,6 +319,8 @@ pub unsafe fn NtWriteFile(
313319 key. map( |k| k as * const u32 ) . unwrap_or( ptr:: null( ) ) ,
314320 )
315321}
322+ }
323+ }
316324
317325// Functions that aren't available on every version of Windows that we support,
318326// but we still use them and just provide some form of a fallback implementation.
@@ -376,4 +384,54 @@ compat_fn_with_fallback! {
376384 ) -> NTSTATUS {
377385 panic!( "keyed events not available" )
378386 }
387+
388+ // These functions are available on UWP when lazily loaded. They will fail WACK if loaded statically.
389+ #[ cfg( target_vendor = "uwp" ) ]
390+ pub fn NtCreateFile (
391+ filehandle: * mut HANDLE ,
392+ desiredaccess: FILE_ACCESS_RIGHTS ,
393+ objectattributes: * const OBJECT_ATTRIBUTES ,
394+ iostatusblock: * mut IO_STATUS_BLOCK ,
395+ allocationsize: * const i64 ,
396+ fileattributes: FILE_FLAGS_AND_ATTRIBUTES ,
397+ shareaccess: FILE_SHARE_MODE ,
398+ createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
399+ createoptions: NTCREATEFILE_CREATE_OPTIONS ,
400+ eabuffer: * const :: core:: ffi:: c_void,
401+ ealength: u32
402+ ) -> NTSTATUS {
403+ STATUS_NOT_IMPLEMENTED
404+ }
405+ #[ cfg( target_vendor = "uwp" ) ]
406+ pub fn NtReadFile (
407+ filehandle: BorrowedHandle <' _>,
408+ event: HANDLE ,
409+ apcroutine: PIO_APC_ROUTINE ,
410+ apccontext: * mut c_void,
411+ iostatusblock: & mut IO_STATUS_BLOCK ,
412+ buffer: * mut crate :: mem:: MaybeUninit <u8 >,
413+ length: ULONG ,
414+ byteoffset: Option <& LARGE_INTEGER >,
415+ key: Option <& ULONG >
416+ ) -> NTSTATUS {
417+ STATUS_NOT_IMPLEMENTED
418+ }
419+ #[ cfg( target_vendor = "uwp" ) ]
420+ pub fn NtWriteFile (
421+ filehandle: BorrowedHandle <' _>,
422+ event: HANDLE ,
423+ apcroutine: PIO_APC_ROUTINE ,
424+ apccontext: * mut c_void,
425+ iostatusblock: & mut IO_STATUS_BLOCK ,
426+ buffer: * const u8 ,
427+ length: ULONG ,
428+ byteoffset: Option <& LARGE_INTEGER >,
429+ key: Option <& ULONG >
430+ ) -> NTSTATUS {
431+ STATUS_NOT_IMPLEMENTED
432+ }
433+ #[ cfg( target_vendor = "uwp" ) ]
434+ pub fn RtlNtStatusToDosError ( Status : NTSTATUS ) -> ULONG {
435+ Status as ULONG
436+ }
379437}
0 commit comments