mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-03 05:08:47 -06:00
cmGlobalVisualStudioGenerator: Fix buffer sizes used RegQueryValueExW
In commit 0b9906c2fb (Windows: Use wide-character system APIs,
2013-12-04, v3.0.0-rc1~254^2) several buffer size computations had to be
updated to multiply by `sizeof(wchar_t)`, but some for RegQueryValueExW
were incorrect because the number of bytes was already computed.
Issue: #19610
This commit is contained in:
@@ -572,8 +572,8 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
|
||||
if (ERROR_SUCCESS == result) {
|
||||
DWORD valueType = REG_SZ;
|
||||
wchar_t data1[256];
|
||||
DWORD cch_data1 = sizeof(data1) * sizeof(data1[0]);
|
||||
RegQueryValueExW(hsubkey, L"Path", 0, &valueType, (LPBYTE)&data1[0],
|
||||
DWORD cch_data1 = sizeof(data1);
|
||||
RegQueryValueExW(hsubkey, L"Path", 0, &valueType, (LPBYTE)data1,
|
||||
&cch_data1);
|
||||
|
||||
DWORD data2 = 0;
|
||||
@@ -649,9 +649,8 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
|
||||
if (ERROR_SUCCESS == result) {
|
||||
DWORD valueType = REG_SZ;
|
||||
wchar_t data1[256];
|
||||
DWORD cch_data1 = sizeof(data1) * sizeof(data1[0]);
|
||||
RegQueryValueExW(hkey, L"Path", 0, &valueType, (LPBYTE)&data1[0],
|
||||
&cch_data1);
|
||||
DWORD cch_data1 = sizeof(data1);
|
||||
RegQueryValueExW(hkey, L"Path", 0, &valueType, (LPBYTE)data1, &cch_data1);
|
||||
|
||||
DWORD data2 = 0;
|
||||
DWORD cch_data2 = sizeof(data2);
|
||||
|
||||
Reference in New Issue
Block a user