Stevnhoved Posted February 28, 2015 Share Posted February 28, 2015 Hi. Thank you for a nice forum. It has often been a real lifesaver. Now I have to figure out if a system is booted via UEFI or legacy BIOS. I have found an example in Delpha that someone has rewritten in WinBach, which looks a lot like AutoIt. http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/DllCall~Information+Booted~UEFI~or~BIOS.txt However, I cannot figure out to translate it to AutoIt. I think have not enough experience with the DllCall function. Can anyone help me, or guide me in some direction? Many thanks in advance: D Best Regards, Martin Stevnhoved Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2015 Moderators Share Posted February 28, 2015 Untested: Func _WinAPI_GetFirmwareEnvironmentVariable($sName, $sGUID) If Not StringLen($sName) Then ; variable cannot be null Return SetError(1, 0, 0) EndIf Local $aRet = DllCall("Kernel32.dll", "dword", _ "GetFirmwareEnvironmentVariableW", "wstr", $sName, _ "wstr", $sGUID, "wstr", "", "dword", 4096) If @error Or Not $aRet[0] Then Return SetError(1, 0, 0) EndIf Return $aRet[3] ; pBuffer EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
DavidKarner Posted April 12, 2016 Share Posted April 12, 2016 #include <WinAPI.au3> MsgBox(0,_WinAPI_GetFirmwareEnvironmentVariable(),0) Func _WinAPI_GetFirmwareEnvironmentVariable() Local $sName = "" Local $sGUID = "{00000000-0000-0000-0000-000000000000}" Local $aRet = DllCall("Kernel32.dll", "dword", _ "GetFirmwareEnvironmentVariableW", "wstr", $sName, _ "wstr", $sGUID, "wstr", "", "dword", 4096) ; ERROR_INVALID_FUNCTION 1 (0x1) ; ERROR_NOACCESS 998 (0x3E6) Local $LastError = _WinAPI_GetLastError() If $LastError == 1 Then Return "Legacy" ElseIf $LastError == 998 Then Return "UEFI" Else Return "Unknown" EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now