summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp')
-rw-r--r--src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp b/src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp
index 9f3cef91..9435a9f1 100644
--- a/src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp
+++ b/src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp
@@ -24,6 +24,7 @@
#include <VBox/VMMDev.h>
#include <VBoxGuestInternal.h>
#include <iprt/assert.h>
+#include <iprt/ldr.h>
/* The guest receives VRDP_ACTIVE/VRDP_INACTIVE notifications.
@@ -255,7 +256,7 @@ typedef struct _VBOXVRDPCONTEXT
uint32_t level;
BOOL fSavedThemeEnabled;
- HMODULE hModule;
+ RTLDRMOD hModUxTheme;
HRESULT (* pfnEnableTheming)(BOOL fEnable);
BOOL (* pfnIsThemeActive)(VOID);
@@ -273,16 +274,17 @@ int VBoxVRDPInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThr
gCtx.level = VRDP_EXPERIENCE_LEVEL_FULL;
gCtx.fSavedThemeEnabled = FALSE;
- gCtx.hModule = LoadLibrary("UxTheme");
-
- if (gCtx.hModule)
+ int rc = RTLdrLoadSystem("UxTheme.dll", false /*fNoUnload*/, &gCtx.hModUxTheme);
+ if (RT_SUCCESS(rc))
{
- *(uintptr_t *)&gCtx.pfnEnableTheming = (uintptr_t)GetProcAddress(gCtx.hModule, "EnableTheming");
- *(uintptr_t *)&gCtx.pfnIsThemeActive = (uintptr_t)GetProcAddress(gCtx.hModule, "IsThemeActive");
+ *(PFNRT *)&gCtx.pfnEnableTheming = RTLdrGetFunction(gCtx.hModUxTheme, "EnableTheming");
+ *(PFNRT *)&gCtx.pfnIsThemeActive = RTLdrGetFunction(gCtx.hModUxTheme, "IsThemeActive");
}
else
{
- gCtx.pfnEnableTheming = 0;
+ gCtx.hModUxTheme = NIL_RTLDRMOD;
+ gCtx.pfnEnableTheming = NULL;
+ gCtx.pfnIsThemeActive = NULL;
}
*pfStartThread = true;
@@ -296,9 +298,11 @@ void VBoxVRDPDestroy(const VBOXSERVICEENV *pEnv, void *pInstance)
Log(("VBoxTray: VBoxVRDPDestroy\n"));
VBOXVRDPCONTEXT *pCtx = (VBOXVRDPCONTEXT *)pInstance;
vboxExperienceRestore (pCtx->level);
- if (gCtx.hModule)
- FreeLibrary(gCtx.hModule);
- gCtx.hModule = 0;
+ if (gCtx.hModUxTheme != NIL_RTLDRMOD)
+ {
+ RTLdrClose(gCtx.hModUxTheme);
+ gCtx.hModUxTheme = NIL_RTLDRMOD;
+ }
return;
}