@@ -1020,77 +1020,87 @@ extern "system" {
10201020 pub fn HeapAlloc ( hHeap : HANDLE , dwFlags : DWORD , dwBytes : SIZE_T ) -> LPVOID ;
10211021 pub fn HeapReAlloc ( hHeap : HANDLE , dwFlags : DWORD , lpMem : LPVOID , dwBytes : SIZE_T ) -> LPVOID ;
10221022 pub fn HeapFree ( hHeap : HANDLE , dwFlags : DWORD , lpMem : LPVOID ) -> BOOL ;
1023+
1024+ // >= Vista / Server 2008
1025+ // https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createsymboliclinka
1026+ pub fn CreateSymbolicLinkW (
1027+ lpSymlinkFileName : LPCWSTR ,
1028+ lpTargetFileName : LPCWSTR ,
1029+ dwFlags : DWORD ,
1030+ ) -> BOOLEAN ;
1031+
1032+ // >= Vista / Server 2008
1033+ // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew
1034+ pub fn GetFinalPathNameByHandleW (
1035+ hFile : HANDLE ,
1036+ lpszFilePath : LPCWSTR ,
1037+ cchFilePath : DWORD ,
1038+ dwFlags : DWORD ,
1039+ ) -> DWORD ;
1040+
1041+ // >= Vista / Server 2003
1042+ // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadstackguarantee
1043+ #[ cfg( not( target_vendor = "uwp" ) ) ]
1044+ pub fn SetThreadStackGuarantee ( _size : * mut c_ulong ) -> BOOL ;
1045+
1046+ // >= Vista / Server 2008
1047+ // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfileinformationbyhandle
1048+ pub fn SetFileInformationByHandle (
1049+ hFile : HANDLE ,
1050+ FileInformationClass : FILE_INFO_BY_HANDLE_CLASS ,
1051+ lpFileInformation : LPVOID ,
1052+ dwBufferSize : DWORD ,
1053+ ) -> BOOL ;
1054+
1055+ // >= Vista / Server 2008
1056+ // https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleepconditionvariablesrw
1057+ pub fn SleepConditionVariableSRW (
1058+ ConditionVariable : PCONDITION_VARIABLE ,
1059+ SRWLock : PSRWLOCK ,
1060+ dwMilliseconds : DWORD ,
1061+ Flags : ULONG ,
1062+ ) -> BOOL ;
1063+
1064+ // >= Vista / Server 2008
1065+ // https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-wakeconditionvariable
1066+ pub fn WakeConditionVariable ( ConditionVariable : PCONDITION_VARIABLE ) ;
1067+ pub fn WakeAllConditionVariable ( ConditionVariable : PCONDITION_VARIABLE ) ;
1068+
1069+ // >= Vista / Server 2008
1070+ // https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-acquiresrwlockexclusive
1071+ pub fn AcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) ;
1072+ pub fn AcquireSRWLockShared ( SRWLock : PSRWLOCK ) ;
1073+ pub fn ReleaseSRWLockExclusive ( SRWLock : PSRWLOCK ) ;
1074+ pub fn ReleaseSRWLockShared ( SRWLock : PSRWLOCK ) ;
1075+ pub fn TryAcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
1076+ pub fn TryAcquireSRWLockShared ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
10231077}
10241078
10251079// Functions that aren't available on every version of Windows that we support,
10261080// but we still use them and just provide some form of a fallback implementation.
10271081compat_fn ! {
10281082 "kernel32" :
10291083
1030- pub fn CreateSymbolicLinkW ( _lpSymlinkFileName: LPCWSTR ,
1031- _lpTargetFileName: LPCWSTR ,
1032- _dwFlags: DWORD ) -> BOOLEAN {
1033- SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; 0
1034- }
1035- pub fn GetFinalPathNameByHandleW ( _hFile: HANDLE ,
1036- _lpszFilePath: LPCWSTR ,
1037- _cchFilePath: DWORD ,
1038- _dwFlags: DWORD ) -> DWORD {
1039- SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; 0
1040- }
1041- #[ cfg( not( target_vendor = "uwp" ) ) ]
1042- pub fn SetThreadStackGuarantee ( _size: * mut c_ulong) -> BOOL {
1043- SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; 0
1044- }
1084+ // >= Win10 1607
1085+ // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
10451086 pub fn SetThreadDescription ( hThread: HANDLE ,
10461087 lpThreadDescription: LPCWSTR ) -> HRESULT {
10471088 SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; E_NOTIMPL
10481089 }
1049- pub fn SetFileInformationByHandle ( _hFile: HANDLE ,
1050- _FileInformationClass: FILE_INFO_BY_HANDLE_CLASS ,
1051- _lpFileInformation: LPVOID ,
1052- _dwBufferSize: DWORD ) -> BOOL {
1053- SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; 0
1054- }
1090+
1091+ // >= Win8 / Server 2012
1092+ // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
10551093 pub fn GetSystemTimePreciseAsFileTime ( lpSystemTimeAsFileTime: LPFILETIME )
10561094 -> ( ) {
10571095 GetSystemTimeAsFileTime ( lpSystemTimeAsFileTime)
10581096 }
1059- pub fn SleepConditionVariableSRW ( ConditionVariable : PCONDITION_VARIABLE ,
1060- SRWLock : PSRWLOCK ,
1061- dwMilliseconds: DWORD ,
1062- Flags : ULONG ) -> BOOL {
1063- panic!( "condition variables not available" )
1064- }
1065- pub fn WakeConditionVariable ( ConditionVariable : PCONDITION_VARIABLE )
1066- -> ( ) {
1067- panic!( "condition variables not available" )
1068- }
1069- pub fn WakeAllConditionVariable ( ConditionVariable : PCONDITION_VARIABLE )
1070- -> ( ) {
1071- panic!( "condition variables not available" )
1072- }
1073- pub fn AcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) -> ( ) {
1074- panic!( "rwlocks not available" )
1075- }
1076- pub fn AcquireSRWLockShared ( SRWLock : PSRWLOCK ) -> ( ) {
1077- panic!( "rwlocks not available" )
1078- }
1079- pub fn ReleaseSRWLockExclusive ( SRWLock : PSRWLOCK ) -> ( ) {
1080- panic!( "rwlocks not available" )
1081- }
1082- pub fn ReleaseSRWLockShared ( SRWLock : PSRWLOCK ) -> ( ) {
1083- panic!( "rwlocks not available" )
1084- }
1085- pub fn TryAcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) -> BOOLEAN {
1086- panic!( "rwlocks not available" )
1087- }
1088- pub fn TryAcquireSRWLockShared ( SRWLock : PSRWLOCK ) -> BOOLEAN {
1089- panic!( "rwlocks not available" )
1090- }
10911097}
1098+
10921099compat_fn ! {
10931100 "api-ms-win-core-synch-l1-2-0" :
1101+
1102+ // >= Windows 8 / Server 2012
1103+ // https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress
10941104 pub fn WaitOnAddress (
10951105 Address : LPVOID ,
10961106 CompareAddress : LPVOID ,
0 commit comments