VirtualBox

Changeset 38310 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 4, 2011 12:16:59 PM (14 years ago)
Author:
vboxsync
Message:

Reverted accidental commit in r73297, fixed debug logging.

Location:
trunk/src/VBox/Additions/WINNT/VBoxGINA
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/Helper.cpp

    r38290 r38310  
    1717
    1818#include <windows.h>
    19 #ifndef TARGET_NT4
    20 # include <Wtsapi32.h>
    21 #endif
    2219#include "winwlx.h"
    2320#include "Helper.h"
     
    6259bool isRemoteSession(void)
    6360{
    64     bool fIsRemote = false;
    65 
    66 #if 0
    67 #ifndef TARGET_NT4
    68     WTS_SESSION_INFO *pSessionInfo = NULL;
    69     DWORD dwSessions;
    70     if (WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE,
    71                              0 /* Reserved */,
    72                              1 /* Version */,
    73                              &pSessionInfo,
    74                              &dwSessions))
    75     {
    76         DWORD dwRemoteSessions = 0;
    77         for (DWORD i = 0; i < dwSessions; i++)
    78         {
    79             switch (pSessionInfo[i].State)
    80             {
    81                 case WTSConnected:
    82                 case WTSActive:
    83                 {
    84                     LPTSTR pBuffer;
    85                     DWORD cbBuffer;
    86                     if (  WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
    87                                                      pSessionInfo[i].SessionId,
    88                                                      WTSClientProtocolType,
    89                                                      &pBuffer, &cbBuffer)
    90                         && pBuffer
    91                         && cbBuffer)
    92                     {
    93                         USHORT uProto = (USHORT)(pBuffer);
    94                         /* Only count RDP sessions -- these are the ones we're
    95                          * interested in here. */
    96                         if (uProto == WTS_PROTOCOL_TYPE_RDP)
    97                             dwRemoteSessions++;
    98                         WTSFreeMemory(pBuffer);
    99 #ifndef DEBUG
    100                         if (dwRemoteSessions) /* Bail out as soon as possible. */
    101                             break;
    102 #endif
    103                     }
    104                     break;
    105                 }
    106 
    107                 default:
    108                     break;
    109             }
    110         }
    111 
    112 #ifdef DEBUG
    113         Log(("VBoxGINA: %s connections detected\n",
    114              dwRemoteSessions ? "RDP" : "No RDP"));
    115 #endif
    116         if (pSessionInfo)
    117             WTSFreeMemory(pSessionInfo);
    118 
    119         if (dwSessions)
    120             fIsRemote = true;
    121     }
    122 #endif
    123 #else
    124     LPTSTR pBuffer;
    125     DWORD cbBuffer;
    126     if (  WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
    127                                      WTS_CURRENT_SESSION,
    128                                      WTSClientProtocolType,
    129                                      &pBuffer, &cbBuffer)
    130         && pBuffer
    131         && cbBuffer)
    132     {
    133         USHORT uProto = (USHORT)(pBuffer);
    134         /* Only count RDP sessions -- these are the ones we're
    135          * interested in here. */
    136         fIsRemote = uProto == WTS_PROTOCOL_TYPE_RDP;
    137         WTSFreeMemory(pBuffer);
    138     }
    139     else
    140         Log(("VBoxGINA: Error %ld querying session information\n",
    141              GetLastError()));
    142 #endif
    143 
    144 #ifdef DEBUG
    145     Log(("VBoxGINA: Is remote session: %s\n",
    146          fIsRemote ? "Yes" : "No"));
    147 #endif
    148     return fIsRemote;
     61    return (0 != GetSystemMetrics(SM_REMOTESESSION)) ? true : false;
    14962}
    15063
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/Makefile.kmk

    r38290 r38310  
    55
    66#
    7 # Copyright (C) 2006-2007 Oracle Corporation
     7# Copyright (C) 2006-2011 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121DLLS += VBoxGINA
    2222VBoxGINA_TEMPLATE = VBOXGUESTR3DLL
    23 VBoxGINA_DEFS     = UNICODE LOG_TO_BACKDOOR VBGL_VBOXGUEST VBOX_WITH_HGCM
     23VBoxGINA_DEFS     = UNICODE VBGL_VBOXGUEST VBOX_WITH_HGCM
     24ifdef DEBUG_andy
     25 VBoxGINA_DEFS   += LOG_ENABLED
     26endif
    2427VBoxGINA_SOURCES  = \
    2528        VBoxGINA.cpp \
     
    3134        $(VBOX_LIB_IPRT_GUEST_R3) \
    3235        $(VBOX_LIB_VBGL_R3)
    33 ifndef TARGET_NT4
    34  VBoxGINA_LIBS   += \
    35         WtsApi32.lib
    36 endif
    3736
    3837include $(KBUILD_PATH)/subfooter.kmk
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.h

    r30852 r38310  
    44
    55/*
    6  * Copyright (C) 2006-2010 Oracle Corporation
     6 * Copyright (C) 2006-2011 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1919
    2020#include <iprt/initterm.h>
     21
     22#define LOG_GROUP LOG_GROUP_AUTOLOGON
    2123#include <VBox/log.h>
    2224
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