Remove Windows Device Class in Registry

0

I have a .INF with a security descriptor HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GA;;;BA)".

I changed this security descriptor to remove admin rights. So that any user can open the application. However, it doesn't work unless I change the device class and ClassGUID in the INF file.

How can I remove the device class of the previously installed driver in windows?

I think previously installed security descriptor is not deleted even though I deleted the driver from device manager.

I am unable to override the security descriptor with the modified INF file.

radar101

Posted 2015-10-13T05:46:56.353

Reputation: 1

Answers

0

I was finally able to finally uninstall the device class using a small C++ program. In the following link, at the end of the site, there is a C++ code which you can delete driver completely including the ClassName Associated with the ClassGUID.

https://www.osronline.com/showthread.cfm?link=168171

I have also copied the same code below as well. I made a small MFC application to perform the uninstallation.

    HDEVINFO devs = INVALID_HANDLE_VALUE;
    SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail;
    SP_DEVINFO_DATA devInfo;
    unsigned int DeviceNo = 0;
    GUID cls;
    DWORD numClass = 0;
    TCHAR devID[MAX_DEVICE_ID_LEN];
    SP_REMOVEDEVICE_PARAMS rmdParams;
SetupDiClassGuidsFromNameEx ("ClassName", &cls, 1, &numClass,
                             NULL, NULL);
devs = SetupDiGetClassDevsEx (&cls, NULL, NULL,
                       DIGCF_PRESENT, NULL, NULL, NULL);
devInfo.cbSize = sizeof(devInfo);
while (SetupDiEnumDeviceInfo (devs, DeviceNo++, &devInfo))
{
     devInfoListDetail.cbSize = sizeof(devInfoListDetail);
     if (!SetupDiGetDeviceInfoListDetail (devs, &devInfoListDetail) ||
         CM_Get_Device_ID_Ex(devInfo.DevInst, devID,
                             MAX_DEVICE_ID_LEN/* 200 */, 0,
                            devInfoListDetail.RemoteMachineHandle))
    {
         break;
     }
    rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
    rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE;
    rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL;
    rmdParams.HwProfile = 0;
    SetupDiSetClassInstallParams (devs, &devInfo,
                                      &rmdParams.ClassInstallHeader,sizeof 
(rmdParams));
    SetupDiCallClassInstaller (DIF_REMOVE, devs, &devInfo);
}
SetupDiDestroyDeviceInfoList(devs);
DEVINST devRoot;
if(CM_Locate_DevNode_Ex(&devRoot,NULL,CM_LOCATE_DEVNODE_NORMAL,NULL) != 
CR_SUCCESS) {
        goto final;
}
CM_Reenumerate_DevNode_Ex(devRoot, 0, NULL);
final:
return;
 }

radar101

Posted 2015-10-13T05:46:56.353

Reputation: 1