build regedit as unicode by default
authorThomas Bluemel <thomas@reactsoft.com>
Mon, 3 Oct 2005 13:44:18 +0000 (13:44 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Mon, 3 Oct 2005 13:44:18 +0000 (13:44 +0000)
svn path=/trunk/; revision=18246

reactos/subsys/system/regedit/framewnd.c
reactos/subsys/system/regedit/regedit.xml
reactos/subsys/system/regedit/regproc.c
reactos/subsys/system/regedit/treeview.c

index 930c1b7..c9a89ae 100644 (file)
@@ -263,7 +263,7 @@ static BOOL ImportRegistryFile(HWND hWnd)
     /*    ofn.lCustData = ;*/
     if (GetOpenFileName(&ofn)) {
         /* FIXME - convert to ascii */
-       if (!import_registry_file((LPSTR)ofn.lpstrFile)) {
+       if (!import_registry_file(ofn.lpstrFile)) {
             /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
             return FALSE;
         }
@@ -617,7 +617,7 @@ InitializeRemoteRegistryPicker(OUT IDsObjectPicker **pDsObjectPicker)
 static HRESULT
 InvokeRemoteRegistryPickerDialog(IN IDsObjectPicker *pDsObjectPicker,
                                  IN HWND hwndParent  OPTIONAL,
-                                 OUT LPWSTR lpBuffer,
+                                 OUT LPTSTR lpBuffer,
                                  IN UINT uSize)
 {
     IDataObject *pdo = NULL;
@@ -652,10 +652,20 @@ InvokeRemoteRegistryPickerDialog(IN IDsObjectPicker *pDsObjectPicker,
                     {
                         nlen = uSize - 1;
                     }
-
+#if UNICODE
                     memcpy(lpBuffer,
                            SelectionList->aDsSelection[0].pwzName,
                            nlen * sizeof(WCHAR));
+#else
+                    WideCharToMultiByte(CP_ACP,
+                                        0,
+                                        SelectionList->aDsSelection[0].pwzName,
+                                        nlen,
+                                        lpBuffer,
+                                        uSize,
+                                        NULL,
+                                        NULL);
+#endif
                     lpBuffer[nlen] = L'\0';
                 }
 
@@ -704,7 +714,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     case ID_REGISTRY_CONNECTNETWORKREGISTRY:
     {
         IDsObjectPicker *ObjectPicker;
-        WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
+        TCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
         HRESULT hRet;
         
         hRet = CoInitialize(NULL);
index 54e87f7..0c50368 100644 (file)
@@ -1,8 +1,10 @@
 <module name="regedit" type="win32gui" installname="regedit.exe">
        <include base="regedit">.</include>
        <define name="__USE_W32API" />
+       <define name="UNICODE" />
+       <define name="_UNICODE" />
        <define name="_WIN32_IE">0x0501</define>
-       <define name="_WIN32_WINNT">0x0501</define>
+       <define name="_WIN32_WINNT">0x0600</define>
        <library>uuid</library>
        <library>kernel32</library>
        <library>user32</library>
index 68adab3..88dcf58 100644 (file)
@@ -427,7 +427,7 @@ HRESULT setValue(LPSTR val_name, LPSTR val_data)
         }
     }
 
-    hRes = RegSetValueEx(
+    hRes = RegSetValueExA(
                currentKeyHandle,
                val_name,
                0,                  /* Reserved */
@@ -987,7 +987,7 @@ void doRegisterDLL(LPSTR stdInput)
         return;
 
     /* Load and register the library, then free it */
-    theLib = LoadLibrary(stdInput);
+    theLib = LoadLibraryA(stdInput);
     if (theLib) {
         FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllRegisterServer");
         if (lpfnDLLRegProc)
@@ -1020,7 +1020,7 @@ void doUnregisterDLL(LPSTR stdInput)
         return;
 
     /* Load and unregister the library, then free it */
-    theLib = LoadLibrary(stdInput);
+    theLib = LoadLibraryA(stdInput);
     if (theLib) {
         FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllUnregisterServer");
         if (lpfnDLLRegProc)
@@ -1174,8 +1174,8 @@ static void export_hkey(FILE *file, HKEY key,
         DWORD value_type;
         DWORD val_name_len1 = *val_name_len;
         DWORD val_size1 = *val_size;
-        ret = RegEnumValue(key, i, *val_name_buf, &val_name_len1, NULL,
-                           &value_type, *val_buf, &val_size1);
+        ret = RegEnumValueA(key, i, *val_name_buf, &val_name_len1, NULL,
+                            &value_type, *val_buf, &val_size1);
         if (ret != ERROR_SUCCESS) {
             more_data = FALSE;
             if (ret != ERROR_NO_MORE_ITEMS) {
@@ -1258,8 +1258,8 @@ static void export_hkey(FILE *file, HKEY key,
     while(more_data) {
         DWORD buf_len = *reg_key_name_len - curr_len;
 
-        ret = RegEnumKeyEx(key, i, *reg_key_name_buf + curr_len + 1, &buf_len,
-                           NULL, NULL, NULL, NULL);
+        ret = RegEnumKeyExA(key, i, *reg_key_name_buf + curr_len + 1, &buf_len,
+                            NULL, NULL, NULL, NULL);
         if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA) {
             more_data = FALSE;
             if (ret != ERROR_NO_MORE_ITEMS) {
@@ -1269,8 +1269,8 @@ static void export_hkey(FILE *file, HKEY key,
             HKEY subkey;
 
             i++;
-            if (RegOpenKey(key, *reg_key_name_buf + curr_len + 1,
-                           &subkey) == ERROR_SUCCESS) {
+            if (RegOpenKeyA(key, *reg_key_name_buf + curr_len + 1,
+                            &subkey) == ERROR_SUCCESS) {
                 export_hkey(file, subkey, reg_key_name_buf, reg_key_name_len,
                             val_name_buf, val_name_len, val_buf, val_size);
                 RegCloseKey(subkey);
@@ -1348,7 +1348,7 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name)
                         &reg_key_name_buf, &reg_key_name_len,
                         &val_name_buf, &val_name_len,
                         &val_buf, &val_size);
-        } else if (RegOpenKey(reg_key_class, branch_name, &key) == ERROR_SUCCESS) {
+        } else if (RegOpenKeyA(reg_key_class, branch_name, &key) == ERROR_SUCCESS) {
             file = REGPROC_open_export_file(file_name);
             export_hkey(file, key,
                         &reg_key_name_buf, &reg_key_name_len,
@@ -1393,7 +1393,7 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name)
  */
 BOOL import_registry_file(LPTSTR filename)
 {
-    FILE* reg_file = fopen(filename, "r");
+    FILE* reg_file = _tfopen(filename, _T("r"));
 
     if (reg_file) {
         processRegLines(reg_file, doSetValue);
@@ -1415,7 +1415,7 @@ static void delete_branch(HKEY key,
     LONG ret;
     long int i;
 
-    if (RegOpenKey(key, *reg_key_name_buf, &branch_key) != ERROR_SUCCESS) {
+    if (RegOpenKeyA(key, *reg_key_name_buf, &branch_key) != ERROR_SUCCESS) {
         REGPROC_print_error();
     }
 
@@ -1434,8 +1434,8 @@ static void delete_branch(HKEY key,
     for (i = subkeys - 1; i >= 0; i--) {
         DWORD buf_len = *reg_key_name_len - curr_len;
 
-        ret = RegEnumKeyEx(branch_key, i, *reg_key_name_buf + curr_len + 1,
-                           &buf_len, NULL, NULL, NULL, NULL);
+        ret = RegEnumKeyExA(branch_key, i, *reg_key_name_buf + curr_len + 1,
+                            &buf_len, NULL, NULL, NULL, NULL);
         if (ret != ERROR_SUCCESS &&
                 ret != ERROR_MORE_DATA &&
                 ret != ERROR_NO_MORE_ITEMS) {
@@ -1446,7 +1446,7 @@ static void delete_branch(HKEY key,
     }
     (*reg_key_name_buf)[curr_len] = '\0';
     RegCloseKey(branch_key);
-    RegDeleteKey(key, *reg_key_name_buf);
+    RegDeleteKeyA(key, *reg_key_name_buf);
 }
 
 /******************************************************************************
@@ -1480,7 +1480,7 @@ void delete_registry_key(CHAR *reg_key_name)
                 getAppName(), reg_key_name);
         exit(1);
     }
-    if (RegOpenKey(reg_key_class, branch_name, &branch_key) == ERROR_SUCCESS) {
+    if (RegOpenKeyA(reg_key_class, branch_name, &branch_key) == ERROR_SUCCESS) {
         /* check whether the key exists */
         RegCloseKey(branch_key);
         delete_branch(reg_key_class, &branch_name, &branch_name_len);
index 5594291..726d06d 100644 (file)
@@ -136,7 +136,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
     HTREEITEM childItem;
     LPCTSTR KeyPath;
     DWORD dwCount, dwIndex, dwMaxSubKeyLen;
-    LPSTR Name = NULL;
+    LPTSTR Name = NULL;
     TVITEM tvItem;
     LPTSTR pszNodes = NULL;
     BOOL bSuccess = FALSE;
@@ -235,7 +235,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
         /* Check if the node is already in there. */
         if (pszNodes) {
             for (s = pszNodes; *s; s += _tcslen(s) + 1) {
-                if (!strcmp(s, Name)) {
+                if (!_tcscmp(s, Name)) {
                     found = TRUE;
                     break;
                 }
@@ -616,7 +616,7 @@ BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath)
                if (!TreeView_Expand(hwndTV, hChildItem, TVE_EXPAND))
                        return FALSE;
 
-               keyPath = s ? s + 1 : "";
+               keyPath = s ? s + 1 : _T("");
                hItem = hChildItem;
        }