VBoxGINA.cpp revision 8c7f99ddfae159036907d817723b8eb3e6c19b5d
/** @file
*
* VBoxGINA -- Windows Logon DLL for VirtualBox
*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "winwlx.h"
#include "VBoxGINA.h"
#include "Helper.h"
#include "Dialog.h"
#include <VBox/VBoxGuestLib.h>
/*
* Global variables
*/
/** DLL instance handle */
/** Version of Winlogon */
/** Handle to Winlogon service */
/** Winlog function dispatch table */
/**
* Function pointers to MSGINA entry points
*/
/* GINA 1.1 */
/* GINA 1.3 */
/* GINA 1.4 */
/**
* DLL entry point.
*/
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
RTR3Init();
VbglR3Init();
LogRel(("VBoxGina: DLL loaded.\n"));
break;
}
case DLL_PROCESS_DETACH:
{
LogRel(("VBoxGina: DLL unloaded.\n"));
VbglR3Term();
/// @todo RTR3Term();
break;
}
default:
break;
}
return TRUE;
}
{
#ifdef DEBUG
/* enable full log output */
#endif
/* load the standard Microsoft GINA DLL */
{
return FALSE;
}
/*
* Now get the entry points of the MSGINA
*/
if (!GWlxNegotiate)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxNegotiate\n"));
return FALSE;
}
if (!GWlxInitialize)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxInitialize\n"));
return FALSE;
}
if (!GWlxDisplaySASNotice)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxDisplaySASNotice\n"));
return FALSE;
}
if (!GWlxLoggedOutSAS)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxLoggedOutSAS\n"));
return FALSE;
}
if (!GWlxActivateUserShell)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxActivateUserShell\n"));
return FALSE;
}
if (!GWlxLoggedOnSAS)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxLoggedOnSAS\n"));
return FALSE;
}
if (!GWlxDisplayLockedNotice)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxDisplayLockedNotice\n"));
return FALSE;
}
if (!GWlxIsLockOk)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxIsLockOk\n"));
return FALSE;
}
if (!GWlxWkstaLockedSAS)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxWkstaLockedSAS\n"));
return FALSE;
}
if (!GWlxIsLogoffOk)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxIsLogoffOk\n"));
return FALSE;
}
if (!GWlxLogoff)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxLogoff\n"));
return FALSE;
}
if (!GWlxShutdown)
{
Log(("VBoxGINA::WlxNegotiate: failed resolving WlxShutdown\n"));
return FALSE;
}
/* GINA 1.1, optional */
/* GINA 1.3, optional */
GWlxNetworkProviderLoad = (PGWLXNETWORKPROVIDERLOAD)GetProcAddress( hDll, "WlxNetworkProviderLoad");
GWlxDisplayStatusMessage = (PGWLXDISPLAYSTATUSMESSAGE)GetProcAddress( hDll, "WlxDisplayStatusMessage");
GWlxRemoveStatusMessage = (PGWLXREMOVESTATUSMESSAGE)GetProcAddress( hDll, "WlxRemoveStatusMessage");
/* GINA 1.4, optional */
Log(("VBoxGINA::WlxNegotiate: optional function pointers:\n"
" WlxStartApplication: %p\n"
" WlxScreenSaverNotify: %p\n"
" WlxNetworkProviderLoad: %p\n"
" WlxDisplayStatusMessage: %p\n"
" WlxGetStatusMessage: %p\n"
" WlxRemoveStatusMessage: %p\n"
" WlxGetConsoleSwitchCredentials: %p\n"
" WlxReconnectNotify: %p\n"
" WlxDisconnectNotify: %p\n",
/* forward call */
}
{
Log(("VBoxGINA::WlxInitialize\n"));
/* store Winlogon function table */
/* store handle to Winlogon service*/
/* hook the dialogs */
/* forward call */
}
{
Log(("VBoxGINA::WlxDisplaySASNotice\n"));
/* check if there are credentials for us, if so simulat C-A-D */
if (credentialsAvailable())
{
Log(("VBoxGINA::WlxDisplaySASNotice: simulating C-A-D\n"));
/* automatic C-A-D */
}
else
{
Log(("VBoxGINA::WlxDisplaySASNotice: starting credentials poller\n"));
/* start the credentials poller thread */
/* forward call to MSGINA */
}
}
{
Log(("VBoxGINA::WlxLoggedOutSAS\n"));
/* when performing a direct logon without C-A-D, our poller might not be running */
if (!credentialsAvailable())
{
}
int iRet;
if (iRet == WLX_SAS_ACTION_LOGON)
{
//
// copy pMprNotifyInfo and pLogonSid for later use
//
// pMprNotifyInfo->pszUserName
// pMprNotifyInfo->pszDomain
// pMprNotifyInfo->pszPassword
// pMprNotifyInfo->pszOldPassword
}
return iRet;
}
{
Log(("VBoxGINA::WlxActivateUserShell\n"));
/* forward call to MSGINA */
}
{
int iRet = WLX_SAS_ACTION_NONE;
/* Winlogon registry path */
{
}
else
{
}
if (dwValue)
{
switch (dwSasType)
{
case WLX_SAS_TYPE_CTRL_ALT_DEL: /* User pressed CTRL-ALT-DEL. */
/* Show the task list (or whatever the OS wants to do here). */
break;
default:
break;
}
}
else
{
/* Forward call to MSGINA. */
Log(("VBoxGINA::WlxLoggedOnSAS: Forwarding call to MSGINA ...\n"));
}
return iRet;
}
{
Log(("VBoxGINA::WlxDisplayLockedNotice\n"));
/* forward call to MSGINA */
}
{
Log(("VBoxGINA::WlxIsLockOk\n"));
/* forward call to MSGINA */
return GWlxIsLockOk(pWlxContext);
}
{
Log(("VBoxGINA::WlxWkstaLockedSAS\n"));
/* forward call to MSGINA */
}
{
Log(("VBoxGINA::WlxIsLogoffOk\n"));
if (bSuccess)
{
//
// if it's ok to logoff, finish with the stored credentials
// and scrub the buffers
//
}
return bSuccess;
}
{
Log(("VBoxGINA::WlxLogoff\n"));
/* forward call to MSGINA */
}
{
Log(("VBoxGINA::WlxShutdown\n"));
/* forward call to MSGINA */
}
/*
* GINA 1.1 entry points
*/
{
Log(("VBoxGINA::WlxScreenSaverNotify\n"));
/* forward to MSGINA if present */
/* return something intelligent */
return TRUE;
}
{
Log(("VBoxGINA::WlxStartApplication: pWlxCtx=%p, pszDesktopName=%ls, pEnvironment=%p, pszCmdLine=%ls\n",
/* forward to MSGINA if present */
if (GWlxStartApplication)
return FALSE;
}
/*
* GINA 1.3 entry points
*/
{
Log(("VBoxGINA::WlxNetworkProviderLoad\n"));
/* forward to MSGINA if present */
return FALSE;
}
{
Log(("VBoxGINA::WlxDisplayStatusMessage\n"));
/* forward to MSGINA if present */
return FALSE;
}
{
Log(("VBoxGINA::WlxGetStatusMessage\n"));
/* forward to MSGINA if present */
if (GWlxGetStatusMessage)
return FALSE;
}
{
Log(("VBoxGINA::WlxRemoveStatusMessage\n"));
/* forward to MSGINA if present */
return GWlxRemoveStatusMessage(pWlxContext);
return FALSE;
}
/*
* GINA 1.4 entry points
*/
{
Log(("VBoxGINA::WlxGetConsoleSwitchCredentials\n"));
/* forward call to MSGINA if present */
return FALSE;
}
{
Log(("VBoxGINA::WlxReconnectNotify\n"));
/* forward to MSGINA if present */
if (GWlxReconnectNotify)
}
{
Log(("VBoxGINA::WlxDisconnectNotify\n"));
/* forward to MSGINA if present */
if (GWlxDisconnectNotify)
}