ntdll: Fix computation in enumerate_key().

This commit is contained in:
Gerald Pfeifer 2007-11-22 21:41:29 +01:00 committed by Alexandre Julliard
parent 173a8bb224
commit 15f8b80ba7
1 changed files with 10 additions and 2 deletions

View File

@ -271,8 +271,16 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
fixed_size = (char *)keyinfo.Name - (char *)&keyinfo; fixed_size = (char *)keyinfo.Name - (char *)&keyinfo;
keyinfo.LastWriteTime = modif; keyinfo.LastWriteTime = modif;
keyinfo.TitleIndex = 0; keyinfo.TitleIndex = 0;
keyinfo.ClassLength = max( 0, wine_server_reply_size(reply) - reply->namelen ); if (reply->namelen < wine_server_reply_size(reply))
keyinfo.ClassOffset = keyinfo.ClassLength ? fixed_size + reply->namelen : -1; {
keyinfo.ClassLength = wine_server_reply_size(reply) - reply->namelen;
keyinfo.ClassOffset = fixed_size + reply->namelen;
}
else
{
keyinfo.ClassLength = 0;
keyinfo.ClassOffset = -1;
}
keyinfo.NameLength = reply->namelen; keyinfo.NameLength = reply->namelen;
memcpy( info, &keyinfo, min( length, fixed_size ) ); memcpy( info, &keyinfo, min( length, fixed_size ) );
} }