VirtualBox

Ignore:
Timestamp:
Jul 20, 2022 7:33:58 PM (3 years ago)
Author:
vboxsync
Message:

VBoxControl: Avoid _strnicmp, use RTUtf16NICmpAscii instead. bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r95326 r95763  
    605605    }
    606606
    607     DWORD xres = atoi(argv[0]);
    608     DWORD yres = atoi(argv[1]);
    609     DWORD bpp  = atoi(argv[2]);
     607    DWORD xres = RTStrToUInt32(argv[0]);
     608    DWORD yres = RTStrToUInt32(argv[1]);
     609    DWORD bpp  = RTStrToUInt32(argv[2]);
    610610    DWORD scr  = 0;
    611611    if (argc == 4)
    612         scr = atoi(argv[3]);
     612        scr = RTStrToUInt32(argv[3]);
    613613
    614614    HMODULE hmodUser = GetModuleHandle("user32.dll");
     
    720720    for (iDevice = 0; iDevice < cDevices; iDevice++)
    721721    {
    722         char szValueName[64];
    723         RTStrPrintf(szValueName, sizeof(szValueName), "\\Device\\Video%u", adwObjectNumberList[iDevice]);
    724 
    725         char szVideoLocation[256];
    726         cbValue = sizeof(szVideoLocation);
    727         status = RegQueryValueExA(hkeyDeviceMap, szValueName, NULL, &dwKeyType, (LPBYTE)&szVideoLocation[0], &cbValue);
     722        RTUTF16 wszValueName[64];
     723        RTUtf16Printf(wszValueName, RT_ELEMENTS(wszValueName), "\\Device\\Video%u", adwObjectNumberList[iDevice]);
     724
     725        RTUTF16 wszVideoLocation[256];
     726        cbValue = sizeof(wszVideoLocation);
     727        status = RegQueryValueExW(hkeyDeviceMap, wszValueName, NULL, &dwKeyType, (LPBYTE)&wszVideoLocation[0], &cbValue);
    728728
    729729        /* This value starts with '\REGISTRY\Machine' */
    730730        if (   status == ERROR_SUCCESS
    731731            && dwKeyType == REG_SZ
    732             && _strnicmp(szVideoLocation, "\\REGISTRY\\Machine", 17) == 0)
    733         {
    734             status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, &szVideoLocation[18], 0,
     732            && RTUtf16NICmpAscii(wszVideoLocation, RT_STR_TUPLE("\\REGISTRY\\Machine")) == 0)
     733        {
     734            status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, &wszVideoLocation[18], 0,
    735735                                   KEY_READ | (writable ? KEY_WRITE : 0), &hkeyVideo);
    736736            if (status == ERROR_SUCCESS)
     
    10841084    }
    10851085
    1086     DWORD xres = atoi(argv[0]);
    1087     DWORD yres = atoi(argv[1]);
    1088     DWORD bpp  = atoi(argv[2]);
     1086    DWORD xres = RTStrToUInt32(argv[0]);
     1087    DWORD yres = RTStrToUInt32(argv[1]);
     1088    DWORD bpp  = RTStrToUInt32(argv[2]);
    10891089
    10901090    /** @todo better check including xres mod 8 = 0! */
     
    11451145    }
    11461146
    1147     DWORD xres = atoi(argv[0]);
    1148     DWORD yres = atoi(argv[1]);
    1149     DWORD bpp  = atoi(argv[2]);
     1147    DWORD xres = RTStrToUInt32(argv[0]);
     1148    DWORD yres = RTStrToUInt32(argv[1]);
     1149    DWORD bpp  = RTStrToUInt32(argv[2]);
    11501150
    11511151    HKEY hkeyVideo = getVideoKey(true);
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