VirtualBox

Changeset 30049 in vbox for trunk/src


Ignore:
Timestamp:
Jun 7, 2010 6:36:26 AM (15 years ago)
Author:
vboxsync
Message:

VBoxServiceVMInfo-win.cpp: r=bird: Consistent error handling in VBoxServiceVMInfoWinWriteUsers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp

    r30013 r30049  
    3737
    3838
     39/*******************************************************************************
     40*   Structures and Typedefs                                                    *
     41*******************************************************************************/
    3942/** Structure for storing the looked up user information. */
    4043typedef struct
     
    4447    WCHAR wszLogonDomain[_MAX_PATH];
    4548} VBOXSERVICEVMINFOUSER, *PVBOXSERVICEVMINFOUSER;
     49
    4650/** Structure for the file information lookup. */
    4751typedef struct
     
    5054    char *pszFileName;
    5155} VBOXSERVICEVMINFOFILE, *PVBOXSERVICEVMINFOFILE;
     56
    5257/** Structure for process information lookup. */
    5358typedef struct
     
    6671void VBoxServiceVMInfoWinProcessesFree(PVBOXSERVICEVMINFOPROC paProcs);
    6772
    68 
    69 /*******************************************************************************
    70 *   Global Variables                                                           *
    71 *******************************************************************************/
    7273
    7374
     
    406407                                               &cbRet))
    407408                {
    408                     if(cbRet)
     409                    if (cbRet)
    409410                        iState = *pBuffer;
    410411                    VBoxServiceVerbose(3, "VMInfo/Users:  Account User=%ls, WTSConnectState=%d\n",
     
    449450 *
    450451 * @returns VBox status code.
    451  * @param   ppszUserList    Where to store the user list (separated by commas).  Must be
    452  *                          freed with RTStrFree().
     452 * @param   ppszUserList    Where to store the user list (separated by commas).
     453 *                          Must be freed with RTStrFree().
    453454 * @param   pcUsersInList   Where to store the number of users in the list.
    454455 */
     
    457458    PLUID       paSessions = NULL;
    458459    ULONG       cSession = 0;
    459     NTSTATUS    r = 0;
    460460
    461461    /* This function can report stale or orphaned interactive logon sessions
    462462       of already logged off users (especially in Windows 2000). */
    463     r = LsaEnumerateLogonSessions(&cSession, &paSessions);
     463    NTSTATUS rcNt = LsaEnumerateLogonSessions(&cSession, &paSessions);
    464464    VBoxServiceVerbose(3, "VMInfo/Users: Found %ld users\n", cSession);
    465     if (r != STATUS_SUCCESS)
    466     {
    467         VBoxServiceError("VMInfo/Users: LsaEnumerate failed with %lu\n", LsaNtStatusToWinError(r));
    468         return RTErrConvertFromWin32(LsaNtStatusToWinError(r));
     465    if (rcNt != STATUS_SUCCESS)
     466    {
     467        VBoxServiceError("VMInfo/Users: LsaEnumerate failed with %lu\n", LsaNtStatusToWinError(rcNt));
     468        return RTErrConvertFromWin32(LsaNtStatusToWinError(rcNt));
    469469    }
    470470
     
    484484                {
    485485                    rc = RTStrAAppend(ppszUserList, ",");
    486                     AssertRCReturn(rc, rc);
     486                    AssertRCBreakStmt(rc, RTStrFree(*ppszUserList));
    487487                }
    488488
     
    495495                    rc = RTStrAAppend(ppszUserList, pszTemp);
    496496                    RTMemFree(pszTemp);
    497                     AssertRCReturn(rc, rc);
    498497                }
    499498                else
    500                     RTStrAAppend(ppszUserList, "<string-convertion-error>");
     499                    rc = RTStrAAppend(ppszUserList, "<string-convertion-error>");
     500                AssertRCBreakStmt(rc, RTStrFree(*ppszUserList));
    501501            }
    502502        }
Note: See TracChangeset for help on using the changeset viewer.

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