Commit e5685804 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 520d1bc5
...@@ -224,7 +224,7 @@ static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType, ...@@ -224,7 +224,7 @@ static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType,
goto done; goto done;
} }
if ( *lpType == REG_DWORD ) valueDataLen = sizeof(DWORD); 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); error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
goto done; goto done;
} }
...@@ -233,7 +233,7 @@ static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType, ...@@ -233,7 +233,7 @@ static LPTSTR read_value(HWND hwnd, HKEY hKey, LPCTSTR valueName, DWORD *lpType,
error(hwnd, IDS_BAD_VALUE, valueName); error(hwnd, IDS_BAD_VALUE, valueName);
goto done; goto done;
} }
buffer[valueDataLen] = 0;
if(len) *len = valueDataLen; if(len) *len = valueDataLen;
return buffer; return buffer;
......
...@@ -764,7 +764,7 @@ static void export_hkey(FILE *file, HKEY key, ...@@ -764,7 +764,7 @@ static void export_hkey(FILE *file, HKEY key,
case REG_SZ: case REG_SZ:
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
fputs("\"", file); fputs("\"", file);
REGPROC_export_string(file, (char*) *val_buf); if (val_size1) REGPROC_export_string(file, (char*) *val_buf);
fputs("\"\n", file); fputs("\"\n", file);
break; break;
......
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