Exemplo n.º 1
0
        protected void InstallWorker_DoWork(object sender, DoWorkEventArgs e) 
        {
            String InfPath = (String) e.Argument;
            String DevPath = String.Empty, InstanceId = String.Empty;

            try
            {
                UInt32  Result = 0;
                Boolean RebootRequired = false;

                DifxFlags Flags = DifxFlags.DRIVER_PACKAGE_ONLY_IF_DEVICE_PRESENT;

                if (cbForce.Checked) Flags |= DifxFlags.DRIVER_PACKAGE_FORCE;

                if (cbBus.Checked)
                {
                    if (!Devcon.Find(new Guid(DS3_BUS_CLASS_GUID), ref DevPath, ref InstanceId))
                    {
                        if (Devcon.Create("System", new Guid("{4D36E97D-E325-11CE-BFC1-08002BE10318}"), "root\\ScpVBus\0\0"))
                        {
                            Logger(DifxLog.DIFXAPI_SUCCESS, 0, "Virtual Bus Created");
                            Bus_Device_Configured = true;
                        }
                    }

                    Result = Installer.Install(InfPath + @"ScpVBus.inf", Flags, out RebootRequired); Reboot |= RebootRequired;
                    if (Result == 0) Bus_Driver_Configured = true;
                }

                if (cbBluetooth.Checked)
                {
                    Result = Installer.Install(InfPath + @"BthWinUsb.inf", Flags, out RebootRequired); Reboot |= RebootRequired;
                    if (Result == 0) BTH_Driver_Configured = true;
                }


                if (cbDS3.Checked)
                {
                    Result = Installer.Install(InfPath + @"Ds3WinUsb.inf", Flags, out RebootRequired); Reboot |= RebootRequired;
                    if (Result == 0) DS3_Driver_Configured = true;
                }

                if (cbService.Checked)
                {
                    IDictionary       State = new Hashtable();
                    AssemblyInstaller Service = new AssemblyInstaller(Directory.GetCurrentDirectory() + @"\ScpService.exe", null);

                    State.Clear(); Service.UseNewContext = true;

                    Service.Install(State);
                    Service.Commit (State);

                    if (Start(ScpService)) Logger(DifxLog.DIFXAPI_INFO, 0, ScpService + " Started.");
                    else Reboot = true;

                    Scp_Service_Configured = true;
                }
            }
            catch { }
        }
Exemplo n.º 2
0
        /// <summary>Install the ScpVBus driver.</summary>
        /// <remarks>Throws exceptions upon errors.</remarks>
        /// <returns>false if a reboot is still required to complete installation, else true to indicate completion.</returns>
        public static bool Install()
        {
            var infPath    = @".\Driver\";
            var devPath    = "";
            var instanceId = "";
            var installer  = Difx.Factory();

            uint result         = 0;
            bool rebootRequired = false;

            DifxFlags flags = DifxFlags.DRIVER_PACKAGE_ONLY_IF_DEVICE_PRESENT | DifxFlags.DRIVER_PACKAGE_FORCE;

            if (!Devcon.Find(new Guid(SCP_BUS_CLASS_GUID), ref devPath, ref instanceId))
            {
                if (!Devcon.Create("System", new Guid("{4D36E97D-E325-11CE-BFC1-08002BE10318}"), "root\\ScpVBus\0\0"))
                {
                    throw new ScpDriverInstallException("Unable to create SCP Virtual Bus. Cannot continue with installation.");
                }
            }

            result = installer.Install(infPath + @"ScpVBus.inf", flags, out rebootRequired);
            if (result != 0)
            {
                throw new ScpDriverInstallException("Driver installation failed with DIFxAPI error 0x" + result.ToString("X8"));
            }
            return(!rebootRequired);
        }
        private void install_Click(object sender, EventArgs e)
        {
            Color  oldColor = install.ForeColor;
            string oldText  = install.Text;

            install.ForeColor = Color.LightGray;
            install.Text      = "Installing...";
            Update();

            string infPath    = @".\Driver\";
            string devPath    = "";
            string instanceId = "";

            uint result         = 0;
            bool rebootRequired = false;

            DifxFlags flags = DifxFlags.DRIVER_PACKAGE_ONLY_IF_DEVICE_PRESENT | DifxFlags.DRIVER_PACKAGE_FORCE;

            if (!Devcon.Find(new Guid(SCP_BUS_CLASS_GUID), ref devPath, ref instanceId))
            {
                if (!Devcon.Create("System", new Guid("{4D36E97D-E325-11CE-BFC1-08002BE10318}"), "root\\ScpVBus\0\0"))
                {
                    MessageBox.Show("Unable to create SCP Virtual Bus, cannot continue with installation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    install.Text      = oldText;
                    install.ForeColor = oldColor;
                    return;
                }
            }

            result = installer.Install(infPath + @"ScpVBus.inf", flags, out rebootRequired);
            if (result == 0)
            {
                if (rebootRequired)
                {
                    MessageBox.Show("Driver successfully installed, but a reboot may be required for it to work properly.", "Installation Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Driver successfully installed!", "Installation Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Driver installation failed with DIFxAPI error 0x" + result.ToString("X8"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            install.Text      = oldText;
            install.ForeColor = oldColor;
        }
Exemplo n.º 4
0
 public virtual UInt32 Preinstall(String InfPath, DifxFlags Flags)
 {
     return 0xFFFFFFFF;
 }
Exemplo n.º 5
0
 public virtual UInt32 Install(String InfPath, DifxFlags Flags, out Boolean RebootRequired)
 {
     RebootRequired = false;
     return 0xFFFFFFFF;
 }
Exemplo n.º 6
0
 public override UInt32 Uninstall(String InfPath, DifxFlags Flags, out Boolean RebootRequired)
 {
     return DriverPackageUninstall(InfPath, (UInt32) Flags, (IntPtr) 0, out RebootRequired);
 }
Exemplo n.º 7
0
 public override UInt32 Preinstall(String InfPath, DifxFlags Flags)
 {
     return DriverPackagePreinstall(InfPath, (UInt32) Flags);
 }
Exemplo n.º 8
0
 public override UInt32 Install(String InfPath, DifxFlags Flags, out Boolean RebootRequired)
 {
     return DriverPackageInstall(InfPath, (UInt32) Flags, IntPtr.Zero, out RebootRequired);
 }
Exemplo n.º 9
0
Arquivo: Difx.cs Projeto: zw5/WiinUPro
 public virtual UInt32 Uninstall(String InfPath, DifxFlags Flags, out Boolean RebootRequired)
 {
     RebootRequired = false;
     return(0xFFFFFFFF);
 }
Exemplo n.º 10
0
Arquivo: Difx.cs Projeto: zw5/WiinUPro
 public virtual UInt32 Preinstall(String InfPath, DifxFlags Flags)
 {
     return(0xFFFFFFFF);
 }
Exemplo n.º 11
0
Arquivo: Difx.cs Projeto: zw5/WiinUPro
 public override UInt32 Uninstall(String InfPath, DifxFlags Flags, out Boolean RebootRequired)
 {
     return(DriverPackageUninstall(InfPath, (UInt32)Flags, (IntPtr)0, out RebootRequired));
 }
Exemplo n.º 12
0
Arquivo: Difx.cs Projeto: zw5/WiinUPro
 public override UInt32 Preinstall(String InfPath, DifxFlags Flags)
 {
     return(DriverPackagePreinstall(InfPath, (UInt32)Flags));
 }
Exemplo n.º 13
0
 public uint Uninstall(string infPath, DifxFlags flags, out bool rebootRequired)
 {
     return(DriverPackageUninstall(infPath, (uint)flags, (IntPtr)0, out rebootRequired));
 }
Exemplo n.º 14
0
 public uint Preinstall(string infPath, DifxFlags flags)
 {
     return(DriverPackagePreinstall(infPath, (uint)flags));
 }
Exemplo n.º 15
0
 public uint Uninstall(string infPath, DifxFlags flags, out bool rebootRequired)
 {
     return DriverPackageUninstall(infPath, (uint) flags, (IntPtr) 0, out rebootRequired);
 }
Exemplo n.º 16
0
 public uint Preinstall(string infPath, DifxFlags flags)
 {
     return DriverPackagePreinstall(infPath, (uint) flags);
 }