I think we're making progress. Hopefully this will be the final iteration...
On Wed, Jun 20, 2018 at 11:18:46PM -0600, Alex Henrie wrote:
Signed-off-by: Alex Henrie alexhenrie24@gmail.com
dlls/ntdll/tests/info.c | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index b18f0d39d9..9e12a013cf 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -54,6 +54,11 @@ static DWORD one_before_last_pid = 0; } \ } while(0)
+/* Firmware table providers */ +#define ACPI 0x41435049 +#define FIRM 0x4649524D +#define RSMB 0x52534D42
static BOOL InitFunctionPtrs(void) { /* All needed functions are NT based, so using GetModuleHandle is a good check */ @@ -826,6 +831,57 @@ static void test_query_logicalprocex(void) } }
+static void test_query_firmware(void) +{
- ULONG len1, len2;
- NTSTATUS status;
- SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti;
- int i;
- sfti = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16);
I'd rather not use HEAP_ZERO_MEMORY and explicitly initialise each element - you already do that later on anyway.
- ok(!!sfti, "Failed to allocate memory\n");
- status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, 15, &len1);
+todo_wine
- ok(status == STATUS_INFO_LENGTH_MISMATCH || broken(status == STATUS_INVALID_INFO_CLASS) /* xp */,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
- if (len1 == 0) /* xp, 2003 */
- {
skip("SystemFirmwareTableInformation is not available\n");
HeapFree(GetProcessHeap(), 0, sfti);
return;
- }
- ok(len1 == 16, "Expected length 16, got %u\n", len1);
- status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, 16, &len1);
- ok(status == STATUS_NOT_IMPLEMENTED, "Expected STATUS_NOT_IMPLEMENTED, got %08x\n", status);
- ok(len1 == 0, "Expected length 0, got %u\n", len1);
- sfti->ProviderSignature = RSMB;
- sfti->Action = SystemFirmwareTable_Get;
- sfti->TableID = 0;
- status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, 16, &len1);
- ok(status == STATUS_BUFFER_TOO_SMALL, "Expected STATUS_BUFFER_TOO_SMALL, got %08x\n", status);
- ok(len1 >= 16, "Expected length >= 16, got %u\n", len1);
- ok(sfti->TableBufferLength == len1 - 16, "Expected length %u, got %u\n", len1 - 16, sfti->TableBufferLength);
- sfti = HeapReAlloc(GetProcessHeap(), 0, sfti, len1);
- ok(!!sfti, "Failed to allocate memory\n");
- for (i = 0; i < 100; i++)
- {
I don't think this loop is very useful. Let's just get the 0th table.
sfti->TableID = i;
status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, len1, &len2);
ok(status == STATUS_SUCCESS, "Table %u: Expected STATUS_SUCCESS, got %08x\n", i, status);
ok(len2 == len1, "Table %u: Expected length %u, got %u\n", i, len1, len2);
ok(sfti->TableBufferLength == len1 - 16,
"Table %u: Expected length %u, got %u\n", i, len1 - 16, sfti->TableBufferLength);
- }
- HeapFree(GetProcessHeap(), 0, sfti);
+}
static void test_query_processor_power_info(void) { NTSTATUS status; @@ -2271,6 +2327,10 @@ START_TEST(info) trace("Starting test_process_debug_flags()\n"); test_query_process_debug_flags(argc, argv);
- /* 0x4C SystemFirmwareTableInformation */
- trace("Starting test_query_firmware()\n");
- test_query_firmware();
- /* belongs to its own file */ trace("Starting test_readvirtualmemory()\n"); test_readvirtualmemory();
-- 2.17.1