//
// If the devices class has the NoDisplayClass value then
// don't display this device.
//
if (hKeyClass = SetupDiOpenClassRegKey(ClassGuid,KEY_READ))
{
bHidden = (RegQueryValueEx(hKeyClass,
REGSTR_VAL_NODISPLAYCLASS,
NULL, NULL, NULL, NULL) == ERROR_SUCCESS);
RegCloseKey(hKeyClass);
}
The following code snippet was seen in http://expert.csdn.net/Expert/topic/1121/1121940.xml?temp=1.285952E-02
How to disable NIC under Win2K/Win98
Answer by: flyboycsdn(飞仔) 2002-10-25 13:18:37
//
// Enumerate though all the devices.
//
for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,&DeviceInfoData);i++)
{
//
// Should we display this device, or move onto the next one.
//
if (CR_SUCCESS != CM_Get_DevNode_Status(&Status, &Problem,
DeviceInfoData.DevInst,0))
{
continue;
}
if (!(ShowHidden || !((Status & DN_NO_SHOW_IN_DM) ||
IsClassHidden(&DeviceInfoData.ClassGuid))))
continue;
How to disable a device
look up SetupDiChangeState function in MSDN, pay attention to DICS_DISABLE flag.
Disables the device. If the device is disableable but this function cannot disable the device dynamically,
this function marks the device to be disabled the next time the machine reboots.