regedit: Call RegEnumValueW with value and val_count parameters.
This commit is contained in:
parent
119501fee8
commit
cf6477ab27
|
@ -226,9 +226,10 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode,
|
||||||
|
|
||||||
if (mode & (SEARCH_VALUES | SEARCH_CONTENT)) {
|
if (mode & (SEARCH_VALUES | SEARCH_CONTENT)) {
|
||||||
int i, adjust;
|
int i, adjust;
|
||||||
WCHAR valName[KEY_MAX_LEN], *KeyPath;
|
WCHAR *valName, *KeyPath;
|
||||||
HKEY hKey, hRoot;
|
HKEY hKey, hRoot;
|
||||||
DWORD lenName;
|
DWORD lenName, lenNameMax, lenValueMax;
|
||||||
|
WCHAR *buffer = NULL;
|
||||||
|
|
||||||
KeyPath = GetItemPath(hwndTV, hItem, &hRoot);
|
KeyPath = GetItemPath(hwndTV, hItem, &hRoot);
|
||||||
|
|
||||||
|
@ -241,7 +242,14 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, KeyPath);
|
HeapFree(GetProcessHeap(), 0, KeyPath);
|
||||||
lenName = KEY_MAX_LEN;
|
|
||||||
|
if (ERROR_SUCCESS != RegQueryInfoKeyW(hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &lenNameMax, &lenValueMax, NULL, NULL))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
lenName = ++lenNameMax;
|
||||||
|
if (!(valName = HeapAlloc(GetProcessHeap(), 0, lenName * sizeof(valName[0]) )))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
adjust = 0;
|
adjust = 0;
|
||||||
/* RegEnumValue won't return empty default value, so fake it when dealing with *row,
|
/* RegEnumValue won't return empty default value, so fake it when dealing with *row,
|
||||||
which corresponds to list view rows, not value ids */
|
which corresponds to list view rows, not value ids */
|
||||||
|
@ -252,14 +260,16 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode,
|
||||||
if (i < 0) i = 0;
|
if (i < 0) i = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
DWORD lenValue = 0, type = 0;
|
DWORD lenValue = 0, type = 0;
|
||||||
lenName = KEY_MAX_LEN;
|
lenName = lenNameMax;
|
||||||
|
|
||||||
if (ERROR_SUCCESS != RegEnumValueW(hKey,
|
if (ERROR_SUCCESS != RegEnumValueW(hKey,
|
||||||
i, valName, &lenName, NULL, &type, NULL, &lenValue))
|
i, valName, &lenName, NULL, &type, NULL, NULL))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (mode & SEARCH_VALUES) {
|
if (mode & SEARCH_VALUES) {
|
||||||
if (match_string(valName, sstring, mode)) {
|
if (match_string(valName, sstring, mode)) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, valName);
|
||||||
|
HeapFree(GetProcessHeap(), 0, buffer);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
*row = i+adjust;
|
*row = i+adjust;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -267,23 +277,27 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode & SEARCH_CONTENT) && (type == REG_EXPAND_SZ || type == REG_SZ)) {
|
if ((mode & SEARCH_CONTENT) && (type == REG_EXPAND_SZ || type == REG_SZ)) {
|
||||||
LPWSTR buffer;
|
if (!buffer)
|
||||||
buffer = HeapAlloc(GetProcessHeap(), 0, lenValue);
|
buffer = HeapAlloc(GetProcessHeap(), 0, lenValueMax);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
break;
|
break;
|
||||||
if (ERROR_SUCCESS != RegEnumValueW(hKey, i, NULL, NULL, NULL, &type, (LPBYTE)buffer, &lenValue))
|
lenName = lenNameMax;
|
||||||
|
lenValue = lenValueMax;
|
||||||
|
if (ERROR_SUCCESS != RegEnumValueW(hKey, i, valName, &lenName, NULL, &type, (LPBYTE)buffer, &lenValue))
|
||||||
break;
|
break;
|
||||||
if (match_string(buffer, sstring, mode)) {
|
if (match_string(buffer, sstring, mode)) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, valName);
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
HeapFree(GetProcessHeap(), 0, buffer);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
*row = i+adjust;
|
*row = i+adjust;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, valName);
|
||||||
|
HeapFree(GetProcessHeap(), 0, buffer);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in New Issue