Changeset 95874 in vbox for trunk/src/VBox/Additions/WINNT/VBoxGINA
- Timestamp:
- Jul 27, 2022 8:01:09 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152599
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxGINA
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGINA/Dialog.cpp
r93115 r95874 16 16 */ 17 17 18 /********************************************************************************************************************************* 19 * Header Files * 20 *********************************************************************************************************************************/ 18 21 #include <iprt/win/windows.h> 19 #include <stdio.h> /* Needed for swprintf() */20 22 21 23 #include <VBox/VBoxGuestLib.h> 22 24 #include <iprt/errcore.h> 25 #include <iprt/utf16.h> 23 26 24 27 #include "Dialog.h" … … 28 31 29 32 33 /********************************************************************************************************************************* 34 * Defined Constants And Macros * 35 *********************************************************************************************************************************/ 30 36 /* 31 37 * Dialog IDs for legacy Windows OSes (e.g. NT 4.0). … … 85 91 #define IDT_LOCKEDDLG_POLL IDT_BASE + 2 86 92 93 94 /********************************************************************************************************************************* 95 * Global Variables * 96 *********************************************************************************************************************************/ 87 97 static DLGPROC g_pfnWlxLoggedOutSASDlgProc = NULL; 88 98 static DLGPROC g_pfnWlxLockedSASDlgProc = NULL; … … 90 100 static PWLX_DIALOG_BOX_PARAM g_pfnWlxDialogBoxParam = NULL; 91 101 102 103 /********************************************************************************************************************************* 104 * Internal Functions * 105 *********************************************************************************************************************************/ 92 106 int WINAPI MyWlxDialogBoxParam (HANDLE, HANDLE, LPWSTR, HWND, DLGPROC, LPARAM); 107 93 108 94 109 void hookDialogBoxes(PVOID pWinlogonFunctions, DWORD dwWlxVersion) … … 190 205 * 191 206 */ 192 size_t l = wcslen(pwszDomain);207 size_t l = RTUtf16Len(pwszDomain); 193 208 if (l > 255) 194 209 VBoxGINAVerbose(0, "VBoxGINA::MyWlxLoggedOutSASDlgProc: Warning! FQDN (domain) is too long (max 255 bytes), will be truncated!\n"); 195 210 196 if ( wcslen(pwszUser) > 0) /* We need a user name that we can use in caes of a FQDN */211 if (*pwszUser) /* We need a user name that we can use in caes of a FQDN */ 197 212 { 198 213 if (l > 16) /* Domain name is longer than 16 chars, cannot be a NetBIOS name anymore */ … … 202 217 } 203 218 else if ( l > 0 204 && wcsstr(pwszDomain, L".") != NULL) /* if we found a dot (.) in the domain name, this has to be a FQDN */219 && RTUtf16Chr(pwszDomain, L'.') != NULL) /* if we found a dot (.) in the domain name, this has to be a FQDN */ 205 220 { 206 221 VBoxGINAVerbose(0, "VBoxGINA::MyWlxLoggedOutSASDlgProc: Domain seems to be a FQDN (dot)!\n"); … … 210 225 if (bIsFQDN) 211 226 { 212 swprintf(szUserFQDN, sizeof(szUserFQDN) / sizeof(wchar_t), L"%s@%s", pwszUser, pwszDomain);227 RTUtf16Printf(szUserFQDN, sizeof(szUserFQDN) / sizeof(wchar_t), "%ls@%ls", pwszUser, pwszDomain); 213 228 VBoxGINAVerbose(0, "VBoxGINA::MyWlxLoggedOutSASDlgProc: FQDN user name is now: %s!\n", szUserFQDN); 214 229 } -
trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp
r93115 r95874 16 16 */ 17 17 18 #include <stdio.h> 19 #include <stdlib.h> 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 20 22 #include <iprt/win/windows.h> 21 23 … … 32 34 #include "Dialog.h" 33 35 34 /* 35 * Global variables. 36 */ 37 36 /********************************************************************************************************************************* 37 * Global Variables * 38 *********************************************************************************************************************************/ 38 39 /** DLL instance handle. */ 39 40 HINSTANCE hDllInstance; -
trunk/src/VBox/Additions/WINNT/VBoxGINA/testcase/tstVBoxGINA.cpp
r93115 r95874 16 16 */ 17 17 18 #define UNICODE19 18 #include <iprt/win/windows.h> 20 #include < stdio.h>19 #include <iprt/stream.h> 21 20 22 21 int main() … … 24 23 DWORD dwErr; 25 24 26 /* *25 /* 27 26 * Be sure that: 28 27 * - the debug VBoxGINA gets loaded instead of a maybe installed … … 31 30 32 31 HMODULE hMod = LoadLibraryW(L"VBoxGINA.dll"); 33 if ( !hMod)32 if (hMod) 34 33 { 35 dwErr = GetLastError(); 36 wprintf(L"VBoxGINA.dll not found, error=%ld\n", dwErr); 37 } 38 else 39 { 40 wprintf(L"VBoxGINA found\n"); 34 RTPrintf("VBoxGINA found\n"); 41 35 42 36 FARPROC pfnDebug = GetProcAddress(hMod, "VBoxGINADebug"); 43 37 if (!pfnDebug) 44 38 { 45 dwErr = GetLastError();46 wprintf(L"Could not load VBoxGINADebug, error=%ld\n", dwErr);39 RTPrintf("Calling VBoxGINA ...\n"); 40 dwErr = pfnDebug(); 47 41 } 48 42 else 49 43 { 50 wprintf(L"Calling VBoxGINA ...\n");51 dwErr = pfnDebug();44 dwErr = GetLastError(); 45 RTPrintf("Could not load VBoxGINADebug, error=%u\n", dwErr); 52 46 } 53 47 54 48 FreeLibrary(hMod); 55 49 } 50 else 51 { 52 dwErr = GetLastError(); 53 RTPrintf("VBoxGINA.dll not found, error=%u\n", dwErr); 54 } 56 55 57 wprintf(L"Test returned: %ld\n", dwErr); 58 56 RTPrintf("Test returned: %s (%u)\n", dwErr == ERROR_SUCCESS ? "SUCCESS" : "FAILURE", dwErr); 59 57 return dwErr == ERROR_SUCCESS ? 0 : 1; 60 58 }
Note:
See TracChangeset
for help on using the changeset viewer.