I'm writing a credential provider that would correct user's password when the user is logging into Windows account and accidentally types password using wrong keyboard language settings (Ukrainian rather than latin for example). The same keys but different letters. Now I need a way to intercept the user-entered password and if it is entered wrongly to correct it. As a starting point I'm using the credentials provider from the Windows SDK. It works fine in a standard mode (like the default CP). But I cannot find where to obtain and correct the password entered by the user. I thought that HRESULT CSampleCredential::GetStringValue( DWORD dwFieldID, PWSTR* ppwz)
method is the right place to do it. To replace
hr = SHStrDupW(_rgFieldStrings[dwFieldID], ppwz);
string with
hr = SHStrDupW(ppwstrCorrected, ppwz);
Where ppwstrCorrected contains either the original password or the corrected one. But this does nothing. Credentials Provider continues to work as it did. I even tried to "break" my provider by making GetStringValue return some gibberish any time it is called. But the sample provider still works as a standard one. And yes, I've tried to log in via the sample provider and not the standard since they are easy to distinguish by bitmaps on their tiles. So where can I intercept the entered password that goes into Windows for checking?
I think it will be better to re-set corrected password back using
ICredentialProviderCredentialEvents::SetFieldString()
ICredentialProviderCredential::GetStringValue()
called by LogonUI to retrieve values of static text fields.