@@ -282,7 +282,7 @@ pub unsafe fn NtReadFile(
282
282
byteoffset: Option <& LARGE_INTEGER >,
283
283
key: Option <& ULONG >,
284
284
) -> NTSTATUS {
285
- windows_sys :: NtReadFile (
285
+ ntdll :: NtReadFile (
286
286
filehandle. as_raw_handle( ) ,
287
287
event,
288
288
apcroutine,
@@ -305,7 +305,7 @@ pub unsafe fn NtWriteFile(
305
305
byteoffset: Option <& LARGE_INTEGER >,
306
306
key: Option <& ULONG >,
307
307
) -> NTSTATUS {
308
- windows_sys :: NtWriteFile (
308
+ ntdll :: NtWriteFile (
309
309
filehandle. as_raw_handle( ) ,
310
310
event,
311
311
apcroutine,
@@ -565,6 +565,53 @@ pub const RtlGenRandom: unsafe fn(
565
565
randombufferlength : u32 ,
566
566
) -> BOOLEAN = SystemFunction036 ;
567
567
568
+ compat_fn_lazy ! {
569
+ pub static NTDLL : & CStr = c"ntdll" => { load: true , unicows: false } ;
570
+
571
+ pub fn NtCreateFile (
572
+ filehandle: * mut HANDLE ,
573
+ desiredaccess: FILE_ACCESS_RIGHTS ,
574
+ objectattributes: * const OBJECT_ATTRIBUTES ,
575
+ iostatusblock: * mut IO_STATUS_BLOCK ,
576
+ allocationsize: * const i64 ,
577
+ fileattributes: FILE_FLAGS_AND_ATTRIBUTES ,
578
+ shareaccess: FILE_SHARE_MODE ,
579
+ createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
580
+ createoptions: NTCREATEFILE_CREATE_OPTIONS ,
581
+ eabuffer: * const :: core:: ffi:: c_void,
582
+ ealength: u32 ,
583
+ ) -> NTSTATUS ;
584
+ }
585
+
586
+ pub mod ntdll {
587
+ use super :: * ;
588
+ compat_fn_lazy ! {
589
+ pub static NTDLL : & CStr = c"ntdll" => { load: true , unicows: false } ;
590
+
591
+ pub fn NtReadFile (
592
+ filehandle: HANDLE ,
593
+ event: HANDLE ,
594
+ apcroutine: PIO_APC_ROUTINE ,
595
+ apccontext: * const :: core:: ffi:: c_void,
596
+ iostatusblock: * mut IO_STATUS_BLOCK ,
597
+ buffer: * mut :: core:: ffi:: c_void,
598
+ length: u32 ,
599
+ byteoffset: * const i64 ,
600
+ key: * const u32 ,
601
+ ) -> NTSTATUS ;
602
+ pub fn NtWriteFile (
603
+ filehandle: HANDLE ,
604
+ event: HANDLE ,
605
+ apcroutine: PIO_APC_ROUTINE ,
606
+ apccontext: * const :: core:: ffi:: c_void,
607
+ iostatusblock: * mut IO_STATUS_BLOCK ,
608
+ buffer: * const :: core:: ffi:: c_void,
609
+ length: u32 ,
610
+ byteoffset: * const i64 ,
611
+ key: * const u32 ,
612
+ ) -> NTSTATUS ;
613
+ }
614
+ }
568
615
compat_fn_with_fallback ! {
569
616
pub static NTDLL : & CStr = c"ntdll" => { load: true , unicows: false } ;
570
617
@@ -592,53 +639,6 @@ compat_fn_with_fallback! {
592
639
) -> NTSTATUS {
593
640
panic!( "keyed events not available" )
594
641
}
595
-
596
- // These functions are available on UWP when lazily loaded. They will fail WACK if loaded statically.
597
- #[ cfg( target_vendor = "uwp" ) ]
598
- pub fn NtCreateFile (
599
- filehandle: * mut HANDLE ,
600
- desiredaccess: FILE_ACCESS_RIGHTS ,
601
- objectattributes: * const OBJECT_ATTRIBUTES ,
602
- iostatusblock: * mut IO_STATUS_BLOCK ,
603
- allocationsize: * const i64 ,
604
- fileattributes: FILE_FLAGS_AND_ATTRIBUTES ,
605
- shareaccess: FILE_SHARE_MODE ,
606
- createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
607
- createoptions: NTCREATEFILE_CREATE_OPTIONS ,
608
- eabuffer: * const :: core:: ffi:: c_void,
609
- ealength: u32
610
- ) -> NTSTATUS {
611
- STATUS_NOT_IMPLEMENTED
612
- }
613
- #[ cfg( target_vendor = "uwp" ) ]
614
- pub fn NtReadFile (
615
- filehandle: BorrowedHandle <' _>,
616
- event: HANDLE ,
617
- apcroutine: PIO_APC_ROUTINE ,
618
- apccontext: * mut c_void,
619
- iostatusblock: & mut IO_STATUS_BLOCK ,
620
- buffer: * mut crate :: mem:: MaybeUninit <u8 >,
621
- length: ULONG ,
622
- byteoffset: Option <& LARGE_INTEGER >,
623
- key: Option <& ULONG >
624
- ) -> NTSTATUS {
625
- STATUS_NOT_IMPLEMENTED
626
- }
627
- #[ cfg( target_vendor = "uwp" ) ]
628
- pub fn NtWriteFile (
629
- filehandle: BorrowedHandle <' _>,
630
- event: HANDLE ,
631
- apcroutine: PIO_APC_ROUTINE ,
632
- apccontext: * mut c_void,
633
- iostatusblock: & mut IO_STATUS_BLOCK ,
634
- buffer: * const u8 ,
635
- length: ULONG ,
636
- byteoffset: Option <& LARGE_INTEGER >,
637
- key: Option <& ULONG >
638
- ) -> NTSTATUS {
639
- STATUS_NOT_IMPLEMENTED
640
- }
641
- #[ cfg( target_vendor = "uwp" ) ]
642
642
pub fn RtlNtStatusToDosError ( Status : NTSTATUS ) -> u32 {
643
643
Status as u32
644
644
}
0 commit comments