#include <windows.h>
#include <stdio.h>
#include <winwlx.h>
#include "ginastub.h"
#define REALGINA_PATH TEXT("MSGINA.DLL")
PGWLX_DISPATCH_VERSION pWlxFuncs;
DWORD WlxVersion;
PGWLX_Negotiate GWlxNegotiate;
PGWLX_Initialize GWlxInitialize;
PGWLX_DisplaySASNotice GWlxDisplaySASNotice;
PGWLX_LoggedOutSAS GWlxLoggedOutSAS;
PGWLX_ActivateUserShell GWlxActivateUserShell;
PGWLX_LoggedOnSAS GWlxLoggedOnSAS;
PGWLX_DisplayLockedNotice GWlxDisplayLockedNotice;
PGWLX_WkstaLockedSAS GWlxWkstaLockedSAS;
PGWLX_IsLockOk GWlxIsLockOk;
PGWLX_IsLogoffOk GWlxIsLogoffOk;
PGWLX_Logoff GWlxLogoff;
PGWLX_Shutdown GWlxShutdown;
PGWLX_StartApplication GWlxStartApplication;
PGWLX_ScreenSaverNotify GWlxScreenSaverNotify;
static BOOL
MyInitialize(void)
{
HINSTANCE hDll;
if (! (hDll = LoadLibrary(REALGINA_PATH)))
return FALSE;
GWlxNegotiate = (PGWLX_Negotiate)
GetProcAddress(hDll, "WlxNegotiate");
if (! GWlxNegotiate)
return FALSE;
GWlxInitialize = (PGWLX_Initialize)
GetProcAddress(hDll, "WlxInitialize");
if (! GWlxInitialize)
return FALSE;
GWlxDisplaySASNotice = (PGWLX_DisplaySASNotice)
GetProcAddress(hDll, "WlxDisplaySASNotice");
if (! GWlxDisplaySASNotice)
return FALSE;
GWlxLoggedOutSAS = (PGWLX_LoggedOutSAS)
GetProcAddress(hDll, "WlxLoggedOutSAS");
if (! GWlxLoggedOutSAS)
return FALSE;
GWlxActivateUserShell = (PGWLX_ActivateUserShell)
GetProcAddress(hDll, "WlxActivateUserShell");
if (! GWlxActivateUserShell)
return FALSE;
GWlxLoggedOnSAS = (PGWLX_LoggedOnSAS)
GetProcAddress(hDll, "WlxLoggedOnSAS");
if (! GWlxLoggedOnSAS)
return FALSE;
GWlxDisplayLockedNotice = (PGWLX_DisplayLockedNotice)
GetProcAddress(hDll, "WlxDisplayLockedNotice");
if (! GWlxDisplayLockedNotice)
return FALSE;
GWlxIsLockOk = (PGWLX_IsLockOk)
GetProcAddress(hDll, "WlxIsLockOk");
if (! GWlxIsLockOk)
return FALSE;
GWlxWkstaLockedSAS = (PGWLX_WkstaLockedSAS)
GetProcAddress(hDll, "WlxWkstaLockedSAS");
if (! GWlxWkstaLockedSAS)
return FALSE;
GWlxIsLogoffOk = (PGWLX_IsLogoffOk)
GetProcAddress(hDll, "WlxIsLogoffOk");
if (! GWlxIsLogoffOk)
return FALSE;
GWlxLogoff = (PGWLX_Logoff)
GetProcAddress(hDll, "WlxLogoff");
if (! GWlxLogoff)
return FALSE;
GWlxShutdown = (PGWLX_Shutdown)
GetProcAddress(hDll, "WlxShutdown");
if (! GWlxShutdown)
return FALSE;
GWlxStartApplication = (PGWLX_StartApplication)
GetProcAddress(hDll, "WlxStartApplication");
GWlxScreenSaverNotify = (PGWLX_ScreenSaverNotify)
GetProcAddress(hDll, "WlxScreenSaverNotify");
return TRUE;
}
BOOL
WINAPI
WlxNegotiate(
DWORD dwWinlogonVersion,
DWORD *pdwDllVersion)
{
if (! MyInitialize())
return FALSE;
WlxVersion = dwWinlogonVersion;
return (* GWlxNegotiate)(dwWinlogonVersion, pdwDllVersion);
}
BOOL
WINAPI
WlxInitialize(
LPWSTR lpWinsta,
HANDLE hWlx,
PVOID pvReserved,
PVOID pWinlogonFunctions,
PVOID *pWlxContext)
{
pWlxFuncs = (PGWLX_DISPATCH_VERSION) pWinlogonFunctions;
return (* GWlxInitialize)(
lpWinsta,
hWlx,
pvReserved,
pWinlogonFunctions,
pWlxContext
);
}
VOID
WINAPI
WlxDisplaySASNotice(
PVOID pWlxContext)
{
(* GWlxDisplaySASNotice)(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 = (* GWlxLoggedOutSAS)(
pWlxContext,
dwSasType,
pAuthenticationId,
pLogonSid,
pdwOptions,
phToken,
pMprNotifyInfo,
pProfile
);
if (iRet == WLX_SAS_ACTION_LOGON) {
}
return iRet;
}
BOOL
WINAPI
WlxActivateUserShell(
PVOID pWlxContext,
PWSTR pszDesktopName,
PWSTR pszMprLogonScript,
PVOID pEnvironment)
{
return (* GWlxActivateUserShell)(
pWlxContext,
pszDesktopName,
pszMprLogonScript,
pEnvironment
);
}
int
WINAPI
WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved)
{
return (* GWlxLoggedOnSAS)(pWlxContext, dwSasType, pReserved);
}
VOID
WINAPI
WlxDisplayLockedNotice(
PVOID pWlxContext)
{
(* GWlxDisplayLockedNotice)(pWlxContext);
}
BOOL
WINAPI
WlxIsLockOk(
PVOID pWlxContext)
{
return (* GWlxIsLockOk)(pWlxContext);
}
int
WINAPI
WlxWkstaLockedSAS(
PVOID pWlxContext,
DWORD dwSasType)
{
return (* GWlxWkstaLockedSAS)(pWlxContext, dwSasType);
}
BOOL
WINAPI
WlxIsLogoffOk(
PVOID pWlxContext
)
{
BOOL bSuccess;
bSuccess = (* GWlxIsLogoffOk)(pWlxContext);
if (bSuccess) {
}
return bSuccess;
}
VOID
WINAPI
WlxLogoff(
PVOID pWlxContext
)
{
(* GWlxLogoff)(pWlxContext);
}
VOID
WINAPI
WlxShutdown(
PVOID pWlxContext,
DWORD ShutdownType
)
{
(* GWlxShutdown)(pWlxContext, ShutdownType);
}
BOOL
WINAPI
WlxScreenSaverNotify(
PVOID pWlxContext,
BOOL * pSecure
)
{
if (GWlxScreenSaverNotify)
return (* GWlxScreenSaverNotify)(pWlxContext, pSecure);
*pSecure = TRUE;
return TRUE;
}
BOOL
WINAPI
WlxStartApplication(
PVOID pWlxContext,
PWSTR pszDesktopName,
PVOID pEnvironment,
PWSTR pszCmdLine
)
{
if (GWlxStartApplication)
return (* GWlxStartApplication)(
pWlxContext,
pszDesktopName,
pEnvironment,
pszCmdLine
);
return TRUE;
}