Commit 9d608490 authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

regedit: Convert remaining registry import code to Unicode.

parent db074ee9
...@@ -475,13 +475,10 @@ static void closeKey(void) ...@@ -475,13 +475,10 @@ static void closeKey(void)
* line - registry file unwrapped line. Should have the registry value name and * line - registry file unwrapped line. Should have the registry value name and
* complete registry value data. * complete registry value data.
*/ */
static void processSetValue(LPSTR line) static void processSetValue(WCHAR* line)
{ {
LPSTR val_name; /* registry value name */ WCHAR* val_name; /* registry value name */
LPSTR val_data; /* registry value data */ WCHAR* val_data; /* registry value data */
WCHAR* val_nameW;
WCHAR* val_dataW;
int line_idx = 0; /* current character under analysis */ int line_idx = 0; /* current character under analysis */
LONG res; LONG res;
...@@ -508,37 +505,44 @@ static void processSetValue(LPSTR line) ...@@ -508,37 +505,44 @@ static void processSetValue(LPSTR line)
} }
} }
if (line[line_idx] != '=') { if (line[line_idx] != '=') {
char* lineA;
line[line_idx] = '\"'; line[line_idx] = '\"';
fprintf(stderr,"Warning! unrecognized line:\n%s\n", line); lineA = GetMultiByteString(line);
fprintf(stderr,"Warning! unrecognized line:\n%s\n", lineA);
HeapFree(GetProcessHeap(), 0, lineA);
return; return;
} }
} else { } else {
fprintf(stderr,"Warning! unrecognized line:\n%s\n", line); char* lineA = GetMultiByteString(line);
fprintf(stderr,"Warning! unrecognized line:\n%s\n", lineA);
HeapFree(GetProcessHeap(), 0, lineA);
return; return;
} }
line_idx++; /* skip the '=' character */ line_idx++; /* skip the '=' character */
val_data = line + line_idx; val_data = line + line_idx;
val_nameW = GetWideString(val_name); REGPROC_unescape_string(val_name);
val_dataW = GetWideString(val_data); res = setValue(val_name, val_data);
REGPROC_unescape_string(val_nameW);
res = setValue(val_nameW, val_dataW);
HeapFree(GetProcessHeap(), 0, val_nameW);
HeapFree(GetProcessHeap(), 0, val_dataW);
if ( res != ERROR_SUCCESS ) if ( res != ERROR_SUCCESS )
{
char* val_nameA = GetMultiByteString(val_name);
char* val_dataA = GetMultiByteString(val_data);
fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n", fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n",
getAppName(), getAppName(),
currentKeyName, currentKeyName,
val_name, val_nameA,
val_data); val_dataA);
HeapFree(GetProcessHeap(), 0, val_nameA);
HeapFree(GetProcessHeap(), 0, val_dataA);
}
} }
/****************************************************************************** /******************************************************************************
* This function receives the currently read entry and performs the * This function receives the currently read entry and performs the
* corresponding action. * corresponding action.
*/ */
static void processRegEntry(LPSTR stdInput) static void processRegEntry(WCHAR* stdInput)
{ {
/* /*
* We encountered the end of the file, make sure we * We encountered the end of the file, make sure we
...@@ -551,28 +555,24 @@ static void processRegEntry(LPSTR stdInput) ...@@ -551,28 +555,24 @@ static void processRegEntry(LPSTR stdInput)
if ( stdInput[0] == '[') /* We are reading a new key */ if ( stdInput[0] == '[') /* We are reading a new key */
{ {
LPSTR keyEnd; WCHAR* keyEnd;
WCHAR* stdInputW;
closeKey(); /* Close the previous key */ closeKey(); /* Close the previous key */
/* Get rid of the square brackets */ /* Get rid of the square brackets */
stdInput++; stdInput++;
keyEnd = strrchr(stdInput, ']'); keyEnd = strrchrW(stdInput, ']');
if (keyEnd) if (keyEnd)
*keyEnd='\0'; *keyEnd='\0';
stdInputW = GetWideString(stdInput);
/* delete the key if we encounter '-' at the start of reg key */ /* delete the key if we encounter '-' at the start of reg key */
if ( stdInput[0] == '-') if ( stdInput[0] == '-')
{ {
delete_registry_key(stdInputW + 1); delete_registry_key(stdInput + 1);
} else if ( openKeyW(stdInputW) != ERROR_SUCCESS ) } else if ( openKeyW(stdInput) != ERROR_SUCCESS )
{ {
fprintf(stderr,"%s: setValue failed to open key %s\n", fprintf(stderr,"%s: setValue failed to open key %s\n",
getAppName(), stdInput); getAppName(), stdInput);
} }
HeapFree(GetProcessHeap(), 0, stdInputW);
} else if( currentKeyHandle && } else if( currentKeyHandle &&
(( stdInput[0] == '@') || /* reading a default @=data pair */ (( stdInput[0] == '@') || /* reading a default @=data pair */
( stdInput[0] == '\"'))) /* reading a new value=data pair */ ( stdInput[0] == '\"'))) /* reading a new value=data pair */
...@@ -606,6 +606,7 @@ void processRegLines(FILE *in) ...@@ -606,6 +606,7 @@ void processRegLines(FILE *in)
while (!feof(in)) { while (!feof(in)) {
LPSTR s; /* The pointer into line for where the current fgets should read */ LPSTR s; /* The pointer into line for where the current fgets should read */
LPSTR check; LPSTR check;
WCHAR* lineW;
s = line; s = line;
for (;;) { for (;;) {
size_t size_remaining; size_t size_remaining;
...@@ -711,10 +712,13 @@ void processRegLines(FILE *in) ...@@ -711,10 +712,13 @@ void processRegLines(FILE *in)
continue; continue;
} }
lineW = GetWideString(line);
break; /* That is the full virtual line */ break; /* That is the full virtual line */
} }
processRegEntry(line); processRegEntry(lineW);
HeapFree(GetProcessHeap(), 0, lineW);
} }
processRegEntry(NULL); processRegEntry(NULL);
......
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