[PATCH 0/1] MR6929: kernelbase: Properly return 0 from EnumSystemFirmwareTable on error.
6d1df55bf3b6051ad61e9c7cb7d63f13c1b9771f changed `NtQuerySystemInformation(SystemFirmwareTableInformation, ...)` to return 0 on error, which left `get_firmware_table` returning -16 This would be interpreted as a very large number by applications, breaking them. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6929
From: Evan Tang <etang(a)codeweavers.com> --- dlls/kernelbase/memory.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index fde655eaaed..0be178f6ab7 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -1790,6 +1790,7 @@ static UINT get_firmware_table( DWORD provider, SYSTEM_FIRMWARE_TABLE_ACTION act { SYSTEM_FIRMWARE_TABLE_INFORMATION *info; ULONG buffer_size = offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer ) + size; + NTSTATUS status; if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, buffer_size ))) { @@ -1801,13 +1802,13 @@ static UINT get_firmware_table( DWORD provider, SYSTEM_FIRMWARE_TABLE_ACTION act info->Action = action; info->TableID = id; - set_ntstatus( NtQuerySystemInformation( SystemFirmwareTableInformation, - info, buffer_size, &buffer_size )); + status = NtQuerySystemInformation( SystemFirmwareTableInformation, info, buffer_size, &buffer_size ); + set_ntstatus(status); buffer_size -= offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer ); if (buffer_size <= size) memcpy( buffer, info->TableBuffer, buffer_size ); HeapFree( GetProcessHeap(), 0, info ); - return buffer_size; + return NT_SUCCESS(status) || status == STATUS_BUFFER_TOO_SMALL ? buffer_size : 0; } /*********************************************************************** -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6929
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150089 Your paranoid android. === debian11b (64 bit WoW report) === user32: win.c:4070: Test failed: Expected active window 0000000003880146, got 0000000000000000. win.c:4071: Test failed: Expected focus window 0000000003880146, got 0000000000000000.
participants (3)
-
Evan Tang -
Evan Tang (@etang-cw) -
Marvin