Regedit: Fixed exporting subtrees with Unicode
Core exporting code still ANSI; need to fix this
Modified: trunk/reactos/subsys/system/regedit/framewnd.c
Modified: trunk/reactos/subsys/system/regedit/regproc.c
Modified: trunk/reactos/subsys/system/regedit/regproc.h
_____
Modified: trunk/reactos/subsys/system/regedit/framewnd.c
--- trunk/reactos/subsys/system/regedit/framewnd.c 2005-10-03
23:01:10 UTC (rev 18255)
+++ trunk/reactos/subsys/system/regedit/framewnd.c 2005-10-04
02:40:01 UTC (rev 18256)
@@ -365,10 +365,17 @@
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_EXPORTRANGE);
if (GetSaveFileName(&ofn)) {
BOOL result;
- /* FIXME - convert strings to ascii! */
- result = export_registry_key((CHAR*)ofn.lpstrFile,
(CHAR*)ExportKeyPath);
- /*result = export_registry_key(ofn.lpstrFile, NULL);*/
- /*if (!export_registry_key(ofn.lpstrFile, NULL)) {*/
+ LPCSTR pszExportKeyPath;
+#ifdef UNICODE
+ CHAR buffer[_MAX_PATH];
+
+ WideCharToMultiByte(CP_ACP, 0, ExportKeyPath, -1, buffer,
sizeof(buffer), NULL, NULL);
+ pszExportKeyPath = buffer;
+#else
+ pszExportKeyPath = ExportKeyPath;
+#endif
+
+ result = export_registry_key(ofn.lpstrFile, pszExportKeyPath);
if (!result) {
/*printf("Can't open file \"%s\"\n",
ofn.lpstrFile);*/
return FALSE;
_____
Modified: trunk/reactos/subsys/system/regedit/regproc.c
--- trunk/reactos/subsys/system/regedit/regproc.c 2005-10-03
23:01:10 UTC (rev 18255)
+++ trunk/reactos/subsys/system/regedit/regproc.c 2005-10-04
02:40:01 UTC (rev 18256)
@@ -1285,9 +1285,9 @@
/***********************************************************************
*******
* Open file for export.
*/
-static FILE *REGPROC_open_export_file(CHAR *file_name)
+static FILE *REGPROC_open_export_file(const TCHAR *file_name)
{
- FILE *file = fopen(file_name, "w");
+ FILE *file = _tfopen(file_name, _T("w"));
if (!file) {
perror("");
fprintf(stderr,"%s: Can't open file \"%s\"\n",
getAppName(),
file_name);
@@ -1305,7 +1305,7 @@
* reg_key_name - registry branch to export. The whole registry is
exported if
* reg_key_name is NULL or contains an empty string.
*/
-BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name)
+BOOL export_registry_key(const TCHAR *file_name, CHAR *reg_key_name)
{
HKEY reg_key_class;
_____
Modified: trunk/reactos/subsys/system/regedit/regproc.h
--- trunk/reactos/subsys/system/regedit/regproc.h 2005-10-03
23:01:10 UTC (rev 18255)
+++ trunk/reactos/subsys/system/regedit/regproc.h 2005-10-04
02:40:01 UTC (rev 18256)
@@ -38,7 +38,7 @@
void doRegisterDLL(LPSTR lpsLine);
void doUnregisterDLL(LPSTR lpsLine);
-BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name);
+BOOL export_registry_key(const TCHAR *file_name, CHAR *reg_key_name);
BOOL import_registry_file(LPTSTR filename);
void delete_registry_key(CHAR *reg_key_name);