VBoxHook.cpp revision a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fc
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VBoxHook -- Global windows hook dll
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Copyright (C) 2006-2007 innotek GmbH
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * available from http://www.virtualbox.org. This file is free software;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * General Public License (GPL) as published by the Free Software
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define dprintf(a) do {} while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif /* DEBUG */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncvoid CALLBACK VBoxHandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("VBoxHandleWinEvent EVENT_OBJECT_LOCATIONCHANGE for window %x\n", hwnd));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("VBoxHandleWinEvent EVENT_OBJECT_CREATE for window %x\n", hwnd));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("VBoxHandleWinEvent EVENT_OBJECT_HIDE for window %x\n", hwnd));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("VBoxHandleWinEvent EVENT_OBJECT_SHOW for window %x\n", hwnd));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("VBoxHandleWinEvent EVENT_OBJECT_DESTROY for window %x\n", hwnd));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync hNotifyEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, VBOXHOOK_GLOBAL_EVENT_NAME);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("OpenEvent returned %x (last err=%x)\n", hNotifyEvent, GetLastError()));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync dprintf(("SetEvent %x returned %d (last error %x)\n", hNotifyEvent, ret, GetLastError()));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Install the global message hook */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync hEventHook[0] = SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync hEventHook[1] = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_HIDE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Remove the global message hook */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return true;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncVBGLR3DECL(int) VbglR3GRPerform(VMMDevRequestHeader *pReq)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync DeviceIoControl(gVBoxDriver, IOCTL_VBOXGUEST_VMMREQUEST, pReq, pReq->size,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync VMMDevReqLogString *pReq = (VMMDevReqLogString *)LogBuffer;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* open VBox guest driver */