VirtualBox

Ignore:
Timestamp:
Sep 25, 2008 12:13:12 PM (16 years ago)
Author:
vboxsync
Message:

VBoxService: Implemented temporary solution for getting rid of invalid guest properties when the VM goes down (reboot/shutdown).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxService/VBoxVMInfo.cpp

    r11982 r12724  
    2323{
    2424    int rc = VINF_SUCCESS;
    25     if((!a_pCtx) || (!a_pszKey))
    26        return VERR_INVALID_PARAMETER;
     25    Assert(a_pCtx);
     26    Assert(a_pszKey);
     27    /* Not checking for a valid a_pszValue is intentional. */
    2728
    2829    char szKeyTemp [_MAX_PATH] = {0};
     
    5960}
    6061
    61 int vboxVMInfoWritePropInt(VBOXINFORMATIONCONTEXT* a_pCtx, char *a_pszKey, int a_iValue )
     62int vboxVMInfoWritePropInt(VBOXINFORMATIONCONTEXT* a_pCtx, char *a_pszKey, int a_iValue)
    6263{
     64    Assert(a_pCtx);
     65    Assert(a_pszKey);
     66
    6367    char szBuffer[_MAX_PATH] = {0}; /** @todo r=bird: this is a bit excessive (the size) */
    6468    itoa(a_iValue, szBuffer, 10);
     
    6973int vboxVMInfoInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread)
    7074{
     75    Assert(pEnv);
     76    Assert(ppInstance);
     77
    7178    Log(("vboxVMInfoThread: Init.\n"));
    7279
     
    100107void vboxVMInfoDestroy(const VBOXSERVICEENV *pEnv, void *pInstance)
    101108{
     109    Assert(pEnv);
     110
    102111    VBOXINFORMATIONCONTEXT *pCtx = (VBOXINFORMATIONCONTEXT *)pInstance;
     112    Assert(pCtx);
    103113
     114    /* @todo Temporary solution: Zap all values which are not valid anymore when VM goes down (reboot/shutdown).
     115     * Needs to be replaced with "temporary properties" later. */
     116    char szPropPath [_MAX_PATH+1] = {0};
     117    char*pPtr = &szPropPath[0];
     118
     119    vboxVMInfoWriteProp(pCtx, "GuestInfo/OS/LoggedInUsersList", "");
     120    vboxVMInfoWritePropInt(pCtx, "GuestInfo/OS/LoggedInUsers", 0);
     121
     122    RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/*");
     123    VbglR3GuestPropDelTree(pCtx->iInfoSvcClientID, &pPtr, 1);
     124    vboxVMInfoWritePropInt(pCtx, "GuestInfo/Net/Count", 0);
     125
     126    /* Disconnect from guest properties API. */
    104127    int rc = VbglR3GuestPropDisconnect(pCtx->iInfoSvcClientID);
    105128    if (!RT_SUCCESS(rc))
     
    112135unsigned __stdcall vboxVMInfoThread(void *pInstance)
    113136{
     137    Assert(pInstance);
     138
    114139    VBOXINFORMATIONCONTEXT *pCtx = (VBOXINFORMATIONCONTEXT *)pInstance;
    115140    bool fTerminate = false;
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