Changeset 83842 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video
- Timestamp:
- Apr 20, 2020 9:24:40 AM (5 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp
r83834 r83842 18 18 #include "VBoxMPCommon.h" 19 19 20 #ifndef DOXYGEN_RUNNING21 #if RT_MSC_PREREQ(RT_MSC_VER_VS2005) && !RT_MSC_PREREQ(RT_MSC_VER_VS2017) /* bird: MS fixed swprintf to be standard-conforming... */22 # define _INC_SWPRINTF_INL_23 extern "C" int __cdecl swprintf(wchar_t *, const wchar_t *, ...);24 # endif25 #endif26 #include <wchar.h>27 20 #include <VBoxVideoVBE.h> 21 #include <iprt/utf16.h> 28 22 29 23 #ifdef VBOX_WITH_WDDM … … 163 157 else 164 158 { 165 wchar_t keyname[32];166 swprintf(keyname, L"CustomXRes%d", iMode);167 rc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomXRes);159 wchar_t wszKeyName[32]; 160 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomXRes%d", iMode); 161 rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomXRes); 168 162 VBOXMP_WARN_VPS_NOBP(rc); 169 swprintf(keyname, L"CustomYRes%d", iMode);170 rc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomYRes);163 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomYRes%d", iMode); 164 rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomYRes); 171 165 VBOXMP_WARN_VPS_NOBP(rc); 172 swprintf(keyname, L"CustomBPP%d", iMode);173 rc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomBPP);166 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomBPP%d", iMode); 167 rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomBPP); 174 168 VBOXMP_WARN_VPS_NOBP(rc); 175 169 } … … 407 401 } 408 402 409 wchar_t keyname[24];403 wchar_t wszKeyName[24]; 410 404 uint32_t xres, yres, bpp = 0; 411 405 412 swprintf(keyname, L"CustomMode%dWidth", curKey);413 rc = VBoxMPCmnRegQueryDword(Registry, keyname, &xres);406 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dWidth", curKey); 407 rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &xres); 414 408 VBOXMP_CHECK_VPS_BREAK(rc); 415 409 416 swprintf(keyname, L"CustomMode%dHeight", curKey);417 rc = VBoxMPCmnRegQueryDword(Registry, keyname, &yres);410 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dHeight", curKey); 411 rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &yres); 418 412 VBOXMP_CHECK_VPS_BREAK(rc); 419 413 420 swprintf(keyname, L"CustomMode%dBPP", curKey);421 rc = VBoxMPCmnRegQueryDword(Registry, keyname, &bpp);414 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dBPP", curKey); 415 rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &bpp); 422 416 VBOXMP_CHECK_VPS_BREAK(rc); 423 417 … … 704 698 else 705 699 { 706 wchar_t keyname[32];707 swprintf(keyname, L"CustomXRes%d", iDisplay);708 rc = VBoxMPCmnRegSetDword(Registry, keyname, pMode->VisScreenWidth);700 wchar_t wszKeyName[32]; 701 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomXRes%d", iDisplay); 702 rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pMode->VisScreenWidth); 709 703 VBOXMP_WARN_VPS(rc); 710 swprintf(keyname, L"CustomYRes%d", iDisplay);711 rc = VBoxMPCmnRegSetDword(Registry, keyname, pMode->VisScreenHeight);704 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomYRes%d", iDisplay); 705 rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pMode->VisScreenHeight); 712 706 VBOXMP_WARN_VPS(rc); 713 swprintf(keyname, L"CustomBPP%d", iDisplay);714 rc = VBoxMPCmnRegSetDword(Registry, keyname, pMode->BitsPerPlane);707 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomBPP%d", iDisplay); 708 rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pMode->BitsPerPlane); 715 709 VBOXMP_WARN_VPS(rc); 716 710 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r83827 r83842 19 19 #include <VBoxVideoVBE.h> 20 20 #include <iprt/param.h> 21 #include < stdio.h>21 #include <iprt/utf16.h> 22 22 23 23 /* simple handle -> value table API */ … … 216 216 { 217 217 NTSTATUS Status = STATUS_SUCCESS; 218 PWCHAR pSuffix;219 218 const WCHAR* pKeyPrefix; 220 219 UINT cbKeyPrefix; … … 246 245 if (cbBuf >= cbResult) 247 246 { 248 wcscpy(pBuf, pKeyPrefix); 249 pSuffix = pBuf + (cbKeyPrefix-2)/2; 250 memcpy(pSuffix, pVGuid->Buffer, pVGuid->Length); 251 pSuffix += pVGuid->Length/2; 252 pSuffix[0] = L'\\'; 253 pSuffix += 1; 254 swprintf(pSuffix, L"%04d", VidPnSourceId); 247 ssize_t cwcFmt = RTUtf16Printf(pBuf, cbBuf / sizeof(WCHAR), "%ls%.*ls\\%04d", 248 pKeyPrefix, pVGuid->Length / sizeof(WCHAR), pVGuid->Buffer, VidPnSourceId); 249 Assert((size_t)cwcFmt + 1 == cbResult / sizeof(WCHAR)); RT_NOREF(cwcFmt); 255 250 } 256 251 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVModes.cpp
r82968 r83842 19 19 #include "common/VBoxMPCommon.h" 20 20 #include <iprt/param.h> /* PAGE_OFFSET_MASK */ 21 22 #include <stdio.h> /* for swprintf */ 21 #include <iprt/utf16.h> 22 23 23 24 24 … … 189 189 else 190 190 { 191 wchar_t keyname[32];192 swprintf(keyname, L"CustomXRes%d", u32Target);193 rc = VBoxMPCmnRegSetDword(Registry, keyname, pResolution->cx);191 wchar_t wszKeyName[32]; 192 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomXRes%d", u32Target); 193 rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pResolution->cx); 194 194 VBOXMP_WARN_VPS(rc); 195 swprintf(keyname, L"CustomYRes%d", u32Target);196 rc = VBoxMPCmnRegSetDword(Registry, keyname, pResolution->cy);195 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomYRes%d", u32Target); 196 rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pResolution->cy); 197 197 VBOXMP_WARN_VPS(rc); 198 swprintf(keyname, L"CustomBPP%d", u32Target);199 rc = VBoxMPCmnRegSetDword(Registry, keyname, 32); /* <- just in case for older driver usage */198 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomBPP%d", u32Target); 199 rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, 32); /* <- just in case for older driver usage */ 200 200 VBOXMP_WARN_VPS(rc); 201 201 } … … 337 337 else 338 338 { 339 wchar_t keyname[32];340 swprintf(keyname, L"CustomXRes%d", u32Target);341 vpRc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomXRes);339 wchar_t wszKeyName[32]; 340 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomXRes%d", u32Target); 341 vpRc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomXRes); 342 342 VBOXMP_WARN_VPS_NOBP(vpRc); 343 swprintf(keyname, L"CustomYRes%d", u32Target);344 vpRc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomYRes);343 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomYRes%d", u32Target); 344 vpRc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomYRes); 345 345 VBOXMP_WARN_VPS_NOBP(vpRc); 346 346 } … … 362 362 for (int curKey=0; curKey<128; curKey++) 363 363 { 364 wchar_t keyname[24];365 366 swprintf(keyname, L"CustomMode%dWidth", curKey);367 vpRc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomXRes);364 wchar_t wszKeyName[24]; 365 366 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dWidth", curKey); 367 vpRc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomXRes); 368 368 VBOXMP_CHECK_VPS_BREAK(vpRc); 369 369 370 swprintf(keyname, L"CustomMode%dHeight", curKey);371 vpRc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomYRes);370 RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dHeight", curKey); 371 vpRc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomYRes); 372 372 VBOXMP_CHECK_VPS_BREAK(vpRc); 373 373 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r83840 r83842 29 29 #include <iprt/param.h> 30 30 #include <iprt/initterm.h> 31 #include <iprt/utf16.h> 31 32 32 33 #include <VBox/VBoxGuestLib.h> … … 41 42 #include "gallium/VBoxMPGaWddm.h" 42 43 #endif 43 44 #include <stdio.h>45 44 46 45 #ifdef DEBUG … … 1093 1092 DWORD dwVal = VBOXWDDM_CFG_DRV_DEFAULT; 1094 1093 HANDLE hKey = NULL; 1095 WCHAR aNameBuf[100];1096 1094 1097 1095 Status = IoOpenDeviceRegistryKey(pDevExt->pPDO, PLUGPLAY_REGKEY_DRIVER, GENERIC_READ, &hKey); … … 1125 1123 else if (hKey) 1126 1124 { 1127 swprintf(aNameBuf, L"%s%d", VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX, i); 1128 Status = vboxWddmRegQueryValueDword(hKey, aNameBuf, &dwVal); 1125 WCHAR wszNameBuf[sizeof(VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX) / sizeof(WCHAR) + 32]; 1126 RTUtf16Printf(wszNameBuf, RT_ELEMENTS(wszNameBuf), "%ls%u", VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX, i); 1127 Status = vboxWddmRegQueryValueDword(hKey, wszNameBuf, &dwVal); 1129 1128 if (NT_SUCCESS(Status)) 1130 1129 { … … 3218 3217 3219 3218 HANDLE hKey = NULL; 3220 WCHAR aNameBuf[100];3221 3219 uint32_t cAdjusted = 0; 3222 3220 … … 3251 3249 Assert(hKey); 3252 3250 3253 swprintf(aNameBuf, L"%s%d", VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX, i); 3254 Status = vboxWddmRegSetValueDword(hKey, aNameBuf, VBOXWDDM_CFG_DRVTARGET_CONNECTED); 3251 WCHAR wszNameBuf[sizeof(VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX) / sizeof(WCHAR) + 32]; 3252 RTUtf16Printf(wszNameBuf, RT_ELEMENTS(wszNameBuf), "%ls%d", VBOXWDDM_REG_DRV_DISPFLAGS_PREFIX, i); 3253 Status = vboxWddmRegSetValueDword(hKey, wszNameBuf, VBOXWDDM_CFG_DRVTARGET_CONNECTED); 3255 3254 if (!NT_SUCCESS(Status)) 3256 WARN(("VBOXESC_CONFIGURETARGETS vboxWddmRegSetValueDword (% d) failed Status 0x%x\n", aNameBuf, Status));3255 WARN(("VBOXESC_CONFIGURETARGETS vboxWddmRegSetValueDword (%ls) failed Status 0x%x\n", wszNameBuf, Status)); 3257 3256 3258 3257 }
Note:
See TracChangeset
for help on using the changeset viewer.