how to protect device from been deleted

Hi everyone,

Now, i have developed a ftdisk filter dirver.and i have a RemoveDeivce
routine to handle RemoveDevice IRP. When I use the Disk Manger on Windows XP
to delete a partion, Windows invoked my RemoveDevice routine by sending my
device an IRP.But I don’t wanna my device to be deleted, so I failed the
RemoveDevice IRP. My problem is that doesn’t work.Althougth I have failed
the RemoveDevice IRP, the Disk Manager could also delete the partion. It
looks like the Disk Manager doesn’t care the Status that IRP returned.!!!I
ask for your help?Do I explain my problem clearly?

Thank for Any suggestion.

You cannot fail the remove irp, it’s status is ignored (just like you can’t fail a IRP_MN_SET_POWER/SystemPowerState irp). You must process the remove request and do what the DDK dictates.

If you want to prevent a remove, you can fail IRP_MN_QUERY_REMOVE_DEVICE

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of ??
Sent: Wednesday, September 13, 2006 9:01 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] how to protect device from been deleted

Hi everyone,
?
??? Now, i have developed a ftdisk filter dirver.and i have a RemoveDeivce routine to handle RemoveDevice IRP. When I use the Disk Manger on Windows XP to delete a partion, Windows invoked my RemoveDevice routine by sending my device an IRP.But I don’t wanna my device to be deleted, so I failed the RemoveDevice IRP. My problem is that doesn’t work.Althougth I have failed the RemoveDevice IRP, the Disk Manager could also delete the partion. It looks like the Disk Manager doesn’t care the Status that IRP returned.!!!I ask for your help?Do I explain my problem clearly?
?
??? Thank for Any suggestion.
— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Correct. Why do you need non-deletable partitions? your product users will
hate you :slight_smile:
Also, MN_REMOVE_DEVICE cannot be failed, and I think its completion status
is ignored.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “??”
To: “Windows System Software Devs Interest List”
Sent: Thursday, September 14, 2006 8:00 AM
Subject: [ntdev] how to protect device from been deleted

> Hi everyone,
>
> Now, i have developed a ftdisk filter dirver.and i have a RemoveDeivce
> routine to handle RemoveDevice IRP. When I use the Disk Manger on Windows XP
> to delete a partion, Windows invoked my RemoveDevice routine by sending my
> device an IRP.But I don’t wanna my device to be deleted, so I failed the
> RemoveDevice IRP. My problem is that doesn’t work.Althougth I have failed
> the RemoveDevice IRP, the Disk Manager could also delete the partion. It
> looks like the Disk Manager doesn’t care the Status that IRP returned.!!!I
> ask for your help?Do I explain my problem clearly?
>
> Thank for Any suggestion.
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

To Maxim Shatskih,

Why i need non-deletable partitions is that the partition contains
important user data my driver maintains.If the user input correct commands,
the partiton will be deleted.But what if the user input the wrrong
commands?So in my driver, i have a check mechanism and if the check
mechanism fails, i should protect the partition to be deleted.

thank for help.

By the way, I foud that the disk manager doesn’t send
IRP_MN_QUERY_REMOVE_DEVICE, so i can’t fail the IRP_MN_QUERY_REMOVE_DEVICE
IRP.The disk manager send lots of IRP_MN_QUERY_DEVICE_RELATIONS IRPs and ONE
IRP_MN_SURPRISE_REMOVAL IRP

It appears you cannot prevent the remove. Instead of trying to fail the remove, why don’t you gracefully put the partition into the correct state during remove processing? Note that the disk might not even be there b/c you got a surprise remove.

d