Exemplo n.º 1
0
        public void Restart()
        {
            WinApi.SP_PROPCHANGE_PARAMS p = new WinApi.SP_PROPCHANGE_PARAMS();
            p.ClassInstallHeader.cbSize          = (uint)Marshal.SizeOf(p.ClassInstallHeader);
            p.ClassInstallHeader.InstallFunction = WinApi.DIF_PROPERTYCHANGE;

            p.StateChange = WinApi.DICS_PROPCHANGE;
            p.Scope       = WinApi.DICS_FLAG_CONFIGSPECIFIC;
            p.HwProfile   = 0;

            if (!WinApi.SetupDiSetClassInstallParams(devInfo, ref devInfoData, ref p, Marshal.SizeOf(p)))
            {
                throw new Error("SetupDiSetClassInstallParams failed");
            }

            if (!WinApi.SetupDiCallClassInstaller(WinApi.DIF_PROPERTYCHANGE, devInfo, ref devInfoData))
            {
                throw new Error("SetupDiCallClassInstaller failed");
            }
        }
Exemplo n.º 2
0
        public void Restart ()
        {
            WinApi.SP_PROPCHANGE_PARAMS p = new WinApi.SP_PROPCHANGE_PARAMS ();
            p.ClassInstallHeader.cbSize = (uint) Marshal.SizeOf (p.ClassInstallHeader);
            p.ClassInstallHeader.InstallFunction = WinApi.DIF_PROPERTYCHANGE;

            p.StateChange = WinApi.DICS_PROPCHANGE;
            p.Scope = WinApi.DICS_FLAG_CONFIGSPECIFIC;
            p.HwProfile = 0;

            if (!WinApi.SetupDiSetClassInstallParams (devInfo, ref devInfoData, ref p, Marshal.SizeOf (p)))
                throw new Error ("SetupDiSetClassInstallParams failed");

            if (!WinApi.SetupDiCallClassInstaller (WinApi.DIF_PROPERTYCHANGE, devInfo, ref devInfoData))
                throw new Error ("SetupDiCallClassInstaller failed");
        }