Displaying a V2 Credential Provider on 'Other user' tile

久未见 提交于 2020-01-01 09:46:13

问题


I am trying to write a custom Windows credential provider. I have downloaded the V2 credential provider sample and I am able build, register and use it.

For testing I have set up a hyper-v Windows 8.1 instance and joined a windows test domain.

However, the custom credential provider is only displayed on user tiles, not on the 'Other user' tile.

The documentation (Credential Provider Framework Changes in Windows 8.docx) provides a small snippet:

// Gets the SID of the user corresponding to the credential. HRESULT CSampleCredential::GetUserSid(__deref_out PWSTR *ppszSid)
{
    *ppszSid = nullptr;
    HRESULT hr = E_UNEXPECTED;

    // _pszUserSid is a private member of CSampleCredential
    if (_pszUserSid != nullptr)
    {
        // ppszSid will be freed by Logon UI
        hr = SHStrDupW(_pszUserSid, ppszSid);
    }
    // Return S_FALSE with a null SID in ppszSid for the
    // credential to be associated with an anonymous user tile.
    else if (_fIsOtherUserTile)
    {
        hr = S_FALSE;
    }

    return hr;
}

I am not sure where '_fIsOtherUserTile' is coming from. If I am ignoring this and just set 'hr' to S_FALSE the credential provider is still not showing up on the 'Other user' tile.

What am I missing? What do I have to change so I am able to use the credential provider on the 'Other user' tile?

Usually I do web projects so I have little experience with the Windows SDK.


回答1:


If you are using the example, it always initializes the SID in the Initialize function, so this code will always copy the SID into the return pointer of the function, regardless of what you do afterwards(_pszUserSid != nullptr is always true in the example). If you want to have this function and have your CP show under "Other user", then the body should be nothing more than:

    *ppszSid = nullptr;
    return S_FALSE;

If you don't want your tile to be tied to a user, you don't have to implement ICredentialProviderCredential2 at all, since it only adds this function. Without this interface implemented, your CP will always show under "Other user". Implementing ICredentialProviderCredential is enough for this.



来源:https://stackoverflow.com/questions/29603940/displaying-a-v2-credential-provider-on-other-user-tile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!