diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-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/common/VBoxService/VBoxServicePageSharing.cpp')
-rw-r--r-- | src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp b/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp index 39c9912d..c954d5c9 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2011 Oracle Corporation + * Copyright (C) 2006-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -23,6 +23,7 @@ #include <iprt/avl.h> #include <iprt/asm.h> #include <iprt/mem.h> +#include <iprt/ldr.h> #include <iprt/process.h> #include <iprt/env.h> #include <iprt/stream.h> @@ -80,8 +81,7 @@ typedef struct _RTL_PROCESS_MODULES } RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES; typedef NTSTATUS (WINAPI *PFNZWQUERYSYSTEMINFORMATION)(ULONG, PVOID, ULONG, PULONG); -static PFNZWQUERYSYSTEMINFORMATION ZwQuerySystemInformation = NULL; -static HMODULE hNtdll = 0; +static PFNZWQUERYSYSTEMINFORMATION g_pfnZwQuerySystemInformation = NULL; static DECLCALLBACK(int) VBoxServicePageSharingEmptyTreeCallback(PAVLPVNODECORE pNode, void *pvUser); @@ -365,13 +365,13 @@ void VBoxServicePageSharingInspectGuest() CloseHandle(hSnapshot); /* Check all loaded kernel modules. */ - if (ZwQuerySystemInformation) + if (g_pfnZwQuerySystemInformation) { ULONG cbBuffer = 0; PVOID pBuffer = NULL; PRTL_PROCESS_MODULES pSystemModules; - NTSTATUS ret = ZwQuerySystemInformation(SystemModuleInformation, (PVOID)&cbBuffer, 0, &cbBuffer); + NTSTATUS ret = g_pfnZwQuerySystemInformation(SystemModuleInformation, (PVOID)&cbBuffer, 0, &cbBuffer); if (!cbBuffer) { VBoxServiceVerbose(1, "ZwQuerySystemInformation returned length 0\n"); @@ -382,7 +382,7 @@ void VBoxServicePageSharingInspectGuest() if (!pBuffer) goto skipkernelmodules; - ret = ZwQuerySystemInformation(SystemModuleInformation, pBuffer, cbBuffer, &cbBuffer); + ret = g_pfnZwQuerySystemInformation(SystemModuleInformation, pBuffer, cbBuffer, &cbBuffer); if (ret != STATUS_SUCCESS) { VBoxServiceVerbose(1, "ZwQuerySystemInformation returned %x (1)\n", ret); @@ -552,12 +552,9 @@ static DECLCALLBACK(int) VBoxServicePageSharingInit(void) AssertRCReturn(rc, rc); #if defined(RT_OS_WINDOWS) && !defined(TARGET_NT4) - hNtdll = LoadLibrary("ntdll.dll"); + g_pfnZwQuerySystemInformation = (PFNZWQUERYSYSTEMINFORMATION)RTLdrGetSystemSymbol("ntdll.dll", "ZwQuerySystemInformation"); - if (hNtdll) - ZwQuerySystemInformation = (PFNZWQUERYSYSTEMINFORMATION)GetProcAddress(hNtdll, "ZwQuerySystemInformation"); - - rc = VbglR3GetSessionId(&g_idSession); + rc = VbglR3GetSessionId(&g_idSession); if (RT_FAILURE(rc)) { if (rc == VERR_IO_GEN_FAILURE) @@ -695,7 +692,7 @@ DECLCALLBACK(int) VBoxServicePageSharingWorkerProcess(bool volatile *pfShutdown) { char const *papszArgs[3]; papszArgs[0] = pszExeName; - papszArgs[1] = "--pagefusionfork"; + papszArgs[1] = "pagefusion"; papszArgs[2] = NULL; rc = RTProcCreate(pszExeName, papszArgs, RTENV_DEFAULT, 0 /* normal child */, &hProcess); if (RT_FAILURE(rc)) @@ -737,12 +734,6 @@ DECLCALLBACK(int) VBoxServicePageSharingWorkerProcess(bool volatile *pfShutdown) static DECLCALLBACK(void) VBoxServicePageSharingTerm(void) { VBoxServiceVerbose(3, "VBoxServicePageSharingTerm\n"); - -#if defined(RT_OS_WINDOWS) && !defined(TARGET_NT4) - if (hNtdll) - FreeLibrary(hNtdll); -#endif - return; } |