summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.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/VBoxLA.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/VBoxLA.cpp')
-rw-r--r--src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp b/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp
index 5856c728..a23219b7 100644
--- a/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp
+++ b/src/VBox/Additions/WINNT/VBoxTray/VBoxLA.cpp
@@ -26,6 +26,7 @@
#include <iprt/assert.h>
#include <iprt/alloc.h>
#include <iprt/list.h>
+#include <iprt/ldr.h>
#define LALOG(a) do { if (gCtx.fLogEnabled) LogRel(a); } while(0)
#define LALOGFORCE(a) do { LogRel(a); } while(0)
@@ -87,8 +88,6 @@ struct VBOXLACONTEXT
char *pszPropWaitPattern; /* Which properties are monitored. */
} activeClient;
- HMODULE hModuleKernel32;
-
BOOL (WINAPI * pfnProcessIdToSessionId)(DWORD dwProcessId, DWORD *pSessionId);
};
@@ -1249,16 +1248,7 @@ int VBoxLAInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThrea
RT_ZERO(gCtx.activeClient);
- gCtx.hModuleKernel32 = LoadLibrary("KERNEL32");
-
- if (gCtx.hModuleKernel32)
- {
- *(uintptr_t *)&gCtx.pfnProcessIdToSessionId = (uintptr_t)GetProcAddress(gCtx.hModuleKernel32, "ProcessIdToSessionId");
- }
- else
- {
- gCtx.pfnProcessIdToSessionId = NULL;
- }
+ *(void **)&gCtx.pfnProcessIdToSessionId = RTLdrGetSystemSymbol("kernel32.dll", "ProcessIdToSessionId");
*pfStartThread = true;
*ppInstance = &gCtx;
return VINF_SUCCESS;
@@ -1279,12 +1269,7 @@ void VBoxLADestroy(const VBOXSERVICEENV *pEnv, void *pInstance)
ActionExecutorDeleteActions(&pCtx->listAttachActions);
ActionExecutorDeleteActions(&pCtx->listDetachActions);
- if (pCtx->hModuleKernel32)
- {
- FreeLibrary(pCtx->hModuleKernel32);
- pCtx->pfnProcessIdToSessionId = NULL;
- }
- pCtx->hModuleKernel32 = NULL;
+ pCtx->pfnProcessIdToSessionId = NULL;
}
/*