To open a custom app by using credentials provider there are two ways to do it.
1) Launch an app when trigger the event SetSelected from provider credential
HRESULT PasswordResetCredential::SetSelected(BOOL* pbAutoLogon)
{
*pbAutoLogon = FALSE;
system("start C:\\TestStartApp.exe");
return S_OK;
}
It may work fine but when the screen gets the wallpaper lock it will trigger automatically the event SetSelected. so the app will reopen again.
2) Create an CommanLink then launch the app in the event CommandLinkClicked
HRESULT PasswordResetCredential::CommandLinkClicked(DWORD dwFieldID)
{
HRESULT hr = S_OK;
if (dwFieldID < ARRAYSIZE(_rgCredProvFieldDescriptors) && (CPFT_COMMAND_LINK == _rgCredProvFieldDescriptors[dwFieldID].cpft)) {
system("start C:\\TestStartApp.exe");
}
return hr;
}
both works but it could be a huge risk for our security. majority of developers doesn't recommend to use the credential provider for this way. we are using a fake credential provider to open an app.