Author: gbrunmar
Date: Sun Sep 30 17:23:31 2007
New Revision: 29308
URL: 
http://svn.reactos.org/svn/reactos?rev=29308&view=rev
Log:
* Unicode fixes to regedit
* Fixed bug 2494
Patch by Carlo Bramix [carlo (dot) bramix (at) libero (dot) it].
See issue #2494 for more details.
Modified:
    trunk/reactos/base/applications/regedit/childwnd.c
    trunk/reactos/base/applications/regedit/framewnd.c
    trunk/reactos/base/applications/regedit/regproc.c
    trunk/reactos/base/applications/regedit/treeview.c
Modified: trunk/reactos/base/applications/regedit/childwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/childwnd.c (original)
+++ trunk/reactos/base/applications/regedit/childwnd.c Sun Sep 30 17:23:31 2007
@@ -202,7 +202,7 @@
        iSuggestionsLength--;
        /* Are we a root key in HKEY_CLASSES_ROOT? */
-       if ((hRootKey == HKEY_CLASSES_ROOT) && pszKeyPath[0] &&
!_tcschr(pszKeyPath, '\\'))
+       if ((hRootKey == HKEY_CLASSES_ROOT) && pszKeyPath[0] &&
!_tcschr(pszKeyPath, TEXT('\\')))
        {
                do
                {
Modified: trunk/reactos/base/applications/regedit/framewnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/framewnd.c (original)
+++ trunk/reactos/base/applications/regedit/framewnd.c Sun Sep 30 17:23:31 2007
@@ -150,7 +150,7 @@
         /* load appropriate string*/
         LPTSTR lpsz = str;
         /* first newline terminates actual string*/
-        lpsz = _tcschr(lpsz, '\n');
+        lpsz = _tcschr(lpsz, _T('\n'));
         if (lpsz != NULL)
             *lpsz = '\0';
     }
@@ -877,7 +877,7 @@
         if (lRet != ERROR_SUCCESS) hKey = 0;
     }
-     switch (LOWORD(wParam)) {
+    switch (LOWORD(wParam)) {
     case ID_EDIT_MODIFY:
         if (valueName && ModifyValue(hWnd, hKey, valueName, FALSE))
             RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
@@ -887,13 +887,23 @@
             RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
         break;
     case ID_EDIT_RENAME:
-        if(ListView_GetSelectedCount(g_pChildWnd->hListWnd) == 1)
-        {
-          item = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
-          if(item > -1)
-          {
-            (void)ListView_EditLabel(g_pChildWnd->hListWnd, item);
-          }
+        if (GetFocus() == g_pChildWnd->hListWnd)
+        {
+            if(ListView_GetSelectedCount(g_pChildWnd->hListWnd) == 1)
+            {
+                item = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
+                if(item > -1)
+                {
+                    (void)ListView_EditLabel(g_pChildWnd->hListWnd, item);
+                }
+            }
+        }
+        if (GetFocus() == g_pChildWnd->hTreeWnd)
+        {
+            /* Get focused entry of treeview (if any) */
+            HTREEITEM hItem = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
+            if (hItem != NULL)
+                (void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, hItem);
         }
         break;
     case ID_EDIT_DELETE:
Modified: trunk/reactos/base/applications/regedit/regproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/regproc.c (original)
+++ trunk/reactos/base/applications/regedit/regproc.c Sun Sep 30 17:23:31 2007
@@ -1735,7 +1735,7 @@
         /* Go up and find the next sibling key */
         do
         {
-            s = _tcsrchr(lpSubKey, '\\');
+            s = _tcsrchr(lpSubKey, TEXT('\\'));
             if (s)
             {
                 *s = '\0';
@@ -1832,7 +1832,7 @@
         if (lResult != ERROR_SUCCESS)
             return lResult;
-        s = _tcsrchr(lpSubKey, '\\');
+        s = _tcsrchr(lpSubKey, TEXT('\\'));
         s = s ? s + 1 : lpSubKey;
     }
     while(!(dwSearchFlags & RSF_LOOKATKEYS) || !RegSearchCompare(s, pszSearchString,
dwSearchFlags));
@@ -1871,3 +1871,4 @@
 }
+
Modified: trunk/reactos/base/applications/regedit/treeview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/treeview.c (original)
+++ trunk/reactos/base/applications/regedit/treeview.c Sun Sep 30 17:23:31 2007
@@ -602,7 +602,7 @@
        while(keyPath[0])
        {
-               s = _tcschr(keyPath, '\\');
+               s = _tcschr(keyPath, TEXT('\\'));
                lstrcpyn(szPathPart, keyPath, s ? s - keyPath + 1 : _tcslen(keyPath) + 1);
                /* Special case for root to expand root key abbreviations */
@@ -656,3 +656,4 @@
        return TRUE;
 }
+