Credential Providers V2 Active for All users(Tiles)

1.1k Views Asked by At

I use sample code of "Credential Providers in Windows 10". I develop my code and change it very good.

But I have some problem with it:

It is not enable (Show tile) for all users in my windows. (Show for one user only)

enter image description here

I See this questions:

https://stackoverflow.com/a/31247811/3477587

Credential provider not displayed for all users (Other user included)

So I change my code but when use from my DLL win-login don't load and I must delete in in safe-mode to I can enter to my windows without Credential Providers.

I change my code as follow:

std::vector<CSamanCredential*>          _pCredential;    // SampleV2Credential

HRESULT CSamanProvider::GetCredentialAt(
    DWORD dwIndex,
    _Outptr_result_nullonfailure_ ICredentialProviderCredential** ppcpc)
{
    HRESULT hr = E_INVALIDARG;
    *ppcpc = nullptr;

    hr = _pCredential[dwIndex]->QueryInterface(IID_PPV_ARGS(ppcpc));

    return hr;
}


HRESULT CSamanProvider::GetCredentialCount(
    _Out_ DWORD* pdwCount,
    _Out_ DWORD* pdwDefault,
    _Out_ BOOL* pbAutoLogonWithDefault)
{
    *pdwDefault = CREDENTIAL_PROVIDER_NO_DEFAULT;
    *pbAutoLogonWithDefault = FALSE;

    if (_fRecreateEnumeratedCredentials)
    {
        _fRecreateEnumeratedCredentials = false;
        _ReleaseEnumeratedCredentials();
        _CreateEnumeratedCredentials();
    }

    DWORD dwUserCount = 0;
    HRESULT hr;

    if (_pCredProviderUserArray != nullptr) {
        hr = _pCredProviderUserArray->GetCount(&dwUserCount);
    }

    if ((dwUserCount == 0) || (IsOS(OS_DOMAINMEMBER) == 1)) {
        dwUserCount += 1;//display additional empty tile
    }
    *pdwCount = dwUserCount;

    return S_OK;
}


void CSamanProvider::_ReleaseEnumeratedCredentials()
{
    DWORD dwUserCount;
    _pCredProviderUserArray->GetCount(&dwUserCount);
    for (DWORD i = 0; i < dwUserCount; i++) {
        if (_pCredential[i] != nullptr)
        {
            _pCredential[i]->Release();
            _pCredential[i] = nullptr;
        }
    }
}

So I change other place in my code but I don't get result.

1

There are 1 best solutions below

0
On

You must follow instructions in the posts you mentioned.

As a indirect response to ICredentialProviderSetUserArray::SetUserArray you must prepare tile for each user in the supplied list.

Later your tiles will be asked for ICredentialProviderCredential2::GetUserSid.
There your tile must return one of SIDs from the list of previous step.

When I was implementing this logic had to redesign a huge part of my code to support this feature.