none
How to get lpName and namespace of firmware environment variable? RRS feed

  • Question

  • Hi all,

    I trying to use GetFirmwareEnvironmentVariable function but I do not know the lpName and lpGuid how to get.

    Does it have tool or command get it? Thanks.

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms724325(v=vs.85).aspx

    • Edited by MissMnie Thursday, April 14, 2016 1:42 AM
    Thursday, April 14, 2016 1:34 AM

Answers

  • There is no way to enumerate the various environment variables; you have to know what you're looking for. The only GUID that is documented for your use is the NULL name and the NULL GUID, which looks like this: GetFirmwareEnvironmentVariable ("", "{00000000-0000-0000-0000-000000000000}", NULL, 0). If the return value is ERROR_INVALID_FUNCTION, then the system booted using legacy BIOS; otherwise it booted using UEFI.

    You would be better off just using GetFirmwareType

     -Brian

     

    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Monday, April 18, 2016 3:42 AM
    Moderator

All replies

  • That is how UEFI communicates with the OS boot code. What are you trying to do?

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Thursday, April 14, 2016 7:09 AM
    Moderator
  • That is how UEFI communicates with the OS boot code. What are you trying to do?

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    For some business application so I want to get/set Firmware Environment Variable in desktop program.
    • Edited by MissMnie Thursday, April 14, 2016 9:13 AM
    Thursday, April 14, 2016 9:12 AM
  • WHICH variables?

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Thursday, April 14, 2016 6:55 PM
    Moderator
  • WHICH variables?

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Hi 

    If have any method get any variable, I could try it. It is OK!

    I searched some sample code but I did not know my PC's  lpName and lpGuid.

    Thanks.

    https://kunyichen.wordpress.com/2014/04/30/note-readwrite-uefi-variables-under-windows-7-and-later/#comment-1362  


    • Edited by MissMnie Monday, April 18, 2016 2:05 AM
    Monday, April 18, 2016 2:05 AM
  • There is no way to enumerate the various environment variables; you have to know what you're looking for. The only GUID that is documented for your use is the NULL name and the NULL GUID, which looks like this: GetFirmwareEnvironmentVariable ("", "{00000000-0000-0000-0000-000000000000}", NULL, 0). If the return value is ERROR_INVALID_FUNCTION, then the system booted using legacy BIOS; otherwise it booted using UEFI.

    You would be better off just using GetFirmwareType

     -Brian

     

    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Monday, April 18, 2016 3:42 AM
    Moderator