Commit 223c24bd authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

regedit: Remove unneeded character conversions.

parent f0a507e1
...@@ -234,9 +234,7 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem) ...@@ -234,9 +234,7 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
/* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */ /* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren) static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
{ {
TVINSERTSTRUCT tvins; TVINSERTSTRUCTW tvins;
CHAR* labelA = GetMultiByteString(label);
HTREEITEM ret;
if (hKey) { if (hKey) {
if (RegQueryInfoKeyW(hKey, 0, 0, 0, &dwChildren, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS) { if (RegQueryInfoKeyW(hKey, 0, 0, 0, &dwChildren, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS) {
...@@ -245,17 +243,16 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HK ...@@ -245,17 +243,16 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HK
} }
tvins.u.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; tvins.u.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
tvins.u.item.pszText = labelA; tvins.u.item.pszText = label;
tvins.u.item.cchTextMax = lstrlen(labelA); tvins.u.item.cchTextMax = lstrlenW(label);
tvins.u.item.iImage = Image_Closed; tvins.u.item.iImage = Image_Closed;
tvins.u.item.iSelectedImage = Image_Open; tvins.u.item.iSelectedImage = Image_Open;
tvins.u.item.cChildren = dwChildren; tvins.u.item.cChildren = dwChildren;
tvins.u.item.lParam = (LPARAM)hKey; tvins.u.item.lParam = (LPARAM)hKey;
tvins.hInsertAfter = (HTREEITEM)(hKey ? TVI_LAST : TVI_SORT); tvins.hInsertAfter = (HTREEITEM)(hKey ? TVI_LAST : TVI_SORT);
tvins.hParent = hParent; tvins.hParent = hParent;
ret = TreeView_InsertItem(hwndTV, &tvins);
HeapFree(GetProcessHeap(), 0, labelA); return TreeView_InsertItemW(hwndTV, &tvins);
return ret;
} }
static BOOL match_string(LPCTSTR sstring1, LPCTSTR sstring2, int mode) static BOOL match_string(LPCTSTR sstring1, LPCTSTR sstring2, int mode)
...@@ -395,7 +392,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -395,7 +392,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
LPWSTR KeyPath; LPWSTR KeyPath;
DWORD dwCount, dwIndex, dwMaxSubKeyLen; DWORD dwCount, dwIndex, dwMaxSubKeyLen;
LPWSTR Name; LPWSTR Name;
TVITEM tvItem; TVITEMW tvItem;
hRoot = NULL; hRoot = NULL;
KeyPath = GetItemPathW(hwndTV, hItem, &hRoot); KeyPath = GetItemPathW(hwndTV, hItem, &hRoot);
...@@ -421,7 +418,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -421,7 +418,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
tvItem.mask = TVIF_CHILDREN; tvItem.mask = TVIF_CHILDREN;
tvItem.hItem = hItem; tvItem.hItem = hItem;
tvItem.cChildren = dwCount; tvItem.cChildren = dwCount;
if (!TreeView_SetItem(hwndTV, &tvItem)) { if (!TreeView_SetItemW(hwndTV, &tvItem)) {
return FALSE; return FALSE;
} }
...@@ -436,7 +433,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -436,7 +433,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
return FALSE; return FALSE;
} }
tvItem.cchTextMax = dwMaxSubKeyLen; tvItem.cchTextMax = dwMaxSubKeyLen;
if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(TCHAR)))) { if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR)))) {
return FALSE; return FALSE;
} }
...@@ -444,7 +441,6 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -444,7 +441,6 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
for (dwIndex = 0; dwIndex < dwCount; dwIndex++) { for (dwIndex = 0; dwIndex < dwCount; dwIndex++) {
DWORD cName = dwMaxSubKeyLen, dwSubCount; DWORD cName = dwMaxSubKeyLen, dwSubCount;
BOOL found; BOOL found;
CHAR* NameA;
found = FALSE; found = FALSE;
if (RegEnumKeyExW(hKey, dwIndex, Name, &cName, 0, 0, 0, NULL) != ERROR_SUCCESS) { if (RegEnumKeyExW(hKey, dwIndex, Name, &cName, 0, 0, 0, NULL) != ERROR_SUCCESS) {
...@@ -460,27 +456,23 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -460,27 +456,23 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
RegCloseKey(hSubKey); RegCloseKey(hSubKey);
} }
NameA = GetMultiByteString(Name);
/* Check if the node is already in there. */ /* Check if the node is already in there. */
for (childItem = TreeView_GetChild(hwndTV, hItem); childItem; for (childItem = TreeView_GetChild(hwndTV, hItem); childItem;
childItem = TreeView_GetNextSibling(hwndTV, childItem)) { childItem = TreeView_GetNextSibling(hwndTV, childItem)) {
tvItem.mask = TVIF_TEXT; tvItem.mask = TVIF_TEXT;
tvItem.hItem = childItem; tvItem.hItem = childItem;
if (!TreeView_GetItem(hwndTV, &tvItem)) { if (!TreeView_GetItemW(hwndTV, &tvItem)) {
HeapFree(GetProcessHeap(), 0, NameA);
return FALSE; return FALSE;
} }
if (!stricmp(tvItem.pszText, NameA)) { if (!lstrcmpiW(tvItem.pszText, Name)) {
found = TRUE; found = TRUE;
HeapFree(GetProcessHeap(), 0, NameA);
break; break;
} }
} }
if (found == FALSE) { if (found == FALSE) {
WINE_TRACE("New subkey %s\n", NameA); WINE_TRACE("New subkey %s\n", wine_dbgstr_w(Name));
AddEntryToTree(hwndTV, hItem, Name, NULL, dwSubCount); AddEntryToTree(hwndTV, hItem, Name, NULL, dwSubCount);
} }
} }
...@@ -493,7 +485,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) ...@@ -493,7 +485,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
while (childItem) { while (childItem) {
HTREEITEM nextItem = TreeView_GetNextSibling(hwndTV, childItem); HTREEITEM nextItem = TreeView_GetNextSibling(hwndTV, childItem);
if (RefreshTreeItem(hwndTV, childItem) == FALSE) { if (RefreshTreeItem(hwndTV, childItem) == FALSE) {
SendMessage(hwndTV, TVM_DELETEITEM, 0, (LPARAM)childItem); SendMessageW(hwndTV, TVM_DELETEITEM, 0, (LPARAM)childItem);
} }
childItem = nextItem; childItem = nextItem;
} }
...@@ -529,9 +521,9 @@ BOOL RefreshTreeView(HWND hwndTV) ...@@ -529,9 +521,9 @@ BOOL RefreshTreeView(HWND hwndTV)
HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name) HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
{ {
TCHAR buf[MAX_NEW_KEY_LEN]; WCHAR buf[MAX_NEW_KEY_LEN];
HTREEITEM hNewItem = 0; HTREEITEM hNewItem = 0;
TVITEMEX item; TVITEMEXW item;
if (!hItem) hItem = TreeView_GetSelection(hwndTV); if (!hItem) hItem = TreeView_GetSelection(hwndTV);
if (!hItem) return FALSE; if (!hItem) return FALSE;
...@@ -540,22 +532,20 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name) ...@@ -540,22 +532,20 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
} else { } else {
item.mask = TVIF_CHILDREN | TVIF_HANDLE; item.mask = TVIF_CHILDREN | TVIF_HANDLE;
item.hItem = hItem; item.hItem = hItem;
if (!TreeView_GetItem(hwndTV, &item)) return FALSE; if (!TreeView_GetItemW(hwndTV, &item)) return FALSE;
item.cChildren = 1; item.cChildren = 1;
if (!TreeView_SetItem(hwndTV, &item)) return FALSE; if (!TreeView_SetItemW(hwndTV, &item)) return FALSE;
} }
SendMessageW(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)hItem ); SendMessageW(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)hItem );
if (!hNewItem) { if (!hNewItem) {
char* nameA = GetMultiByteString(name);
for(hNewItem = TreeView_GetChild(hwndTV, hItem); hNewItem; hNewItem = TreeView_GetNextSibling(hwndTV, hNewItem)) { for(hNewItem = TreeView_GetChild(hwndTV, hItem); hNewItem; hNewItem = TreeView_GetNextSibling(hwndTV, hNewItem)) {
item.mask = TVIF_HANDLE | TVIF_TEXT; item.mask = TVIF_HANDLE | TVIF_TEXT;
item.hItem = hNewItem; item.hItem = hNewItem;
item.pszText = buf; item.pszText = buf;
item.cchTextMax = COUNT_OF(buf); item.cchTextMax = COUNT_OF(buf);
if (!TreeView_GetItem(hwndTV, &item)) continue; if (!TreeView_GetItemW(hwndTV, &item)) continue;
if (lstrcmp(nameA, item.pszText) == 0) break; if (lstrcmpW(name, item.pszText) == 0) break;
} }
HeapFree(GetProcessHeap(), 0, nameA);
} }
if (hNewItem) if (hNewItem)
SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hNewItem); SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hNewItem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment