Changeset 29828 in vbox for trunk/src/VBox
- Timestamp:
- May 26, 2010 7:09:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r29807 r29828 745 745 pData = NULL; 746 746 } 747 } 748 749 int VBoxServiceControlExecCreateProcess(const char *pszExec, const char * const *papszArgs, RTENV hEnv, uint32_t fFlags, 750 PCRTHANDLE phStdIn, PCRTHANDLE phStdOut, PCRTHANDLE phStdErr, const char *pszAsUser, 751 const char *pszPassword, PRTPROCESS phProcess) 752 { 753 /* Get the predefined path of sysprep.exe (depending on Windows OS). */ 754 int rc = VINF_SUCCESS; 755 char szSysprepCmd[RTPATH_MAX] = "C:\\sysprep\\sysprep.exe"; 756 OSVERSIONINFOEX OSInfoEx; 757 RT_ZERO(OSInfoEx); 758 OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 759 if ( GetVersionEx((LPOSVERSIONINFO) &OSInfoEx) 760 && OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT 761 && OSInfoEx.dwMajorVersion >= 6 /* Vista or later */) 762 { 763 rc = RTEnvGetEx(RTENV_DEFAULT, "windir", szSysprepCmd, sizeof(szSysprepCmd), NULL); 764 if (RT_SUCCESS(rc)) 765 rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\sysprep\\sysprep.exe"); 766 } 767 768 /* 769 * If sysprep should be executed do this in the context of VBoxService, which 770 * (usually, if started by SCM) has administrator rights. Because of that a UI 771 * won't be shown (doesn't have a desktop). 772 */ 773 if ( RT_SUCCESS(rc) 774 && stricmp(pszExec, szSysprepCmd) == 0) 775 { 776 rc = RTProcCreateEx(pszExec, papszArgs, hEnv, 0 /* fFlags */, 777 phStdIn, phStdOut, phStdErr, NULL /* pszAsUser */, 778 NULL /* pszPassword */, phProcess); 779 } 780 else 781 { 782 /* Do normal execution. */ 783 rc = RTProcCreateEx(pszExec, papszArgs, hEnv, fFlags, 784 phStdIn, phStdOut, phStdErr, pszAsUser, 785 pszPassword, phProcess); 786 } 787 return rc; 747 788 } 748 789 … … 821 862 { 822 863 RTPROCESS hProcess; 823 rc = RTProcCreateEx(pData->pszCmd, pData->papszArgs, hEnv, RTPROC_FLAGS_SERVICE,824 phStdIn, phStdOut, phStdErr,825 pData->pszUser, pData->pszPassword,826 &hProcess);864 rc = VBoxServiceControlExecCreateProcess(pData->pszCmd, pData->papszArgs, hEnv, RTPROC_FLAGS_SERVICE, 865 phStdIn, phStdOut, phStdErr, 866 pData->pszUser, pData->pszPassword, 867 &hProcess); 827 868 if (RT_SUCCESS(rc)) 828 869 {
Note:
See TracChangeset
for help on using the changeset viewer.