davep davep@cyw.uklinux.net writes:
Could you please send me a +reg,+server trace of the offending calls?
Attached.
Thanks; does this fix it?
Index: dlls/advapi32/registry.c =================================================================== RCS file: /opt/cvs-commit/wine/dlls/advapi32/registry.c,v retrieving revision 1.20 diff -u -r1.20 registry.c --- dlls/advapi32/registry.c 2001/01/06 01:29:18 1.20 +++ dlls/advapi32/registry.c 2001/02/13 22:11:00 @@ -447,6 +447,7 @@ return ERROR_INVALID_PARAMETER;
status = NtQueryKey( hkey, KeyFullInformation, buffer, sizeof(buffer), &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done;
if (class) { @@ -460,32 +461,30 @@ status = NtQueryKey( hkey, KeyFullInformation, buf_ptr, total_size, &total_size ); }
- if (!status) + if (status) goto done; + + if (class_len && (info->ClassLength/sizeof(WCHAR) + 1 > *class_len)) { - if (class_len && (info->ClassLength/sizeof(WCHAR) + 1 > *class_len)) - { - status = STATUS_BUFFER_OVERFLOW; - } - else - { - memcpy( class, buf_ptr + info->ClassOffset, info->ClassLength ); - class[info->ClassLength/sizeof(WCHAR)] = 0; - } + status = STATUS_BUFFER_OVERFLOW; + } + else + { + memcpy( class, buf_ptr + info->ClassOffset, info->ClassLength ); + class[info->ClassLength/sizeof(WCHAR)] = 0; } } + else status = STATUS_SUCCESS;
- if (!status || status == STATUS_BUFFER_OVERFLOW) - { - if (class_len) *class_len = info->ClassLength / sizeof(WCHAR); - if (subkeys) *subkeys = info->SubKeys; - if (max_subkey) *max_subkey = info->MaxNameLen; - if (max_class) *max_class = info->MaxClassLen; - if (values) *values = info->Values; - if (max_value) *max_value = info->MaxValueNameLen; - if (max_data) *max_data = info->MaxValueDataLen; - if (modif) *modif = info->LastWriteTime; - } + if (class_len) *class_len = info->ClassLength / sizeof(WCHAR); + if (subkeys) *subkeys = info->SubKeys; + if (max_subkey) *max_subkey = info->MaxNameLen; + if (max_class) *max_class = info->MaxClassLen; + if (values) *values = info->Values; + if (max_value) *max_value = info->MaxValueNameLen; + if (max_data) *max_data = info->MaxValueDataLen; + if (modif) *modif = info->LastWriteTime;
+ done: if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); return RtlNtStatusToDosError( status ); } @@ -502,7 +501,7 @@ NTSTATUS status; char buffer[256], *buf_ptr = buffer; KEY_FULL_INFORMATION *info = (KEY_FULL_INFORMATION *)buffer; - DWORD total_size; + DWORD total_size, len;
TRACE( "(0x%x,%p,%ld,%p,%p,%p,%p,%p,%p,%p,%p)\n", hkey, class, class_len ? *class_len : 0, reserved, subkeys, max_subkey, values, max_value, max_data, security, modif ); @@ -511,6 +510,7 @@ return ERROR_INVALID_PARAMETER;
status = NtQueryKey( hkey, KeyFullInformation, buffer, sizeof(buffer), &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done;
if (class || class_len) { @@ -524,39 +524,37 @@ status = NtQueryKey( hkey, KeyFullInformation, buf_ptr, total_size, &total_size ); }
- if (!status) - { - DWORD len = WideCharToMultiByte( CP_ACP, 0, - (WCHAR *)(buf_ptr + info->ClassOffset), - info->ClassLength/sizeof(WCHAR), - NULL, 0, NULL, NULL ); - if (class_len) - { - if (len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW; - *class_len = len; - } - if (class && !status) - { - WideCharToMultiByte( CP_ACP, 0, - (WCHAR *)(buf_ptr + info->ClassOffset), - info->ClassLength/sizeof(WCHAR), - class, len, NULL, NULL ); - class[len] = 0; - } - } - } + if (status) goto done;
- if (!status || status == STATUS_BUFFER_OVERFLOW) - { - if (subkeys) *subkeys = info->SubKeys; - if (max_subkey) *max_subkey = info->MaxNameLen; - if (max_class) *max_class = info->MaxClassLen; - if (values) *values = info->Values; - if (max_value) *max_value = info->MaxValueNameLen; - if (max_data) *max_data = info->MaxValueDataLen; - if (modif) *modif = info->LastWriteTime; - } + len = WideCharToMultiByte( CP_ACP, 0, + (WCHAR *)(buf_ptr + info->ClassOffset), + info->ClassLength/sizeof(WCHAR), + NULL, 0, NULL, NULL ); + if (class_len) + { + if (len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW; + *class_len = len; + } + if (class && !status) + { + WideCharToMultiByte( CP_ACP, 0, + (WCHAR *)(buf_ptr + info->ClassOffset), + info->ClassLength/sizeof(WCHAR), + class, len, NULL, NULL ); + class[len] = 0; + } + } + else status = STATUS_SUCCESS; + + if (subkeys) *subkeys = info->SubKeys; + if (max_subkey) *max_subkey = info->MaxNameLen; + if (max_class) *max_class = info->MaxClassLen; + if (values) *values = info->Values; + if (max_value) *max_value = info->MaxValueNameLen; + if (max_data) *max_data = info->MaxValueDataLen; + if (modif) *modif = info->LastWriteTime;
+ done: if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); return RtlNtStatusToDosError( status ); } @@ -821,6 +819,7 @@ } else if (status != STATUS_BUFFER_OVERFLOW) goto done; } + else status = STATUS_SUCCESS;
if (type) *type = info->Type; if (count) *count = total_size - info_size; @@ -880,36 +879,35 @@ buf_ptr, total_size, &total_size ); }
- if (!status) + if (status) goto done; + + if (is_string(info->Type)) { - if (is_string(info->Type)) + DWORD len = WideCharToMultiByte( CP_ACP, 0, (WCHAR *)(buf_ptr + info_size), + (total_size - info_size) /sizeof(WCHAR), + NULL, 0, NULL, NULL ); + if (data && len) { - DWORD len = WideCharToMultiByte( CP_ACP, 0, (WCHAR *)(buf_ptr + info_size), - (total_size - info_size) /sizeof(WCHAR), - NULL, 0, NULL, NULL ); - if (data && len) + if (len > *count) status = STATUS_BUFFER_OVERFLOW; + else { - if (len > *count) status = STATUS_BUFFER_OVERFLOW; - else - { - WideCharToMultiByte( CP_ACP, 0, (WCHAR *)(buf_ptr + info_size), - (total_size - info_size) /sizeof(WCHAR), - data, len, NULL, NULL ); - /* if the type is REG_SZ and data is not 0-terminated - * and there is enough space in the buffer NT appends a \0 */ - if (len < *count && data[len-1]) data[len] = 0; - } + WideCharToMultiByte( CP_ACP, 0, (WCHAR *)(buf_ptr + info_size), + (total_size - info_size) /sizeof(WCHAR), + data, len, NULL, NULL ); + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + if (len < *count && data[len-1]) data[len] = 0; } - total_size = len + info_size; - } - else if (data) - { - if (total_size - info_size > *count) status = STATUS_BUFFER_OVERFLOW; - else memcpy( data, buf_ptr + info_size, total_size - info_size ); } + total_size = len + info_size; } - else if (status != STATUS_BUFFER_OVERFLOW) goto done; + else if (data) + { + if (total_size - info_size > *count) status = STATUS_BUFFER_OVERFLOW; + else memcpy( data, buf_ptr + info_size, total_size - info_size ); + } } + else status = STATUS_SUCCESS;
if (type) *type = info->Type; if (count) *count = total_size - info_size; @@ -1056,6 +1054,7 @@ } } } + else status = STATUS_SUCCESS;
if (type) *type = info->Type; if (count) *count = info->DataLength; @@ -1151,6 +1150,7 @@ else memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); } } + else status = STATUS_SUCCESS;
if (type) *type = info->Type; if (count) *count = info->DataLength;