~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-03-11 17:16:37 UTC
  • mfrom: (0.3.4 upstream) (0.4.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100311171637-43z64ia3ccpj8vqn
Tags: 3.1.4-dfsg-2ubuntu1
* Merge from Debian unstable (LP: #528561), remaining changes:
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
  - Replace *-source packages with transitional packages for *-dkms
* Fix crash in vboxvideo_drm with kernel 2.6.33 / backported drm code
  (LP: #535297)
* Add a list of linux-headers packages to the apport hook
* Update debian/patches/u02-lp-integration.dpatch with a
  DEP-3 compliant header
* Add ${misc:Depends} to virtualbox-ose-source and virtualbox-ose-guest-source
  Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
# include <sys/socket.h>
39
39
# include <net/if.h>
40
40
# include <unistd.h>
41
 
# include <utmp.h>
 
41
# ifndef RT_OS_FREEBSD /* The header does not exist anymore since FreeBSD 9-current */
 
42
#  include <utmp.h>
 
43
# endif
42
44
# ifdef RT_OS_SOLARIS
43
45
#  include <sys/sockio.h>
44
46
# endif
174
176
    if (RT_SUCCESS(rc))
175
177
    {
176
178
        /* Write information to host. */
177
 
        rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "%s", pszAddVer);
178
 
        rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "%s", pszAddRev);
 
179
        rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "%s", pszAddVer);
 
180
        rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "%s", pszAddRev);
179
181
        RTStrFree(pszAddVer);
180
182
        RTStrFree(pszAddRev);
181
183
    }
218
220
            return 1;
219
221
        }
220
222
 
221
 
        PLUID pLuid = NULL;
222
 
        DWORD dwNumOfProcLUIDs = VBoxServiceVMInfoWinGetLUIDsFromProcesses(&pLuid);
223
 
 
224
 
        VBOXSERVICEVMINFOUSER userInfo;
225
 
        ZeroMemory (&userInfo, sizeof(VBOXSERVICEVMINFOUSER));
226
 
 
227
 
        for (int i = 0; i<(int)ulCount; i++)
 
223
        PVBOXSERVICEVMINFOPROC pProcs;
 
224
        DWORD dwNumProcs;
 
225
        rc = VBoxServiceVMInfoWinProcessesEnumerate(&pProcs, &dwNumProcs);
 
226
 
 
227
        for (ULONG i=0; i<ulCount; i++)
228
228
        {
229
 
            if (VBoxServiceVMInfoWinIsLoggedIn(&userInfo, &pSessions[i], pLuid, dwNumOfProcLUIDs))
 
229
            VBOXSERVICEVMINFOUSER userInfo;
 
230
            /* Leave the memory clearing *inside* the loop as VBoxServiceVMInfoWinIsLoggedIn
 
231
             * assumes the memory reserved for strings is zeroed.
 
232
             */
 
233
            ZeroMemory (&userInfo, sizeof(VBOXSERVICEVMINFOUSER));
 
234
 
 
235
            if (   VBoxServiceVMInfoWinIsLoggedIn(&userInfo, &pSessions[i])
 
236
                && VBoxServiceVMInfoWinSessionGetProcessCount(&pSessions[i], pProcs, dwNumProcs) > 0)
230
237
            {
231
238
                if (uiUserCount > 0)
232
239
                    strcat (szUserList, ",");
239
246
            }
240
247
        }
241
248
 
242
 
        if (NULL != pLuid)
243
 
            ::LocalFree (pLuid);
244
 
 
 
249
        VBoxServiceVMInfoWinProcessesFree(pProcs);
245
250
        ::LsaFreeReturnBuffer(pSessions);
246
251
# endif /* TARGET_NT4 */
247
252
#elif defined(RT_OS_FREEBSD)