regedit: Fix reading from stdin.

This commit is contained in:
Alexander Nicolaysen Sørnes 2009-06-16 15:46:33 +02:00 committed by Alexandre Julliard
parent c29328583d
commit dcade85261
1 changed files with 11 additions and 3 deletions

View File

@ -610,20 +610,29 @@ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode)
* *
* Parameters: * Parameters:
* in - input stream to read from * in - input stream to read from
* first_chars - beginning of stream, read due to Unicode check
*/ */
static void processRegLinesA(FILE *in) static void processRegLinesA(FILE *in, char* first_chars)
{ {
LPSTR line = NULL; /* line read from input stream */ LPSTR line = NULL; /* line read from input stream */
ULONG lineSize = REG_VAL_BUF_SIZE; ULONG lineSize = REG_VAL_BUF_SIZE;
line = HeapAlloc(GetProcessHeap(), 0, lineSize); line = HeapAlloc(GetProcessHeap(), 0, lineSize);
CHECK_ENOUGH_MEMORY(line); CHECK_ENOUGH_MEMORY(line);
memcpy(line, first_chars, 2);
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; WCHAR* lineW;
s = line; s = line;
if(first_chars)
{
s += 2;
first_chars = NULL;
}
for (;;) { for (;;) {
size_t size_remaining; size_t size_remaining;
int size_to_get; int size_to_get;
@ -1373,8 +1382,7 @@ BOOL import_registry_file(FILE* reg_file)
processRegLinesW(reg_file); processRegLinesW(reg_file);
} else } else
{ {
rewind(reg_file); processRegLinesA(reg_file, (char*)s);
processRegLinesA(reg_file);
} }
} }
return TRUE; return TRUE;