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.
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