EFI_STATUS Status = EFI_SUCCESS; EFI_GUID OemOSTypeGuid = {0xd06a0bc7, 0x9feb, 0x4cbb, 0xbd, 0x78, 0xbb, 0xdc, 0xe7, 0x70, 0xef, 0xd3}; UINT32 Attributes = ; UINTN DataSize = sizeof (OEM_OS_TYPE2); OEM_OS_TYPE2 SaveOSType2; Status = pRS->GetVariable ( L"VariableName", &OemOSTypeGuid, &Attributes, // NULL &DataSize, (VOID *)&SaveOSType2 // &SaveOSType2 ); if (EFI_ERROR(Status) && (Status == EFI_NOT_FOUND)) // variable inexistence, then create it { SaveOSType2.Value = 0x11; Status = pRS->SetVariable ( L"VariableName", &OemOSTypeGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, // 0x07 sizeof (OEM_OS_TYPE2), &SaveOSType2 ); }