c++windowscredential-providerswinlogonscreen-lock

How to set a button to open an application on windows login screen


This is my first question.

I would like to know if there is a way to set a button on the login screen to open a custom app.

I have already searched by Microsoft documentation then found about credential provider but I don't want to create an IU login. I just want to open an application like this:

enter image description here

enter image description here

This is what I want to achieve

If there is something that might help me it will be welcome.


Solution

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