コード例 #1
0
 public override bool DeviceFound(DeviceItem item, IntPtr pDeviceInfoSet, ref SetupApi.SP_DEVINFO_DATA DeviceInfoData)
 {
     if (mRemoveDeviceOptions.RemoveByVidPid)
     {
         if (item.VendorID.ToLower() != mRemoveDeviceOptions.DeviceItem.VendorID.ToLower() ||
         item.ProductID.ToLower() != mRemoveDeviceOptions.DeviceItem.ProductID.ToLower())
             return true;
     }
     else
     {
         if (item.mDeviceId != mRemoveDeviceOptions.DeviceItem.mDeviceId) return true;
     }
     bool bUninstalled;
     if (SetupApi.WindowsVersion >= WindowsVersionType.WINDOWS_7)
     {
         if ((bUninstalled=SetupApi.DiUninstallDevice(IntPtr.Zero, pDeviceInfoSet, ref DeviceInfoData, 0, IntPtr.Zero))==true)
             mRemoved++;
         else
             InfWizardStatus.Log(CategoryType.RemoveDevice,  StatusType.Warning|StatusType.Win32Error, "failed uninstalling device.");
     }
     else
     {
         if ((bUninstalled=SetupApi.SetupDiRemoveDevice(pDeviceInfoSet, ref DeviceInfoData))==true)
             mRemoved++;
         else
             InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Warning|StatusType.Win32Error, "failed uninstalling device.");
     }
     if (bUninstalled)
     {
         InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Success, "device uninstall complete");
     }
     object oInfFileName;
     if (item.mDriverRegistryList != null && !item.mIsSkipServiceName)
     {
         if (item.mDriverRegistryList.TryGetValue("InfPath", out oInfFileName))
         {
             if (!(SetupApi.SetupUninstallOEMInf(oInfFileName.ToString(), SetupApi.SUOI.FORCEDELETE, IntPtr.Zero)))
                 InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Warning | StatusType.Win32Error, "SetupUninstallOEMInf failed");
         }
     }
     return mRemoveDeviceOptions.RemoveByVidPid;
 }
コード例 #2
0
 public static extern bool SetupCopyOEMInf([In] String SourceInfFileName, [In] String OEMSourceMediaLocation, SetupApi.SPOST OEMSourceMediaType, uint CopyStyle, [Out] StringBuilder DestinationInfFileName, uint DestinationInfFileNameSize, out uint RequiredSize, [Out] StringBuilder DestinationInfFileNameComponent);
コード例 #3
0
 public virtual bool DeviceFound(DeviceItem item,
                                 IntPtr pDeviceInfoSet,
                                 ref SetupApi.SP_DEVINFO_DATA DeviceInfoData)
 {
     deviceList.Add(item);
     return true; // true to continue enumerating
 }
コード例 #4
0
 public static extern CR CM_Reenumerate_DevNode(int devInst, SetupApi.CM flags);