Adding Your Logo to Winlogon's Dialog
Caution: Use this code at your own risk!!
Restoring Your Windows (fat32)
Reboot your Window with the boot disk, copy msgina.dll to xgina.dll, and reboot again.
Details
For details about this program, please look for gina in the MS MSDN.
Installation
- Add the GinaDLL key to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows BT\CurrentVersion\Winlogon".
- The value of key GinaDLL is xgina.dll.
- Reboot.
Using the GINA Export Functions
The DLL must implement and export a set of functions that Winlogon will call to identify and authenticate the user. The following topics show examples of how to implement some of these functions. For a complete list of the functions that the GINA must implement and export, see the Winlogon and GINA references.
GINA Export Functions
A GINA DLL must export the following functions:
| Function | Description |
| WlxActivateUserShell | Activates the user shell program. |
| WlxDisplayLockedNotice | Allows the GINA DLL to display lock information. |
| WlxDisplaySASNotice | Winlogon calls this function when no user is logged on. |
| WlxDisplayStatusMessage | Winlogon calls this function with a status message to display. |
| WlxGetConsoleSwitchCredentials | Winlogon calls this function to read the currently logged-on user's credentials to transparently transfer them to a target session. |
| WlxGetStatusMessage | Winlogon calls this function to get the current status message. |
| WlxInitialize | Initializes the GINA DLL for a specific window station. |
| WlxIsLockOk | Verifies that the workstation lock is okay. |
| WlxIslogoffOk | Verifies that the logoff is okay. |
| WlxLoggedOnSAS | Winlogon calls this function when it receives a secure attention sequence (SAS) event while the user is logged on and the workstation is not locked. |
| WlxLoggedOutSAS | Winlogon calls this function when it receives an SAS event while no user is logged on. |
| WlxLogoff | Notifies the GINA DLL that a logoff operation was requested. |
| WlxNegotiate | Indicates whether the current version of Winlogon can be used with the GINA DLL. |
| WlxNetworkProviderLoad | Winlogon calls this function after it loads a network provider to collect valid authentication and identification information. |
| WlxRemoveStatusMessage | Winlogon calls this function to tell the GINA DLL to stop displaying the status message. |
| WlxScreensaverNotify | Allows the GINA to interact with the screen saver operation. |
| WlxShutdown | Winlogon calls this function just before shutting down, allowing the GINA to perform any shutdown tasks, such as ejecting a smart card from a reader. |
| WlxStartApplication | Winlogon calls this function when the system needs an application started in the user's context. |
| WlxWkstaLockedSAS | Winlogon calls this function when it receives an SAS while the workstation is locked. |
The WlxNegotiate function must be implemented by a replacement GINA DLL. This is the first call made by Winlogon to the GINA DLL.
Winlogon determines which dispatch table is passed to the GINA in subsequent calls to WlxInitialize.
HookWlxDialogBoxParam is called from WlxInitialize to hook your dialog box procedure by ((PWLX_DISPATCH_VERSION_X_X) pWinlogonFunctions)->WlxDialogBoxParam = MyWlxDialogBoxParam;.
Here is the redirected WlxDialogBoxParam() function by MyWlxDialogBoxparam function:
int WINAPI MyWlxDialogBoxParam (HANDLE hWlx,
HANDLE hInst,
LPWSTR lpszTemplate,
HWND hwndOwner,
DLGPROC dlgprc,
LPARAM dwInitParam)
{
//
// Sanity check.
//
assert(pfWlxDialogBoxParam != NULL);
//
// We only know MSGINA dialogs by identifiers.
//
if (!HIWORD(lpszTemplate))
{
//
// Hook appropriate dialog boxes as necessary.
//
#ifdef _DEBUG
DEBUG_MSG("WlxDialogBoxParam :%ld",(DWORD) lpszTemplate);
#endif
switch ((DWORD) lpszTemplate)
{
case IDD_WLXDIAPLAYSASNOTICE_DIALOG:
{
#ifdef _DEBUG
DEBUG_MSG("WlxDialogBoxParam : WLXDIAPLAYSASNOTICE_DIALOG");
#endif
pfWlxDisplaySASDlgProc = dlgprc;
return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
hwndOwner,
MyWlxDisplaySASDlgProc,
dwInitParam);
}
case 1500:
case IDD_WLXLOGGEDOUTSAS_DIALOG:
{
#ifdef _DEBUG
DEBUG_MSG("WlxDialogBoxParam : WLXLOGGEDOUTSAS_DIALOG");
#endif
pfWlxLoggedOutSASDlgProc = dlgprc;
return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
hwndOwner,
MyWlxLoggedOutSASDlgProc,
dwInitParam);
}
case 1900:
case IDD_WLXWKSTALOCKEDSAS_DIALOG:
{
#ifdef _DEBUG
DEBUG_MSG("WlxDialogBoxParam : WLXWKSTALOCKEDSAS_DIALOG");
#endif
pfWlxWkstaLockedSASDlgProc = dlgprc;
return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
hwndOwner,
MyWlxWkstaLockedSASDlgProc,
dwInitParam);
}
case 1950:
case IDD_WLXLOGGEDONSAS_DIALOG:
{
#ifdef _DEBUG
DEBUG_MSG("WlxDialogBoxParam : WLXLOGGEDONSAS_DIALOG");
#endif
pfWlxLoggedOnSASDlgProc = dlgprc;
return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
hwndOwner,
MyWlxLoggedOnSASDlgProc,
dwInitParam);
}
case 1700:
case IDD_CHANGE_PASSWORD_DIALOG:
{
#ifdef _DEBUG
DEBUG_MSG("WlxDialogBoxParam : CHANGE_PASSWORD_DIALOG");
#endif
pfChangePasswordDlgProc = dlgprc;
return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
hwndOwner,
MyChangePasswordDlgProc,
dwInitParam);
}
}
}
//
// The rest will not be redirected.
//
return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
hwndOwner, dlgprc, dwInitParam);
}
BOOL CALLBACK MyWlxLoggedOutSASDlgProc (HWND hwndDlg,
// handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam) // second message parameter
{
BOOL bResult;
//
// Sanity check.
//
assert(pfWlxLoggedOutSASDlgProc != NULL);
//
// Pass on to MSGINA first.
//
bResult = pfWlxLoggedOutSASDlgProc(hwndDlg, uMsg, wParam,
lParam);
#ifdef _DEBUG
DEBUG_MSG("Logout dlg msg id : %ld" , uMsg);
#endif
if (uMsg == WM_INITDIALOG)
{
DWORD dwIndex;
HWND hwndDomain;
NET_API_STATUS netstatus;
LPWKSTA_INFO_100 lpWkstaInfo;
#ifdef _DEBUG
DEBUG_MSG("Logout state init");
#endif
//
// Get local machine name.
//
netstatus = NetWkstaGetInfo(NULL, 100, (LPBYTE *)
&lpWkstaInfo);
if (netstatus != NERR_Success)
{
return bResult;
}
//
// Convert to ANSI.
//
wcstombs(g_szLocalMachineName,
lpWkstaInfo->wki100_computername,
sizeof(g_szLocalMachineName));
//
// and free the buffer.
//
NetApiBufferFree((LPVOID) lpWkstaInfo);
//
// Manipulate the domain combo box so that only some
// predetermined trusted domains are included in the list.
//
// In our case, we restrict logon to local machine only.
//
hwndDomain = GetDlgItem(hwndDlg, IDC_WLXLOGGEDOUTSAS_DOMAIN);
if (hwndDomain == NULL)
{
return bResult;
}
dwIndex = (DWORD) SendMessage(hwndDomain, CB_FINDSTRING,
0, (LPARAM) g_szLocalMachineName);
if (dwIndex != CB_ERR)
{
SendMessage(hwndDomain, CB_SETCURSEL, (WPARAM) dwIndex, 0);
EnableWindow(hwndDomain, FALSE);
}
}
else if ( uMsg == WM_PAINT)
{
RECT rect;
GetClientRect( hwndDlg , &rect);
rect.top = rect.bottom - 33;
DrawLogo(hwndDlg,IMAGE_FILE,rect.left , rect.top);
}
return bResult;
}

Comments
Nike Current Max 1 FB publicity, father a fervent color grain, the unheard of shoes
Posted by Geozyoceada on 04/25/2013 12:38amIn the summer in a tumbler interior the serene sprite seems to be a wholesome creme de la creme, but if the sprite "feet"? Will also supply you a set off, get a refreshing! This summer, Nike and Sprite [url=http://northernroofing.co.uk/roofins.cfm]nike free[/url] and his sneakers to a blend of exemplary snow spread of unripened, drained and dejected color schematic in the definitive Nike Superciliousness Max 1 shoes let it be known a drinks chill scent.[url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] Summer is the metre to choice a cleanly shoe, shoes should be a good choice. Qualifying series Nike Freshen Max HomeTurf megalopolis recently definitely comes up, this series in the first-rate Breath Max shoes to London, Paris and Milan the three paid encomium to the iconic metropolis of Europe, combined with the characteristics of the three cities, Sense Max 1 HYP,Air Max 90 HYP,Show Max 1 and shoes such as Air Max 95, combined [url=http://markwarren.org.uk/goodbuy.cfm]nike free run[/url] with the Hyperfuse, as well as a variation of materials, such as suede, Whether you hankering practicable or retro-everything.
ReplyumpYPV dr op Lfc GOCW he
Posted by rGWfCDWunD on 02/17/2013 08:47pmbuy cheap tramadol tramadol sr 100 mg side effects - buy tramadol online us pharmacy
Replygina and memory cards
Posted by maxsoft on 12/27/2005 03:09pmI'm tryin to start a my gina.dll to use a memory card (sle4442) to logon on win2000/xp systems, but I have not some good staff to begin. Can anyone help me with some basica code?I'm experienced on smart card and memory card and I can give you my help
ReplyProblem With SAS_SC_INSERT on Windows XP
Posted by Legacy on 12/29/2003 12:00amOriginally posted by: Stefano Valore
Hi ,
I've problem in the WlxInitialize export function,
try to set with the WlxSetOption the Smart Card SAS event and i could not get the SAS_SC_INSERT with Windows XP.
There is any work around?
Thanks very much
Stefano
-
Replysmart card
Posted by maxsoft on 12/27/2005 03:37pmSalve stefano, mi chiamo Massimiliano e sono un programmatore freelance. Scusa la sfacciatagine ma ho visto che hai implementato giC_ qualcosa a cui vorrei arrivare anch'io. Vorrei implementere una mia dll (gina.dll) per l'accesso a win2000/xp con l'ausilio di una memory card. Sto studiando pGina.dll e vorrei implementare la funzionalitC_ per il logon da memory card (sle4442: sulla quale memorizzo nome utente in chiaro e l'hash a 32 bit della password): la dll legge prima nome utente e l'hash della pasword dalla carta quindi tramite nome utente legge la password dal sistema, la confronta com l'MD5 della password ripescata su windows e se la funzione C( verificata si viene autenticati. Conosco bene le memory card e le smart card e le chiamate alle API della winscard.dll, ma non so da dove cominciare con Wlx. Sapresti darmi un aiuto per partire?Potrei fare altrettanto con l'uso delle smart card. SAluti, Max.
ReplyWlxDisplaySASNotice
Posted by Legacy on 12/07/2003 12:00amOriginally posted by: Agenor
Using the XGina.DLL on Windows 2000:
When I turn on the PC I get the following calls during the log on
WlxNegotiate
MyInitialize
WlxInitialize
WlxDisplayStatusMessage
WlxDisplayStatusMessage
WlxDisplayStatusMessage
WlxRemoveStatusMessage
WlxRemoveStatusMessage
WlxRemoveStatusMessage
WlxLoggedOutSAS
WlxActivateUserShell
I have expected the "WlxDisplaySASNotice" after "WlxInitialize".
But this call comes first time when I logoff the user (not Shutdown or Restart!).
Background for this: I need to implement a welcome message (i.e. "Press Ctrl+Alt+Del to logon").
Therefore I thought to do this in the "WlxDisplaySASNotice" function.
Can anyone tell me where to find my mistake? Maybe I misunderstand the standard GINA procedure.
Thanks
ReplyAgenor
Problem with Smart Cards on WIn XP
Posted by Legacy on 09/05/2003 12:00amOriginally posted by: bfadi
Hi ,
ReplyI just finished an Authentication Solution that use Smart Card to logon to windows. It work very well on win 2000 BUT in WinXP I could not get the SAS_SC_INSERT. And the dialog on the initial logon say "Press CAD" BUT in Win2K it sayes "Inser Smart Card OR Press CAD" !
Is there any Registry key that make WinXP use SmartCardLogon ?
Thanks very much
Bypassing LogonUser( ) in GINAL.DLL
Posted by Legacy on 07/10/2003 12:00amOriginally posted by: Jayesh Suthar
I have created Gina.dll and used it.
In WlxLoggedOutSAS() i am checking Pin number in one device and after verifing that number i am reding user name and password from the device and then doing login with LononUser() function. Its working fine.
Now i want to bypass LogonUser() function with inputs username and password. Means after verifing Pin number i don't want to doLogonUser() with username and password.
Any solution??
ReplyClick Event
Posted by Legacy on 07/02/2003 12:00amOriginally posted by: F. Rahman
XGina.dll is by far the best sample code!!!
Is it possible to add a Click Event on the Logo? To display a MessageBox?
Thanks.
ReplyGINA and windows services
Posted by Legacy on 05/16/2003 12:00amOriginally posted by: Irda
Dear All,
Probably this is the BEST online help that i can figure out at this moment, and hopefully it will assist me in getting to start on how essentially to set the start parameter for a fingerprint reader to system.
Shall i create a new windows service in order to ensure that the driver is loaded by the time the GINA is invoke?
Please assist me on this stumbled situation. THNX Q!
Irda
Replytest program
Posted by Legacy on 05/14/2003 12:00amOriginally posted by: pappu
Where is the code for test program
ReplyLoading, Please Wait ...