Changeset 46513 in vbox
- Timestamp:
- Jun 12, 2013 3:26:23 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r46506 r46513 1452 1452 /* Use a predefined sysprep path as default. */ 1453 1453 char szSysprepCmd[RTPATH_MAX] = "C:\\sysprep\\sysprep.exe"; 1454 /** @todo Check digital signature of file above before executing it? */ 1454 1455 1455 1456 /* 1456 * On Windows Vista (and up) sysprep is located in "system32\\ sysprep\\sysprep.exe",1457 * On Windows Vista (and up) sysprep is located in "system32\\Sysprep\\sysprep.exe", 1457 1458 * so detect the OS and use a different path. 1458 1459 */ … … 1460 1461 RT_ZERO(OSInfoEx); 1461 1462 OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 1462 if ( GetVersionEx((LPOSVERSIONINFO) &OSInfoEx) 1463 BOOL fRet = GetVersionEx((LPOSVERSIONINFO) &OSInfoEx); 1464 if ( fRet 1463 1465 && OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT 1464 1466 && OSInfoEx.dwMajorVersion >= 6 /* Vista or later */) 1465 1467 { 1466 1468 rc = RTEnvGetEx(RTENV_DEFAULT, "windir", szSysprepCmd, sizeof(szSysprepCmd), NULL); 1469 #ifndef RT_ARCH_AMD64 1470 /* Don't execute 64-bit sysprep from a 32-bit service host! */ 1471 char szSysWow64[RTPATH_MAX]; 1472 if (RTStrPrintf(szSysWow64, sizeof(szSysWow64), "%s", szSysprepCmd)) 1473 { 1474 rc = RTPathAppend(szSysWow64, sizeof(szSysWow64), "SysWow64"); 1475 AssertRC(rc); 1476 } 1477 if ( RT_SUCCESS(rc) 1478 && RTPathExists(szSysWow64)) 1479 VBoxServiceVerbose(0, "Warning: This service is 32-bit; could not execute sysprep on 64-bit OS!\n"); 1480 #endif 1467 1481 if (RT_SUCCESS(rc)) 1468 rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\sysprep\\sysprep.exe"); 1469 } 1482 rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\Sysprep\\sysprep.exe"); 1483 if (RT_SUCCESS(rc)) 1484 RTPathChangeToDosSlashes(szSysprepCmd, false /* No forcing necessary */); 1485 1486 if (RT_FAILURE(rc)) 1487 VBoxServiceError("Failed to detect sysrep location, rc=%Rrc\n", rc); 1488 } 1489 else if (!fRet) 1490 VBoxServiceError("Failed to retrieve OS information, last error=%ld\n", GetLastError()); 1491 1492 VBoxServiceVerbose(3, "Sysprep executable is: %s\n", szSysprepCmd); 1470 1493 1471 1494 if (RT_SUCCESS(rc)) … … 1476 1499 if (RT_SUCCESS(rc)) 1477 1500 { 1501 /* As we don't specify credentials for the sysprep process, it will 1502 * run under behalf of the account VBoxService was started under, most 1503 * likely local system. */ 1478 1504 rc = RTProcCreateEx(szSysprepCmd, papszArgsExp, hEnv, 0 /* fFlags */, 1479 1505 phStdIn, phStdOut, phStdErr, NULL /* pszAsUser */,
Note:
See TracChangeset
for help on using the changeset viewer.

