Running EXE application in GINA beofe login screen (Command line)

673 Views Asked by At

I have created a Credential Launcher for Windows 7 and was able to run Windows application after the Tile button click event, it was very easy.

I added a few registry settings and *pbAutoLogon = FALSE;.

However now i am now trying to do the same for Windows XP.

Which function I should target or how to achieve the same results ?

1

There are 1 best solutions below

0
ixe013 On

I see you tagged your question with "Gina", so I guess you know that Credential Providers do not exist on XP.

Your answer depends on when exactly you want to run that program, especially with regards to the secure attention sequence (SAS, or when a user press CTRL-ALT-Delete)

  • Before the SAS, use WlxDisplaySASNotice
  • After the SAS, use WlxLoggedOutSAS

Since you don't want to write a whole GINA yourself, you could use a custom Gina that wraps msgina.dll. Here is one I wrote, you can find the original I started from in the Platform SDK.

Using that approch, you get a chance to execute code just before or just after certain events, like running your program after a successful logon, something like :

int WINAPI WlxLoggedOutSAS(PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId, PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken, PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, PVOID * pProfile)
{
    int result;

    result =  pfWlxLoggedOutSAS(pWlxContext, dwSasType, pAuthenticationId, pLogonSid, pdwOptions, phToken, pMprNotifyInfo, pProfile);

    if (result == WLX_SAS_ACTION_LOGON)
    {
        //We have a successful logon, let's run our code
        run_my_custom_code();
    }

    return result;
}

There are some caveats, though :

  • The code cannot block. Winlogon will wait, but your users might not. Spanw a process and let it run.
  • Your program will be running with SYSTEM privileges, which is a security risk. Sandboxing your process could be hard. If you can't break out of it, don't assume nobody can...