VirtualBox

Changeset 46593 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jun 17, 2013 2:32:51 PM (12 years ago)
Author:
vboxsync
Message:

updates

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/win/dllmain.cpp

    r44528 r46593  
    4646
    4747        // idempotent, so doesn't harm, and needed for COM embedding scenario
    48         RTR3InitDll(0);
     48        RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
    4949    }
    5050    else if (dwReason == DLL_PROCESS_DETACH)
  • trunk/src/VBox/Main/src-server/win/PerformanceWin.cpp

    r46460 r46593  
    3434
    3535#include <iprt/err.h>
     36#include <iprt/ldr.h>
    3637#include <iprt/mp.h>
    3738#include <iprt/mem.h>
     
    8788    PFNGST  mpfnGetSystemTimes;
    8889    PFNNQSI mpfnNtQuerySystemInformation;
    89     HMODULE mhNtDll;
    9090
    9191    ULONG   totalRAM;
     
    9797}
    9898
    99 CollectorWin::CollectorWin() : CollectorHAL(), mhNtDll(0)
    100 {
    101     mpfnGetSystemTimes = (PFNGST)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
    102                                                 "GetSystemTimes");
     99CollectorWin::CollectorWin() : CollectorHAL(), mpfnNtQuerySystemInformation(NULL)
     100{
     101    /* Note! Both kernel32.dll and ntdll.dll can be assumed to always be present. */
     102    mpfnGetSystemTimes = (PFNGST)RTLdrGetSystemSymbol("kernel32.dll", "GetSystemTimes");
    103103    if (!mpfnGetSystemTimes)
    104104    {
    105105        /* Fall back to deprecated NtQuerySystemInformation */
    106         if (!(mhNtDll = LoadLibrary(TEXT("ntdll.dll"))))
    107         {
    108             LogRel(("Failed to load NTDLL.DLL with error 0x%x. GetSystemTimes() is"
    109                     " not available either. CPU and VM metrics will not be collected.\n",
    110                     GetLastError()));
    111             mpfnNtQuerySystemInformation = 0;
    112         }
    113         else if (!(mpfnNtQuerySystemInformation = (PFNNQSI)GetProcAddress(mhNtDll,
    114                                                                           "NtQuerySystemInformation")))
    115         {
    116             LogRel(("Neither GetSystemTimes() nor NtQuerySystemInformation() is"
    117                     " not available. CPU and VM metrics will not be collected.\n"));
    118             mpfnNtQuerySystemInformation = 0;
    119         }
     106        mpfnNtQuerySystemInformation = (PFNNQSI)RTLdrGetSystemSymbol("ntdll.dll", "NtQuerySystemInformation");
     107        if (!mpfnNtQuerySystemInformation)
     108            LogRel(("Warning! Neither GetSystemTimes() nor NtQuerySystemInformation() is not available.\n"
     109                    "         CPU and VM metrics will not be collected! (lasterr %u)\n", GetLastError()));
    120110    }
    121111
     
    130120CollectorWin::~CollectorWin()
    131121{
    132     if (mhNtDll)
    133         FreeLibrary(mhNtDll);
    134122}
    135123
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette