@@ -605,130 +605,130 @@ pub struct timeval {
605605
606606// Functions forbidden when targeting UWP
607607cfg_if:: cfg_if! {
608- if #[ cfg( not( target_vendor = "uwp" ) ) ] {
609- pub const EXCEPTION_CONTINUE_SEARCH : LONG = 0 ;
610- pub const EXCEPTION_STACK_OVERFLOW : DWORD = 0xc00000fd ;
611- pub const EXCEPTION_MAXIMUM_PARAMETERS : usize = 15 ;
612-
613- #[ repr( C ) ]
614- pub struct EXCEPTION_RECORD {
615- pub ExceptionCode : DWORD ,
616- pub ExceptionFlags : DWORD ,
617- pub ExceptionRecord : * mut EXCEPTION_RECORD ,
618- pub ExceptionAddress : LPVOID ,
619- pub NumberParameters : DWORD ,
620- pub ExceptionInformation : [ LPVOID ; EXCEPTION_MAXIMUM_PARAMETERS ]
621- }
622-
623- pub enum CONTEXT { }
624-
625- #[ repr( C ) ]
626- pub struct EXCEPTION_POINTERS {
627- pub ExceptionRecord : * mut EXCEPTION_RECORD ,
628- pub ContextRecord : * mut CONTEXT ,
629- }
630-
631- pub type PVECTORED_EXCEPTION_HANDLER = extern "system"
632- fn ( ExceptionInfo : * mut EXCEPTION_POINTERS ) -> LONG ;
633-
634- #[ repr( C ) ]
635- #[ derive( Copy , Clone ) ]
636- pub struct CONSOLE_READCONSOLE_CONTROL {
637- pub nLength: ULONG ,
638- pub nInitialChars: ULONG ,
639- pub dwCtrlWakeupMask: ULONG ,
640- pub dwControlKeyState: ULONG ,
641- }
642-
643- pub type PCONSOLE_READCONSOLE_CONTROL = * mut CONSOLE_READCONSOLE_CONTROL ;
644-
645- #[ repr( C ) ]
646- pub struct BY_HANDLE_FILE_INFORMATION {
647- pub dwFileAttributes: DWORD ,
648- pub ftCreationTime: FILETIME ,
649- pub ftLastAccessTime: FILETIME ,
650- pub ftLastWriteTime: FILETIME ,
651- pub dwVolumeSerialNumber: DWORD ,
652- pub nFileSizeHigh: DWORD ,
653- pub nFileSizeLow: DWORD ,
654- pub nNumberOfLinks: DWORD ,
655- pub nFileIndexHigh: DWORD ,
656- pub nFileIndexLow: DWORD ,
657- }
658-
659- pub type LPBY_HANDLE_FILE_INFORMATION = * mut BY_HANDLE_FILE_INFORMATION ;
660- pub type LPCVOID = * const c_void;
661-
662- pub const HANDLE_FLAG_INHERIT : DWORD = 0x00000001 ;
663-
664- pub const TOKEN_READ : DWORD = 0x20008 ;
665-
666- extern "system" {
667- #[ link_name = "SystemFunction036" ]
668- pub fn RtlGenRandom ( RandomBuffer : * mut u8 , RandomBufferLength : ULONG ) -> BOOLEAN ;
669-
670- pub fn ReadConsoleW ( hConsoleInput: HANDLE ,
671- lpBuffer: LPVOID ,
672- nNumberOfCharsToRead: DWORD ,
673- lpNumberOfCharsRead: LPDWORD ,
674- pInputControl: PCONSOLE_READCONSOLE_CONTROL ) -> BOOL ;
675-
676- pub fn WriteConsoleW ( hConsoleOutput: HANDLE ,
677- lpBuffer: LPCVOID ,
678- nNumberOfCharsToWrite: DWORD ,
679- lpNumberOfCharsWritten: LPDWORD ,
680- lpReserved: LPVOID ) -> BOOL ;
681-
682- pub fn GetConsoleMode ( hConsoleHandle: HANDLE ,
683- lpMode: LPDWORD ) -> BOOL ;
684- // Allowed but unused by UWP
685- pub fn OpenProcessToken ( ProcessHandle : HANDLE ,
686- DesiredAccess : DWORD ,
687- TokenHandle : * mut HANDLE ) -> BOOL ;
688- pub fn GetUserProfileDirectoryW ( hToken: HANDLE ,
689- lpProfileDir: LPWSTR ,
690- lpcchSize: * mut DWORD ) -> BOOL ;
691- pub fn GetFileInformationByHandle ( hFile: HANDLE ,
692- lpFileInformation: LPBY_HANDLE_FILE_INFORMATION )
693- -> BOOL ;
694- pub fn SetHandleInformation ( hObject: HANDLE ,
695- dwMask: DWORD ,
696- dwFlags: DWORD ) -> BOOL ;
697- pub fn AddVectoredExceptionHandler ( FirstHandler : ULONG ,
698- VectoredHandler : PVECTORED_EXCEPTION_HANDLER )
699- -> LPVOID ;
700- pub fn CreateHardLinkW ( lpSymlinkFileName: LPCWSTR ,
701- lpTargetFileName: LPCWSTR ,
702- lpSecurityAttributes: LPSECURITY_ATTRIBUTES )
703- -> BOOL ;
608+ if #[ cfg( not( target_vendor = "uwp" ) ) ] {
609+ pub const EXCEPTION_CONTINUE_SEARCH : LONG = 0 ;
610+ pub const EXCEPTION_STACK_OVERFLOW : DWORD = 0xc00000fd ;
611+ pub const EXCEPTION_MAXIMUM_PARAMETERS : usize = 15 ;
612+
613+ #[ repr( C ) ]
614+ pub struct EXCEPTION_RECORD {
615+ pub ExceptionCode : DWORD ,
616+ pub ExceptionFlags : DWORD ,
617+ pub ExceptionRecord : * mut EXCEPTION_RECORD ,
618+ pub ExceptionAddress : LPVOID ,
619+ pub NumberParameters : DWORD ,
620+ pub ExceptionInformation : [ LPVOID ; EXCEPTION_MAXIMUM_PARAMETERS ]
621+ }
622+
623+ pub enum CONTEXT { }
624+
625+ #[ repr( C ) ]
626+ pub struct EXCEPTION_POINTERS {
627+ pub ExceptionRecord : * mut EXCEPTION_RECORD ,
628+ pub ContextRecord : * mut CONTEXT ,
629+ }
630+
631+ pub type PVECTORED_EXCEPTION_HANDLER = extern "system"
632+ fn ( ExceptionInfo : * mut EXCEPTION_POINTERS ) -> LONG ;
633+
634+ #[ repr( C ) ]
635+ #[ derive( Copy , Clone ) ]
636+ pub struct CONSOLE_READCONSOLE_CONTROL {
637+ pub nLength: ULONG ,
638+ pub nInitialChars: ULONG ,
639+ pub dwCtrlWakeupMask: ULONG ,
640+ pub dwControlKeyState: ULONG ,
641+ }
642+
643+ pub type PCONSOLE_READCONSOLE_CONTROL = * mut CONSOLE_READCONSOLE_CONTROL ;
644+
645+ #[ repr( C ) ]
646+ pub struct BY_HANDLE_FILE_INFORMATION {
647+ pub dwFileAttributes: DWORD ,
648+ pub ftCreationTime: FILETIME ,
649+ pub ftLastAccessTime: FILETIME ,
650+ pub ftLastWriteTime: FILETIME ,
651+ pub dwVolumeSerialNumber: DWORD ,
652+ pub nFileSizeHigh: DWORD ,
653+ pub nFileSizeLow: DWORD ,
654+ pub nNumberOfLinks: DWORD ,
655+ pub nFileIndexHigh: DWORD ,
656+ pub nFileIndexLow: DWORD ,
657+ }
658+
659+ pub type LPBY_HANDLE_FILE_INFORMATION = * mut BY_HANDLE_FILE_INFORMATION ;
660+ pub type LPCVOID = * const c_void;
661+
662+ pub const HANDLE_FLAG_INHERIT : DWORD = 0x00000001 ;
663+
664+ pub const TOKEN_READ : DWORD = 0x20008 ;
665+
666+ extern "system" {
667+ #[ link_name = "SystemFunction036" ]
668+ pub fn RtlGenRandom ( RandomBuffer : * mut u8 , RandomBufferLength : ULONG ) -> BOOLEAN ;
669+
670+ pub fn ReadConsoleW ( hConsoleInput: HANDLE ,
671+ lpBuffer: LPVOID ,
672+ nNumberOfCharsToRead: DWORD ,
673+ lpNumberOfCharsRead: LPDWORD ,
674+ pInputControl: PCONSOLE_READCONSOLE_CONTROL ) -> BOOL ;
675+
676+ pub fn WriteConsoleW ( hConsoleOutput: HANDLE ,
677+ lpBuffer: LPCVOID ,
678+ nNumberOfCharsToWrite: DWORD ,
679+ lpNumberOfCharsWritten: LPDWORD ,
680+ lpReserved: LPVOID ) -> BOOL ;
681+
682+ pub fn GetConsoleMode ( hConsoleHandle: HANDLE ,
683+ lpMode: LPDWORD ) -> BOOL ;
684+ // Allowed but unused by UWP
685+ pub fn OpenProcessToken ( ProcessHandle : HANDLE ,
686+ DesiredAccess : DWORD ,
687+ TokenHandle : * mut HANDLE ) -> BOOL ;
688+ pub fn GetUserProfileDirectoryW ( hToken: HANDLE ,
689+ lpProfileDir: LPWSTR ,
690+ lpcchSize: * mut DWORD ) -> BOOL ;
691+ pub fn GetFileInformationByHandle ( hFile: HANDLE ,
692+ lpFileInformation: LPBY_HANDLE_FILE_INFORMATION )
693+ -> BOOL ;
694+ pub fn SetHandleInformation ( hObject: HANDLE ,
695+ dwMask: DWORD ,
696+ dwFlags: DWORD ) -> BOOL ;
697+ pub fn AddVectoredExceptionHandler ( FirstHandler : ULONG ,
698+ VectoredHandler : PVECTORED_EXCEPTION_HANDLER )
699+ -> LPVOID ;
700+ pub fn CreateHardLinkW ( lpSymlinkFileName: LPCWSTR ,
701+ lpTargetFileName: LPCWSTR ,
702+ lpSecurityAttributes: LPSECURITY_ATTRIBUTES )
703+ -> BOOL ;
704+ }
704705 }
705706}
706- }
707707
708708// UWP specific functions & types
709709cfg_if:: cfg_if! {
710- if #[ cfg( target_vendor = "uwp" ) ] {
711- pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG : DWORD = 0x00000002 ;
712-
713- #[ repr( C ) ]
714- pub struct FILE_STANDARD_INFO {
715- pub AllocationSize : LARGE_INTEGER ,
716- pub EndOfFile : LARGE_INTEGER ,
717- pub NumberOfLink : DWORD ,
718- pub DeletePending : BOOLEAN ,
719- pub Directory : BOOLEAN ,
720- }
721-
722- extern "system" {
723- pub fn GetFileInformationByHandleEx ( hFile: HANDLE ,
724- fileInfoClass: FILE_INFO_BY_HANDLE_CLASS ,
725- lpFileInformation: LPVOID ,
726- dwBufferSize: DWORD ) -> BOOL ;
727- pub fn BCryptGenRandom ( hAlgorithm: LPVOID , pBuffer: * mut u8 ,
728- cbBuffer: ULONG , dwFlags: ULONG ) -> LONG ;
710+ if #[ cfg( target_vendor = "uwp" ) ] {
711+ pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG : DWORD = 0x00000002 ;
712+
713+ #[ repr( C ) ]
714+ pub struct FILE_STANDARD_INFO {
715+ pub AllocationSize : LARGE_INTEGER ,
716+ pub EndOfFile : LARGE_INTEGER ,
717+ pub NumberOfLink : DWORD ,
718+ pub DeletePending : BOOLEAN ,
719+ pub Directory : BOOLEAN ,
720+ }
721+
722+ extern "system" {
723+ pub fn GetFileInformationByHandleEx ( hFile: HANDLE ,
724+ fileInfoClass: FILE_INFO_BY_HANDLE_CLASS ,
725+ lpFileInformation: LPVOID ,
726+ dwBufferSize: DWORD ) -> BOOL ;
727+ pub fn BCryptGenRandom ( hAlgorithm: LPVOID , pBuffer: * mut u8 ,
728+ cbBuffer: ULONG , dwFlags: ULONG ) -> LONG ;
729+ }
729730 }
730731}
731- }
732732
733733// Shared between Desktop & UWP
734734extern "system" {
0 commit comments