VBoxTray.cpp revision 74804912a237136f06d0b49682a119577135902b
2362N/A * available from http://www.virtualbox.org. This file is free software;
2362N/A#include "VBoxTray.h"
2362N/A#include "VBoxHelpers.h"
2362N/A#include "VBoxSeamless.h"
0N/A#include "VBoxClipboard.h"
0N/A#include "VBoxDisplay.h"
0N/A#include "VBoxRestore.h"
0N/A#include "VBoxVRDP.h"
0N/A#include "VBoxHostVersion.h"
0N/A#include "VBoxSharedFolders.h"
0N/A#include <VBoxHook.h>
0N/A#include "resource.h"
0N/A#include <VBoxGuestInternal.h>
static void vboxTrayIconRemove()
if (hTrayWnd)
if (hTrayNotifyWnd)
return VERR_NOT_SUPPORTED;
bool fStartThread = false;
unsigned threadid;
&threadid);
pTable++;
return VINF_SUCCESS;
pTable++;
void VBoxServiceReloadCursor(void)
if (hWin)
ShowCursor(false);
ShowCursor(true);
NULL,
NULL);
LogRel(("VBoxTray: Could not open VirtualBox Guest Additions driver! Please install / start it first! rc = %d\n", GetLastError()));
if (!gToolWindow)
/* We need to setup a security descriptor to allow other processes modify access to the seamless notification event semaphore */
if (!ret)
BOOL (WINAPI * pfnConvertStringSecurityDescriptorToSecurityDescriptorA)(LPCSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize);
if (hModule)
*(uintptr_t *)&pfnConvertStringSecurityDescriptorToSecurityDescriptorA = (uintptr_t)GetProcAddress(hModule, "ConvertStringSecurityDescriptorToSecurityDescriptorA");
Log(("VBoxTray: pfnConvertStringSecurityDescriptorToSecurityDescriptorA = %x\n", pfnConvertStringSecurityDescriptorToSecurityDescriptorA));
ret = pfnConvertStringSecurityDescriptorToSecurityDescriptorA("S:(ML;;NW;;;LW)", /* this means "low integrity" */
if (!ret)
Log(("VBoxTray: ConvertStringSecurityDescriptorToSecurityDescriptorA failed with %d\n", GetLastError()));
if (!ret)
if (!ret)
#ifdef VBOX_WITH_WDDM
if ( vboxTrayIconAdd()
/* Boost thread priority to make sure we wake up early for seamless window notifications (not sure if it actually makes any difference though) */
if (0 == ghSeamlessNotifyEvent) /* If seamless mode is not active / supported, reduce event array count */
if (waitResult == 0)
/* Do not use a global namespace ("Global\\") for mutex name here, will blow up NT4 compatibility! */
return rc;
return rc;
VbglR3Term();
switch (msg)
case WM_CREATE:
if (!s_uTaskbarCreated)
case WM_CLOSE:
case WM_DESTROY:
case WM_TIMER:
switch (wParam)
case WM_VBOXTRAY_TRAY_ICON:
switch (lParam)
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_VBOX_SEAMLESS_UPDATE:
case WM_VBOXTRAY_VM_RESTORED:
case WM_VBOXTRAY_VRDP_CHECK: