Changeset 96476 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Aug 25, 2022 2:46:22 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 153324
- Location:
- trunk/src/VBox/Runtime/r3/win
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r96475 r96476 92 92 DECL_HIDDEN_DATA(decltype(GetHandleInformation) *) g_pfnGetHandleInformation = NULL; 93 93 DECL_HIDDEN_DATA(decltype(SetHandleInformation) *) g_pfnSetHandleInformation = NULL; 94 DECL_HIDDEN_DATA(decltype(IsDebuggerPresent) *) g_pfnIsDebuggerPresent = NULL; 95 DECL_HIDDEN_DATA(decltype(GetSystemTimeAsFileTime) *) g_pfnGetSystemTimeAsFileTime = NULL; 94 96 95 97 /** The native ntdll.dll handle. */ … … 566 568 g_pfnGetSystemWindowsDirectoryW = (PFNGETWINSYSDIR)GetProcAddress(g_hModKernel32, "GetWindowsDirectoryW"); 567 569 g_pfnSystemTimeToTzSpecificLocalTime = (decltype(SystemTimeToTzSpecificLocalTime) *)GetProcAddress(g_hModKernel32, "SystemTimeToTzSpecificLocalTime"); 568 g_pfnCreateWaitableTimerExW = (PFNCREATEWAITABLETIMEREX) GetProcAddress(g_hModKernel32, "CreateWaitableTimerExW"); 569 g_pfnGetHandleInformation = (decltype(GetHandleInformation) *)GetProcAddress(g_hModKernel32, "GetHandleInformation"); 570 g_pfnSetHandleInformation = (decltype(SetHandleInformation) *)GetProcAddress(g_hModKernel32, "SetHandleInformation"); 571 Assert(g_pfnSetHandleInformation || g_enmWinVer < kRTWinOSType_NT351); 572 Assert(g_pfnGetHandleInformation || g_enmWinVer < kRTWinOSType_NT351); 570 g_pfnCreateWaitableTimerExW = (PFNCREATEWAITABLETIMEREX) GetProcAddress(g_hModKernel32, "CreateWaitableTimerExW"); 571 g_pfnGetHandleInformation = (decltype(GetHandleInformation) *) GetProcAddress(g_hModKernel32, "GetHandleInformation"); 572 g_pfnSetHandleInformation = (decltype(SetHandleInformation) *) GetProcAddress(g_hModKernel32, "SetHandleInformation"); 573 g_pfnIsDebuggerPresent = (decltype(IsDebuggerPresent) *) GetProcAddress(g_hModKernel32, "IsDebuggerPresent"); 574 g_pfnGetSystemTimeAsFileTime = (decltype(GetSystemTimeAsFileTime) *)GetProcAddress(g_hModKernel32, "GetSystemTimeAsFileTime"); 575 Assert(g_pfnSetHandleInformation || g_enmWinVer < kRTWinOSType_NT351); 576 Assert(g_pfnGetHandleInformation || g_enmWinVer < kRTWinOSType_NT351); 577 Assert(g_pfnIsDebuggerPresent || g_enmWinVer < kRTWinOSType_NT4); 578 Assert(g_pfnGetSystemTimeAsFileTime || g_enmWinVer < kRTWinOSType_NT4); 573 579 574 580 /* -
trunk/src/VBox/Runtime/r3/win/internal-r3-win.h
r96475 r96476 116 116 extern DECL_HIDDEN_DATA(HMODULE) g_hModKernel32; 117 117 typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT); 118 extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW;118 extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW; 119 119 extern DECL_HIDDEN_DATA(decltype(SystemTimeToTzSpecificLocalTime) *) g_pfnSystemTimeToTzSpecificLocalTime; 120 120 typedef HANDLE (WINAPI *PFNCREATEWAITABLETIMEREX)(LPSECURITY_ATTRIBUTES, LPCWSTR, DWORD, DWORD); 121 extern DECL_HIDDEN_DATA(PFNCREATEWAITABLETIMEREX) g_pfnCreateWaitableTimerExW;121 extern DECL_HIDDEN_DATA(PFNCREATEWAITABLETIMEREX) g_pfnCreateWaitableTimerExW; 122 122 extern DECL_HIDDEN_DATA(decltype(GetHandleInformation) *) g_pfnGetHandleInformation; 123 123 extern DECL_HIDDEN_DATA(decltype(SetHandleInformation) *) g_pfnSetHandleInformation; 124 extern DECL_HIDDEN_DATA(decltype(IsDebuggerPresent) *) g_pfnIsDebuggerPresent; 125 extern DECL_HIDDEN_DATA(decltype(GetSystemTimeAsFileTime) *) g_pfnGetSystemTimeAsFileTime; 124 126 typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT); 125 extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW;127 extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW; 126 128 127 129 -
trunk/src/VBox/Runtime/r3/win/thread-win.cpp
r96407 r96476 195 195 DECLINLINE(void) rtThreadWinSetThreadName(PRTTHREADINT pThread, DWORD idThread) 196 196 { 197 if ( IsDebuggerPresent())197 if (g_pfnIsDebuggerPresent && g_pfnIsDebuggerPresent()) 198 198 rtThreadWinTellDebuggerThreadName(idThread, &pThread->szName[0]); 199 199 -
trunk/src/VBox/Runtime/r3/win/time-win.cpp
r96407 r96476 178 178 uint64_t u64; 179 179 AssertCompile(sizeof(u64) == sizeof(FILETIME)); 180 GetSystemTimeAsFileTime((LPFILETIME)&u64); 180 if (g_pfnGetSystemTimeAsFileTime) 181 g_pfnGetSystemTimeAsFileTime((LPFILETIME)&u64); 182 else 183 { 184 SYSTEMTIME SysTime = {0}; 185 GetSystemTime(&SysTime); 186 BOOL fRet = SystemTimeToFileTime(&SysTime, (LPFILETIME)&u64); 187 Assert(fRet); RT_NOREF(fRet); 188 } 181 189 return RTTimeSpecSetNtTime(pTime, u64); 190 182 191 } 183 192 … … 185 194 RTDECL(PRTTIMESPEC) RTTimeLocalNow(PRTTIMESPEC pTime) 186 195 { 187 uint64_t u64;188 AssertCompile(sizeof(u64) == sizeof(FILETIME));189 GetSystemTimeAsFileTime((LPFILETIME)&u64);190 196 uint64_t u64Local; 191 if (!FileTimeToLocalFileTime((FILETIME const *)&u64, (LPFILETIME)&u64Local)) 192 u64Local = u64; 197 if (g_pfnGetSystemTimeAsFileTime) 198 { 199 uint64_t u64; 200 AssertCompile(sizeof(u64) == sizeof(FILETIME)); 201 g_pfnGetSystemTimeAsFileTime((LPFILETIME)&u64); 202 if (!FileTimeToLocalFileTime((FILETIME const *)&u64, (LPFILETIME)&u64Local)) 203 u64Local = u64; 204 } 205 else 206 { 207 SYSTEMTIME SysTime = {0}; 208 GetLocalTime(&SysTime); 209 BOOL fRet = SystemTimeToFileTime(&SysTime, (LPFILETIME)&u64Local); 210 Assert(fRet); RT_NOREF(fRet); 211 } 193 212 return RTTimeSpecSetNtTime(pTime, u64Local); 194 213 }
Note:
See TracChangeset
for help on using the changeset viewer.