kernelbase: Implement EnumSystemFirmwareTables().

This commit is contained in:
Alexandre Julliard 2024-11-13 10:58:01 +01:00
parent 966cec7a63
commit 6208d61055
2 changed files with 24 additions and 22 deletions

View file

@ -765,16 +765,13 @@ static void test_SystemFirmwareTable(void)
ok( *(UINT *)sfti->TableBuffer == 0, "wrong table id %x\n", *(UINT *)sfti->TableBuffer );
len = pEnumSystemFirmwareTables( RSMB, NULL, 0 );
todo_wine
ok( len == sizeof(UINT), "wrong len %u\n", len );
if (len)
{
smbios_table = malloc( len );
len = pEnumSystemFirmwareTables( RSMB, smbios_table, len );
ok( len == sizeof(UINT), "wrong len %u\n", len );
ok( *(UINT *)smbios_table == 0, "wrong table id %x\n", *(UINT *)smbios_table );
free( smbios_table );
}
HeapFree(GetProcessHeap(), 0, sfti);
}

View file

@ -1785,27 +1785,12 @@ BOOL WINAPI GetXStateFeaturesMask( CONTEXT *context, DWORD64 *feature_mask )
* Firmware functions
***********************************************************************/
/***********************************************************************
* EnumSystemFirmwareTable (kernelbase.@)
*/
UINT WINAPI EnumSystemFirmwareTables( DWORD provider, void *buffer, DWORD size )
{
FIXME( "(0x%08lx, %p, %ld)\n", provider, buffer, size );
return 0;
}
/***********************************************************************
* GetSystemFirmwareTable (kernelbase.@)
*/
UINT WINAPI GetSystemFirmwareTable( DWORD provider, DWORD id, void *buffer, DWORD size )
static UINT get_firmware_table( DWORD provider, SYSTEM_FIRMWARE_TABLE_ACTION action, DWORD id,
void *buffer, DWORD size )
{
SYSTEM_FIRMWARE_TABLE_INFORMATION *info;
ULONG buffer_size = offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer ) + size;
TRACE( "(0x%08lx, 0x%08lx, %p, %ld)\n", provider, id, buffer, size );
if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, buffer_size )))
{
SetLastError( ERROR_OUTOFMEMORY );
@ -1813,7 +1798,7 @@ UINT WINAPI GetSystemFirmwareTable( DWORD provider, DWORD id, void *buffer, DWOR
}
info->ProviderSignature = provider;
info->Action = SystemFirmwareTable_Get;
info->Action = action;
info->TableID = id;
set_ntstatus( NtQuerySystemInformation( SystemFirmwareTableInformation,
@ -1824,3 +1809,23 @@ UINT WINAPI GetSystemFirmwareTable( DWORD provider, DWORD id, void *buffer, DWOR
HeapFree( GetProcessHeap(), 0, info );
return buffer_size;
}
/***********************************************************************
* EnumSystemFirmwareTables (kernelbase.@)
*/
UINT WINAPI EnumSystemFirmwareTables( DWORD provider, void *buffer, DWORD size )
{
TRACE( "(0x%08lx, %p, %ld)\n", provider, buffer, size );
return get_firmware_table( provider, SystemFirmwareTable_Enumerate, 0, buffer, size );
}
/***********************************************************************
* GetSystemFirmwareTable (kernelbase.@)
*/
UINT WINAPI GetSystemFirmwareTable( DWORD provider, DWORD id, void *buffer, DWORD size )
{
TRACE( "(0x%08lx, 0x%08lx, %p, %ld)\n", provider, id, buffer, size );
return get_firmware_table( provider, SystemFirmwareTable_Get, id, buffer, size );
}