Discussion:
[KMDF] Removing FDO and let PDO running
(too old to reply)
Your Name
2006-08-31 17:34:09 UTC
Permalink
Hi,

I am writing a FDO for the system-enumerated system timer (PIT 8253) aka
PDO (denoted *PNP0100).

It works fine for now (I can use the IRQ) but the coding process is
getting frustrating because I develop in a "one machine environnement"
so each time I uninstall my device from the device manager, the system
needs to reboot.

Can KMDF remove my FDO by simply detaching it from its PDO so I can
reinstall the FDO with "Update driver" in device manager or devcon ?

I tried this in my EvtDriverAddDevice callback :

...
status = WdfDeviceCreate(
&DeviceInit,
&attributes,
&device
);

if (!NT_SUCCESS(status))
{
return status;
}

WdfDeviceRemoveRemovalRelationsPhysicalDevice(
device,
WdfFdoInitWdmGetPhysicalDevice(DeviceInit)
);
...

But I get the BSOD 0x0000010d with arguments
0x00000004
0xb8xxxxxx // some address around b
0x00000000
0x85xxxxxx // some address around 8

What's wrong ?
Is detaching/reataching at will even possible ?
Thanks for your time.

Guillaume
Your Name
2006-08-31 22:56:13 UTC
Permalink
Setting the PnP capabilities like this ...

WDF_DEVICE_PNP_CAPABILITIES_INIT(&deviceCapabilities);

deviceCapabilities.Removable = WdfTrue; // <- WANT TO REMOVE !!

WdfDeviceSetPnpCapabilities(
device,
&deviceCapabilities
);

... doesn't lead to better results except the ability to use the "safe
remove capability". Unfortunately, it doesn't work either.

Any idea ??
Post by Your Name
Hi,
I am writing a FDO for the system-enumerated system timer (PIT 8253) aka
PDO (denoted *PNP0100).
It works fine for now (I can use the IRQ) but the coding process is
getting frustrating because I develop in a "one machine environnement"
so each time I uninstall my device from the device manager, the system
needs to reboot.
Can KMDF remove my FDO by simply detaching it from its PDO so I can
reinstall the FDO with "Update driver" in device manager or devcon ?
...
status = WdfDeviceCreate(
&DeviceInit,
&attributes,
&device
);
if (!NT_SUCCESS(status))
{
return status;
}
WdfDeviceRemoveRemovalRelationsPhysicalDevice(
device,
WdfFdoInitWdmGetPhysicalDevice(DeviceInit)
);
...
But I get the BSOD 0x0000010d with arguments
0x00000004
0xb8xxxxxx // some address around b
0x00000000
0x85xxxxxx // some address around 8
What's wrong ?
Is detaching/reataching at will even possible ?
Thanks for your time.
Guillaume
Doron Holan [MS]
2006-09-01 03:28:02 UTC
Permalink
do not list your own PDO as a removal relation. instead of uninstalling,
disable the device. this will unload the stack as well. you don't need to
set the removal capability either. does an application open a handle to
your device? if so, that application must register for handle
notifications, otherwise the disable/remove will fail. the setup logs (see
http://blogs.msdn.com/doronh/archive/2006/08/31/734412.aspx) will tell you
why the uinstall/disable required a reboot. by default, KMDF allows a
graceful disable/uninstall, so there is something else that is keeping your
device stack around and requiring the reboot.

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Your Name
Setting the PnP capabilities like this ...
WDF_DEVICE_PNP_CAPABILITIES_INIT(&deviceCapabilities);
deviceCapabilities.Removable = WdfTrue; // <- WANT TO REMOVE !!
WdfDeviceSetPnpCapabilities(
device,
&deviceCapabilities
);
... doesn't lead to better results except the ability to use the "safe
remove capability". Unfortunately, it doesn't work either.
Any idea ??
Post by Your Name
Hi,
I am writing a FDO for the system-enumerated system timer (PIT 8253) aka
PDO (denoted *PNP0100).
It works fine for now (I can use the IRQ) but the coding process is
getting frustrating because I develop in a "one machine environnement" so
each time I uninstall my device from the device manager, the system needs
to reboot.
Can KMDF remove my FDO by simply detaching it from its PDO so I can
reinstall the FDO with "Update driver" in device manager or devcon ?
...
status = WdfDeviceCreate(
&DeviceInit,
&attributes,
&device
);
if (!NT_SUCCESS(status))
{
return status;
}
WdfDeviceRemoveRemovalRelationsPhysicalDevice(
device,
WdfFdoInitWdmGetPhysicalDevice(DeviceInit)
);
...
But I get the BSOD 0x0000010d with arguments
0x00000004
0xb8xxxxxx // some address around b
0x00000000
0x85xxxxxx // some address around 8
What's wrong ?
Is detaching/reataching at will even possible ?
Thanks for your time.
Guillaume
Your Name
2006-09-03 03:57:16 UTC
Permalink
Thanks,
Post by Doron Holan [MS]
instead of uninstalling,
disable the device.
Device manager won't let me, the disable icon is not present for my
device. Where can I find all the reasons why it's like that ?
Post by Doron Holan [MS]
does an application open a handle to
your device? if so, that application must register for handle
notifications, otherwise the disable/remove will fail.
I don't think so, WinObj tells me :
- 1 reference
- 0 handle
Post by Doron Holan [MS]
the setup logs (see
http://blogs.msdn.com/doronh/archive/2006/08/31/734412.aspx) will tell you
why the uinstall/disable required a reboot. by default, KMDF allows a
graceful disable/uninstall, so there is something else that is keeping your
device stack around and requiring the reboot.
setupapi.log shows something strange when I disable then reenable the
PDO for the system timer without my FDO installed on top :

[HERE I DISABLE]
#-198 Command line processed: "C:\WINDOWS\system32\mmc.exe"
C:\WINDOWS\system32\devmgmt.msc /s
#I292 Changing device properties of "ACPI\PNP0100\3&2411E6FE&0".

[HERE I RE-ENABLE]
#-198 Command line processed: "C:\WINDOWS\system32\mmc.exe"
C:\WINDOWS\system32\devmgmt.msc /s
#I292 Changing device properties of "ACPI\PNP0100\3&2411E6FE&0".
#I292 Changing device properties of "ACPI\PNP0100\3&2411E6FE&0".
#W165 Device "ACPI\PNP0100\3&2411E6FE&0" required reboot: Device not
started (unknown reason).
#I294 DICS_ENABLE DICS_FLAG_GLOBAL: Enabling device globally.

Maybe it has something to do with the PDO being "no driver"
Doron Holan [MS]
2006-09-03 05:31:09 UTC
Permalink
it is not disableable b/c there is an acpi property indicating it should be
disable. that or somebody in the stack other then acpi is reporting
PNP_DEVICE_NOT_DISABLEABLE

if you have one reference and no handles, you leaked a reference somewhere
with ObReferenceObject.

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Your Name
Thanks,
instead of uninstalling, disable the device.
Device manager won't let me, the disable icon is not present for my
device. Where can I find all the reasons why it's like that ?
does an application open a handle to your device? if so, that
application must register for handle notifications, otherwise the
disable/remove will fail.
- 1 reference
- 0 handle
the setup logs (see
http://blogs.msdn.com/doronh/archive/2006/08/31/734412.aspx) will tell
you why the uinstall/disable required a reboot. by default, KMDF allows a
graceful disable/uninstall, so there is something else that is keeping
your device stack around and requiring the reboot.
setupapi.log shows something strange when I disable then reenable the PDO
[HERE I DISABLE]
#-198 Command line processed: "C:\WINDOWS\system32\mmc.exe"
C:\WINDOWS\system32\devmgmt.msc /s
#I292 Changing device properties of "ACPI\PNP0100\3&2411E6FE&0".
[HERE I RE-ENABLE]
#-198 Command line processed: "C:\WINDOWS\system32\mmc.exe"
C:\WINDOWS\system32\devmgmt.msc /s
#I292 Changing device properties of "ACPI\PNP0100\3&2411E6FE&0".
#I292 Changing device properties of "ACPI\PNP0100\3&2411E6FE&0".
#W165 Device "ACPI\PNP0100\3&2411E6FE&0" required reboot: Device not
started (unknown reason).
#I294 DICS_ENABLE DICS_FLAG_GLOBAL: Enabling device globally.
Maybe it has something to do with the PDO being "no driver"
Your Name
2006-09-04 01:53:40 UTC
Permalink
Post by Doron Holan [MS]
that or somebody in the stack other then acpi is reporting
PNP_DEVICE_NOT_DISABLEABLE
You're right, here's what my stack looks like with !devnode (also, the
stack contains 2 devices.)

# The system timer PDO :

DevNode 0x86add9f0 for PDO 0000000000
(...)
Flags (0000000000)
CapabilityFlags (0xe9766544) LockSupported, UniqueID,
RawDeviceOK, WakeFromD0,
WakeFromD3, HardwareDisabled,
NoDisplayInUI
Unknown flags 0xe9740000

# My FDO :

DevNode 0x86adb1c8 for PDO 0x86add9f0
(...)
Flags (0x000000f0) DNF_ENUMERATED, DNF_IDS_QUERIED,
DNF_HAS_BOOT_CONFIG, DNF_BOOT_CONFIG_RESERVED
UserFlags (0x00000008) ***DNUF_NOT_DISABLEABLE***
CapabilityFlags (0x00000080) SilentInstall
DisableableDepends = 1 (including self)

So it appears I unintentionally set a PNP_DEVICE_NOT_DISABLEABLE user
flag somehow. I am not touching any flag of capability directly in my
code. How can I unset this flag safely ?
Post by Doron Holan [MS]
if you have one reference and no handles, you leaked a reference somewhere
with ObReferenceObject.
Isn't that reference the one for my running FDO ?? If it was zero, the
stack would unload without disabling right ?
Doron Holan [MS]
2006-09-04 05:14:37 UTC
Permalink
i am betting acpi is setting flag for you. you could clear the flag by
using the following code in your add device routine

WDF_DEVICE_STATE state

WDF_DEVICE_STATE_INIT(&state);
state.NotDisableable =WdfFalse;

WdfDeviceSetDeviceState(device, &state);
Post by Your Name
Isn't that reference the one for my running FDO ?? If it was zero, the
stack would unload without disabling right ?
If this reference is there after the stack has been removed, this is a
leaked reference. typically for a driver before a remove has been
processed, will have at least 2 references per created devobj

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Your Name
Post by Doron Holan [MS]
that or somebody in the stack other then acpi is reporting
PNP_DEVICE_NOT_DISABLEABLE
You're right, here's what my stack looks like with !devnode (also, the
stack contains 2 devices.)
DevNode 0x86add9f0 for PDO 0000000000
(...)
Flags (0000000000)
CapabilityFlags (0xe9766544) LockSupported, UniqueID,
RawDeviceOK, WakeFromD0,
WakeFromD3, HardwareDisabled,
NoDisplayInUI
Unknown flags 0xe9740000
DevNode 0x86adb1c8 for PDO 0x86add9f0
(...)
Flags (0x000000f0) DNF_ENUMERATED, DNF_IDS_QUERIED,
DNF_HAS_BOOT_CONFIG, DNF_BOOT_CONFIG_RESERVED
UserFlags (0x00000008) ***DNUF_NOT_DISABLEABLE***
CapabilityFlags (0x00000080) SilentInstall
DisableableDepends = 1 (including self)
So it appears I unintentionally set a PNP_DEVICE_NOT_DISABLEABLE user flag
somehow. I am not touching any flag of capability directly in my code. How
can I unset this flag safely ?
Post by Doron Holan [MS]
if you have one reference and no handles, you leaked a reference
somewhere with ObReferenceObject.
Isn't that reference the one for my running FDO ?? If it was zero, the
stack would unload without disabling right ?
Loading...