VBoxRestore.cpp revision 74804912a237136f06d0b49682a119577135902b
/* $Id$ */
/** @file
* VBoxRestore - Restore notification.
*/
/*
* Copyright (C) 2006-2010 Oracle Corporation
*
* 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.
*/
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include "VBoxTray.h"
#include "VBoxHelpers.h"
#include "VBoxRestore.h"
#include <VBoxDisplay.h>
#include <VBoxGuestInternal.h>
typedef struct _VBOXRESTORECONTEXT
{
const VBOXSERVICEENV *pEnv;
static VBOXRESTORECONTEXT gCtx = {0};
{
Log(("VBoxTray: VBoxRestoreInit\n"));
*pfStartThread = true;
*ppInstance = &gCtx;
return VINF_SUCCESS;
}
{
Log(("VBoxTray: VBoxRestoreDestroy\n"));
return;
}
void VBoxRestoreSession()
{
}
void VBoxRestoreCheckVRDP()
{
VBOXDISPIFESCAPE escape = {0};
/* Check VRDP activity. */
/* Send to display driver. */
{
{
}
}
}
/**
* Thread function to wait for and process seamless mode change
* requests
*/
{
bool fTerminate = false;
maskInfo.u32NotMask = 0;
if (DeviceIoControl (gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL))
{
Log(("VBoxTray: VBoxRestoreThread: DeviceIOControl(CtlMask - or) succeeded\n"));
}
else
{
Log(("VBoxTray: VBoxRestoreThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n"));
return 0;
}
do
{
/* wait for a seamless change event */
if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_WAITEVENT, &waitEvent, sizeof(waitEvent), &waitEvent, sizeof(waitEvent), &cbReturned, NULL))
{
Log(("VBoxTray: VBoxRestoreThread: DeviceIOControl succeeded\n"));
/* are we supposed to stop? */
break;
Log(("VBoxTray: VBoxRestoreThread: checking event\n"));
/* did we get the right event? */
else
/** @todo Don't poll, but wait for connect/disconnect events */
}
else
{
Log(("VBoxTray: VBoxTray: error 0 from DeviceIoControl VBOXGUEST_IOCTL_WAITEVENT\n"));
/* sleep a bit to not eat too much CPU in case the above call always fails */
{
fTerminate = true;
break;
}
}
}
while (!fTerminate);
if (DeviceIoControl (gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL))
{
Log(("VBoxTray: VBoxRestoreThread: DeviceIOControl(CtlMask - not) succeeded\n"));
}
else
{
Log(("VBoxTray: VBoxRestoreThread: DeviceIOControl(CtlMask) failed\n"));
}
Log(("VBoxTray: VBoxRestoreThread: finished seamless change request thread\n"));
return 0;
}