Ignore:
Timestamp:
Dec 2, 2002, 10:34:46 AM (23 years ago)
Author:
sandervl
Message:

Convert command line from OS/2 to Windows codepage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/wprocess.cpp

    r9262 r9449  
    1 /* $Id: wprocess.cpp,v 1.159 2002-09-18 10:58:48 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.160 2002-12-02 09:34:46 sandervl Exp $ */
    22
    33/*
     
    13981398    if (rc == NO_ERROR)
    13991399    {
    1400       // PH 2002-04-11
    1401       // Note: intentional memory leak, pszCmdLineW will not be freed
    1402       // or allocated after process startup
     1400        // PH 2002-04-11
     1401        // Note: intentional memory leak, pszCmdLineW will not be freed
     1402        // or allocated after process startup
     1403        cch = strlen(pszCmdLineA) + 1;
     1404
    14031405        pszCmdLineW = (WCHAR*)malloc(cch * 2);
    1404         if (pszCmdLineW != NULL)
    1405             AsciiToUnicode(pszCmdLineA, (WCHAR*)pszCmdLineW);
     1406        if (pszCmdLineW != NULL) {
     1407            //Translate from OS/2 to Windows codepage & ascii to unicode
     1408            MultiByteToWideChar(CP_OEMCP, 0, pszCmdLineA, -1, (LPWSTR)pszCmdLineW, cch-1);
     1409            ((LPWSTR)pszCmdLineW)[cch-1] = 0;
     1410
     1411            //ascii command line is still in OS/2 codepage, so convert it
     1412            WideCharToMultiByte(CP_ACP, 0, pszCmdLineW, -1, (LPSTR)pszCmdLineA, cch-1, 0, NULL);
     1413            ((LPSTR)pszCmdLineA)[cch-1] = 0;
     1414        }
    14061415        else
    14071416        {
     1417            DebugInt3();
    14081418            dprintf(("KERNEL32: InitCommandLine(%p): malloc(%d) failed (2)\n", pszPeExe, cch));
    14091419            rc = ERROR_NOT_ENOUGH_MEMORY;
Note: See TracChangeset for help on using the changeset viewer.