|
在Windows NT6.0 (Vista)中, 已经使用了新的LogUI来替代 Windows 2000/XP/2003中的GINA模块. 下面是我参照M$的SDK, 改出来的GINA模块, 支持Windows 2000/XP/2003.
 GinaHook.h
//-------------------------------------------------------------------------
// Create :2007-5-27 17:41 王嘉
// Memo :替换MSGINA.dll
//-------------------------------------------------------------------------

//
// Function prototypes for the GINA interface.
//

typedef BOOL (WINAPI * PFWLXNEGOTIATE) (DWORD, DWORD *);
typedef BOOL (WINAPI * PFWLXINITIALIZE) (LPWSTR, HANDLE, PVOID, PVOID, PVOID *);
typedef VOID (WINAPI * PFWLXDISPLAYSASNOTICE) (PVOID);
typedef int (WINAPI * PFWLXLOGGEDOUTSAS) (PVOID, DWORD, PLUID, PSID, PDWORD,
PHANDLE, PWLX_MPR_NOTIFY_INFO,
PVOID *);
typedef BOOL (WINAPI * PFWLXACTIVATEUSERSHELL) (PVOID, PWSTR, PWSTR, PVOID);
typedef int (WINAPI * PFWLXLOGGEDONSAS) (PVOID, DWORD, PVOID);
typedef VOID (WINAPI * PFWLXDISPLAYLOCKEDNOTICE) (PVOID);
typedef int (WINAPI * PFWLXWKSTALOCKEDSAS) (PVOID, DWORD);
typedef BOOL (WINAPI * PFWLXISLOCKOK) (PVOID);
typedef BOOL (WINAPI * PFWLXISLOGOFFOK) (PVOID);
typedef VOID (WINAPI * PFWLXLOGOFF) (PVOID);
typedef VOID (WINAPI * PFWLXSHUTDOWN) (PVOID, DWORD);

//
// New for version 1.1
//

typedef BOOL (WINAPI * PFWLXSCREENSAVERNOTIFY) (PVOID, BOOL *);
typedef BOOL (WINAPI * PFWLXSTARTAPPLICATION) (PVOID, PWSTR, PVOID, PWSTR);

//
// New for version 1.3
//

typedef BOOL (WINAPI * PFWLXNETWORKPROVIDERLOAD) (PVOID, PWLX_MPR_NOTIFY_INFO);
typedef BOOL (WINAPI * PFWLXDISPLAYSTATUSMESSAGE) (PVOID, HDESK, DWORD, PWSTR, PWSTR);
typedef BOOL (WINAPI * PFWLXGETSTATUSMESSAGE) (PVOID, DWORD *, PWSTR, DWORD);
typedef BOOL (WINAPI * PFWLXREMOVESTATUSMESSAGE) (PVOID);

//
// New for version 1.4
//
typedef BOOL (WINAPI * PFWLXSHELLSHUTDOWNDIALOG) (HWND, WCHAR *, BOOL); // ShellShutdownDialog
typedef VOID (WINAPI * PFWLXDISCONNECTNOTIFY) (PVOID); // WlxDisconnectNotify
typedef BOOL (WINAPI * PFWLXGETCONSOLESWITCHCREDENTIALS) (PVOID, PVOID);// WlxGetConsoleSwitchCredentials
typedef VOID (WINAPI * PFWLXRECONNECTNOTIFY) (PVOID); // WlxReconn
可以看出,WinNT5.2的 MSGINA.dll的导出函数比以往版本有所增加.
 GinaHook.cpp
//-------------------------------------------------------------------------
// Create :2007-5-27 17:41 王嘉
// Memo :替换MSGINA.dll
//-------------------------------------------------------------------------
#pragma once

#define _WIN32_WINNT 0x0400
#include <afx.h>
#include <afxwin.h>
#include <WinWlx.h>
#include <tchar.h>
#include <Import.Win32.Infrastructure.h>
#include "Ginahook.h"
#include "./resource.h"



//
// Winlogon function dispatch table.
//
static PVOID g_pWinlogon = NULL;
static DWORD g_dwVersion = WLX_VERSION_1_4;
static HANDLE g_hWlx = NULL;
static HANDLE g_hFile = INVALID_HANDLE_VALUE;
static HINSTANCE g_hInstance = NULL;

static PWLX_DIALOG_BOX g_pWlxDialogBox = NULL;
static PWLX_MESSAGE_BOX g_pWlxMessageBox = NULL;
static PVOID g_pContext = NULL;

typedef DWORD (_stdcall *PFN_ThemeWaitForServiceReady)(DWORD dwTimeout);
typedef BOOL (_stdcall *PFN_ThemeWatchForStart)(void);




//
// Location of the real MSGINA.
//

#define REALGINA_PATH TEXT("MSGINA.DLL")
#define GINASTUB_VERSION (WLX_VERSION_1_4) // Highest version supported at
// this point. Remember to modify
// this as support for newer version
// is added to this program.


//
// Pointers to the real MSGINA functions.
//

static PFWLXNEGOTIATE pfWlxNegotiate;
static PFWLXINITIALIZE pfWlxInitialize;
static PFWLXDISPLAYSASNOTICE pfWlxDisplaySASNotice;
static PFWLXLOGGEDOUTSAS pfWlxLoggedOutSAS;
static PFWLXACTIVATEUSERSHELL pfWlxActivateUserShell;
static PFWLXLOGGEDONSAS pfWlxLoggedOnSAS;
static PFWLXDISPLAYLOCKEDNOTICE pfWlxDisplayLockedNotice;
static PFWLXWKSTALOCKEDSAS pfWlxWkstaLockedSAS;
static PFWLXISLOCKOK pfWlxIsLockOk;
static PFWLXISLOGOFFOK pfWlxIsLogoffOk;
static PFWLXLOGOFF pfWlxLogoff;
static PFWLXSHUTDOWN pfWlxShutdown;

//
// New for version 1.1
//

static PFWLXSTARTAPPLICATION pfWlxStartApplication = NULL;
static PFWLXSCREENSAVERNOTIFY pfWlxScreenSaverNotify = NULL;

//
// New for version 1.2 - No new GINA interface was added, except
// a new function in the dispatch table.
//

//
// New for version 1.3
//

static PFWLXNETWORKPROVIDERLOAD pfWlxNetworkProviderLoad = NULL;
static PFWLXDISPLAYSTATUSMESSAGE pfWlxDisplayStatusMessage = NULL;
static PFWLXGETSTATUSMESSAGE pfWlxGetStatusMessage = NULL;
static PFWLXREMOVESTATUSMESSAGE pfWlxRemoveStatusMessage = NULL;


//
// New for version 1.4
//

static PFWLXSHELLSHUTDOWNDIALOG pfShellShutdownDialog = NULL;
static PFWLXDISCONNECTNOTIFY pfWlxDisconnectNotify = NULL;
static PFWLXGETCONSOLESWITCHCREDENTIALS pfWlxGetConsoleSwitchCredentials = NULL;
static PFWLXRECONNECTNOTIFY pfWlxReconnectNotify = NULL;



//////////////////////////////////////////////////////////////////////////


//-------------------------------------------------------------------------
// Function Name :AppendLog
// Parameter(s) :
// Return :
// Create :2007-5-28 10:36 王嘉
// Memo :添加日志
//-------------------------------------------------------------------------
void AppendLog(LPCTSTR lpszInfo)
  {
if (g_hFile != INVALID_HANDLE_VALUE)
 {
DWORD dwWritten = 0;
WriteFile( g_hFile
, lpszInfo
, _tcslen(lpszInfo) * sizeof(TCHAR)
, &dwWritten
, NULL
);
}
}




//-------------------------------------------------------------------------
// Function Name :LoginDlgProc
// Parameter(s) :
// Return :
// Create :2007-5-28 10:36 王嘉
// Memo :登录对话框
//-------------------------------------------------------------------------
BOOL CALLBACK LoginDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
  {
switch (message)
 {

case WM_INITDIALOG:
 {
CString str;
CIni ini(Generic::GetModulePath(::GetModuleHandle(_T("Gina.dll"))) +_T("user.ini"));
ini.SetSection(_T("GENERIC"));
str=ini.GetValue(_T("Username"),_T("Unknown"));
SetWindowText( GetDlgItem( hwndDlg, IDC_EDIT_USERNAME)
, str
);

SetForegroundWindow(hwndDlg);
SetActiveWindow(hwndDlg);
SetFocus( GetDlgItem( hwndDlg, IDC_EDIT_PWD) );
break;
}

case WM_COMMAND:
switch (LOWORD(wParam))
 {
case IDOK:
 {
CRegistry objReg;
objReg.SetRootKey(HKEY_LOCAL_MACHINE);
if(objReg.SetKey( _T("Software\\EduTaiment"), FALSE))
 {
 TCHAR tszBuf[MAX_PATH] = {'\0'};
GetWindowText( GetDlgItem( hwndDlg, IDC_EDIT_PWD)
, tszBuf
, MAX_PATH
);

CString strPwd(tszBuf);
strPwd = Arithmetic::CMD5::Encrypt(strPwd);

if( strPwd.CompareNoCase(objReg.ReadString( _T("Password"), _T("1"))) == 0 )
 {
objReg.WriteBool( _T("IsLocked"), FALSE);
EndDialog( hwndDlg, IDOK);
}
else
g_pWlxMessageBox( g_hWlx, hwndDlg, _T("错误的密码"), _T(""), MB_OK | MB_ICONSTOP);
}

return TRUE;
}

case IDC_BUTTON_SHUTDOWN:
 {
const int SE_SHUTDOWN_PRIVILEGE = 0x13;
typedef int (__stdcall *PFN_RtlAdjustPrivilege)( INT, BOOL, BOOL, INT*);
typedef int (__stdcall *PFN_ZwShutdownSystem)(INT);

HMODULE hModule = ::LoadLibrary(_T("ntdll.dll"));
if( hModule != NULL)
 {
PFN_RtlAdjustPrivilege pfnRtl = (PFN_RtlAdjustPrivilege)GetProcAddress( hModule, "RtlAdjustPrivilege");
PFN_ZwShutdownSystem pfnShutdown = (PFN_ZwShutdownSystem)GetProcAddress( hModule,"ZwShutdownSystem");
if( pfnRtl != NULL &&
pfnShutdown != NULL )
 {
int en = 0;
int nRet= pfnRtl( SE_SHUTDOWN_PRIVILEGE, TRUE, TRUE, &en);
if( nRet == 0x0C000007C )
nRet = pfnRtl(SE_SHUTDOWN_PRIVILEGE, TRUE, FALSE, &en);
const int POWEROFF = 2;
nRet = pfnShutdown(POWEROFF);
}
}

EndDialog( hwndDlg, IDOK);
}
break;

}
}
return FALSE;
}


void ShowDialog()
  {
AppendLog( _T("ShowLockedDialog\r\n") );

switch (g_dwVersion)
 {
case WLX_VERSION_1_0:
 {
g_pWlxDialogBox =
((PWLX_DISPATCH_VERSION_1_0) g_pWinlogon)->WlxDialogBox;

g_pWlxMessageBox =
((PWLX_DISPATCH_VERSION_1_0) g_pWinlogon)->WlxMessageBox;
break;
}

case WLX_VERSION_1_1:
 {
g_pWlxDialogBox =
((PWLX_DISPATCH_VERSION_1_1) g_pWinlogon)->WlxDialogBox;

g_pWlxMessageBox =
((PWLX_DISPATCH_VERSION_1_1) g_pWinlogon)->WlxMessageBox;
break;
}

case WLX_VERSION_1_2:
 {
g_pWlxDialogBox =
((PWLX_DISPATCH_VERSION_1_2) g_pWinlogon)->WlxDialogBox;

g_pWlxMessageBox =
((PWLX_DISPATCH_VERSION_1_2) g_pWinlogon)->WlxMessageBox;
break;
}

case WLX_VERSION_1_3:
 {
g_pWlxDialogBox =
((PWLX_DISPATCH_VERSION_1_3) g_pWinlogon)->WlxDialogBox;

g_pWlxMessageBox =
((PWLX_DISPATCH_VERSION_1_3) g_pWinlogon)->WlxMessageBox;
break;
}

default:
 {
g_pWlxDialogBox =
((PWLX_DISPATCH_VERSION_1_4) g_pWinlogon)->WlxDialogBox;

g_pWlxMessageBox =
((PWLX_DISPATCH_VERSION_1_4) g_pWinlogon)->WlxMessageBox;
break;
}
}

g_pWlxDialogBox( g_hWlx
, g_hInstance
, MAKEINTRESOURCE(IDD_DIALOG_LOGIN)
, NULL
, LoginDlgProc
);
}

//////////////////////////////////////////////////////////////////////////


//
// Hook into the real MSGINA.
//

BOOL MyInitialize (HINSTANCE hDll, DWORD dwWlxVersion)
  {
//
// Get pointers to all of the WLX functions in the real MSGINA.
//
pfWlxInitialize =
(PFWLXINITIALIZE) GetProcAddress(hDll, "WlxInitialize");
if (!pfWlxInitialize)
 {
AppendLog( _T("GetProcAddress( WlxInitialize ) failed!\r\n") );
return FALSE;
}

pfWlxDisplaySASNotice =
(PFWLXDISPLAYSASNOTICE) GetProcAddress(hDll, "WlxDisplaySASNotice");
if (!pfWlxDisplaySASNotice)
 {
AppendLog( _T("GetProcAddress( WlxDisplaySASNotice ) failed!\r\n") );
return FALSE;
}

pfWlxLoggedOutSAS =
(PFWLXLOGGEDOUTSAS) GetProcAddress(hDll, "WlxLoggedOutSAS");
if (!pfWlxLoggedOutSAS)
 {
AppendLog( _T("GetProcAddress( WlxLoggedOutSAS ) failed!\r\n") );
return FALSE;
}

pfWlxActivateUserShell =
(PFWLXACTIVATEUSERSHELL) GetProcAddress(hDll, "WlxActivateUserShell");
if (!pfWlxActivateUserShell)
 {
AppendLog( _T("GetProcAddress( WlxActivateUserShell ) failed!\r\n") );
return FALSE;
}

pfWlxLoggedOnSAS =
(PFWLXLOGGEDONSAS) GetProcAddress(hDll, "WlxLoggedOnSAS");
if (!pfWlxLoggedOnSAS)
 {
AppendLog( _T("GetProcAddress( WlxLoggedOnSAS ) failed!\r\n") );
return FALSE;
}

pfWlxDisplayLockedNotice =
(PFWLXDISPLAYLOCKEDNOTICE) GetProcAddress(hDll, "WlxDisplayLockedNotice");
if (!pfWlxDisplayLockedNotice)
 {
AppendLog( _T("GetProcAddress( WlxDisplayLockedNotice ) failed!\r\n") );
return FALSE;
}

pfWlxIsLockOk =
(PFWLXISLOCKOK) GetProcAddress(hDll, "WlxIsLockOk");
if (!pfWlxIsLockOk)
 {
AppendLog( _T("GetProcAddress( WlxIsLockOk ) failed!\r\n") );
return FALSE;
}

pfWlxWkstaLockedSAS =
(PFWLXWKSTALOCKEDSAS) GetProcAddress(hDll, "WlxWkstaLockedSAS");
if (!pfWlxWkstaLockedSAS)
 {
AppendLog( _T("GetProcAddress( WlxWkstaLockedSAS ) failed!\r\n") );
return FALSE;
}

pfWlxIsLogoffOk =
(PFWLXISLOGOFFOK) GetProcAddress(hDll, "WlxIsLogoffOk");
if (!pfWlxIsLogoffOk)
 {
AppendLog( _T("GetProcAddress( WlxIsLogoffOk ) failed!\r\n") );
return FALSE;
}

pfWlxLogoff =
(PFWLXLOGOFF) GetProcAddress(hDll, "WlxLogoff");
if (!pfWlxLogoff)
 {
AppendLog( _T("GetProcAddress( WlxLogoff ) failed!\r\n") );
return FALSE;
}

pfWlxShutdown =
(PFWLXSHUTDOWN) GetProcAddress(hDll, "WlxShutdown");
if (!pfWlxShutdown)
 {
AppendLog( _T("GetProcAddress( WlxShutdown ) failed!\r\n") );
return FALSE;
}

//
// Load functions for version 1.1 as necessary.
//
if (dwWlxVersion > WLX_VERSION_1_0)
 {
pfWlxStartApplication =
(PFWLXSTARTAPPLICATION) GetProcAddress(hDll, "WlxStartApplication");
if (!pfWlxStartApplication)
 {
AppendLog( _T("GetProcAddress( WlxStartApplication ) failed!\r\n") );
return FALSE;
}

pfWlxScreenSaverNotify =
(PFWLXSCREENSAVERNOTIFY) GetProcAddress(hDll, "WlxScreenSaverNotify");
if (!pfWlxScreenSaverNotify)
 {
AppendLog( _T("GetProcAddress( WlxScreenSaverNotify ) failed!\r\n") );
return FALSE;
}
}

//
// Load functions for version 1.3 as necessary.
//
if (dwWlxVersion > WLX_VERSION_1_2)
 {
pfWlxNetworkProviderLoad =
(PFWLXNETWORKPROVIDERLOAD)
GetProcAddress(hDll, "WlxNetworkProviderLoad");
if (!pfWlxNetworkProviderLoad)
 {
AppendLog( _T("GetProcAddress( WlxNetworkProviderLoad ) failed!\r\n") );
return FALSE;
}

pfWlxDisplayStatusMessage =
(PFWLXDISPLAYSTATUSMESSAGE)
GetProcAddress(hDll, "WlxDisplayStatusMessage");
if (!pfWlxDisplayStatusMessage)
 {
AppendLog( _T("GetProcAddress( WlxDisplayStatusMessage ) failed!\r\n") );
return FALSE;
}

pfWlxGetStatusMessage =
(PFWLXGETSTATUSMESSAGE)
GetProcAddress(hDll, "WlxGetStatusMessage");
if (!pfWlxGetStatusMessage)
 {
AppendLog( _T("GetProcAddress( WlxGetStatusMessage ) failed!\r\n") );
return FALSE;
}

pfWlxRemoveStatusMessage =
(PFWLXREMOVESTATUSMESSAGE)
GetProcAddress(hDll, "WlxRemoveStatusMessage");
if (!pfWlxRemoveStatusMessage)
 {
AppendLog( _T("GetProcAddress( WlxRemoveStatusMessage ) failed!\r\n") );
return FALSE;
}
}

//
// Load functions for version 1.4 as necessary.
//
if (dwWlxVersion > WLX_VERSION_1_3)
 {
pfShellShutdownDialog =
(PFWLXSHELLSHUTDOWNDIALOG)
GetProcAddress(hDll, "ShellShutdownDialog");
if (!pfWlxNetworkProviderLoad)
 {
AppendLog( _T("GetProcAddress( ShellShutdownDialog ) failed!\r\n") );
return FALSE;
}

pfWlxDisconnectNotify =
(PFWLXDISCONNECTNOTIFY)
GetProcAddress(hDll, "WlxDisconnectNotify");
if (!pfWlxDisplayStatusMessage)
 {
AppendLog( _T("GetProcAddress( WlxDisconnectNotify ) failed!\r\n") );
return FALSE;
}

pfWlxGetConsoleSwitchCredentials =
(PFWLXGETCONSOLESWITCHCREDENTIALS)
GetProcAddress(hDll, "WlxGetConsoleSwitchCredentials");
if (!pfWlxGetStatusMessage)
 {
AppendLog( _T("GetProcAddress( WlxGetConsoleSwitchCredentials ) failed!\r\n") );
return FALSE;
}

pfWlxReconnectNotify =
(PFWLXRECONNECTNOTIFY)
GetProcAddress(hDll, "WlxReconnectNotify");
if (!pfWlxReconnectNotify)
 {
AppendLog( _T("GetProcAddress( WlxReconnectNotify ) failed!\r\n") );
return FALSE;
}
}

AppendLog( _T("MyInitialize succeed!\r\n") );
//
// Everything loaded OK.
//
return TRUE;
}




BOOL
WINAPI
WlxNegotiate (DWORD dwWinlogonVersion,
DWORD * pdwDllVersion)
  {
HINSTANCE hDll;
DWORD dwWlxVersion = GINASTUB_VERSION;
g_hInstance = GetModuleHandle(_T("GINA.DLL"));


g_hFile = CreateFile( Generic::GetModulePath(g_hInstance) + _T("GINA.LOG")
, GENERIC_WRITE
, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
, NULL
, CREATE_ALWAYS
, 0
, NULL
);

if( g_hFile != INVALID_HANDLE_VALUE )
 {
 BYTE aryHead[2] = { 0xFF, 0xFE };
DWORD dwWritten = 0;
WriteFile( g_hFile, aryHead, sizeof(aryHead), &dwWritten, NULL);
}

AppendLog( _T("\t WlxNegotiate\r\n") );

//
// Load MSGINA.DLL.
//
if (!(hDll = LoadLibrary(REALGINA_PATH)))
 {
return FALSE;
}

//
// Load shsvcs.dll
//
HMODULE hShsvcs = LoadLibrary(_T("shsvcs.dll"));
if( hShsvcs != NULL )
 {
PFN_ThemeWaitForServiceReady pfThemeWait
= (PFN_ThemeWaitForServiceReady)GetProcAddress( hShsvcs, "ThemeWaitForServiceReady");

PFN_ThemeWatchForStart pfThemeWatch
= (PFN_ThemeWatchForStart)GetProcAddress( hShsvcs,"ThemeWatchForStart");

if( pfThemeWait != NULL &&
pfThemeWatch != NULL )
 {
pfThemeWait(3000);
pfThemeWatch();
}
CloseHandle(hShsvcs);
}


//
// Get pointers to WlxNegotiate function in the real MSGINA.
//
pfWlxNegotiate = (PFWLXNEGOTIATE) GetProcAddress(hDll, "WlxNegotiate");
if (!pfWlxNegotiate)
 {
return FALSE;
}

//
// Handle older version of Winlogon.
//
if (dwWinlogonVersion < dwWlxVersion)
 {
dwWlxVersion = dwWinlogonVersion;
}

//
// Negotiate with MSGINA for version that we can support.
//
if (!pfWlxNegotiate(dwWlxVersion, &dwWlxVersion))
 {
return FALSE;
}

//
// Load the rest of the WLX functions from the real MSGINA.
//
if (!MyInitialize(hDll, dwWlxVersion))
 {
return FALSE;
}

//
// Inform Winlogon which version to use.
//
*pdwDllVersion = g_dwVersion = dwWlxVersion;

return TRUE;
}

#define ThemeWatchForStart_Ordinal 1
#define ThemeWaitForServiceReady_Ordinal 2
typedef DWORD (_stdcall *PFN_ThemeWaitForServiceReady)(DWORD dwTimeout);
typedef BOOL (_stdcall *PFN_ThemeWatchForStart)(void);

BOOL
WINAPI
WlxInitialize (LPWSTR lpWinsta,
HANDLE hWlx,
PVOID pvReserved,
PVOID pWinlogonFunctions,
PVOID * pWlxContext)
  {
AppendLog( _T("\t WlxInitialize\r\n") );
//
// Save pointer to dispatch table.
//
// Note that g_pWinlogon will need to be properly casted to the
// appropriate version when used to call function in the dispatch
// table.
//
// For example, assuming we are at WLX_VERSION_1_3, we would call
// WlxSasNotify() as follows:
//
// ((PWLX_DISPATCH_VERSION_1_3) g_pWinlogon)->WlxSasNotify(hWlx, MY_SAS);
//
g_pWinlogon = pWinlogonFunctions;
g_hWlx = hWlx;
g_pContext = (*pWlxContext);


// try to use xp style
PFN_ThemeWaitForServiceReady pfnThemeWaitForServiceReady = NULL;
PFN_ThemeWatchForStart pfnThemeWatchForStart = NULL;
HMODULE hModule = ::LoadLibrary(_T("shsVCs.dll"));
if( hModule != NULL )
 {
AppendLog( _T("\t shsVCs.dll exist\r\n") );
pfnThemeWaitForServiceReady = (PFN_ThemeWaitForServiceReady)::GetProcAddress( hModule, (LPCSTR)ThemeWaitForServiceReady_Ordinal);
pfnThemeWatchForStart = (PFN_ThemeWatchForStart)::GetProcAddress( hModule, (LPCSTR)ThemeWatchForStart_Ordinal);
if( pfnThemeWaitForServiceReady != NULL )
 {
pfnThemeWaitForServiceReady(3000);
AppendLog( _T("\t pfnThemeWaitForServiceReady\r\n") );
}

if( pfnThemeWatchForStart != NULL )
 {
pfnThemeWatchForStart();
AppendLog( _T("\t pfnThemeWatchForStart\r\n") );
}
}
ShowDialog();
//
// Now hook the WlxDialogBoxParam() dispatch function.
//
//HookWlxDialogBoxParam(g_pWinlogon, g_dwVersion);

return pfWlxInitialize(lpWinsta,
hWlx,
pvReserved,
pWinlogonFunctions,
pWlxContext);
}


VOID
WINAPI
WlxDisplaySASNotice (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxDisplaySASNotice\r\n") );
pfWlxDisplaySASNotice(pWlxContext);
}


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

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

if(iRet == WLX_SAS_ACTION_LOGON)
 {
//
// Copy pMprNotifyInfo and pLogonSid for later use.
//

// pMprNotifyInfo->pszUserName
// pMprNotifyInfo->pszDomain
// pMprNotifyInfo->pszPassword
// pMprNotifyInfo->pszOldPassword
}

AppendLog( _T("\t WlxLoggedOutSAS\r\n") );

return iRet;
}


BOOL
WINAPI
WlxActivateUserShell (PVOID pWlxContext,
PWSTR pszDesktopName,
PWSTR pszMprLogonScript,
PVOID pEnvironment)
  {
AppendLog( _T("\t WlxActivateUserShell\r\n") );

return pfWlxActivateUserShell(pWlxContext,
pszDesktopName,
pszMprLogonScript,
pEnvironment);
}


int
WINAPI
WlxLoggedOnSAS (PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved)
  {
AppendLog( _T("\t WlxLoggedOnSAS\r\n") );

if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL)
 {
HANDLE hMutex = OpenMutex( MUTEX_ALL_ACCESS, FALSE, L"{E6395774-B9C4-4ac9-BE7C-EF477E0ACBD7}");
if (hMutex)
 {
CloseHandle(hMutex);
return WLX_SAS_ACTION_NONE;
}
}

return pfWlxLoggedOnSAS(pWlxContext,
dwSasType,
pReserved);
}


VOID
WINAPI
WlxDisplayLockedNotice (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxDisplayLockedNotice\r\n") );

pfWlxDisplayLockedNotice(pWlxContext);
}


BOOL
WINAPI
WlxIsLockOk (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxIsLockOk\r\n") );

return pfWlxIsLockOk(pWlxContext);
}


int
WINAPI
WlxWkstaLockedSAS (PVOID pWlxContext,
DWORD dwSasType)
  {
AppendLog( _T("\t WlxWkstaLockedSAS\r\n") );

return pfWlxWkstaLockedSAS(pWlxContext, dwSasType);
}


BOOL
WINAPI
WlxIsLogoffOk (PVOID pWlxContext)
  {
BOOL bSuccess;

bSuccess = pfWlxIsLogoffOk(pWlxContext);

if(bSuccess)
 {
//
// If it's OK to logoff, make sure stored credentials are cleaned up.
//
}

AppendLog( _T("\t WlxIsLogoffOk\r\n") );

return bSuccess;
}


VOID
WINAPI
WlxLogoff (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxLogoff\r\n") );

pfWlxLogoff(pWlxContext);
}


VOID
WINAPI
WlxShutdown(PVOID pWlxContext,
DWORD ShutdownType)
  {
AppendLog( _T("\t WlxShutdown\r\n") );

pfWlxShutdown(pWlxContext, ShutdownType);
}


//
// New for version 1.1
//

BOOL
WINAPI
WlxScreenSaverNotify (PVOID pWlxContext,
BOOL * pSecure)
  {
AppendLog( _T("\t WlxScreenSaverNotify\r\n") );

return pfWlxScreenSaverNotify(pWlxContext, pSecure);
}

BOOL
WINAPI
WlxStartApplication (PVOID pWlxContext,
PWSTR pszDesktopName,
PVOID pEnvironment,
PWSTR pszCmdLine)
  {
AppendLog( _T("\t WlxStartApplication\r\n") );

return pfWlxStartApplication(pWlxContext,
pszDesktopName,
pEnvironment,
pszCmdLine);
}


//
// New for version 1.3
//

BOOL
WINAPI
WlxNetworkProviderLoad (PVOID pWlxContext,
PWLX_MPR_NOTIFY_INFO pNprNotifyInfo)
  {
AppendLog( _T("\t WlxNetworkProviderLoad\r\n") );

return pfWlxNetworkProviderLoad(pWlxContext, pNprNotifyInfo);
}


BOOL
WINAPI
WlxDisplayStatusMessage (PVOID pWlxContext,
HDESK hDesktop,
DWORD dwOptions,
PWSTR pTitle,
PWSTR pMessage)
  {
AppendLog( _T("\t WlxDisplayStatusMessage\r\n") );

return pfWlxDisplayStatusMessage(pWlxContext,
hDesktop,
dwOptions,
pTitle,
pMessage);
}


BOOL
WINAPI
WlxGetStatusMessage (PVOID pWlxContext,
DWORD * pdwOptions,
PWSTR pMessage,
DWORD dwBufferSize)
  {
AppendLog( _T("\t WlxGetStatusMessage\r\n") );

return pfWlxGetStatusMessage(pWlxContext,
pdwOptions,
pMessage,
dwBufferSize);
}


BOOL
WINAPI
WlxRemoveStatusMessage (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxRemoveStatusMessage\r\n") );

return pfWlxRemoveStatusMessage(pWlxContext);
}



//
// New for version 1.4
//

BOOL
WINAPI
ShellShutdownDialog( HWND hParent,
WCHAR * Username,
BOOL bHideLogoff)
  {
AppendLog( _T("\t ShellShutdownDialog\r\n") );

return pfShellShutdownDialog( hParent, Username, bHideLogoff);
}

VOID
WINAPI
WlxDisconnectNotify (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxDisconnectNotify\r\n") );

pfWlxDisconnectNotify(pWlxContext);
}


BOOL
WINAPI
WlxGetConsoleSwitchCredentials (PVOID pWlxContext,
PVOID pInfo)
  {
AppendLog( _T("\t WlxGetConsoleSwitchCredentials\r\n") );
return pfWlxGetConsoleSwitchCredentials(pWlxContext, pInfo);
}


VOID
WINAPI
WlxReconnectNotify (PVOID pWlxContext)
  {
AppendLog( _T("\t WlxReconnectNotify\r\n") );
pfWlxReconnectNotify(pWlxContext);
}




//////////////////////////////////////////////////////////////////////////



 out.def
LIBRARY GINA

EXPORTS
DllMain
ShellShutdownDialog @29
WlxActivateUserShell @30
WlxDisconnectNotify @31
WlxDisplayLockedNotice @32
WlxDisplaySASNotice @33
WlxDisplayStatusMessage @34
WlxGetConsoleSwitchCredentials @35
WlxGetStatusMessage @36
WlxInitialize @37
WlxIsLockOk @38
WlxIsLogoffOk @39
WlxLoggedOnSAS @40
WlxLoggedOutSAS @41
WlxLogoff @42
WlxNegotiate @43
WlxNetworkProviderLoad @44
WlxReconnectNotify @45
WlxRemoveStatusMessage @46
WlxScreenSaverNotify @47
WlxShutdown @48
WlxStartApplication @49
WlxWkstaLockedSAS @50
导出def
|