RegSetValueEx problem?

Alexandre Julliard julliard at winehq.com
Mon Apr 9 16:07:33 CDT 2001


gerard patel <gerard.patel at asi.fr> writes:

> I have browsed server/registry.c and it seems that the registry
> stores a terminating null for strings; so if you have in the registry
> file a string like "0123456789", it get in memory a length of 11.
> So I guess that the fix would be to fix the length by -1 somewhere
> in the path server->ntdll->advapi

No, the current behavior is correct for NT; what you want is a version
check to get the Win95 behavior. Something like the patch below should
do it (and of course WineMine should be fixed to work on NT too).

Index: dlls/advapi32/registry.c
===================================================================
RCS file: /opt/cvs-commit/wine/dlls/advapi32/registry.c,v
retrieving revision 1.24
diff -u -r1.24 registry.c
--- dlls/advapi32/registry.c	2001/03/23 19:12:01	1.24
+++ dlls/advapi32/registry.c	2001/04/09 20:49:35
@@ -640,8 +640,12 @@
 {
     UNICODE_STRING nameW;
 
-    if (count && is_string(type))
+    if (GetVersion() & 0x80000000)  /* win95 */
     {
+        if (type == REG_SZ) count = strlenW( (WCHAR *)data ) + 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) */
         if (str[count / sizeof(WCHAR) - 1] && !str[count / sizeof(WCHAR)])
@@ -663,7 +667,11 @@
     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++;


-- 
Alexandre Julliard
julliard at winehq.com




More information about the wine-devel mailing list