Changeset 37447 in vbox for trunk/src/VBox
- Timestamp:
- Jun 14, 2011 3:46:03 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r37020 r37447 865 865 if (fFlags & RT_BIT(2)) 866 866 uProcFlags = RTPROC_FLAGS_HIDDEN; 867 /* Process Main flag "ExecuteProcessFlag_NoProfile". */ 868 if (fFlags & RT_BIT(3)) 869 uProcFlags = RTPROC_FLAGS_NO_PROFILE; 867 870 } 868 871 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r37375 r37447 140 140 { 141 141 GETOPTDEF_EXEC_IGNOREORPHANEDPROCESSES = 1000, 142 GETOPTDEF_EXEC_NO_PROFILE, 142 143 GETOPTDEF_EXEC_OUTPUTFORMAT, 143 144 GETOPTDEF_EXEC_DOS2UNIX, … … 443 444 { "--ignore-operhaned-processes", GETOPTDEF_EXEC_IGNOREORPHANEDPROCESSES, RTGETOPT_REQ_NOTHING }, 444 445 { "--image", 'i', RTGETOPT_REQ_STRING }, 446 { "--no-profile", GETOPTDEF_EXEC_NO_PROFILE, RTGETOPT_REQ_NOTHING }, 445 447 { "--password", 'p', RTGETOPT_REQ_STRING }, 446 448 { "--timeout", 't', RTGETOPT_REQ_UINT32 }, … … 502 504 case GETOPTDEF_EXEC_IGNOREORPHANEDPROCESSES: 503 505 fExecFlags |= ExecuteProcessFlag_IgnoreOrphanedProcesses; 506 break; 507 508 case GETOPTDEF_EXEC_NO_PROFILE: 509 fExecFlags |= ExecuteProcessFlag_NoProfile; 504 510 break; 505 511 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r37380 r37447 8147 8147 <enum 8148 8148 name="ExecuteProcessFlag" 8149 uuid=" 3258e8a5-ba0c-43d5-86b5-cf91405fddc0"8149 uuid="286ceb91-5f66-4c96-9845-4483e90e00ae" 8150 8150 > 8151 8151 <desc> … … 8165 8165 <const name="Hidden" value="4"> 8166 8166 <desc>Don't show the started process according to the guest OS guidelines.</desc> 8167 </const> 8168 <const name="NoProfile" value="8"> 8169 <desc>Do not use the user's profile data when exeuting a process.</desc> 8167 8170 </const> 8168 8171 </enum> -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r37375 r37447 1803 1803 if ( !(aFlags & ExecuteProcessFlag_IgnoreOrphanedProcesses) 1804 1804 && !(aFlags & ExecuteProcessFlag_WaitForProcessStartOnly) 1805 && !(aFlags & ExecuteProcessFlag_Hidden)) 1805 && !(aFlags & ExecuteProcessFlag_Hidden) 1806 && !(aFlags & ExecuteProcessFlag_NoProfile)) 1806 1807 { 1807 1808 if (pRC) -
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r37318 r37447 868 868 } 869 869 870 /* 871 * If we didn't find a matching VBoxTray, just use the token we got 872 * above from LogonUserW(). This enables us to at least run processes with 873 * desktop interaction without UI. 874 */ 875 phToken = fFound ? &hTokenUserDesktop : &hTokenLogon; 876 877 RTLDRMOD hUserenv; 878 int rc = RTLdrLoad("Userenv.dll", &hUserenv); 879 if (RT_SUCCESS(rc)) 870 /** @todo Hmm, this function already is too big! We need to split 871 * it up into several small parts. */ 872 873 /* If we got an error due to account lookup/loading above, don't 874 * continue here. */ 875 if (dwErr == NO_ERROR) 880 876 { 881 PFNLOADUSERPROFILEW pfnLoadUserProfileW; 882 rc = RTLdrGetSymbol(hUserenv, "LoadUserProfileW", (void**)&pfnLoadUserProfileW); 877 /* 878 * If we didn't find a matching VBoxTray, just use the token we got 879 * above from LogonUserW(). This enables us to at least run processes with 880 * desktop interaction without UI. 881 */ 882 phToken = fFound ? &hTokenUserDesktop : &hTokenLogon; 883 RTLDRMOD hUserenv; 884 int rc = RTLdrLoad("Userenv.dll", &hUserenv); 883 885 if (RT_SUCCESS(rc)) 884 886 { 885 PFN UNLOADUSERPROFILE pfnUnloadUserProfile;886 rc = RTLdrGetSymbol(hUserenv, " UnloadUserProfile", (void**)&pfnUnloadUserProfile);887 PFNLOADUSERPROFILEW pfnLoadUserProfileW; 888 rc = RTLdrGetSymbol(hUserenv, "LoadUserProfileW", (void**)&pfnLoadUserProfileW); 887 889 if (RT_SUCCESS(rc)) 888 890 { 889 PROFILEINFOW profileInfo; 890 ZeroMemory(&profileInfo, sizeof(profileInfo)); 891 profileInfo.dwSize = sizeof(profileInfo); 892 profileInfo.lpUserName = pwszUser; 893 profileInfo.dwFlags = PI_NOUI; /* Prevents the display of profile error messages. */ 894 895 if (pfnLoadUserProfileW(*phToken, &profileInfo)) 891 PFNUNLOADUSERPROFILE pfnUnloadUserProfile; 892 rc = RTLdrGetSymbol(hUserenv, "UnloadUserProfile", (void**)&pfnUnloadUserProfile); 893 if (RT_SUCCESS(rc)) 896 894 { 897 PRTUTF16 pwszzBlock; 898 rc = rtProcEnvironmentCreateFromToken(*phToken, hEnv, &pwszzBlock); 899 if (RT_SUCCESS(rc)) 895 PROFILEINFOW profileInfo; 896 if (!(fFlags & RTPROC_FLAGS_NO_PROFILE)) 900 897 { 901 /* 902 * Useful KB articles: 903 * http://support.microsoft.com/kb/165194/ 904 * http://support.microsoft.com/kb/184802/ 905 * http://support.microsoft.com/kb/327618/ 906 */ 907 fRc = CreateProcessAsUserW(*phToken, 908 pwszExec, 909 pwszCmdLine, 910 NULL, /* pProcessAttributes */ 911 NULL, /* pThreadAttributes */ 912 TRUE, /* fInheritHandles */ 913 dwCreationFlags, 914 pwszzBlock, 915 NULL, /* pCurrentDirectory */ 916 pStartupInfo, 917 pProcInfo); 918 if (fRc) 919 dwErr = NO_ERROR; 898 ZeroMemory(&profileInfo, sizeof(profileInfo)); 899 profileInfo.dwSize = sizeof(profileInfo); 900 profileInfo.lpUserName = pwszUser; 901 profileInfo.dwFlags = PI_NOUI; /* Prevents the display of profile error messages. */ 902 903 if (!pfnLoadUserProfileW(*phToken, &profileInfo)) 904 dwErr = GetLastError(); 905 } 906 907 if (dwErr == NO_ERROR) 908 { 909 PRTUTF16 pwszzBlock; 910 rc = rtProcEnvironmentCreateFromToken(*phToken, hEnv, &pwszzBlock); 911 if (RT_SUCCESS(rc)) 912 { 913 /* 914 * Useful KB articles: 915 * http://support.microsoft.com/kb/165194/ 916 * http://support.microsoft.com/kb/184802/ 917 * http://support.microsoft.com/kb/327618/ 918 */ 919 fRc = CreateProcessAsUserW(*phToken, 920 pwszExec, 921 pwszCmdLine, 922 NULL, /* pProcessAttributes */ 923 NULL, /* pThreadAttributes */ 924 TRUE, /* fInheritHandles */ 925 dwCreationFlags, 926 pwszzBlock, 927 NULL, /* pCurrentDirectory */ 928 pStartupInfo, 929 pProcInfo); 930 if (fRc) 931 dwErr = NO_ERROR; 932 else 933 dwErr = GetLastError(); /* CreateProcessAsUserW() failed. */ 934 rtProcEnvironmentDestroy(pwszzBlock); 935 } 920 936 else 921 dwErr = GetLastError(); /* CreateProcessAsUserW() failed. */ 922 rtProcEnvironmentDestroy(pwszzBlock); 937 dwErr = rc; 938 939 if (!(fFlags & RTPROC_FLAGS_NO_PROFILE)) 940 pfnUnloadUserProfile(*phToken, profileInfo.hProfile); 923 941 } 924 else925 dwErr = rc;926 pfnUnloadUserProfile(*phToken, profileInfo.hProfile);927 942 } 928 else929 dwErr = GetLastError(); /* LoadUserProfileW() failed. */930 943 } 931 }932 RTLdrClose(hUserenv);933 } 944 RTLdrClose(hUserenv); 945 } /* Userenv.dll found/loaded? */ 946 } /* Account lookup succeeded? */ 934 947 if (hTokenUserDesktop != INVALID_HANDLE_VALUE) 935 948 CloseHandle(hTokenUserDesktop);
Note:
See TracChangeset
for help on using the changeset viewer.