ntdll: Implement BIOS table enumeration.

Based on a patch by Dāvis Mosāns.
This commit is contained in:
Alexandre Julliard 2024-11-13 10:57:25 +01:00
parent 23db166ec8
commit 966cec7a63
2 changed files with 23 additions and 5 deletions

View file

@ -756,18 +756,13 @@ static void test_SystemFirmwareTable(void)
sfti->Action = SystemFirmwareTable_Enumerate;
status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, min_sfti_len, &expected_len);
todo_wine
ok( status == STATUS_BUFFER_TOO_SMALL, "NtQuerySystemInformation failed %lx\n", status );
sfti = HeapReAlloc(GetProcessHeap(), 0, sfti, expected_len);
status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, expected_len, &expected_len);
todo_wine
ok( !status, "NtQuerySystemInformation failed %lx\n", status );
if (!status)
{
ok( expected_len == min_sfti_len + sizeof(UINT), "wrong len %lu\n", expected_len );
ok( sfti->TableBufferLength == sizeof(UINT), "wrong len %lu\n", sfti->TableBufferLength );
ok( *(UINT *)sfti->TableBuffer == 0, "wrong table id %x\n", *(UINT *)sfti->TableBuffer );
}
len = pEnumSystemFirmwareTables( RSMB, NULL, 0 );
todo_wine

View file

@ -2131,6 +2131,26 @@ static struct smbios_prologue *create_smbios_data(void)
#endif
static NTSTATUS enum_firmware_info( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULONG available_len,
ULONG *required_len )
{
ULONG len;
switch (sfti->ProviderSignature)
{
case RSMB:
sfti->TableBufferLength = len = sizeof(UINT);
*required_len = offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer[len] );
if (available_len < *required_len) return STATUS_BUFFER_TOO_SMALL;
*(UINT *)sfti->TableBuffer = 0;
return STATUS_SUCCESS;
default:
FIXME("info_class SYSTEM_FIRMWARE_TABLE_INFORMATION provider %08x\n", (unsigned int)sfti->ProviderSignature);
return STATUS_NOT_IMPLEMENTED;
}
}
static NTSTATUS get_firmware_info( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULONG available_len,
ULONG *required_len )
{
@ -3462,6 +3482,9 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
switch (sfti->Action)
{
case SystemFirmwareTable_Enumerate:
ret = enum_firmware_info(sfti, size, &len);
break;
case SystemFirmwareTable_Get:
ret = get_firmware_info(sfti, size, &len);
break;