Changeset 70345 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Dec 26, 2017 3:51:56 PM (7 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r70336 r70345 1555 1555 r3/win/vcc100-ntdll-fakesA.asm \ 1556 1556 r3/win/vcc100-ws2_32-fakes.cpp \ 1557 r3/win/vcc100-ws2_32-fakesA.asm 1557 r3/win/vcc100-ws2_32-fakesA.asm \ 1558 r3/win/vcc100-shell32-fakes.cpp \ 1559 r3/win/vcc100-shell32-fakesA.asm \ 1558 1560 1559 1561 # -
trunk/src/VBox/Runtime/r3/init.cpp
r69970 r70345 292 292 unicode main function. So, we have to use CommandLineToArgvW to get 293 293 something similar. It should do the same conversion... :-) */ 294 /** @todo Replace this CommandLineToArgvW call with a call into 295 * getoptargv.cpp so we don't depend on shell32 and an API not present 296 * in NT 3.1. */ 294 297 int cArgsW = -1; 295 298 PWSTR *papwszArgs = NULL; -
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r70215 r70345 75 75 /** The previous unhandled exception filter. */ 76 76 static LPTOP_LEVEL_EXCEPTION_FILTER g_pfnUnhandledXcptFilter = NULL; 77 /** SystemTimeToTzSpecificLocalTime. */ 78 decltype(SystemTimeToTzSpecificLocalTime) *g_pfnSystemTimeToTzSpecificLocalTime = NULL; 77 79 78 80 /** The native ntdll.dll handle. */ … … 525 527 if (g_pfnGetSystemWindowsDirectoryW) 526 528 g_pfnGetSystemWindowsDirectoryW = (PFNGETWINSYSDIR)GetProcAddress(g_hModKernel32, "GetWindowsDirectoryW"); 529 g_pfnSystemTimeToTzSpecificLocalTime = (decltype(SystemTimeToTzSpecificLocalTime) *)GetProcAddress(g_hModKernel32, "SystemTimeToTzSpecificLocalTime"); 527 530 528 531 /* … … 531 534 g_pfnNtQueryFullAttributesFile = (PFNNTQUERYFULLATTRIBUTESFILE)GetProcAddress(g_hModNtDll, "NtQueryFullAttributesFile"); 532 535 g_pfnNtDuplicateToken = (PFNNTDUPLICATETOKEN)GetProcAddress( g_hModNtDll, "NtDuplicateToken"); 536 533 537 534 538 /* -
trunk/src/VBox/Runtime/r3/win/internal-r3-win.h
r70215 r70345 97 97 extern DECLHIDDEN(RTWINOSTYPE) g_enmWinVer; 98 98 #ifdef _WINDEF_ 99 extern DECLHIDDEN(HMODULE) g_hModKernel32; 99 extern DECLHIDDEN(OSVERSIONINFOEXW) g_WinOsInfoEx; 100 101 extern DECLHIDDEN(HMODULE) g_hModKernel32; 102 typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT); 103 extern DECLHIDDEN(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW; 104 extern decltype(SystemTimeToTzSpecificLocalTime) *g_pfnSystemTimeToTzSpecificLocalTime; 105 100 106 extern DECLHIDDEN(HMODULE) g_hModNtDll; 101 102 extern DECLHIDDEN(OSVERSIONINFOEXW) g_WinOsInfoEx;103 typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT);104 extern DECLHIDDEN(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW;105 107 typedef NTSTATUS (NTAPI *PFNNTQUERYFULLATTRIBUTESFILE)(struct _OBJECT_ATTRIBUTES *, struct _FILE_NETWORK_OPEN_INFORMATION *); 106 108 extern DECLHIDDEN(PFNNTQUERYFULLATTRIBUTESFILE) g_pfnNtQueryFullAttributesFile; 107 109 typedef NTSTATUS (NTAPI *PFNNTDUPLICATETOKEN)(HANDLE, ACCESS_MASK, struct _OBJECT_ATTRIBUTES *, BOOLEAN, TOKEN_TYPE, PHANDLE); 108 extern DECLHIDDEN(PFNNTDUPLICATETOKEN) g_pfnNtDuplicateToken;110 extern DECLHIDDEN(PFNNTDUPLICATETOKEN) g_pfnNtDuplicateToken; 109 111 110 112 extern DECLHIDDEN(HMODULE) g_hModWinSock; -
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r70215 r70345 144 144 static decltype(CreateProcessAsUserW) *g_pfnCreateProcessAsUserW = NULL; 145 145 static decltype(LsaNtStatusToWinError) *g_pfnLsaNtStatusToWinError = NULL; 146 /* user32.dll: */ 147 static decltype(OpenWindowStationW) *g_pfnOpenWindowStationW = NULL; 148 static decltype(CloseWindowStation) *g_pfnCloseWindowStation = NULL; 146 149 /* userenv.dll: */ 147 150 static PFNCREATEENVIRONMENTBLOCK g_pfnCreateEnvironmentBlock = NULL; … … 361 364 rc = RTLdrGetSymbol(hMod, "LsaNtStatusToWinError", (void **)&g_pfnLsaNtStatusToWinError); 362 365 if (RT_FAILURE(rc)) { g_pfnLsaNtStatusToWinError = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT350); } 366 367 RTLdrClose(hMod); 368 } 369 370 /* 371 * user32.dll APIs. 372 */ 373 rc = RTLdrLoadSystem("user32.dll", true /*fNoUnload*/, &hMod); 374 if (RT_SUCCESS(rc)) 375 { 376 rc = RTLdrGetSymbol(hMod, "OpenWindowStationW", (void **)&g_pfnOpenWindowStationW); 377 if (RT_FAILURE(rc)) { g_pfnOpenWindowStationW = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT310); } 378 379 rc = RTLdrGetSymbol(hMod, "CloseWindowStation", (void **)&g_pfnCloseWindowStation); 380 if (RT_FAILURE(rc)) { g_pfnCloseWindowStation = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT310); } 363 381 364 382 RTLdrClose(hMod); … … 1299 1317 /** @todo Always mess with the interactive one? Maybe it's not there... */ 1300 1318 *phWinStationOld = GetProcessWindowStation(); 1301 HWINSTA hWinStation0 = OpenWindowStationW(L"winsta0", FALSE /*fInherit*/, READ_CONTROL | WRITE_DAC); 1319 HWINSTA hWinStation0; 1320 if (g_pfnOpenWindowStationW) 1321 hWinStation0 = g_pfnOpenWindowStationW(L"winsta0", FALSE /*fInherit*/, READ_CONTROL | WRITE_DAC); 1322 else 1323 hWinStation0 = OpenWindowStationA("winsta0", FALSE /*fInherit*/, READ_CONTROL | WRITE_DAC); /* (for NT3.1) */ 1302 1324 if (hWinStation0) 1303 1325 { … … 1326 1348 else 1327 1349 AssertFailed(); 1328 CloseWindowStation(hWinStation0); 1350 if (g_pfnCloseWindowStation) 1351 g_pfnCloseWindowStation(hWinStation0); 1329 1352 } 1330 1353 else … … 1711 1734 { 1712 1735 HWINSTA hOldWinStation = NULL; 1713 if (!fFound && g_enmWinVer <= kRTWinOSType_NT4) /** @todo test newer versions... */ 1736 if ( !fFound 1737 && g_enmWinVer <= kRTWinOSType_NT4) /** @todo test newer versions... */ 1714 1738 rtProcWinStationPrep(hTokenToUse, pStartupInfo, &hOldWinStation); 1715 1739 -
trunk/src/VBox/Runtime/r3/win/time2-win.cpp
r69111 r70345 39 39 #include "internal/time.h" 40 40 41 #include "internal-r3-win.h" 41 42 42 43 … … 56 57 RTDECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec) 57 58 { 58 /*59 * FileTimeToLocalFileTime does not do the right thing, so we'll have60 * to convert to system time and SystemTimeToTzSpecificLocalTime instead.61 */62 59 RTTIMESPEC LocalTime; 63 SYSTEMTIME SystemTimeIn; 64 FILETIME FileTime; 65 if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTimeSpec, &FileTime), &SystemTimeIn)) 60 if (g_pfnSystemTimeToTzSpecificLocalTime) 66 61 { 67 SYSTEMTIME SystemTimeOut; 68 if (SystemTimeToTzSpecificLocalTime(NULL /* use current TZI */, 69 &SystemTimeIn, 70 &SystemTimeOut)) 62 /* 63 * FileTimeToLocalFileTime does not do the right thing, so we'll have 64 * to convert to system time and SystemTimeToTzSpecificLocalTime instead. 65 */ 66 SYSTEMTIME SystemTimeIn; 67 FILETIME FileTime; 68 if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTimeSpec, &FileTime), &SystemTimeIn)) 71 69 { 72 if (SystemTimeToFileTime(&SystemTimeOut, &FileTime)) 70 SYSTEMTIME SystemTimeOut; 71 if (g_pfnSystemTimeToTzSpecificLocalTime(NULL /* use current TZI */, &SystemTimeIn, &SystemTimeOut)) 73 72 { 74 RTTimeSpecSetNtFileTime(&LocalTime, &FileTime); 75 pTime = RTTimeExplode(pTime, &LocalTime); 76 if (pTime) 77 pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL; 78 return pTime; 73 if (SystemTimeToFileTime(&SystemTimeOut, &FileTime)) 74 { 75 RTTimeSpecSetNtFileTime(&LocalTime, &FileTime); 76 pTime = RTTimeExplode(pTime, &LocalTime); 77 if (pTime) 78 pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL; 79 return pTime; 80 } 79 81 } 80 82 } -
trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp
r70343 r70345 68 68 #define SetThreadAffinityMask Ignore_SetThreadAffinityMask 69 69 #define GetProcessAffinityMask Ignore_GetProcessAffinityMask 70 #define CommandLineToArgvW Ignore_CommandLineToArgvW 70 #define GetHandleInformation Ignore_GetHandleInformation 71 #define SetHandleInformation Ignore_SetHandleInformation 71 72 72 73 #include <iprt/nt/nt-and-windows.h> … … 100 101 #undef SetThreadAffinityMask 101 102 #undef GetProcessAffinityMask 102 #undef CommandLineToArgvW 103 #undef GetHandleInformation 104 #undef SetHandleInformation 103 105 104 106 … … 745 747 746 748 747 /** @todo This is actually in SHELL32. */ 748 DECL_KERNEL32(LPWSTR *) CommandLineToArgvW(LPCWSTR pwszCmdLine, int *pcArgs) 749 { 750 RESOLVE_ME(CommandLineToArgvW); 751 if (pfnApi) 752 return pfnApi(pwszCmdLine, pcArgs); 753 754 *pcArgs = 0; 755 return NULL; 749 DECL_KERNEL32(BOOL) GetHandleInformation(HANDLE hObject, DWORD *pfFlags) 750 { 751 RESOLVE_ME(GetHandleInformation); 752 if (pfnApi) 753 return pfnApi(hObject, pfFlags); 754 755 756 OBJECT_HANDLE_FLAG_INFORMATION Info = { 0, 0 }; 757 DWORD cbRet = sizeof(Info); 758 NTSTATUS rcNt = NtQueryObject(hObject, ObjectHandleFlagInformation, &Info, sizeof(Info), &cbRet); 759 if (NT_SUCCESS(rcNt)) 760 { 761 *pfFlags = (Info.Inherit ? HANDLE_FLAG_INHERIT : 0) 762 | (Info.ProtectFromClose ? HANDLE_FLAG_PROTECT_FROM_CLOSE : 0); 763 return TRUE; 764 } 765 *pfFlags = 0; 766 AssertMsg(rcNt == STATUS_INVALID_HANDLE, ("rcNt=%#x\n", rcNt)); 767 SetLastError(rcNt == STATUS_INVALID_HANDLE ? ERROR_INVALID_HANDLE : ERROR_INVALID_FUNCTION); 768 return FALSE; 769 } 770 771 772 DECL_KERNEL32(BOOL) SetHandleInformation(HANDLE hObject, DWORD fMask, DWORD fFlags) 773 { 774 RESOLVE_ME(SetHandleInformation); 775 if (pfnApi) 776 return pfnApi(hObject, fMask, fFlags); 777 778 SetLastError(ERROR_INVALID_FUNCTION); 779 return FALSE; 756 780 } 757 781 -
trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakesA.asm
r70341 r70345 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - Wrappers for kernel32 APIs mis isng NT4.3 ; IPRT - Wrappers for kernel32 APIs missing in NT4 and earlier. 4 4 ; 5 5 … … 77 77 MAKE_IMPORT_ENTRY SetThreadAffinityMask, 8 78 78 MAKE_IMPORT_ENTRY GetProcessAffinityMask, 12 79 MAKE_IMPORT_ENTRY CommandLineToArgvW, 8 ; Lazy bird: this lives in shell32. 79 MAKE_IMPORT_ENTRY GetHandleInformation, 8 80 MAKE_IMPORT_ENTRY SetHandleInformation, 12 80 81
Note:
See TracChangeset
for help on using the changeset viewer.