none
GetSystemFirmwareTable() - Does this work?

    Question

  • #include <windows.h>

    #include <string.h>

    #include <stdio.h>

    #include <iostream.h>

    ULONG_PTR

    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

    // FACP APIC SPCR MCFG OEMB

    //

    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

Answers

All replies

  • For win32 API issues, please use the newsgroups at http://msdn.microsoft.com/newsgroups/topic.aspx?url=/MSDN-FILES/028/201/015/topic.xml

    OTP

    Thanks,
    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

    regards
    ananda

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

    Thanks,
    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.

    regards
    ananda

    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.

     

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

     

    In my native language is Japanese, the use of automatic translation.
    If the elusive please be patient.
    http://www.google.co.jp/translate_t?langpair=en|ja

    Wednesday, November 21, 2007 7:51 PM