Changeset 36446 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Mar 28, 2011 9:42:12 AM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxGINA
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGINA/Helper.cpp
r30853 r36446 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #include <VBox/VMMDev.h> 25 25 #include <iprt/string.h> 26 27 /* remote session handling */ 28 DWORD g_dwHandleRemoteSessions = 0; 26 29 27 30 /* the credentials */ … … 49 52 } 50 53 54 /** 55 * Detects whether our process is running in a remote session or not. 56 * 57 * @return bool true if running in a remote session, false if not. 58 */ 59 bool isRemoteSession(void) 60 { 61 return (0 != GetSystemMetrics(SM_REMOTESESSION)) ? true : false; 62 } 63 64 /** 65 * Loads the global configuration from registry. 66 * 67 * @return DWORD Windows error code. 68 */ 69 DWORD loadConfiguration(void) 70 { 71 HKEY hKey; 72 /** @todo Add some registry wrapper function(s) as soon as we got more values to retrieve. */ 73 DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Oracle\\VirtualBox Guest Additions\\AutoLogon", 74 0L, KEY_QUERY_VALUE, &hKey); 75 if (dwRet == ERROR_SUCCESS) 76 { 77 DWORD dwValue; 78 DWORD dwType = REG_DWORD; 79 DWORD dwSize = sizeof(DWORD); 80 81 dwRet = RegQueryValueEx(hKey, L"HandleRemoteSessions", NULL, &dwType, (LPBYTE)&dwValue, &dwSize); 82 if ( dwRet == ERROR_SUCCESS 83 && dwType == REG_DWORD 84 && dwSize == sizeof(DWORD)) 85 { 86 g_dwHandleRemoteSessions = dwValue; 87 } 88 RegCloseKey(hKey); 89 } 90 return dwRet; 91 } 92 93 /** 94 * Determines whether we should handle the current session or not. 95 * 96 * @return bool true if we should handle this session, false if not. 97 */ 98 bool handleCurrentSession(void) 99 { 100 bool fHandle = false; 101 if (isRemoteSession()) 102 { 103 if (g_dwHandleRemoteSessions) /* Force remote session handling. */ 104 fHandle = true; 105 } 106 else /* No remote session. */ 107 fHandle = true; 108 return fHandle; 109 } 110 51 111 void credentialsReset(void) 52 112 { … … 58 118 bool credentialsAvailable(void) 59 119 { 120 if (!handleCurrentSession()) 121 return false; 122 60 123 HANDLE vboxDriver = getVBoxDriver(); 61 124 if (vboxDriver == INVALID_HANDLE_VALUE) … … 80 143 bool credentialsRetrieve(void) 81 144 { 145 if (!handleCurrentSession()) 146 return false; 147 82 148 Log(("VBoxGINA::credentialsRetrieve\n")); 83 149 … … 161 227 bool credentialsPollerCreate(void) 162 228 { 229 if (!handleCurrentSession()) 230 return false; 231 163 232 Log(("VBoxGINA::credentialsPollerCreate\n")); 164 233 -
trunk/src/VBox/Additions/WINNT/VBoxGINA/Helper.h
r30852 r36446 4 4 5 5 /* 6 * Copyright (C) 2006-201 0Oracle Corporation6 * Copyright (C) 2006-2011 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 26 extern wchar_t g_Domain[]; 27 27 28 DWORD loadConfiguration(); 29 bool handleCurrentSession(void); 30 28 31 void credentialsReset(void); 29 32 bool credentialsAvailable(void); -
trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp
r36283 r36446 112 112 #endif 113 113 114 Log(("VBoxGINA::WlxNegotiate: dwWinlogonVersion: %d\n", dwWinlogonVersion)); 115 116 /* load the standard Microsoft GINA DLL */ 114 Log(("VBoxGINA::WlxNegotiate: dwWinlogonVersion: %ld\n", dwWinlogonVersion)); 115 116 /* Load global configuration from registry. */ 117 DWORD dwRet = loadConfiguration(); 118 if (ERROR_SUCCESS != dwRet) 119 Log(("VBoxGINA: Error loading global configuration, error=%ld\n", dwRet)); 120 121 /* If we have a remote session (that is, a connection via remote desktop / 122 * terminal services) deny it if not specified explicitly. */ 123 if (!handleCurrentSession()) 124 Log(("VBoxGINA: Handling of remote desktop sessions is disabled.\n")); 125 126 /* Load the standard Microsoft GINA DLL. */ 117 127 if (!(hDll = LoadLibrary(TEXT("MSGINA.DLL")))) 118 128 { 119 Log(("VBoxGINA::WlxNegotiate: failed loading MSGINA! last error = %d\n", GetLastError()));129 Log(("VBoxGINA::WlxNegotiate: failed loading MSGINA! Last error=%ld\n", GetLastError())); 120 130 return FALSE; 121 131 } … … 444 454 * GINA 1.3 entry points 445 455 */ 446 BOOL WINAPI WlxNetworkProviderLoad 456 BOOL WINAPI WlxNetworkProviderLoad(PVOID pWlxContext, PWLX_MPR_NOTIFY_INFO pNprNotifyInfo) 447 457 { 448 458 Log(("VBoxGINA::WlxNetworkProviderLoad\n"));
Note:
See TracChangeset
for help on using the changeset viewer.