In 71aba33f, GetSystemFirmwareTable was moved from kernel32 to kernelbase. In the process, its error handling was refactored to use NtQuerySystemInformation, and it began to return zero whenever NtQuerySystemInformation failed. This prevents software from being able to make 'preflight' calls to determine how large their buffer should be.
This patch simply restores the old behavior.
Signed-off-by: John Chadwick john@jchw.io --- dlls/kernelbase/memory.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index 6be399bc97..c93d490e74 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -1161,13 +1161,10 @@ UINT WINAPI GetSystemFirmwareTable( DWORD provider, DWORD id, void *buffer, DWOR info->Action = SystemFirmwareTable_Get; info->TableID = id;
- if (set_ntstatus( NtQuerySystemInformation( SystemFirmwareTableInformation, - info, buffer_size, &buffer_size ))) - { - buffer_size -= offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer ); - if (buffer_size <= size) memcpy( buffer, info->TableBuffer, buffer_size ); - } - else buffer_size = 0; + set_ntstatus( NtQuerySystemInformation( SystemFirmwareTableInformation, + info, buffer_size, &buffer_size )); + 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;