From 15f8b80ba7ac0fba9fe94b46c1c4f63308ab75e1 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Thu, 22 Nov 2007 21:41:29 +0100 Subject: [PATCH] ntdll: Fix computation in enumerate_key(). --- dlls/ntdll/reg.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index 85297e3a376..8b724ec4b48 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -271,8 +271,16 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i 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.ClassOffset = keyinfo.ClassLength ? fixed_size + reply->namelen : -1; + if (reply->namelen < wine_server_reply_size(reply)) + { + 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; memcpy( info, &keyinfo, min( length, fixed_size ) ); }