diff options
Diffstat (limited to 'CPP/Windows/Registry.cpp')
-rw-r--r-- | CPP/Windows/Registry.cpp | 15 |
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) { value.Empty(); DWORD type = 0; - UInt32 curSize = 0; - LONG res = RegQueryValueEx(_object, name, NULL, &type, NULL, (DWORD *)&curSize); + DWORD curSize = 0; + LONG res = RegQueryValueEx(_object, name, NULL, &type, NULL, &curSize); if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) return res; UInt32 curSize2 = curSize; @@ -281,13 +281,11 @@ LONG CKey::QueryValue(LPCWSTR name, UString &value) { value.Empty(); DWORD type = 0; - UInt32 curSize = 0; - + DWORD curSize = 0; LONG res; - if (g_IsNT) { - res = RegQueryValueExW(_object, name, NULL, &type, NULL, (DWORD *)&curSize); + res = RegQueryValueExW(_object, name, NULL, &type, NULL, &curSize); if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) return res; UInt32 curSize2 = curSize; @@ -302,7 +300,6 @@ LONG CKey::QueryValue(LPCWSTR name, UString &value) res = QueryValue(name == 0 ? 0 : (LPCSTR)GetSystemString(name), vTemp); value = GetUnicodeString(vTemp); } - return res; } @@ -377,7 +374,7 @@ LONG CKey::GetValue_Strings(LPCTSTR valueName, UStringVector &strings) strings.Clear(); CByteBuffer buffer; UInt32 dataSize = 0; - LONG res = QueryValue(valueName, buffer, dataSize); + const LONG res = QueryValue(valueName, buffer, dataSize); if (res != ERROR_SUCCESS) return res; if (dataSize > buffer.Size()) @@ -386,7 +383,7 @@ LONG CKey::GetValue_Strings(LPCTSTR valueName, UStringVector &strings) return E_FAIL; const wchar_t *data = (const wchar_t *)(const void *)(const Byte *)buffer; - size_t numChars = dataSize / sizeof(wchar_t); + const size_t numChars = dataSize / sizeof(wchar_t); size_t prev = 0; UString s; |