Changeset 62785 in vbox for trunk/src/VBox
- Timestamp:
- Aug 1, 2016 6:56:28 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/auth/winlogon/winlogon.cpp
r62679 r62785 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VirtualBox External Authentication Library: 4 * Windows Logon Authentication. 3 * VirtualBox External Authentication Library - Windows Logon Authentication. 5 4 */ 6 5 … … 21 20 22 21 #include <iprt/win/windows.h> 23 24 22 #include <VBox/VBoxAuth.h> 23 #include <iprt/cdefs.h> 25 24 26 25 #ifdef AUTH_DEBUG 27 # include <stdio.h>26 # include <stdio.h> 28 27 29 28 static void dprintfw(const WCHAR *fmt, ...) … … 40 39 va_end(va); 41 40 } 42 # define DBGAUTH(a) dprintfw a41 # define DBGAUTH(a) dprintfw a 43 42 #else 44 # define DBGAUTH(a)43 # define DBGAUTH(a) 45 44 #endif 46 45 47 static WCHAR swszEmpty[] = { L"" };46 static WCHAR g_wszEmpty[] = { L"" }; 48 47 49 48 static void freeWideChar(WCHAR *pwszString) 50 49 { 51 if (pwszString && pwszString != & swszEmpty[0])50 if (pwszString && pwszString != &g_wszEmpty[0]) 52 51 { 53 52 size_t cb = (wcslen(pwszString) + 1) * sizeof(WCHAR); … … 63 62 */ 64 63 if (!pszString || *pszString == 0) 65 return & swszEmpty[0];64 return &g_wszEmpty[0]; 66 65 67 66 /* … … 98 97 } 99 98 99 /* Prototype it to make sure we've got the right prototype. */ 100 100 extern "C" 101 101 #if defined(_MSC_VER) 102 102 __declspec(dllexport) 103 103 #endif 104 AuthResult AUTHCALL AuthEntry (const char *szCaller, 105 PAUTHUUID pUuid, 106 AuthGuestJudgement guestJudgement, 107 const char *szUser, 108 const char *szPassword, 109 const char *szDomain, 110 int fLogon, 111 unsigned clientId) 104 FNAUTHENTRY3 AuthEntry; 105 106 /** 107 * @callback_method_impl{FNAUTHENTRY3} 108 */ 109 extern "C" 110 AuthResult AUTHCALL AuthEntry(const char *pszCaller, 111 PAUTHUUID pUuid, 112 AuthGuestJudgement guestJudgement, 113 const char *pszUser, 114 const char *pszPassword, 115 const char *pszDomain, 116 int fLogon, 117 unsigned clientId) 112 118 { 119 RT_NOREF4(pszCaller, pUuid, guestJudgement, clientId); 113 120 if (!fLogon) 114 121 { … … 117 124 } 118 125 119 LPWSTR lpwszUsername = utf8ToWideChar(szUser);120 LPWSTR lpwszDomain = utf8ToWideChar(szDomain);121 LPWSTR lpwszPassword = utf8ToWideChar(szPassword);126 LPWSTR pwszUsername = utf8ToWideChar(pszUser); 127 LPWSTR pwszDomain = utf8ToWideChar(pszDomain); 128 LPWSTR pwszPassword = utf8ToWideChar(pszPassword); 122 129 123 130 DBGAUTH((L"u[%ls], d[%ls], p[%ls]\n", lpwszUsername, lpwszDomain, lpwszPassword)); … … 125 132 AuthResult result = AuthResultAccessDenied; 126 133 127 if ( lpwszUsername && lpwszDomain && lpwszPassword)134 if (pwszUsername && pwszDomain && pwszPassword) 128 135 { 129 136 /* LOGON32_LOGON_INTERACTIVE is intended for users who will be interactively using the computer, … … 135 142 HANDLE hToken; 136 143 137 BOOL fSuccess = LogonUserW( lpwszUsername,138 lpwszDomain,139 lpwszPassword,144 BOOL fSuccess = LogonUserW(pwszUsername, 145 pwszDomain, 146 pwszPassword, 140 147 dwLogonType, 141 148 dwLogonProvider, … … 156 163 } 157 164 158 freeWideChar( lpwszUsername);159 freeWideChar( lpwszDomain);160 freeWideChar( lpwszPassword);165 freeWideChar(pwszUsername); 166 freeWideChar(pwszDomain); 167 freeWideChar(pwszPassword); 161 168 162 169 return result; 163 170 } 164 171 165 /* Verify the function prototype. */166 static PAUTHENTRY3 gpfnAuthEntry = AuthEntry;
Note:
See TracChangeset
for help on using the changeset viewer.