locked
Credential Provider QueryInterface and ICredentialProviderEvents RRS feed

  • Question

  • I am having an issue regarding a Win7 credential provider I am building. I must have missed something in the documentation because I am having a problem with exceptions occurring while trying to call CredentialsChanged on the ICredentialProviderEvents object.

    The code I am using is the following:

    if(_pcpeProviderEvents){

    ICredentialProviderEvents* event = _pcpeProviderEvents;

    ICredentialProviderEvents* objEvent;

    HRESULT hr;

    hr = event->QueryInterface(IID_ICredentialProviderEvents,(void **)&objEvent);

    if(SUCCEEDED ( hr )){

    objEvent->CredentialsChanged(_upAdviseContext);

    objEvent->Release();

    }

    }

    _pcpeProviderEvents is a pointer I set to the ICredentialProviderEvents pointer passed in during the ICredentialProviderEvents::Advise call and _upAdviseContext is UINT_PTR I set to the context pointer passed in on the same Advise call. I set both to NULL in the ICredentialProviderEvents::UnAdvise function. I initialize both to NULL in the ICredentialProvider constructor.

    The call to QueryInterface never returns and LogonUI.exe crashes.

    For the record, I did try a straight call of:

    pcpeProviderEvents->CredentialsChanged(_upAdviseContext);

    That didn't work either, but I didn't expect it to work.

    What a I doing wrong here?

    BTW – In the CPUS_CREDUI scenario the above code works just fine. In the CPUS_UNLOCK and CPUS_LOGON scenarios it doesn't, further it crashes my CredentialProvider and I have to restart in safe mode to clear the DLL from the registry. If anybody has any ideas on this subject I'd really like a hint about what to do next. All I am really trying to do is advise LogonUI.exe that the credential interface has changed. 

    I also tried A similar technique using the ICredentialProviderCredentialEvents (ICPCE) interface, but the time between the ICredentialProviderCredential::Advise and UnAdvise is quite limited. It seems the ICredentialProviderCredential::Advise is called only after a CredentialChanged called on the ICredentialProviderEvents interface and just after a credential is selected. Even so, the ICPCE calls to change the interface didn't seem to work anyway.

    So, how does one signal the interface has changed to LogonUI.exe? Nothing I'm doing seems to work.

    And, who named these things? A more compact notation would have been better.

    Thanks 

    Paul


    Greetings From Tralfamador.

    Wednesday, April 24, 2013 12:43 AM

All replies

  • Hi,

    Maybe you forget to add a ->AddRef in the Advice function.

    Here is my code :

    HRESULT CEIDProvider::Advise(
        ICredentialProviderEvents* pcpe,
        UINT_PTR upAdviseContext
        )
    {
        if (_pcpe != NULL)
        {
            _pcpe->Release();
        }
        _pcpe = pcpe;
        _pcpe->AddRef();
        _upAdviseContext = upAdviseContext;
        return S_OK;

    }

    and in a hardware callback function

    if (_pcpe != NULL)
       {
        _pcpe->CredentialsChanged(_upAdviseContext);
       }

    regards,

    vincent

    Thursday, May 9, 2013 4:56 PM