VirtualBox

Changeset 38128 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jul 25, 2011 8:02:16 AM (13 years ago)
Author:
vboxsync
Message:

VBoxService/VMInfo-win: Added more logging for OOM situations.

File:
1 edited

Legend:

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

    r38087 r38128  
    341341    {
    342342        ULONG ulError = LsaNtStatusToWinError(rcNt);
    343         /* Skip session data which is not valid anymore because it may have been
    344          * already terminated. */
    345         if (ulError != ERROR_NO_SUCH_LOGON_SESSION)
    346             VBoxServiceError("VMInfo/Users: LsaGetLogonSessionData failed, LSA error %u\n", ulError);
     343        switch (ulError)
     344        {
     345            case ERROR_NOT_ENOUGH_MEMORY:
     346                /* If we don't have enough memory it's hard to judge whether the specified user
     347                 * is logged in or not, so just assume he/she's not. */
     348                VBoxServiceError("VMInfo/Users: Not enough memory to retrieve logon session data!\n");
     349                break;
     350
     351            case ERROR_NO_SUCH_LOGON_SESSION:
     352                /* Skip session data which is not valid anymore because it may have been
     353                 * already terminated. */
     354                break;
     355
     356            default:
     357                VBoxServiceError("VMInfo/Users: LsaGetLogonSessionData failed with error %ul\n", ulError);
     358                break;
     359        }
    347360        if (pSessionData)
    348361            LsaFreeReturnBuffer(pSessionData);
     
    497510    if (rcNt != STATUS_SUCCESS)
    498511    {
    499         ULONG rcWin = LsaNtStatusToWinError(rcNt);
    500 
    501         /* If we're about to shutdown when we were in the middle of enumerating the logon
    502            sessions, skip the error to not confuse the user with an unnecessary log message. */
    503         if (rcWin == ERROR_SHUTDOWN_IN_PROGRESS)
    504         {
    505             VBoxServiceVerbose(3, "VMInfo/Users: Shutdown in progress ...\n");
    506             rcWin = ERROR_SUCCESS;
    507         }
    508         else
    509             VBoxServiceError("VMInfo/Users: LsaEnumerate failed with %lu\n", rcWin);
    510         return RTErrConvertFromWin32(rcWin);
     512        ULONG ulError = LsaNtStatusToWinError(rcNt);
     513        switch (ulError)
     514        {
     515            case ERROR_NOT_ENOUGH_MEMORY:
     516                VBoxServiceError("VMInfo/Users: Not enough memory to enumerate logon sessions!\n");
     517                break;
     518
     519            case ERROR_SHUTDOWN_IN_PROGRESS:
     520                /* If we're about to shutdown when we were in the middle of enumerating the logon
     521                 * sessions, skip the error to not confuse the user with an unnecessary log message. */
     522                VBoxServiceVerbose(3, "VMInfo/Users: Shutdown in progress ...\n");
     523                ulError = ERROR_SUCCESS;
     524                break;
     525
     526            default:
     527                VBoxServiceError("VMInfo/Users: LsaEnumerate failed with error %ul\n", ulError);
     528                break;
     529        }
     530
     531        return RTErrConvertFromWin32(ulError);
    511532    }
    512533    VBoxServiceVerbose(3, "VMInfo/Users: Found %ld sessions\n", cSession);
     
    515536    DWORD                   cProcs;
    516537    int rc = VBoxServiceVMInfoWinProcessesEnumerate(&paProcs, &cProcs);
    517     if (RT_SUCCESS(rc))
     538    if (RT_FAILURE(rc))
     539    {
     540        if (rc == VERR_NO_MEMORY)
     541            VBoxServiceError("VMInfo/Users: Not enough memory to enumerate processes for a session!\n");
     542        else
     543            VBoxServiceError("VMInfo/Users: Failed to enumerate processes for a session, rc=%Rrc\n", rc);
     544    }
     545    else
    518546    {
    519547        *pcUsersInList = 0;
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