VBoxHook.cpp revision c74dac1e8af31137c50ea672564e1d1291f396ed
/** @file
*
* VBoxHook -- Global windows hook dll
*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*
*/
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <VBoxHook.h>
#include <VBoxDisplay.h>
#include <stdio.h>
#pragma data_seg("SHARED")
#pragma data_seg()
static void VBoxRecheckVisibleWindows();
#ifdef DEBUG
#else
#define dprintf(a) do {} while (0)
#endif /* DEBUG */
typedef struct
{
{
if ( idObject != OBJID_WINDOW
|| !hwnd)
return;
return;
switch(event)
{
if (!(dwStyle & WS_VISIBLE))
return;
case EVENT_OBJECT_CREATE:
case EVENT_OBJECT_DESTROY:
case EVENT_OBJECT_HIDE:
case EVENT_OBJECT_SHOW:
#ifdef DEBUG
switch(event)
{
break;
case EVENT_OBJECT_CREATE:
break;
case EVENT_OBJECT_HIDE:
break;
case EVENT_OBJECT_SHOW:
break;
case EVENT_OBJECT_DESTROY:
break;
}
#endif
break;
}
}
{
if ( !(dwStyle & WS_VISIBLE)
return TRUE;
/* Only visible windows that are present on the desktop are interesting here */
{
char szWindowText[256];
szWindowText[0] = 0;
/* Filter out Windows XP shadow windows */
/** @todo still shows inside the guest */
if ( szWindowText[0] == 0
{
return TRUE;
}
/** @todo will this suffice? The Program Manager window covers the whole screen */
{
dprintf(("Enum hwnd=%x rect (%d,%d) (%d,%d)\n", hwnd, rect.left, rect.top, rect.right, rect.bottom));
{
}
else
/* this region is relative to the window origin instead of the desktop origin */
{
/* create a union of the current visible region and the visible rectangle of this window. */
}
else
}
else
{
dprintf(("Enum hwnd=%x rect (%d,%d) (%d,%d) (ignored)\n", hwnd, rect.left, rect.top, rect.right, rect.bottom));
}
}
return TRUE; /* continue enumeration */
}
void VBoxRecheckVisibleWindows()
{
dprintf(("VBoxRecheckVisibleWindows desktop=%x rect (%d,%d) (%d,%d)\n", GetDesktopWindow(), param.rect.left, param.rect.top, param.rect.right, param.rect.bottom));
{
if (cbSize)
{
if (lpRgnData)
{
if (cbSize)
{
#ifdef DEBUG
dprintf(("New visible region: \n"));
{
dprintf(("visible rect (%d,%d)(%d,%d)\n", lpRect[i].left, lpRect[i].top, lpRect[i].right, lpRect[i].bottom));
}
#endif
/* send to display driver */
}
}
}
}
}
/* Install the global message hook */
{
/* Check current visible region state */
hDll,
0, 0,
hDll,
0, 0,
return !!hEventHook;
}
/* Remove the global message hook */
{
UnhookWinEvent(hEventHook[0]);
return true;
}
#ifdef DEBUG
#include <VBox/VBoxGuest.h>
static char LogBuffer[1024];
{
return VINF_SUCCESS;
}
{
int rc;
/* open VBox guest driver */
if (gVBoxDriver == INVALID_HANDLE_VALUE)
NULL,
NULL);
if (gVBoxDriver == INVALID_HANDLE_VALUE)
return;
return;
}
#endif