@@ -1020,77 +1020,87 @@ extern "system" {
1020
1020
pub fn HeapAlloc ( hHeap : HANDLE , dwFlags : DWORD , dwBytes : SIZE_T ) -> LPVOID ;
1021
1021
pub fn HeapReAlloc ( hHeap : HANDLE , dwFlags : DWORD , lpMem : LPVOID , dwBytes : SIZE_T ) -> LPVOID ;
1022
1022
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 ;
1023
1077
}
1024
1078
1025
1079
// Functions that aren't available on every version of Windows that we support,
1026
1080
// but we still use them and just provide some form of a fallback implementation.
1027
1081
compat_fn ! {
1028
1082
"kernel32" :
1029
1083
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
1045
1086
pub fn SetThreadDescription ( hThread: HANDLE ,
1046
1087
lpThreadDescription: LPCWSTR ) -> HRESULT {
1047
1088
SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ; E_NOTIMPL
1048
1089
}
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
1055
1093
pub fn GetSystemTimePreciseAsFileTime ( lpSystemTimeAsFileTime: LPFILETIME )
1056
1094
-> ( ) {
1057
1095
GetSystemTimeAsFileTime ( lpSystemTimeAsFileTime)
1058
1096
}
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
- }
1091
1097
}
1098
+
1092
1099
compat_fn ! {
1093
1100
"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
1094
1104
pub fn WaitOnAddress (
1095
1105
Address : LPVOID ,
1096
1106
CompareAddress : LPVOID ,
0 commit comments