From 918da64ae21bf4958b0789f22ef9d68449a77fb0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 10 Apr 2001 21:30:24 +0000 Subject: [PATCH] RegSetValueExA/W: fixed REG_SZ string length handling for Win95. --- dlls/advapi32/registry.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index c11af42a9e1..557da9b6234 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -640,7 +640,11 @@ DWORD WINAPI RegSetValueExW( HKEY hkey, LPCWSTR name, DWORD reserved, { UNICODE_STRING nameW; - if (count && is_string(type)) + if (GetVersion() & 0x80000000) /* win95 */ + { + if (type == REG_SZ) count = (strlenW( (WCHAR *)data ) + 1) * sizeof(WCHAR); + } + else if (count && is_string(type)) { LPCWSTR str = (LPCWSTR)data; /* if user forgot to count terminating null, add it (yes NT does this) */ @@ -663,7 +667,11 @@ DWORD WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD type, WCHAR *dataW = NULL; NTSTATUS status; - if (count && is_string(type)) + if (GetVersion() & 0x80000000) /* win95 */ + { + if (type == REG_SZ) count = strlen(data) + 1; + } + else if (count && is_string(type)) { /* if user forgot to count terminating null, add it (yes NT does this) */ if (data[count-1] && !data[count]) count++; -- 2.11.4.GIT