VirtualBox

Changeset 29807 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
May 26, 2010 10:13:20 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
62016
Message:

Guest Control/IPRT/VBoxManage: More gentle error messages, bug fix for process lookup with different user, correct return value of process start error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/process-win.cpp

    r29728 r29807  
    287287                                           (LPVOID)pTokenUser,
    288288                                           dwSize,
    289                                            &dwSize)
    290                     && IsValidSid(pTokenUser->User.Sid)
    291                     && EqualSid(pTokenUser->User.Sid, pSID))
     289                                           &dwSize))
    292290                {
    293                     if (DuplicateTokenEx(hTokenProc, MAXIMUM_ALLOWED,
    294                                          NULL, SecurityIdentification, TokenPrimary, phToken))
     291                    if (   IsValidSid(pTokenUser->User.Sid)
     292                        && EqualSid(pTokenUser->User.Sid, pSID))
    295293                    {
    296                         /*
    297                          * So we found the process instance which belongs to the user we want to
    298                          * to run our new process under. This duplicated token will be used for
    299                          * the actual CreateProcessAsUserW() call then.
    300                          */
    301                         fFound = TRUE;
     294                        if (DuplicateTokenEx(hTokenProc, MAXIMUM_ALLOWED,
     295                                             NULL, SecurityIdentification, TokenPrimary, phToken))
     296                        {
     297                            /*
     298                             * So we found the process instance which belongs to the user we want to
     299                             * to run our new process under. This duplicated token will be used for
     300                             * the actual CreateProcessAsUserW() call then.
     301                             */
     302                            fFound = TRUE;
     303                        }
     304                        else
     305                            dwErr = GetLastError();
    302306                    }
    303                     else
    304                         dwErr = GetLastError();
    305307                }
    306308                else
     
    320322    if (fFound)
    321323        return VINF_SUCCESS;
    322     return RTErrConvertFromWin32(dwErr);
     324    if (dwErr != NO_ERROR)
     325        return RTErrConvertFromWin32(dwErr);
     326    return VERR_NOT_FOUND; /* No error occured, but we didn't find the right process. */
    323327}
    324328
     
    649653                break;
    650654
    651             case ERROR_PASSWORD_EXPIRED:
    652             case ERROR_ACCOUNT_RESTRICTION:
     655            case ERROR_PASSWORD_EXPIRED:           
     656            case ERROR_ACCOUNT_RESTRICTION: /* See: http://support.microsoft.com/kb/303846/ */
    653657                rc = VERR_LOGON_FAILURE;
    654658                break;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette