VirtualBox

Ignore:
Timestamp:
Jul 27, 2022 8:01:09 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152599
Message:

Add/Nt/VBoxGINA: Made it build in VBOX_WITH_NOCRT_STATIC mode. bugref:10261

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

Legend:

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

    r93115 r95874  
    1616 */
    1717
     18/*********************************************************************************************************************************
     19*   Header Files                                                                                                                 *
     20*********************************************************************************************************************************/
    1821#include <iprt/win/windows.h>
    19 #include <stdio.h>      /* Needed for swprintf() */
    2022
    2123#include <VBox/VBoxGuestLib.h>
    2224#include <iprt/errcore.h>
     25#include <iprt/utf16.h>
    2326
    2427#include "Dialog.h"
     
    2831
    2932
     33/*********************************************************************************************************************************
     34*   Defined Constants And Macros                                                                                                 *
     35*********************************************************************************************************************************/
    3036/*
    3137 * Dialog IDs for legacy Windows OSes (e.g. NT 4.0).
     
    8591#define IDT_LOCKEDDLG_POLL                IDT_BASE + 2
    8692
     93
     94/*********************************************************************************************************************************
     95*   Global Variables                                                                                                             *
     96*********************************************************************************************************************************/
    8797static DLGPROC g_pfnWlxLoggedOutSASDlgProc = NULL;
    8898static DLGPROC g_pfnWlxLockedSASDlgProc = NULL;
     
    90100static PWLX_DIALOG_BOX_PARAM g_pfnWlxDialogBoxParam = NULL;
    91101
     102
     103/*********************************************************************************************************************************
     104*   Internal Functions                                                                                                           *
     105*********************************************************************************************************************************/
    92106int WINAPI MyWlxDialogBoxParam (HANDLE, HANDLE, LPWSTR, HWND, DLGPROC, LPARAM);
     107
    93108
    94109void hookDialogBoxes(PVOID pWinlogonFunctions, DWORD dwWlxVersion)
     
    190205             *
    191206             */
    192             size_t l = wcslen(pwszDomain);
     207            size_t l = RTUtf16Len(pwszDomain);
    193208            if (l > 255)
    194209                VBoxGINAVerbose(0, "VBoxGINA::MyWlxLoggedOutSASDlgProc: Warning! FQDN (domain) is too long (max 255 bytes), will be truncated!\n");
    195210
    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 */
    197212            {
    198213                if (l > 16) /* Domain name is longer than 16 chars, cannot be a NetBIOS name anymore */
     
    202217                }
    203218                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 */
    205220                {
    206221                    VBoxGINAVerbose(0, "VBoxGINA::MyWlxLoggedOutSASDlgProc: Domain seems to be a FQDN (dot)!\n");
     
    210225                if (bIsFQDN)
    211226                {
    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);
    213228                    VBoxGINAVerbose(0, "VBoxGINA::MyWlxLoggedOutSASDlgProc: FQDN user name is now: %s!\n", szUserFQDN);
    214229                }
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp

    r93115 r95874  
    1616 */
    1717
    18 #include <stdio.h>
    19 #include <stdlib.h>
     18
     19/*********************************************************************************************************************************
     20*   Header Files                                                                                                                 *
     21*********************************************************************************************************************************/
    2022#include <iprt/win/windows.h>
    2123
     
    3234#include "Dialog.h"
    3335
    34 /*
    35  * Global variables.
    36  */
    37 
     36/*********************************************************************************************************************************
     37*   Global Variables                                                                                                             *
     38*********************************************************************************************************************************/
    3839/** DLL instance handle. */
    3940HINSTANCE hDllInstance;
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/testcase/tstVBoxGINA.cpp

    r93115 r95874  
    1616 */
    1717
    18 #define UNICODE
    1918#include <iprt/win/windows.h>
    20 #include <stdio.h>
     19#include <iprt/stream.h>
    2120
    2221int main()
     
    2423    DWORD dwErr;
    2524
    26     /**
     25    /*
    2726     * Be sure that:
    2827     * - the debug VBoxGINA gets loaded instead of a maybe installed
     
    3130
    3231    HMODULE hMod = LoadLibraryW(L"VBoxGINA.dll");
    33     if (!hMod)
     32    if (hMod)
    3433    {
    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");
    4135
    4236        FARPROC pfnDebug = GetProcAddress(hMod, "VBoxGINADebug");
    4337        if (!pfnDebug)
    4438        {
    45             dwErr = GetLastError();
    46             wprintf(L"Could not load VBoxGINADebug, error=%ld\n", dwErr);
     39            RTPrintf("Calling VBoxGINA ...\n");
     40            dwErr = pfnDebug();
    4741        }
    4842        else
    4943        {
    50             wprintf(L"Calling VBoxGINA ...\n");
    51             dwErr = pfnDebug();
     44            dwErr = GetLastError();
     45            RTPrintf("Could not load VBoxGINADebug, error=%u\n", dwErr);
    5246        }
    5347
    5448        FreeLibrary(hMod);
    5549    }
     50    else
     51    {
     52        dwErr = GetLastError();
     53        RTPrintf("VBoxGINA.dll not found, error=%u\n", dwErr);
     54    }
    5655
    57     wprintf(L"Test returned: %ld\n", dwErr);
    58 
     56    RTPrintf("Test returned: %s (%u)\n", dwErr == ERROR_SUCCESS ? "SUCCESS" : "FAILURE", dwErr);
    5957    return dwErr == ERROR_SUCCESS ? 0 : 1;
    6058}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette