i built a V2 credential provider sample and registe it to windows10, the provider can be load and displayed in unlock screen after i click "Sign-in options", but the provider can not be displayed in power-on/switch-user logon screen. i put some log in the code like this
HRESULT CSampleProvider::_EnumerateCredentials()
{
DebugTrace(__FILEW__, __LINE__, _T("enter _EnumerateCredentials"));
HRESULT hr = E_UNEXPECTED;
if (_pCredProviderUserArray != nullptr)
{
DWORD dwUserCount;
_pCredProviderUserArray->GetCount(&dwUserCount);
**DebugTrace(__FILEW__, __LINE__, _T(" dwUserCount = %d"), dwUserCount);**
if (dwUserCount > 0)
{
ICredentialProviderUser *pCredUser;
hr = _pCredProviderUserArray->GetAt(0, &pCredUser);
if (SUCCEEDED(hr))
{
_pCredential = new(std::nothrow) CSampleCredential();
if (_pCredential != nullptr)
{
hr = _pCredential->Initialize(_cpus, s_rgCredProvFieldDescriptors, s_rgFieldStatePairs, pCredUser);
if (FAILED(hr))
{
_pCredential->Release();
_pCredential = nullptr;
}
}
else
{
hr = E_OUTOFMEMORY;
}
pCredUser->Release();
}
}
}
return hr;
}
turns out dwUserCount is 0 in power-on/switch-user logon screen, so that the provider will not initialize any credential.
My question is, how to make the provider initialize its credentials without ICredentialProviderUser
object?
thanks in advance.
The exact answer - noway.
New Windows Logon
scenario assumes that there are some users that can login into computer and have an option to choose which provider use for login.
Each User's tile
will have a set of icons from Credential Providers registered on computer.
Your provider must accept a list of users that can be logged on the computer and make a decision to display or not it's icon next to user's tile.
The only possible way in this situation is to implement a default tile behaviour, as described in v1 credential provider guide.