gerard patel gerard.patel@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++;
On Mon, 09 Apr 2001, you wrote:
gerard patel gerard.patel@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).
{patch snipped}
I have now been able to build and run WineMine under NT4, and it works perfectly. On exit each parameter is saved to the registry as 16 bytes including the training garbage (not visible in Regedit of course) and when restarted the exact same 16 bytes are reloaded from the registry.
It does therefore seem that there is something wrong with Wne's implementation.