VBoxHook.cpp revision fd5f006a327367e12b478fe849521f4581dd0cf7
/* $Id$ */
/** @file
* VBoxHook -- Global windows hook dll
*/
/*
* 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.
*/
#include <Windows.h>
#include <VBoxHook.h>
#include <VBox/VBoxGuestLib.h>
#include <stdio.h>
#pragma data_seg("SHARED")
#pragma data_seg()
static HANDLE hWinNotifyEvent = 0;
static HANDLE hDesktopNotifyEvent = 0;
#ifdef DEBUG
#else
# define dprintf(a) do {} while (0)
#endif /* !DEBUG */
{
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
if (!hWinNotifyEvent)
{
}
break;
}
}
{
if (!hDesktopNotifyEvent)
{
}
}
{
if (hDesktopEventHook)
return TRUE;
hDll,
0, 0,
0);
return !!hDesktopEventHook;
}
{
if (hDesktopEventHook)
{
}
hDesktopEventHook = 0;
return TRUE;
}
/** Install the global message hook */
{
return TRUE;
hDll,
0, 0,
hDll,
0, 0,
return !!hWinEventHook[0];
}
/** Remove the global message hook */
{
{
}
return TRUE;
}
#ifdef DEBUG
# include <VBox/VBoxGuest.h>
/**
* dprintf worker using VBoxGuest.sys and VMMDevReq_LogString.
*/
{
/*
* Open VBox guest driver once.
*/
if (hVBoxGuest == INVALID_HANDLE_VALUE)
{
NULL,
NULL);
if (hVBoxGuest == INVALID_HANDLE_VALUE)
return;
}
/*
* We're apparently afraid of using stack here, so we use a static buffer
* instead and pray we won't be here at the same time on two threads...
*/
static union
{
} s_uBuf;
__debugbreak();
&cbReturned, NULL);
}
#endif /* DEBUG */