VirtualBox

Changeset 26073 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jan 27, 2010 3:06:32 PM (15 years ago)
Author:
vboxsync
Message:

Unicode terminator is two bytes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp

    r26072 r26073  
    208208        usBuffer = (sessionData->UserName).Buffer;
    209209        iLength = (sessionData->UserName).Length;
    210         if (iLength > sizeof(a_pUserInfo->szUser) - sizeof(TCHAR))   /* -sizeof(TCHAR) because we have to add the terminating null char at the end later. */
     210        if (iLength > sizeof(a_pUserInfo->szUser) - sizeof(WCHAR))   /* -sizeof(WCHAR) because we have to add the terminating null char at the end later. */
    211211        {
    212212            VBoxServiceVerbose(0, "User name too long (%d bytes) for buffer! Name will be truncated.\n", iLength);
    213             iLength = sizeof(a_pUserInfo->szUser) - sizeof(TCHAR);
     213            iLength = sizeof(a_pUserInfo->szUser) - sizeof(WCHAR);
    214214        }
    215215        wcsncpy (a_pUserInfo->szUser, usBuffer, iLength);
     
    218218        usBuffer = (sessionData->AuthenticationPackage).Buffer;
    219219        iLength = (sessionData->AuthenticationPackage).Length;
    220         if (iLength > sizeof(a_pUserInfo->szAuthenticationPackage) - sizeof(TCHAR))   /* -sizeof(TCHAR) because we have to add the terminating null char at the end later. */
     220        if (iLength > sizeof(a_pUserInfo->szAuthenticationPackage) - sizeof(WCHAR))   /* -sizeof(WCHAR) because we have to add the terminating null char at the end later. */
    221221        {
    222222            VBoxServiceVerbose(0, "Authentication pkg name too long (%d bytes) for buffer! Name will be truncated.\n", iLength);
    223             iLength = sizeof(a_pUserInfo->szAuthenticationPackage) - sizeof(TCHAR);
     223            iLength = sizeof(a_pUserInfo->szAuthenticationPackage) - sizeof(WCHAR);
    224224        }
    225225        if (iLength)
    226         {
    227226            wcsncpy (a_pUserInfo->szAuthenticationPackage, usBuffer, iLength);
    228         }
    229227
    230228        /* Get logon domain. */
    231229        usBuffer = (sessionData->LogonDomain).Buffer;
    232230        iLength = (sessionData->LogonDomain).Length;
    233         if (iLength > sizeof(a_pUserInfo->szLogonDomain) - sizeof(TCHAR))   /* -sizeof(TCHAR) because we have to add the terminating null char at the end later. */
     231        if (iLength > sizeof(a_pUserInfo->szLogonDomain) - sizeof(WCHAR))   /* -sizeof(WCHAR) because we have to add the terminating null char at the end later. */
    234232        {
    235233            VBoxServiceVerbose(0, "Logon domain name too long (%d bytes) for buffer! Name will be truncated.\n", iLength);
    236             iLength = sizeof(a_pUserInfo->szLogonDomain) - sizeof(TCHAR);
     234            iLength = sizeof(a_pUserInfo->szLogonDomain) - sizeof(WCHAR);
    237235        }
    238236        if (iLength)
    239         {
    240237            wcsncpy (a_pUserInfo->szLogonDomain, usBuffer, iLength);
    241         }
    242238
    243239        /* Only handle users which can login interactively or logged in remotely over native RDP. */
Note: See TracChangeset for help on using the changeset viewer.

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