VirtualBox

Changeset 50076 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Jan 14, 2014 8:49:41 AM (11 years ago)
Author:
vboxsync
Message:

VBoxCredProv: Added some more interface checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredentialProvider.cpp

    r50064 r50076  
    4242*   Global Variables                                                           *
    4343*******************************************************************************/
    44 static LONG g_cDllRefs  = 0;            /**< Global DLL reference count. */
    45 static HINSTANCE g_hDllInst = NULL;     /**< Global DLL hInstance. */
     44static LONG g_cDllRefs  = 0;                 /**< Global DLL reference count. */
     45static HINSTANCE g_hDllInst = NULL;          /**< Global DLL hInstance. */
    4646
    4747#ifdef VBOX_WITH_SENS
    4848static bool g_fSENSEnabled = false;
    49 static IEventSystem *g_pIEventSystem /**< Pointer to IEventSystem interface. */
     49static IEventSystem *g_pIEventSystem = NULL; /**< Pointer to IEventSystem interface. */
    5050
    5151/**
     
    182182    LONG m_cRefs;
    183183};
    184 static VBoxCredProvSensLogon *g_pISensLogon;
     184static VBoxCredProvSensLogon *g_pISensLogon = NULL;
    185185
    186186
     
    213213    }
    214214
    215     if (SUCCEEDED(hr))
     215    if (   SUCCEEDED(hr)
     216        && g_pIEventSystem)
    216217    {
    217218        IEventSubscription *pIEventSubscription;
     
    292293        VBoxCredProvVerbose(0, "VBoxCredentialProviderRegisterSENS: Error registering SENS provider, hr=%Rhrc\n", hr);
    293294        if (g_pIEventSystem)
     295        {
    294296            g_pIEventSystem->Release();
    295     }
    296 
     297            g_pIEventSystem = NULL;
     298        }
     299    }
     300
     301    VBoxCredProvVerbose(0, "VBoxCredentialProviderRegisterSENS: Returning hr=%Rhrc\n", hr);
    297302    return hr;
    298303}
     
    304309{
    305310    if (g_pIEventSystem)
     311    {
    306312        g_pIEventSystem->Release();
     313        g_pIEventSystem = NULL;
     314    }
    307315
    308316    /* We need to reconnecto to the event system because we can be called
    309317     * in a different context COM can't handle. */
    310     HRESULT hr = CoCreateInstance(CLSID_CEventSystem, 0, CLSCTX_SERVER, IID_IEventSystem, (void**)&g_pIEventSystem);
    311     if (SUCCEEDED(hr))
     318    HRESULT hr = CoCreateInstance(CLSID_CEventSystem, 0,
     319                                  CLSCTX_SERVER, IID_IEventSystem, (void**)&g_pIEventSystem);
     320    if (   SUCCEEDED(hr)
     321        && g_pIEventSystem)
    312322    {
    313323        VBoxCredProvVerbose(0, "VBoxCredentialProviderUnregisterSENS\n");
     
    346356
    347357        g_pIEventSystem->Release();
     358        g_pIEventSystem = NULL;
    348359    }
    349360
    350361    if (g_pISensLogon)
     362    {
    351363        delete g_pISensLogon;
     364        g_pISensLogon = NULL;
     365    }
     366
     367    VBoxCredProvVerbose(0, "VBoxCredentialProviderUnregisterSENS: Returning hr=%Rhrc\n", hr);
    352368}
    353369#endif /* VBOX_WITH_SENS */
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