regedit: Convert searching to Unicode.
This commit is contained in:
parent
5c1fa0eede
commit
583bf6e4bf
|
@ -39,7 +39,7 @@
|
|||
static WCHAR favoritesKey[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','A','p','p','l','e','t','s','\\','R','e','g','E','d','i','t','\\','F','a','v','o','r','i','t','e','s',0};
|
||||
static BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
|
||||
static WCHAR favoriteName[128];
|
||||
static TCHAR searchString[128];
|
||||
static WCHAR searchString[128];
|
||||
static int searchMask = SEARCH_KEYS | SEARCH_VALUES | SEARCH_CONTENT;
|
||||
|
||||
static TCHAR FileNameBuffer[_MAX_PATH];
|
||||
|
@ -484,26 +484,26 @@ static INT_PTR CALLBACK find_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
|
|||
CheckDlgButton(hwndDlg, IDC_FIND_VALUES, searchMask&SEARCH_VALUES ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwndDlg, IDC_FIND_CONTENT, searchMask&SEARCH_CONTENT ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwndDlg, IDC_FIND_WHOLE, searchMask&SEARCH_WHOLE ? BST_CHECKED : BST_UNCHECKED);
|
||||
SendMessage(hwndValue, EM_SETLIMITTEXT, 127, 0);
|
||||
SetWindowText(hwndValue, searchString);
|
||||
SendMessageW(hwndValue, EM_SETLIMITTEXT, 127, 0);
|
||||
SetWindowTextW(hwndValue, searchString);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDC_VALUE_NAME:
|
||||
if (HIWORD(wParam) == EN_UPDATE) {
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(hwndValue)>0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLengthW(hwndValue)>0);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case IDOK:
|
||||
if (GetWindowTextLength(hwndValue)>0) {
|
||||
if (GetWindowTextLengthW(hwndValue)>0) {
|
||||
int mask = 0;
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_FIND_KEYS)) mask |= SEARCH_KEYS;
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_FIND_VALUES)) mask |= SEARCH_VALUES;
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_FIND_CONTENT)) mask |= SEARCH_CONTENT;
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_FIND_WHOLE)) mask |= SEARCH_WHOLE;
|
||||
searchMask = mask;
|
||||
GetWindowText(hwndValue, searchString, 128);
|
||||
GetWindowTextW(hwndValue, searchString, 128);
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -747,7 +747,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
SetFocus(g_pChildWnd->hTreeWnd);
|
||||
}
|
||||
} else {
|
||||
error(hWnd, IDS_NOTFOUND, searchString);
|
||||
CHAR* searchStringA = GetMultiByteString(searchString);
|
||||
error(hWnd, IDS_NOTFOUND, searchStringA);
|
||||
HeapFree(GetProcessHeap(), 0, searchStringA);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -137,7 +137,7 @@ extern BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
|
|||
extern HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name);
|
||||
extern HWND StartKeyRename(HWND hwndTV);
|
||||
extern HTREEITEM FindPathInTree(HWND hwndTV, LPCWSTR lpKeyName);
|
||||
extern HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode, int *row);
|
||||
extern HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, int *row);
|
||||
|
||||
/* edit.c */
|
||||
extern BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR newKeyName);
|
||||
|
|
|
@ -258,18 +258,18 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HK
|
|||
return TreeView_InsertItemW(hwndTV, &tvins);
|
||||
}
|
||||
|
||||
static BOOL match_string(LPCTSTR sstring1, LPCTSTR sstring2, int mode)
|
||||
static BOOL match_string(LPCWSTR sstring1, LPCWSTR sstring2, int mode)
|
||||
{
|
||||
if (mode & SEARCH_WHOLE)
|
||||
return !stricmp(sstring1, sstring2);
|
||||
return !lstrcmpiW(sstring1, sstring2);
|
||||
else
|
||||
return NULL != StrStrI(sstring1, sstring2);
|
||||
return NULL != StrStrIW(sstring1, sstring2);
|
||||
}
|
||||
|
||||
static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode, int *row)
|
||||
static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, int *row)
|
||||
{
|
||||
TVITEM item;
|
||||
TCHAR keyname[KEY_MAX_LEN];
|
||||
TVITEMW item;
|
||||
WCHAR keyname[KEY_MAX_LEN];
|
||||
item.mask = TVIF_TEXT;
|
||||
item.hItem = hItem;
|
||||
item.pszText = keyname;
|
||||
|
@ -282,16 +282,16 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode,
|
|||
|
||||
if (mode & (SEARCH_VALUES | SEARCH_CONTENT)) {
|
||||
int i, adjust;
|
||||
TCHAR valName[KEY_MAX_LEN], *KeyPath;
|
||||
WCHAR valName[KEY_MAX_LEN], *KeyPath;
|
||||
HKEY hKey, hRoot;
|
||||
DWORD lenName;
|
||||
|
||||
KeyPath = GetItemPath(hwndTV, hItem, &hRoot);
|
||||
KeyPath = GetItemPathW(hwndTV, hItem, &hRoot);
|
||||
|
||||
if (!KeyPath || !hRoot)
|
||||
return FALSE;
|
||||
|
||||
if (RegOpenKeyEx(hRoot, KeyPath, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
|
||||
if (RegOpenKeyExW(hRoot, KeyPath, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
|
||||
HeapFree(GetProcessHeap(), 0, KeyPath);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode,
|
|||
adjust = 0;
|
||||
/* RegEnumValue won't return empty default value, so fake it when dealing with *row,
|
||||
which corresponds to list view rows, not value ids */
|
||||
if (ERROR_SUCCESS == RegEnumValue(hKey, 0, valName, &lenName, NULL, NULL, NULL, NULL) && *valName)
|
||||
if (ERROR_SUCCESS == RegEnumValueW(hKey, 0, valName, &lenName, NULL, NULL, NULL, NULL) && *valName)
|
||||
adjust = 1;
|
||||
|
||||
i = (*row)-adjust;
|
||||
|
@ -310,7 +310,7 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode,
|
|||
DWORD lenValue = 0, type = 0;
|
||||
lenName = KEY_MAX_LEN;
|
||||
|
||||
if (ERROR_SUCCESS != RegEnumValue(hKey,
|
||||
if (ERROR_SUCCESS != RegEnumValueW(hKey,
|
||||
i, valName, &lenName, NULL, &type, NULL, &lenValue))
|
||||
break;
|
||||
|
||||
|
@ -323,9 +323,9 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode,
|
|||
}
|
||||
|
||||
if ((mode & SEARCH_CONTENT) && (type == REG_EXPAND_SZ || type == REG_SZ)) {
|
||||
LPTSTR buffer;
|
||||
LPWSTR buffer;
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, lenValue);
|
||||
RegEnumValue(hKey, i, valName, &lenName, NULL, &type, (LPBYTE)buffer, &lenValue);
|
||||
RegEnumValueW(hKey, i, valName, &lenName, NULL, &type, (LPBYTE)buffer, &lenValue);
|
||||
if (match_string(buffer, sstring, mode)) {
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
RegCloseKey(hKey);
|
||||
|
@ -342,7 +342,7 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mode, int *row)
|
||||
HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, int *row)
|
||||
{
|
||||
HTREEITEM hTry, hLast;
|
||||
|
||||
|
|
Loading…
Reference in New Issue