aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/Registry.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/Windows/Registry.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/CPP/Windows/Registry.cpp b/CPP/Windows/Registry.cpp
index b20157d..c8b1709 100644
--- a/CPP/Windows/Registry.cpp
+++ b/CPP/Windows/Registry.cpp
@@ -254,8 +254,8 @@ LONG CKey::QueryValue(LPCTSTR name, CSysString &value)
254{ 254{
255 value.Empty(); 255 value.Empty();
256 DWORD type = 0; 256 DWORD type = 0;
257 UInt32 curSize = 0; 257 DWORD curSize = 0;
258 LONG res = RegQueryValueEx(_object, name, NULL, &type, NULL, (DWORD *)&curSize); 258 LONG res = RegQueryValueEx(_object, name, NULL, &type, NULL, &curSize);
259 if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) 259 if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
260 return res; 260 return res;
261 UInt32 curSize2 = curSize; 261 UInt32 curSize2 = curSize;
@@ -281,13 +281,11 @@ LONG CKey::QueryValue(LPCWSTR name, UString &value)
281{ 281{
282 value.Empty(); 282 value.Empty();
283 DWORD type = 0; 283 DWORD type = 0;
284 UInt32 curSize = 0; 284 DWORD curSize = 0;
285
286 LONG res; 285 LONG res;
287
288 if (g_IsNT) 286 if (g_IsNT)
289 { 287 {
290 res = RegQueryValueExW(_object, name, NULL, &type, NULL, (DWORD *)&curSize); 288 res = RegQueryValueExW(_object, name, NULL, &type, NULL, &curSize);
291 if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) 289 if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
292 return res; 290 return res;
293 UInt32 curSize2 = curSize; 291 UInt32 curSize2 = curSize;
@@ -302,7 +300,6 @@ LONG CKey::QueryValue(LPCWSTR name, UString &value)
302 res = QueryValue(name == 0 ? 0 : (LPCSTR)GetSystemString(name), vTemp); 300 res = QueryValue(name == 0 ? 0 : (LPCSTR)GetSystemString(name), vTemp);
303 value = GetUnicodeString(vTemp); 301 value = GetUnicodeString(vTemp);
304 } 302 }
305
306 return res; 303 return res;
307} 304}
308 305
@@ -377,7 +374,7 @@ LONG CKey::GetValue_Strings(LPCTSTR valueName, UStringVector &strings)
377 strings.Clear(); 374 strings.Clear();
378 CByteBuffer buffer; 375 CByteBuffer buffer;
379 UInt32 dataSize = 0; 376 UInt32 dataSize = 0;
380 LONG res = QueryValue(valueName, buffer, dataSize); 377 const LONG res = QueryValue(valueName, buffer, dataSize);
381 if (res != ERROR_SUCCESS) 378 if (res != ERROR_SUCCESS)
382 return res; 379 return res;
383 if (dataSize > buffer.Size()) 380 if (dataSize > buffer.Size())
@@ -386,7 +383,7 @@ LONG CKey::GetValue_Strings(LPCTSTR valueName, UStringVector &strings)
386 return E_FAIL; 383 return E_FAIL;
387 384
388 const wchar_t *data = (const wchar_t *)(const void *)(const Byte *)buffer; 385 const wchar_t *data = (const wchar_t *)(const void *)(const Byte *)buffer;
389 size_t numChars = dataSize / sizeof(wchar_t); 386 const size_t numChars = dataSize / sizeof(wchar_t);
390 size_t prev = 0; 387 size_t prev = 0;
391 UString s; 388 UString s;
392 389