Changeset 70215 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Dec 19, 2017 3:25:24 AM (7 years ago)
- Location:
- trunk/src/VBox/Runtime/r3/win
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
r69111 r70215 191 191 case kRTWinOSType_98SE: strcpy(szTmp, "Windows 98 (Second Edition)"); break; 192 192 case kRTWinOSType_ME: strcpy(szTmp, "Windows Me"); break; 193 case kRTWinOSType_NT310: strcpy(szTmp, "Windows NT 3.10"); break; 194 case kRTWinOSType_NT350: strcpy(szTmp, "Windows NT 3.50"); break; 193 195 case kRTWinOSType_NT351: strcpy(szTmp, "Windows NT 3.51"); break; 194 196 case kRTWinOSType_NT4: strcpy(szTmp, "Windows NT 4.0"); break; -
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r70199 r70215 222 222 if ( dwMajorVersion == 3 223 223 && dwMinorVersion == 1) 224 enmVer = kRTWinOSType_NT31; 224 enmVer = kRTWinOSType_NT310; 225 else if ( dwMajorVersion == 3 226 && dwMinorVersion == 50) 227 enmVer = kRTWinOSType_NT350; 225 228 else if ( dwMajorVersion == 3 226 229 && dwMinorVersion == 51) -
trunk/src/VBox/Runtime/r3/win/internal-r3-win.h
r70195 r70215 56 56 kRTWinOSType_9XLAST = 99, 57 57 kRTWinOSType_NTFIRST = 100, 58 kRTWinOSType_NT31 = kRTWinOSType_NTFIRST, 58 kRTWinOSType_NT310 = kRTWinOSType_NTFIRST, 59 kRTWinOSType_NT350, 59 60 kRTWinOSType_NT351, 60 61 kRTWinOSType_NT4, -
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r70195 r70215 141 141 static PFNCREATEPROCESSWITHLOGON g_pfnCreateProcessWithLogonW = NULL; 142 142 static PFNLSALOOKUPNAMES2 g_pfnLsaLookupNames2 = NULL; 143 static decltype(LogonUserW) *g_pfnLogonUserW = NULL; 144 static decltype(CreateProcessAsUserW) *g_pfnCreateProcessAsUserW = NULL; 145 static decltype(LsaNtStatusToWinError) *g_pfnLsaNtStatusToWinError = NULL; 143 146 /* userenv.dll: */ 144 147 static PFNCREATEENVIRONMENTBLOCK g_pfnCreateEnvironmentBlock = NULL; … … 345 348 { 346 349 rc = RTLdrGetSymbol(hMod, "CreateProcessWithLogonW", (void **)&g_pfnCreateProcessWithLogonW); 347 AssertStmt(RT_SUCCESS(rc), g_pfnCreateProcessWithLogonW = NULL);350 if (RT_FAILURE(rc)) { g_pfnCreateProcessWithLogonW = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT4); } 348 351 349 352 rc = RTLdrGetSymbol(hMod, "LsaLookupNames2", (void **)&g_pfnLsaLookupNames2); 350 AssertStmt(RT_SUCCESS(rc), g_pfnLsaLookupNames2 = NULL); 353 if (RT_FAILURE(rc)) { g_pfnLsaLookupNames2 = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT4); } 354 355 rc = RTLdrGetSymbol(hMod, "LogonUserW", (void **)&g_pfnLogonUserW); 356 if (RT_FAILURE(rc)) { g_pfnLogonUserW = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT350); } 357 358 rc = RTLdrGetSymbol(hMod, "CreateProcessAsUserW", (void **)&g_pfnCreateProcessAsUserW); 359 if (RT_FAILURE(rc)) { g_pfnCreateProcessAsUserW = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT350); } 360 361 rc = RTLdrGetSymbol(hMod, "LsaNtStatusToWinError", (void **)&g_pfnLsaNtStatusToWinError); 362 if (RT_FAILURE(rc)) { g_pfnLsaNtStatusToWinError = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT350); } 351 363 352 364 RTLdrClose(hMod); … … 360 372 { 361 373 rc = RTLdrGetSymbol(hMod, "LoadUserProfileW", (void **)&g_pfnLoadUserProfileW); 362 AssertStmt(RT_SUCCESS(rc), g_pfnLoadUserProfileW = NULL);374 if (RT_FAILURE(rc)) { g_pfnLoadUserProfileW = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT4); } 363 375 364 376 rc = RTLdrGetSymbol(hMod, "UnloadUserProfile", (void **)&g_pfnUnloadUserProfile); 365 AssertStmt(RT_SUCCESS(rc), g_pfnUnloadUserProfile = NULL);377 if (RT_FAILURE(rc)) { g_pfnUnloadUserProfile = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT4); } 366 378 367 379 rc = RTLdrGetSymbol(hMod, "CreateEnvironmentBlock", (void **)&g_pfnCreateEnvironmentBlock); 368 AssertStmt(RT_SUCCESS(rc), g_pfnCreateEnvironmentBlock = NULL);380 if (RT_FAILURE(rc)) { g_pfnCreateEnvironmentBlock = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT4); } 369 381 370 382 rc = RTLdrGetSymbol(hMod, "DestroyEnvironmentBlock", (void **)&g_pfnDestroyEnvironmentBlock); 371 AssertStmt(RT_SUCCESS(rc), g_pfnDestroyEnvironmentBlock = NULL);383 if (RT_FAILURE(rc)) { g_pfnDestroyEnvironmentBlock = NULL; Assert(g_enmWinVer <= kRTWinOSType_NT4); } 372 384 373 385 RTLdrClose(hMod); … … 662 674 AssertPtrReturn(pwszPassword, VERR_INVALID_POINTER); 663 675 AssertPtrReturn(phToken, VERR_INVALID_POINTER); 676 if (!g_pfnLogonUserW) 677 return VERR_NOT_SUPPORTED; 664 678 665 679 /* … … 672 686 */ 673 687 PCRTUTF16 pwszDomainNone = g_enmWinVer < kRTWinOSType_2K ? L"" /* NT4 and older */ : NULL /* Windows 2000 and up */; 674 BOOL fRc = LogonUserW(pwszUser,675 /* The domain always is passed as part of the UPN (user name). */676 pwszDomainNone,677 pwszPassword,678 LOGON32_LOGON_INTERACTIVE,679 LOGON32_PROVIDER_DEFAULT,680 phToken);688 BOOL fRc = g_pfnLogonUserW(pwszUser, 689 /* The domain always is passed as part of the UPN (user name). */ 690 pwszDomainNone, 691 pwszPassword, 692 LOGON32_LOGON_INTERACTIVE, 693 LOGON32_PROVIDER_DEFAULT, 694 phToken); 681 695 if (fRc) 682 696 return VINF_SUCCESS; … … 1530 1544 } 1531 1545 } 1546 else if (g_pfnLsaNtStatusToWinError) 1547 { 1548 dwErr = g_pfnLsaNtStatusToWinError(ntSts); 1549 LogRelFunc(("LsaLookupNames2 failed with: %ld\n", dwErr)); 1550 rc = dwErr != NO_ERROR ? RTErrConvertFromWin32(dwErr) : VERR_INTERNAL_ERROR_2; 1551 } 1532 1552 else 1533 1553 { 1534 dwErr = LsaNtStatusToWinError(ntSts); 1535 LogRelFunc(("LsaLookupNames2 failed with: %ld\n", dwErr)); 1536 rc = dwErr != NO_ERROR ? RTErrConvertFromWin32(dwErr) : VERR_INTERNAL_ERROR_2; 1554 LogRelFunc(("LsaLookupNames2 failed with: %#x\n", ntSts)); 1555 rc = RTErrConvertFromNtStatus(ntSts); 1537 1556 } 1538 1557 … … 1551 1570 LsaClose(lsahPolicy); 1552 1571 } 1572 else if (g_pfnLsaNtStatusToWinError) 1573 { 1574 dwErr = g_pfnLsaNtStatusToWinError(ntSts); 1575 LogRelFunc(("LsaOpenPolicy failed with: %ld\n", dwErr)); 1576 rc = dwErr != NO_ERROR ? RTErrConvertFromWin32(dwErr) : VERR_INTERNAL_ERROR_3; 1577 } 1553 1578 else 1554 1579 { 1555 dwErr = LsaNtStatusToWinError(ntSts); 1556 LogRelFunc(("LsaOpenPolicy failed with: %ld\n", dwErr)); 1557 rc = dwErr != NO_ERROR ? RTErrConvertFromWin32(dwErr) : VERR_INTERNAL_ERROR_3; 1580 LogRelFunc(("LsaOpenPolicy failed with: %#x\n", ntSts)); 1581 rc = RTErrConvertFromNtStatus(ntSts); 1558 1582 } 1559 1583 … … 1696 1720 * http://support.microsoft.com/kb/327618/ 1697 1721 */ 1698 fRc = CreateProcessAsUserW(hTokenToUse, 1699 *ppwszExec, 1700 pwszCmdLine, 1701 NULL, /* pProcessAttributes */ 1702 NULL, /* pThreadAttributes */ 1703 TRUE, /* fInheritHandles */ 1704 dwCreationFlags, 1705 /** @todo Warn about exceeding 8192 bytes 1706 * on XP and up. */ 1707 pwszzBlock, /* lpEnvironment */ 1708 NULL, /* pCurrentDirectory */ 1709 pStartupInfo, 1710 pProcInfo); 1711 if (fRc) 1712 rc = VINF_SUCCESS; 1722 if (g_pfnCreateProcessAsUserW) 1723 { 1724 fRc = g_pfnCreateProcessAsUserW(hTokenToUse, 1725 *ppwszExec, 1726 pwszCmdLine, 1727 NULL, /* pProcessAttributes */ 1728 NULL, /* pThreadAttributes */ 1729 TRUE, /* fInheritHandles */ 1730 dwCreationFlags, 1731 /** @todo Warn about exceeding 8192 bytes 1732 * on XP and up. */ 1733 pwszzBlock, /* lpEnvironment */ 1734 NULL, /* pCurrentDirectory */ 1735 pStartupInfo, 1736 pProcInfo); 1737 if (fRc) 1738 rc = VINF_SUCCESS; 1739 else 1740 { 1741 dwErr = GetLastError(); 1742 if (dwErr == ERROR_PRIVILEGE_NOT_HELD) 1743 rc = rtProcWinFigureWhichPrivilegeNotHeld2(); 1744 else 1745 rc = RTErrConvertFromWin32(dwErr); 1746 } 1747 } 1713 1748 else 1714 { 1715 dwErr = GetLastError(); 1716 if (dwErr == ERROR_PRIVILEGE_NOT_HELD) 1717 rc = rtProcWinFigureWhichPrivilegeNotHeld2(); 1718 else 1719 rc = RTErrConvertFromWin32(dwErr); 1720 } 1749 rc = VERR_NOT_SUPPORTED; 1721 1750 1722 1751 if (hOldWinStation)
Note:
See TracChangeset
for help on using the changeset viewer.