Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: GetFirmwareEnvironmentVariableA GetFirmwareEnvironmentVariable Get Firmware Environment Variable Detect Windows System Machine Booted UEFI Legacy BIOS
uses Windows, SysUtils; function GetFirmwareEnvironmentVariableA(lpName, lpGuid: LPCSTR; pBuffer: Pointer; nSize: DWORD): DWORD; stdcall; external kernel32 name 'GetFirmwareEnvironmentVariableA'; begin try GetFirmwareEnvironmentVariableA('','{00000000-0000-0000-0000-000000000000}', nil,0); if (GetLastError = ERROR_INVALID_FUNCTION) then Writeln('Legacy BIOS') else Writeln('UEFI Boot Mode'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.Any help would be appreciated.
#DefineFunction GetFirmwareType() ERROR_INVALID_FUNCTION = 1 DllCall("kernel32.dll",long:"GetFirmwareEnvironmentVariableA",lpstr:'',lpstr:'{00000000-0000-0000-0000-000000000000}', lpnull, long:0) If DllLastError() == ERROR_INVALID_FUNCTION Then Return "Legacy BIOS" Else Return "UEFI Boot Mode" #EndFunction ; Test Message("Firmware", "System firmware: ": GetFirmwareType())
Article ID: W18506
Filename: Booted UEFI or BIOS.txt
File Created: 2014:06:05:10:35:42
Last Updated: 2014:06:05:10:35:42