VirtualBox

Changeset 93640 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 7, 2022 2:02:44 PM (3 years ago)
Author:
vboxsync
Message:

Runtime: bugref:9955: Added conversion from console codepage to UTF-8 in Windows needed for proper handling the password containing national characters from console.

Location:
trunk/src/VBox/Runtime/r3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/utf8-posix.cpp

    r93544 r93640  
    693693}
    694694
     695
     696RTR3DECL(int)  RTStrConsoleCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag)
     697{
     698    return RTStrCurrentCPToUtf8Tag(ppszString, pszString, pszTag);
     699}
  • trunk/src/VBox/Runtime/r3/win/utf8-win.cpp

    r93115 r93640  
    117117}
    118118
    119 
    120 RTR3DECL(int)  RTStrCurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag)
     119static int rtStrCPToUtf8Tag(char **ppszString, const char *pszString, uint32_t uCodePage, const char *pszTag)
    121120{
    122121    Assert(ppszString);
     
    143142     */
    144143    int rc;
    145     int cwc = MultiByteToWideChar(CP_ACP, 0, pszString, -1, NULL, 0);
     144    int cwc = MultiByteToWideChar((UINT)uCodePage, 0, pszString, -1, NULL, 0);
    146145    if (cwc > 0)
    147146    {
     
    155154             * Do the translation.
    156155             */
    157             if (MultiByteToWideChar(CP_ACP, 0, pszString, -1, pwszString, cwc) > 0)
     156            if (MultiByteToWideChar((UINT)uCodePage, 0, pszString, -1, pwszString, cwc) > 0)
    158157            {
    159158                /*
     
    183182}
    184183
     184
     185RTR3DECL(int)  RTStrCurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag)
     186{
     187    return rtStrCPToUtf8Tag(ppszString, pszString, CP_ACP, pszTag);
     188}
     189
     190
     191RTR3DECL(int)  RTStrConsoleCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag)
     192{
     193    return rtStrCPToUtf8Tag(ppszString, pszString, GetConsoleCP(), pszTag);
     194}
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