Changeset 36453 in vbox for trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProv.cpp
- Timestamp:
- Mar 29, 2011 8:01:56 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProv.cpp
r32431 r36453 7 7 // Copyright (c) 2006 Microsoft Corporation. All rights reserved. 8 8 // 9 // Modifications (c) 2009-201 0Oracle Corporation9 // Modifications (c) 2009-2011 Oracle Corporation 10 10 // 11 11 … … 25 25 m_pCred(NULL), 26 26 m_pCredProvEvents(NULL), 27 m_fGotCredentials(false) 27 m_fGotCredentials(false), 28 m_fHandleRemoteSessions(false) 28 29 { 29 30 LONG l = DllAddRef(); … … 69 70 70 71 72 /** 73 * Loads the global configuration from registry. 74 * 75 * @return DWORD Windows error code. 76 */ 77 DWORD VBoxCredProv::LoadConfiguration(void) 78 { 79 HKEY hKey; 80 /** @todo Add some registry wrapper function(s) as soon as we got more values to retrieve. */ 81 DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Oracle\\VirtualBox Guest Additions\\AutoLogon", 82 0L, KEY_QUERY_VALUE, &hKey); 83 if (dwRet == ERROR_SUCCESS) 84 { 85 DWORD dwValue; 86 DWORD dwType = REG_DWORD; 87 DWORD dwSize = sizeof(DWORD); 88 89 dwRet = RegQueryValueEx(hKey, L"HandleRemoteSessions", NULL, &dwType, (LPBYTE)&dwValue, &dwSize); 90 if ( dwRet == ERROR_SUCCESS 91 && dwType == REG_DWORD 92 && dwSize == sizeof(DWORD)) 93 { 94 m_fHandleRemoteSessions = true; 95 } 96 RegCloseKey(hKey); 97 } 98 /* Do not report back an error here yet. */ 99 return ERROR_SUCCESS; 100 } 101 102 103 /** 104 * Determines whether we should handle the current session or not. 105 * 106 * @return bool true if we should handle this session, false if not. 107 */ 108 bool VBoxCredProv::HandleCurrentSession(void) 109 { 110 bool fHandle = false; 111 if (isRemoteSession()) 112 { 113 if (m_fHandleRemoteSessions) /* Force remote session handling. */ 114 fHandle = true; 115 } 116 else /* No remote session. */ 117 fHandle = true; 118 return fHandle; 119 } 120 121 71 122 /* 72 123 * SetUsageScenario is the provider's cue that it's going to be asked for tiles … … 79 130 UNREFERENCED_PARAMETER(dwFlags); 80 131 HRESULT hr; 132 DWORD dwErr; 81 133 82 134 m_cpUsageScenario = cpUsageScenario; … … 88 140 case CPUS_LOGON: 89 141 case CPUS_UNLOCK_WORKSTATION: 142 143 dwErr = LoadConfiguration(); 144 if (dwErr != ERROR_SUCCESS) 145 LogRel(("VBoxCredProv: Error while loading configuration, error=%ld\n", dwErr)); 146 /* Do not stop running on a misconfigured system. */ 147 148 /* 149 * If we're told to not handle the current session just bail out and let the 150 * user know. 151 */ 152 if (!HandleCurrentSession()) 153 { 154 LogRel(("VBoxCredProv: Handling of remote desktop sessions is disabled.\n")); 155 break; 156 } 90 157 91 158 if (m_pPoller == NULL)
Note:
See TracChangeset
for help on using the changeset viewer.