Example #1
0
        private Boolean CreateUEFIBootOption(String Drive)
        {
            String _Drive = String.Format(@"\\.\{0}", Drive);

            Log.write("-Add UEFI Entry");

            if (!UEFIWrapper.UEFI_Init())
            {
                Log.write("UEFI Init Fail");
                return(false);
            }

            if (Environment.Is64BitOperatingSystem)
            {
                if (!UEFIWrapper.UEFI_MakeMediaBootOption(config.BOOT_ENTRY_TEXT, _Drive, config.UEFI_DIR + config.UEFI_GRUB_BIN64))
                {
                    Log.write("UEFI 64-bit Entry Fail");
                    return(false);
                }
            }
            else
            {
                if (!UEFIWrapper.UEFI_MakeMediaBootOption(config.BOOT_ENTRY_TEXT, _Drive, config.UEFI_DIR + config.UEFI_GRUB_BIN32))
                {
                    Log.write("UEFI 32-bit Entry Fail");
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        protected override bool UnInstallBootObjects(Object extraData)
        {
            Log.write("===Removing Boot Objects===");
            MountFirmwarePartition();
            if (UEFIWrapper.UEFI_Init())
            {
                Log.write("-Remove Android UEFI Entry");
                int ret = UEFIWrapper.UEFI_DeleteBootOptionByDescription(config.BOOT_ENTRY_TEXT);
                Log.write("-UEFI: " + ret);
            }
            else
            {
                Log.write("-UEFI Init ... fail");
            }
            base.cleanup(config.UEFI_PARTITION_MOUNTPOINT + config.UEFI_DIR);
            UnMountFirmwarePartition();

            return(true);
        }
Example #3
0
        Boolean RequirementsCheck()
        {
            /*
             * App is running as admin
             * Access to NVRAM Granted
             * System has UEFI
             * System is running Windows 8 or higher
             * System is running on Windows 64-bit
             * Target partition has enough space
             *
             */

            Log.write("=============[REQUIREMENTS CHECK]============");
            //
            //Administrator check
            //
            if (IsAdministrator())
            {
                Log.write("Administrator privilege ... ok");
            }
            else
            {
                Log.write("Administrator privilege ... fail");
                return(false);
            }
            //
            // 64-bit check
            //
            if (!Environment.Is64BitOperatingSystem)
            {
                Log.write("OS Type: ... fail");
                return(false);
            }
            //
            // OS Version Check
            //
            Log.write("OSVer: " + Environment.OSVersion.ToString());
            if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                switch (System.Environment.OSVersion.Version.Major)
                {
                case 6:
                    if (System.Environment.OSVersion.Version.Minor >= 2)
                    {
                        Log.write("OperatingSystem Version ... ok");
                    }
                    break;

                case 10:
                    Log.write("OperatingSystem Version ... ok");
                    break;

                default:
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            //
            //Load UEFI Library
            //
            Handle = LoadLibrary(@"Win32UEFI.dll");
            if (Handle == IntPtr.Zero)
            {
                int errorCode = Marshal.GetLastWin32Error();
                Log.write(string.Format("Failed to load library (ErrorCode: {0})", errorCode));
                return(false);
            }

            //
            //NVRAM Access
            //
            if (ws.GetAccesstoNVRam())
            {
                Log.write("Windows Security: Access NVRAM Privilege ... ok");
            }
            else
            {
                Log.write("Windows Security: Access NVRAM Privilege ... Not All Set");
            }

            //
            //UEFI Check
            //
            if (UEFIWrapper.UEFI_isUEFIAvailable())
            {
                Log.write("System Firmware: UEFI");
            }
            else
            {
                Log.write("System Firmware: Other");
                return(false);
            }

            return(true);
        }