Windows Dev Center

GetSystemFirmwareTable() - Does this work?


  • #include <windows.h>

    #include <string.h>

    #include <stdio.h>

    #include <iostream.h>


    main(ULONG_PTR argc, char *argv[])


    Description: The input to this can be

    - a.pat b.pat c.pat abcd\q.pat fgh\m.apt xyz\* pqr\?.pat g.pat

    - ListFile with the above list



    UCHAR pFirmwareTableBuffer1[0x100];

    UCHAR pFirmwareTableBuffer2[0x100];

    ULONG_PTR retValue;

    ULONG_PTR err;

    retValue = EnumSystemFirmwareTables('ACPI', pFirmwareTableBuffer1, 0x100);

    printf("Ret vlaue 1= %d\n", retValue);


    // Return 20 and pFirmwareTableBuffer1 has



    retValue = GetSystemFirmwareTable('ACPI', 'FACP', pFirmwareTableBuffer2, 0x100);

    err = GetLastError();

    printf("Ret vlaue 2 = %d, Err = %d\n", retValue, err);


    // Returns 0 and err = 1168 - No elements found - Please tell me why?



    Friday, May 19, 2006 9:20 PM


All replies

  • For win32 API issues, please use the newsgroups at


    Ayman Shoukry
    VC++ Team
    Friday, May 19, 2006 9:24 PM
  • Thanks for the tip. I did post in Win32 Programming tools and it has been almost 5 days, have not heard from any one. All I am looking for is some working sample code. If you can kindly point me to a sample code that would be more then suffecient. Thanks again


    Monday, May 22, 2006 5:04 PM
  • I will move this to the windows team in case someone has a working sample.

    Ayman Shoukry
    VC++ Team
    Monday, May 22, 2006 5:19 PM
  • Since I did not hear from anyone I contacted Microsoft and MSDN directly and this is the solution they provided and it works.

    Quote begin:

    Here’s the answers I got. I’ll update the docs with this info:

    The issue is with the how the table ID is represented.  Because it’s a DWORD and little endian you have to reverse the characters in the string.  If you change the call to the following it will work:


         retValue = GetSystemFirmwareTable('ACPI', 'PCAF', pFirmwareTableBuffer2, 0x100);

    Quote End:

    The next version MSDN will have the correct usuage. So this issue might be closed.


    Friday, May 26, 2006 4:39 PM
  • 'FACP' change to *(DWORD *)"FACP" and work.
    The first argument is that 'ACPI' should not be changed.
    API vulnerability seems.


    retValue = GetSystemFirmwareTable('ACPI', *(DWORD *)"FACP", pFirmwareTableBuffer, 0x100);


    In my native language is Japanese, the use of automatic translation.
    If the elusive please be patient.|ja

    Wednesday, November 21, 2007 7:51 PM