summaryrefslogtreecommitdiff
path: root/src/VBox/Main/src-server/win
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/src-server/win')
-rw-r--r--src/VBox/Main/src-server/win/HostDnsServiceWin.cpp233
-rw-r--r--src/VBox/Main/src-server/win/HostPowerWin.cpp38
-rw-r--r--src/VBox/Main/src-server/win/NetIf-win.cpp37
-rw-r--r--src/VBox/Main/src-server/win/PerformanceWin.cpp84
-rw-r--r--src/VBox/Main/src-server/win/svchlp.cpp2
-rw-r--r--src/VBox/Main/src-server/win/svchlp.h2
-rw-r--r--src/VBox/Main/src-server/win/svcmain.cpp17
7 files changed, 335 insertions, 78 deletions
diff --git a/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp b/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp
new file mode 100644
index 00000000..1bd72233
--- /dev/null
+++ b/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp
@@ -0,0 +1,233 @@
+/* -*- indent-tabs-mode: nil; -*- */
+#include <VBox/com/string.h>
+#include <VBox/com/ptr.h>
+
+
+#include <iprt/assert.h>
+#include <iprt/err.h>
+
+#include <Windows.h>
+
+#include <string>
+#include <vector>
+#include "../HostDnsService.h"
+
+struct HostDnsServiceWin::Data
+{
+ HostDnsServiceWin::Data(){}
+ HKEY hKeyTcpipParameters;
+#define DATA_DNS_UPDATE_EVENT 0
+#define DATA_SHUTDOWN_EVENT 1
+#define DATA_MAX_EVENT 2
+ HANDLE haDataEvent[DATA_MAX_EVENT];
+};
+
+static inline int registerNotification(const HKEY& hKey, HANDLE& hEvent)
+{
+ LONG lrc = RegNotifyChangeKeyValue(hKey,
+ TRUE,
+ REG_NOTIFY_CHANGE_LAST_SET,
+ hEvent,
+ TRUE);
+ AssertMsgReturn(lrc == ERROR_SUCCESS,
+ ("Failed to register event on the key. Please debug me!"),
+ VERR_INTERNAL_ERROR);
+
+ return VINF_SUCCESS;
+}
+
+HostDnsServiceWin::HostDnsServiceWin():HostDnsMonitor(true), m(NULL)
+{
+ m = new Data();
+
+ m->haDataEvent[DATA_DNS_UPDATE_EVENT] = CreateEvent(NULL,
+ TRUE, FALSE, NULL);
+ AssertReleaseMsg(m->haDataEvent[DATA_DNS_UPDATE_EVENT],
+ ("Failed to create event for DNS event (%d)\n", GetLastError()));
+
+ m->haDataEvent[DATA_SHUTDOWN_EVENT] = CreateEvent(NULL,
+ TRUE, FALSE, NULL);
+ AssertReleaseMsg(m->haDataEvent[DATA_SHUTDOWN_EVENT],
+ ("Failed to create event for Shutdown signal (%d)\n", GetLastError()));
+
+ LONG lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ TEXT("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"),
+ 0, KEY_READ|KEY_NOTIFY, &m->hKeyTcpipParameters);
+ AssertReleaseMsg(lrc == ERROR_SUCCESS,
+ ("Failed to open Registry Key for read and update notifications (%d)\n",
+ GetLastError()));
+}
+
+
+HostDnsServiceWin::~HostDnsServiceWin()
+{
+ if (m && !m->hKeyTcpipParameters)
+ {
+ RegCloseKey(m->hKeyTcpipParameters);
+ m->hKeyTcpipParameters = 0;
+
+ CloseHandle(m->haDataEvent[DATA_DNS_UPDATE_EVENT]);
+ CloseHandle(m->haDataEvent[DATA_SHUTDOWN_EVENT]);
+
+ delete m;
+
+ m = NULL;
+ }
+}
+
+
+HRESULT HostDnsServiceWin::init()
+{
+ HRESULT hrc = HostDnsMonitor::init();
+ AssertComRCReturn(hrc, hrc);
+
+ return updateInfo();
+}
+
+
+void HostDnsServiceWin::monitorThreadShutdown()
+{
+ SetEvent(m->haDataEvent[DATA_SHUTDOWN_EVENT]);
+}
+
+
+int HostDnsServiceWin::monitorWorker()
+{
+ registerNotification(m->hKeyTcpipParameters,
+ m->haDataEvent[DATA_DNS_UPDATE_EVENT]);
+
+ monitorThreadInitializationDone();
+
+ DWORD dwRc;
+ while (true)
+ {
+ dwRc = WaitForMultipleObjects(DATA_MAX_EVENT,
+ m->haDataEvent,
+ FALSE,
+ INFINITE);
+ AssertMsgReturn(dwRc != WAIT_FAILED,
+ ("WaitForMultipleObjects failed (%d) to wait! Please debug",
+ GetLastError()), VERR_INTERNAL_ERROR);
+
+ if ((dwRc - WAIT_OBJECT_0) == DATA_DNS_UPDATE_EVENT)
+ {
+ updateInfo();
+ notifyAll();
+ ResetEvent(m->haDataEvent[DATA_DNS_UPDATE_EVENT]);
+ registerNotification(m->hKeyTcpipParameters,
+ m->haDataEvent[DATA_DNS_UPDATE_EVENT]);
+
+ }
+ else if ((dwRc - WAIT_OBJECT_0) == DATA_SHUTDOWN_EVENT)
+ {
+ break;
+ }
+ else
+ {
+ AssertMsgFailedReturn(
+ ("WaitForMultipleObjects returns out of bound index %d. Please debug!",
+ dwRc),
+ VERR_INTERNAL_ERROR);
+ }
+ }
+ return VINF_SUCCESS;
+}
+
+
+HRESULT HostDnsServiceWin::updateInfo()
+{
+ HRESULT hrc;
+ DWORD regIndex;
+ BYTE abDomain[256];
+ BYTE abNameServers[256];
+ BYTE abSearchList[256];
+
+ RT_ZERO(abDomain);
+ RT_ZERO(abNameServers);
+ RT_ZERO(abSearchList);
+
+ regIndex = 0;
+ do {
+ CHAR keyName[256];
+ DWORD cbKeyName = sizeof(keyName);
+ DWORD keyType = 0;
+ BYTE keyData[1024];
+ DWORD cbKeyData = sizeof(keyData);
+
+ hrc = RegEnumValueA(m->hKeyTcpipParameters, regIndex, keyName, &cbKeyName, 0,
+ &keyType, keyData, &cbKeyData);
+ if ( hrc == ERROR_SUCCESS
+ || hrc == ERROR_MORE_DATA)
+ {
+ if ( RTStrICmp("Domain", keyName) == 0
+ && cbKeyData > 1
+ && cbKeyData < sizeof(abDomain))
+ memcpy(abDomain, keyData, cbKeyData);
+
+ else if ( RTStrICmp("DhcpDomain", keyName) == 0
+ && cbKeyData > 1
+ && abDomain[0] == 0
+ && cbKeyData < sizeof(abDomain))
+ memcpy(abDomain, keyData, cbKeyData);
+
+ else if ( RTStrICmp("NameServer", keyName) == 0
+ && cbKeyData > 1
+ && cbKeyData < sizeof(abNameServers))
+ memcpy(abNameServers, keyData, cbKeyData);
+
+ else if ( RTStrICmp("DhcpNameServer", keyName) == 0
+ && cbKeyData > 1
+ && abNameServers[0] == 0
+ && cbKeyData < sizeof(abNameServers))
+ memcpy(abNameServers, keyData, cbKeyData);
+
+ else if ( RTStrICmp("SearchList", keyName) == 0
+ && cbKeyData > 1
+ && cbKeyData < sizeof(abSearchList))
+ memcpy(abSearchList, keyData, cbKeyData);
+ }
+ regIndex++;
+ } while (hrc != ERROR_NO_MORE_ITEMS);
+
+ /* OK, now parse and update DNS structures. */
+ /* domain name */
+ HostDnsInformation info;
+ info.domain = (char*)abDomain;
+
+ /* server list */
+ strList2List(info.servers, (char *)abNameServers);
+ /* search list */
+ strList2List(info.searchList, (char *)abSearchList);
+
+ HostDnsMonitor::setInfo(info);
+
+ return S_OK;
+}
+
+
+void HostDnsServiceWin::strList2List(std::vector<std::string>& lst, char *strLst)
+{
+ char *next, *current;
+ char address[512];
+
+ AssertPtrReturnVoid(strLst);
+
+ if (strlen(strLst) == 0)
+ return;
+
+ current = strLst;
+ do {
+ RT_ZERO(address);
+ next = RTStrStr(current, " ");
+
+ if (next)
+ strncpy(address, current, RT_MIN(sizeof(address)-1, next - current));
+ else
+ strcpy(address, current);
+
+ lst.push_back(std::string(address));
+
+ current = next + 1;
+ } while(next);
+
+}
diff --git a/src/VBox/Main/src-server/win/HostPowerWin.cpp b/src/VBox/Main/src-server/win/HostPowerWin.cpp
index ae806fd7..34826f9d 100644
--- a/src/VBox/Main/src-server/win/HostPowerWin.cpp
+++ b/src/VBox/Main/src-server/win/HostPowerWin.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -31,12 +31,12 @@ extern "C" {
static WCHAR gachWindowClassName[] = L"VBoxPowerNotifyClass";
-HostPowerServiceWin::HostPowerServiceWin(VirtualBox *aVirtualBox) : HostPowerService(aVirtualBox)
+HostPowerServiceWin::HostPowerServiceWin(VirtualBox *aVirtualBox) : HostPowerService(aVirtualBox), mThread(NIL_RTTHREAD)
{
mHwnd = 0;
- int rc = RTThreadCreate (&mThread, HostPowerServiceWin::NotificationThread, this, 65536,
- RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "MainPower");
+ int rc = RTThreadCreate(&mThread, HostPowerServiceWin::NotificationThread, this, 65536,
+ RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "MainPower");
if (RT_FAILURE(rc))
{
@@ -55,12 +55,14 @@ HostPowerServiceWin::~HostPowerServiceWin()
SetWindowLongPtr(mHwnd, 0, 0);
/* Send the quit message and wait for it be processed. */
SendMessage(mHwnd, WM_QUIT, 0, 0);
+ RTThreadWait(mThread, 5000, NULL);
+ mThread = NIL_RTTHREAD;
}
}
-DECLCALLBACK(int) HostPowerServiceWin::NotificationThread (RTTHREAD ThreadSelf, void *pInstance)
+DECLCALLBACK(int) HostPowerServiceWin::NotificationThread(RTTHREAD ThreadSelf, void *pInstance)
{
HostPowerServiceWin *pPowerObj = (HostPowerServiceWin *)pInstance;
HWND hwnd = 0;
@@ -68,7 +70,7 @@ DECLCALLBACK(int) HostPowerServiceWin::NotificationThread (RTTHREAD ThreadSelf,
/* Create a window and make it a power event notification handler. */
int rc = VINF_SUCCESS;
- HINSTANCE hInstance = (HINSTANCE)GetModuleHandle (NULL);
+ HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
/* Register the Window Class. */
WNDCLASS wc;
@@ -94,10 +96,10 @@ DECLCALLBACK(int) HostPowerServiceWin::NotificationThread (RTTHREAD ThreadSelf,
else
{
/* Create the window. */
- hwnd = pPowerObj->mHwnd = CreateWindowEx (WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
- gachWindowClassName, gachWindowClassName,
- WS_POPUPWINDOW,
- -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
+ hwnd = pPowerObj->mHwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
+ gachWindowClassName, gachWindowClassName,
+ WS_POPUPWINDOW,
+ -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
if (hwnd == NULL)
{
@@ -121,11 +123,11 @@ DECLCALLBACK(int) HostPowerServiceWin::NotificationThread (RTTHREAD ThreadSelf,
Log(("HostPowerServiceWin::NotificationThread: exit thread\n"));
if (hwnd)
- DestroyWindow (hwnd);
+ DestroyWindow(hwnd);
if (atomWindowClass != 0)
{
- UnregisterClass (gachWindowClassName, hInstance);
+ UnregisterClass(gachWindowClassName, hInstance);
atomWindowClass = 0;
}
@@ -146,11 +148,11 @@ LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam
switch(wParam)
{
case PBT_APMSUSPEND:
- pPowerObj->notify(HostPowerEvent_Suspend);
+ pPowerObj->notify(Reason_HostSuspend);
break;
case PBT_APMRESUMEAUTOMATIC:
- pPowerObj->notify(HostPowerEvent_Resume);
+ pPowerObj->notify(Reason_HostResume);
break;
case PBT_APMPOWERSTATUSCHANGE:
@@ -177,27 +179,27 @@ LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam
if ( rc == 0 /* STATUS_SUCCESS */
&& BatteryState.EstimatedTime < 60*5)
{
- pPowerObj->notify(HostPowerEvent_BatteryLow);
+ pPowerObj->notify(Reason_HostBatteryLow);
}
}
else
/* If the machine has less than 5% battery left (and is not connected to the AC), then we should save the state. */
if (SystemPowerStatus.BatteryFlag == 4 /* critical battery status; less than 5% */)
{
- pPowerObj->notify(HostPowerEvent_BatteryLow);
+ pPowerObj->notify(Reason_HostBatteryLow);
}
}
}
break;
}
default:
- return DefWindowProc (hwnd, msg, wParam, lParam);
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return TRUE;
}
default:
- return DefWindowProc (hwnd, msg, wParam, lParam);
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
diff --git a/src/VBox/Main/src-server/win/NetIf-win.cpp b/src/VBox/Main/src-server/win/NetIf-win.cpp
index cce820da..3b86dabd 100644
--- a/src/VBox/Main/src-server/win/NetIf-win.cpp
+++ b/src/VBox/Main/src-server/win/NetIf-win.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2008-2010 Oracle Corporation
+ * Copyright (C) 2008-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;
@@ -954,7 +954,7 @@ static int vboxNetWinAddComponent(std::list<ComObjPtr<HostNetworkInterface> > *
if (hr == S_OK)
{
NETIFINFO Info;
- memset(&Info, 0, sizeof(Info));
+ RT_ZERO(Info);
Info.Uuid = *(Guid(IfGuid).raw());
rc = collectNetIfInfo(name, Guid(IfGuid), &Info, iDefaultInterface);
if (RT_FAILURE(rc))
@@ -1082,6 +1082,33 @@ int NetIfGetConfigByName(PNETIFINFO)
return VERR_NOT_IMPLEMENTED;
}
+/**
+ * Obtain the current state of the interface.
+ *
+ * @returns VBox status code.
+ *
+ * @param pcszIfName Interface name.
+ * @param penmState Where to store the retrieved state.
+ */
+int NetIfGetState(const char *pcszIfName, NETIFSTATUS *penmState)
+{
+ return VERR_NOT_IMPLEMENTED;
+}
+
+/**
+ * Retrieve the physical link speed in megabits per second. If the interface is
+ * not up or otherwise unavailable the zero speed is returned.
+ *
+ * @returns VBox status code.
+ *
+ * @param pcszIfName Interface name.
+ * @param puMbits Where to store the link speed.
+ */
+int NetIfGetLinkSpeed(const char * /*pcszIfName*/, uint32_t * /*puMbits*/)
+{
+ return VERR_NOT_IMPLEMENTED;
+}
+
int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
IHostNetworkInterface **aHostNetworkInterface,
IProgress **aProgress,
@@ -1485,7 +1512,7 @@ int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
{
hr = pBp->EnumBindingInterfaces(&pEnumBi);
Assert(hr == S_OK);
- if ( hr == S_OK )
+ if (hr == S_OK)
{
hr = pEnumBi->Reset();
Assert(hr == S_OK);
@@ -1493,7 +1520,7 @@ int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
{
while ((hr = pEnumBi->Next(1, &pBi, NULL)) == S_OK)
{
- hr = pBi->GetLowerComponent( &pMpNcc );
+ hr = pBi->GetLowerComponent(&pMpNcc);
Assert(hr == S_OK);
if (hr == S_OK)
{
@@ -1527,7 +1554,7 @@ int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
}
else
{
- LogRel(("failed to get the sun_VBoxNetFlt component, error (0x%x)", hr));
+ LogRel(("failed to get the sun_VBoxNetFlt component, error (0x%x)\n", hr));
}
VBoxNetCfgWinReleaseINetCfg(pNc, FALSE);
diff --git a/src/VBox/Main/src-server/win/PerformanceWin.cpp b/src/VBox/Main/src-server/win/PerformanceWin.cpp
index 48643c6d..74c2bf13 100644
--- a/src/VBox/Main/src-server/win/PerformanceWin.cpp
+++ b/src/VBox/Main/src-server/win/PerformanceWin.cpp
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2008 Oracle Corporation
+ * Copyright (C) 2008-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;
@@ -33,8 +33,10 @@ extern "C" {
}
#include <iprt/err.h>
+#include <iprt/ldr.h>
#include <iprt/mp.h>
#include <iprt/mem.h>
+#include <iprt/system.h>
#include <map>
@@ -61,6 +63,7 @@ public:
virtual int getRawHostCpuLoad(uint64_t *user, uint64_t *kernel, uint64_t *idle);
virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total);
+
private:
struct VMProcessStats
{
@@ -72,21 +75,20 @@ private:
typedef std::map<RTPROCESS, VMProcessStats> VMProcessMap;
- VMProcessMap mProcessStats;
+ VMProcessMap mProcessStats;
- typedef BOOL (WINAPI *PFNGST)(
- LPFILETIME lpIdleTime,
- LPFILETIME lpKernelTime,
- LPFILETIME lpUserTime);
- typedef NTSTATUS (WINAPI *PFNNQSI)(
- SYSTEM_INFORMATION_CLASS SystemInformationClass,
- PVOID SystemInformation,
- ULONG SystemInformationLength,
- PULONG ReturnLength);
+ typedef BOOL (WINAPI *PFNGST)(LPFILETIME lpIdleTime,
+ LPFILETIME lpKernelTime,
+ LPFILETIME lpUserTime);
+ typedef NTSTATUS (WINAPI *PFNNQSI)(SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ PVOID SystemInformation,
+ ULONG SystemInformationLength,
+ PULONG ReturnLength);
PFNGST mpfnGetSystemTimes;
PFNNQSI mpfnNtQuerySystemInformation;
- HMODULE mhNtDll;
+
+ ULONG totalRAM;
};
CollectorHAL *createHAL()
@@ -94,35 +96,29 @@ CollectorHAL *createHAL()
return new CollectorWin();
}
-CollectorWin::CollectorWin() : CollectorHAL(), mhNtDll(0)
+CollectorWin::CollectorWin() : CollectorHAL(), mpfnNtQuerySystemInformation(NULL)
{
- mpfnGetSystemTimes = (PFNGST)GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
- "GetSystemTimes");
+ /* Note! Both kernel32.dll and ntdll.dll can be assumed to always be present. */
+ mpfnGetSystemTimes = (PFNGST)RTLdrGetSystemSymbol("kernel32.dll", "GetSystemTimes");
if (!mpfnGetSystemTimes)
{
/* Fall back to deprecated NtQuerySystemInformation */
- if (!(mhNtDll = LoadLibrary(TEXT("ntdll.dll"))))
- {
- LogRel(("Failed to load NTDLL.DLL with error 0x%x. GetSystemTimes() is"
- " not available either. CPU and VM metrics will not be collected.\n",
- GetLastError()));
- mpfnNtQuerySystemInformation = 0;
- }
- else if (!(mpfnNtQuerySystemInformation = (PFNNQSI)GetProcAddress(mhNtDll,
- "NtQuerySystemInformation")))
- {
- LogRel(("Neither GetSystemTimes() nor NtQuerySystemInformation() is"
- " not available. CPU and VM metrics will not be collected.\n"));
- mpfnNtQuerySystemInformation = 0;
- }
+ mpfnNtQuerySystemInformation = (PFNNQSI)RTLdrGetSystemSymbol("ntdll.dll", "NtQuerySystemInformation");
+ if (!mpfnNtQuerySystemInformation)
+ LogRel(("Warning! Neither GetSystemTimes() nor NtQuerySystemInformation() is not available.\n"
+ " CPU and VM metrics will not be collected! (lasterr %u)\n", GetLastError()));
}
+
+ uint64_t cb;
+ int rc = RTSystemQueryTotalRam(&cb);
+ if (RT_FAILURE(rc))
+ totalRAM = 0;
+ else
+ totalRAM = (ULONG)(cb / 1024);
}
CollectorWin::~CollectorWin()
{
- if (mhNtDll)
- FreeLibrary(mhNtDll);
}
#define FILETTIME_TO_100NS(ft) (((uint64_t)ft.dwHighDateTime << 32) + ft.dwLowDateTime)
@@ -278,7 +274,7 @@ int CollectorWin::getHostCpuMHz(ULONG *mhz)
return VERR_NO_MEMORY;
LONG ns = CallNtPowerInformation(ProcessorInformation, NULL, 0, ppi,
- nProcessors * sizeof(PROCESSOR_POWER_INFORMATION));
+ nProcessors * sizeof(PROCESSOR_POWER_INFORMATION));
if (ns)
{
Log(("CallNtPowerInformation() -> %x\n", ns));
@@ -300,19 +296,16 @@ int CollectorWin::getHostCpuMHz(ULONG *mhz)
int CollectorWin::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available)
{
- MEMORYSTATUSEX mstat;
-
- mstat.dwLength = sizeof(mstat);
- if (GlobalMemoryStatusEx(&mstat))
+ AssertReturn(totalRAM, VERR_INTERNAL_ERROR);
+ uint64_t cb;
+ int rc = RTSystemQueryAvailableRam(&cb);
+ if (RT_SUCCESS(rc))
{
- *total = (ULONG)( mstat.ullTotalPhys / 1024 );
- *available = (ULONG)( mstat.ullAvailPhys / 1024 );
+ *total = totalRAM;
+ *available = (ULONG)(cb / 1024);
*used = *total - *available;
}
- else
- return RTErrConvertFromWin32(GetLastError());
-
- return VINF_SUCCESS;
+ return rc;
}
int CollectorWin::getProcessCpuLoad(RTPROCESS process, ULONG *user, ULONG *kernel)
@@ -348,9 +341,4 @@ int CollectorWin::getProcessMemoryUsage(RTPROCESS process, ULONG *used)
return VINF_SUCCESS;
}
-int getDiskListByFs(const char *name, DiskList& list)
-{
- return VERR_NOT_IMPLEMENTED;
-}
-
}
diff --git a/src/VBox/Main/src-server/win/svchlp.cpp b/src/VBox/Main/src-server/win/svchlp.cpp
index 2191f3fa..a3c07ff6 100644
--- a/src/VBox/Main/src-server/win/svchlp.cpp
+++ b/src/VBox/Main/src-server/win/svchlp.cpp
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2010 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;
diff --git a/src/VBox/Main/src-server/win/svchlp.h b/src/VBox/Main/src-server/win/svchlp.h
index 0e8b8b80..a5df8dba 100644
--- a/src/VBox/Main/src-server/win/svchlp.h
+++ b/src/VBox/Main/src-server/win/svchlp.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/src-server/win/svcmain.cpp b/src/VBox/Main/src-server/win/svcmain.cpp
index 111c2dd4..5e2c251b 100644
--- a/src/VBox/Main/src-server/win/svcmain.cpp
+++ b/src/VBox/Main/src-server/win/svcmain.cpp
@@ -327,19 +327,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpC
* registering/unregistering or calling the helper functionality. */
if (fRun)
{
+ /** @todo Merge this code with server.cpp (use Logging.cpp?). */
+ char szLogFile[RTPATH_MAX];
if (!pszLogFile)
{
- char szLogFile[RTPATH_MAX];
vrc = com::GetVBoxUserHomeDirectory(szLogFile, sizeof(szLogFile));
if (RT_SUCCESS(vrc))
vrc = RTPathAppend(szLogFile, sizeof(szLogFile), "VBoxSVC.log");
- if (RT_SUCCESS(vrc))
- pszLogFile = RTStrDup(szLogFile);
}
+ else
+ {
+ if (!RTStrPrintf(szLogFile, sizeof(szLogFile), "%s", pszLogFile))
+ vrc = VERR_NO_MEMORY;
+ }
+ if (RT_FAILURE(vrc))
+ return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to create logging file name, rc=%Rrc", vrc);
+
char szError[RTPATH_MAX + 128];
- vrc = com::VBoxLogRelCreate("COM Server", pszLogFile,
+ vrc = com::VBoxLogRelCreate("COM Server", szLogFile,
RTLOGFLAGS_PREFIX_THREAD | RTLOGFLAGS_PREFIX_TIME_PROG,
- "all", "VBOXSVC_RELEASE_LOG",
+ VBOXSVC_LOG_DEFAULT, "VBOXSVC_RELEASE_LOG",
RTLOGDEST_FILE, UINT32_MAX /* cMaxEntriesPerGroup */,
cHistory, uHistoryFileTime, uHistoryFileSize,
szError, sizeof(szError));