dlls/ntdll/reg.c -- bugfix
Gerald Pfeifer
gerald at pfeifer.com
Thu Nov 22 14:41:29 CST 2007
I am by far an expert of that code, but the current
keyinfo.ClassLength = max( 0, wine_server_reply_size(reply) - reply->namelen );
there is the same as
keyinfo.ClassLength = wine_server_reply_size(reply) - reply->namelen;
and I assume this is not the expected outcome.
The reason is that wine_server_reply_size returns data_size_t which, like
reply->namelen is unsigned as defined in include/wine/server_protocol.h,
so the difference of these two always will be unsigned and thus larger
than 0.
Again, I am no an expert here, but I believe the following patch
establishes the original intent of this code. If this is the case,
this indeed fixes a genuine bug.
Gerald
ChangeLog:
Fix computation in enumerate_key().
Index: dlls/ntdll/reg.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/reg.c,v
retrieving revision 1.79
diff -u -3 -p -r1.79 reg.c
--- dlls/ntdll/reg.c 17 Oct 2007 14:06:21 -0000 1.79
+++ dlls/ntdll/reg.c 22 Nov 2007 20:29:19 -0000
@@ -271,7 +271,7 @@ static NTSTATUS enumerate_key( HANDLE ha
fixed_size = (char *)keyinfo.Name - (char *)&keyinfo;
keyinfo.LastWriteTime = modif;
keyinfo.TitleIndex = 0;
- keyinfo.ClassLength = max( 0, wine_server_reply_size(reply) - reply->namelen );
+ keyinfo.ClassLength = max( 0, (int)wine_server_reply_size(reply) - (int)reply->namelen );
keyinfo.ClassOffset = keyinfo.ClassLength ? fixed_size + reply->namelen : -1;
keyinfo.NameLength = reply->namelen;
memcpy( info, &keyinfo, min( length, fixed_size ) );
More information about the wine-patches
mailing list