Override NoInstallClass when all devices in class removed

Does anyone know if it is possible to override the NoInstallClass setting
when all devices from the class have been removed or is there a way to
change the setting of this parameter when the last device from the class has
been removed?

I ask because I am using this setting to prevent more than one device of the
class from being installed as driver will not support it. However, when
that single device is removed from the system I desire to allow a user the
ability to again install a single device of that class.

If it is possible, I envision that I could set the NoInstallClass to false
when that single device is removed and then reset it to true when a device
of the class is again installed into the system. Otherwise, I would like to
remove the entire class definition from the system when the single device is
removed so that a device of the class can be reinstalled into the system.
This seems cleaner to me than simply preventing the installation of multiple
devices from the Class CoInstaller.

I had to do something similar. Instead of using NoInstallClass, I just
kept a global count in the driver. Something akin to this which only
allows one instance of the driver to be loaded.

IRP_MN_START_DEVICE:
//
// Only check if we are initially starting
//
if (DevExt->PnpState == ADDED) {
DevExt->IsStartedDevice = TRUE;

startCount = InterlockedIncrement(&Globals.StartedDevices);

if (startCount > 1) {
//
// The count will be decremented in ProcessRemove.
//
// InterlockedDecrement(&Globals.StartedDevices);

return STATUS_UNSUCCESSFUL;
}

IRP_MN_SURPRISE_REMOVAL:
ProcessRemove(DevExt, TRUE);
IRP_MN_REMOVE:
ProcessRemove(DevExt, FALSE);

VOID
ProcessRemove(
PDEVICE_EXTENSION DevExt,
BOOLEAN SurpriseRemoval
)
{
if (SurpriseRemoval || DevExt->PnpState != SURPRISEREMOVED) {
if (DevExt->IsStartedDevice) {
value = InterlockedDecrement(&Globals.StartedDevices);
ASSERT(value >= 0);
}
}
}

d

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: Del Fredricks [mailto:xxxxx@ask.i.might.tell]
Sent: Tuesday, April 15, 2003 7:12 AM
To: NT Developers Interest List
Subject: [ntdev] Override NoInstallClass when all devices in class
removed

Does anyone know if it is possible to override the NoInstallClass
setting
when all devices from the class have been removed or is there a way to
change the setting of this parameter when the last device from the class
has
been removed?

I ask because I am using this setting to prevent more than one device of
the
class from being installed as driver will not support it. However, when
that single device is removed from the system I desire to allow a user
the
ability to again install a single device of that class.

If it is possible, I envision that I could set the NoInstallClass to
false
when that single device is removed and then reset it to true when a
device
of the class is again installed into the system. Otherwise, I would
like to
remove the entire class definition from the system when the single
device is
removed so that a device of the class can be reinstalled into the
system.
This seems cleaner to me than simply preventing the installation of
multiple
devices from the Class CoInstaller.


You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com