mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:35:43 +00:00
[REGEDIT] Fix issue at Find registry key (#4341)
- If we dont select a item as a starting point to search from, we need to set pszValueName to the first value name in current subkey. - Check pszSubKey length before calling RegFindRecurse. - Set focus to subkey when we search for it.
This commit is contained in:
parent
65d7fb1a82
commit
568383c9b9
1 changed files with 18 additions and 9 deletions
|
@ -160,9 +160,6 @@ BOOL RegFindRecurse(
|
||||||
if (lResult != ERROR_SUCCESS)
|
if (lResult != ERROR_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (pszValueName == NULL)
|
|
||||||
pszValueName = s_empty;
|
|
||||||
|
|
||||||
lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL,
|
lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
&c, NULL, NULL, NULL, NULL);
|
&c, NULL, NULL, NULL, NULL);
|
||||||
if (lResult != ERROR_SUCCESS)
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
@ -195,6 +192,9 @@ BOOL RegFindRecurse(
|
||||||
|
|
||||||
qsort(ppszNames, c, sizeof(LPWSTR), compare);
|
qsort(ppszNames, c, sizeof(LPWSTR), compare);
|
||||||
|
|
||||||
|
if (pszValueName == NULL)
|
||||||
|
pszValueName = ppszNames[0];
|
||||||
|
|
||||||
for(i = 0; i < c; i++)
|
for(i = 0; i < c; i++)
|
||||||
{
|
{
|
||||||
if (DoEvents())
|
if (DoEvents())
|
||||||
|
@ -370,13 +370,14 @@ BOOL RegFindWalk(
|
||||||
LPWSTR *ppszNames = NULL;
|
LPWSTR *ppszNames = NULL;
|
||||||
|
|
||||||
hBaseKey = *phKey;
|
hBaseKey = *phKey;
|
||||||
|
|
||||||
|
if (wcslen(pszSubKey) >= _countof(szSubKey))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey,
|
if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey,
|
||||||
ppszFoundValueName))
|
ppszFoundValueName))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (wcslen(pszSubKey) >= MAX_PATH)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
wcscpy(szSubKey, pszSubKey);
|
wcscpy(szSubKey, pszSubKey);
|
||||||
while(szSubKey[0] != 0)
|
while(szSubKey[0] != 0)
|
||||||
{
|
{
|
||||||
|
@ -687,11 +688,19 @@ BOOL FindNext(HWND hWnd)
|
||||||
{
|
{
|
||||||
GetKeyName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey);
|
GetKeyName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey);
|
||||||
SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
|
SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
|
||||||
SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
|
|
||||||
free(pszFoundSubKey);
|
free(pszFoundSubKey);
|
||||||
|
|
||||||
|
if (pszFoundValueName != NULL)
|
||||||
|
{
|
||||||
|
SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
|
||||||
free(pszFoundValueName);
|
free(pszFoundValueName);
|
||||||
SetFocus(g_pChildWnd->hListWnd);
|
SetFocus(g_pChildWnd->hListWnd);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetFocus(g_pChildWnd->hTreeWnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
return fSuccess || s_bAbort;
|
return fSuccess || s_bAbort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue