Im trying to change the boot order to all my Toshiba's The vendor said i could use SetFirmwareEnvironmentVariable() to do this. So i have found the code and generated this
static void Main(string[] args)
{
//Set the variables for the UEFI Change
string inGUID = "{8be4df61-93ca-11d2-aa0d-00e098032b8c}";
string inName = "BootOrder";
string inBuffer = "0x0003,0x0000,0x0001,0x0004,0x0005,0x0006";
string dwAttribute = "0x7";
//Attempt to set the UEFI Variables Windows XP and UP??
//ANSII
var ResultsANSII = SetFirmwareEnvironmentVariable(
inName,
inGUID,
Marshal.StringToHGlobalUni(inBuffer),
sizeof(UInt16));
var ErrorMessage = Marshal.GetLastWin32Error();
}
[DllImport("kernel32.dll", EntryPoint = "SetFirmwareEnvironmentVariable"), SetLastError = true]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetFirmwareEnvironmentVariable(
[In][MarshalAs(UnmanagedType.LPTStr)] string lpName,
[In][MarshalAs(UnmanagedType.LPTStr)] string lpGuid,
[In]IntPtr pBuffer,
uint nSize);
however it doesnt seem to be working. the results codes are 0 but its not changing the boot order. Anyone have any ideas?