VBoxServiceVMInfo.cpp revision f44b6583d60e03aa9366a491b16071532cf92357
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * VBoxVMInfo - Virtual machine (guest) information for the host.
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * Copyright (C) 2009 Sun Microsystems, Inc.
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * This file is part of VirtualBox Open Source Edition (OSE), as
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * available from http://www.virtualbox.org. This file is free software;
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * you can redistribute it and/or modify it under the terms of the GNU
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * General Public License (GPL) as published by the Free Software
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * Foundation, in version 2 as it comes in the "COPYING" file of the
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * Clara, CA 95054 USA or visit http://www.sun.com if you need
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp * additional information or have any questions.
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp/*******************************************************************************
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp* Header Files *
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp*******************************************************************************/
27fbcf8a5036d0cea1c401094c8bb0731ddc87ecdp# include <utmp.h>
#include "VBoxServiceInternal.h"
#include "VBoxServiceUtils.h"
#ifdef RT_OS_WINDOWS
return VINF_SUCCESS;
static DECLCALLBACK(int) VBoxServiceVMInfoOption(const char **ppszShort, int argc, char **argv, int *pi)
if (ppszShort)
return rc;
if (!g_VMInfoInterval)
if (!g_VMInfoInterval)
#ifdef RT_OS_WINDOWS
g_pfnWTSGetActiveConsoleSessionId = (fnWTSGetActiveConsoleSessionId)GetProcAddress(hKernel32, "WTSGetActiveConsoleSessionId");
return rc;
#ifdef RT_OS_WINDOWS
#ifdef RT_OS_WINDOWS
unsigned cErrors = 0;
#ifdef RT_OS_WINDOWS
NTSTATUS r = 0;
if (r != STATUS_SUCCESS)
for (int i = 0; i<(int)ulCount; i++)
if (uiUserCount > 0)
uiUserCount++;
if (rc != 0)
setutent();
if (uiUserCount > 0)
uiUserCount++;
endutent();
VboxServiceWriteProp(g_VMInfoGuestPropSvcClientID, "GuestInfo/OS/LoggedInUsersList", (uiUserCount > 0) ? szUserList : NULL);
if (uiUserCount == 0)
int nNumInterfaces = 0;
#ifdef RT_OS_WINDOWS
unsigned long nBytesReturned = 0;
sizeof(InterfaceList),
0) == SOCKET_ERROR)
int iCurIface = 0;
VboxServiceWritePropInt(g_VMInfoGuestPropSvcClientID, szPropPath, (nNumInterfaces > 1 ? nNumInterfaces-1 : 0));
for (int i = 0; i < nNumInterfaces; ++i)
#ifdef RT_OS_WINDOWS
#ifdef RT_OS_WINDOWS
#ifdef RT_OS_WINDOWS
#ifdef RT_OS_SOLARIS
iCurIface++;
#ifdef RT_OS_WINDOWS
if (*pfShutdown)
if (*pfShutdown)
#ifdef RT_OS_WINDOWS
WSACleanup();
return rc;
int rc;
if (g_VMInfoLoggedInUsers > 0)