cwindowswinapidriverdevice-driver

Remove oem.inf files corresponding to hardware id


I'm installing my driver using dpinst.exe. But before installing my driver I wish to delete all the oem files from inf directory corresponding to my hardware ID.

I want to do this programatically. Please suggest me a way to do this.

**Update :**

I want to do this without device connected as I may pre-install the driver before connecting the device. My device is PNP device.


Solution

    1. Use SetupDiEnumDeviceInfo and SetupDiGetDeviceRegistryProperty to match your hardware ID
    2. Use SetupDiOpenDevRegKey and RegQueryValueEx to read the corresponding InfPath
    3. Call SetupUninstallOEMInf