@@ -113,22 +113,50 @@ unsafe extern "system" {
113113 pub fn ProcessPrng ( pbdata : * mut u8 , cbdata : usize ) -> BOOL ;
114114}
115115
116- windows_link:: link!( "ntdll.dll" "system" fn NtCreateNamedPipeFile (
117- filehandle: * mut HANDLE ,
118- desiredaccess: FILE_ACCESS_RIGHTS ,
119- objectattributes: * const OBJECT_ATTRIBUTES ,
120- iostatusblock: * mut IO_STATUS_BLOCK ,
121- shareaccess: FILE_SHARE_MODE ,
122- createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
123- createoptions: NTCREATEFILE_CREATE_OPTIONS ,
124- namedpipetype: u32 ,
125- readmode: u32 ,
126- completionmode: u32 ,
127- maximuminstances: u32 ,
128- inboundquota: u32 ,
129- outboundquota: u32 ,
130- defaulttimeout: * const u64 ,
131- ) -> NTSTATUS ) ;
116+ cfg_select ! {
117+ target_family = "rust9x" => {
118+ compat_fn_with_fallback! {
119+ pub static NTDLL : & CStr = c"ntdll" => { load: false , unicows: false } ;
120+ // NT only (duh)
121+ pub fn NtCreateNamedPipeFile (
122+ filehandle: * mut HANDLE ,
123+ desiredaccess: FILE_ACCESS_RIGHTS ,
124+ objectattributes: * const OBJECT_ATTRIBUTES ,
125+ iostatusblock: * mut IO_STATUS_BLOCK ,
126+ shareaccess: FILE_SHARE_MODE ,
127+ createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
128+ createoptions: NTCREATEFILE_CREATE_OPTIONS ,
129+ namedpipetype: u32 ,
130+ readmode: u32 ,
131+ completionmode: u32 ,
132+ maximuminstances: u32 ,
133+ inboundquota: u32 ,
134+ outboundquota: u32 ,
135+ defaulttimeout: * const u64 ,
136+ ) -> NTSTATUS {
137+ rtabort!( "unimplemented" )
138+ }
139+ }
140+ }
141+ _ => {
142+ windows_link:: link!( "ntdll.dll" "system" fn NtCreateNamedPipeFile (
143+ filehandle: * mut HANDLE ,
144+ desiredaccess: FILE_ACCESS_RIGHTS ,
145+ objectattributes: * const OBJECT_ATTRIBUTES ,
146+ iostatusblock: * mut IO_STATUS_BLOCK ,
147+ shareaccess: FILE_SHARE_MODE ,
148+ createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
149+ createoptions: NTCREATEFILE_CREATE_OPTIONS ,
150+ namedpipetype: u32 ,
151+ readmode: u32 ,
152+ completionmode: u32 ,
153+ maximuminstances: u32 ,
154+ inboundquota: u32 ,
155+ outboundquota: u32 ,
156+ defaulttimeout: * const u64 ,
157+ ) -> NTSTATUS ) ;
158+ }
159+ }
132160
133161// Functions that aren't available on every version of Windows that we support,
134162// but we still use them and just provide some form of a fallback implementation.
@@ -259,6 +287,67 @@ cfg_select! {
259287 windows_link:: link_raw_dylib!( "ntdll.dll" "system" fn NtWriteFile ( filehandle : HANDLE , event : HANDLE , apcroutine : PIO_APC_ROUTINE , apccontext : * const core:: ffi:: c_void, iostatusblock : * mut IO_STATUS_BLOCK , buffer : * const core:: ffi:: c_void, length : u32 , byteoffset : * const i64 , key : * const u32 ) -> NTSTATUS ) ;
260288 windows_link:: link_raw_dylib!( "ntdll.dll" "system" fn RtlNtStatusToDosError ( status : NTSTATUS ) -> u32 ) ;
261289 }
290+ target_family = "rust9x" => {
291+ compat_fn_with_fallback! {
292+ pub static NTDLL : & CStr = c"ntdll" => { load: false , unicows: false } ;
293+
294+ pub fn NtCreateFile (
295+ filehandle: * mut HANDLE ,
296+ desiredaccess: FILE_ACCESS_RIGHTS ,
297+ objectattributes: * const OBJECT_ATTRIBUTES ,
298+ iostatusblock: * mut IO_STATUS_BLOCK ,
299+ allocationsize: * const i64 ,
300+ fileattributes: FILE_FLAGS_AND_ATTRIBUTES ,
301+ shareaccess: FILE_SHARE_MODE ,
302+ createdisposition: NTCREATEFILE_CREATE_DISPOSITION ,
303+ createoptions: NTCREATEFILE_CREATE_OPTIONS ,
304+ eabuffer: * const core:: ffi:: c_void,
305+ ealength: u32
306+ ) -> NTSTATUS {
307+ STATUS_NOT_IMPLEMENTED
308+ }
309+
310+ pub fn NtReadFile (
311+ filehandle: HANDLE ,
312+ event: HANDLE ,
313+ apcroutine: PIO_APC_ROUTINE ,
314+ apccontext: * const c_void,
315+ iostatusblock: * mut IO_STATUS_BLOCK ,
316+ buffer: * mut c_void,
317+ length: u32 ,
318+ byteoffset: * const i64 ,
319+ key: * const u32
320+ ) -> NTSTATUS {
321+ STATUS_NOT_IMPLEMENTED
322+ }
323+ pub fn NtWriteFile (
324+ filehandle: HANDLE ,
325+ event: HANDLE ,
326+ apcroutine: PIO_APC_ROUTINE ,
327+ apccontext: * const c_void,
328+ iostatusblock: * mut IO_STATUS_BLOCK ,
329+ buffer: * const c_void,
330+ length: u32 ,
331+ byteoffset: * const i64 ,
332+ key: * const u32
333+ ) -> NTSTATUS {
334+ STATUS_NOT_IMPLEMENTED
335+ }
336+ pub fn RtlNtStatusToDosError ( Status : NTSTATUS ) -> u32 {
337+ ERROR_CALL_NOT_IMPLEMENTED
338+ }
339+ pub fn NtOpenFile (
340+ filehandle: * mut HANDLE ,
341+ desiredaccess: u32 ,
342+ objectattributes: * const OBJECT_ATTRIBUTES ,
343+ iostatusblock: * mut IO_STATUS_BLOCK ,
344+ shareaccess: u32 ,
345+ openoptions: u32
346+ ) -> NTSTATUS {
347+ STATUS_NOT_IMPLEMENTED
348+ }
349+ }
350+ }
262351 _ => { }
263352}
264353
@@ -643,3 +732,13 @@ compat_fn_with_fallback! {
643732 rtabort!( "unimplemented" )
644733 }
645734}
735+
736+ #[ cfg( target_family = "rust9x" ) ]
737+ compat_fn_with_fallback ! {
738+ pub static KERNEL32 : & CStr = c"kernel32" => { load: false , unicows: false } ;
739+ // >= 98+, NT4.0
740+ // https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal
741+ pub fn CancelIo ( hfile: HANDLE ) -> BOOL {
742+ rtabort!( "unimplemented" )
743+ }
744+ }
0 commit comments