regedit: Fix editing and exporting of zero-size strings.

This commit is contained in:
Alexandre Julliard 2008-05-13 20:27:11 +02:00
parent 520d1bc5e4
commit e568580447
2 changed files with 3 additions and 3 deletions

View file

@ -224,7 +224,7 @@ static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType,
goto done;
}
if ( *lpType == REG_DWORD ) valueDataLen = sizeof(DWORD);
if (!(buffer = HeapAlloc(GetProcessHeap(), 0, valueDataLen))) {
if (!(buffer = HeapAlloc(GetProcessHeap(), 0, valueDataLen+1))) {
error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
goto done;
}
@ -233,7 +233,7 @@ static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType,
error(hwnd, IDS_BAD_VALUE, valueName);
goto done;
}
buffer[valueDataLen] = 0;
if(len) *len = valueDataLen;
return buffer;

View file

@ -764,7 +764,7 @@ static void export_hkey(FILE *file, HKEY key,
case REG_SZ:
case REG_EXPAND_SZ:
fputs("\"", file);
REGPROC_export_string(file, (char*) *val_buf);
if (val_size1) REGPROC_export_string(file, (char*) *val_buf);
fputs("\"\n", file);
break;