Re: Modify the return value of IOCTL in disk.sys
- From: "Gary G. Little" <gary.g.little@xxxxxxxxxxx>
- Date: Thu, 2 Aug 2007 09:22:17 -0500
First, you won't, or typically you shouldn't, be dealing with
ReadFile\WriteFile. Though those two can munge their way, incrementally,
through a harddrive, it is by far easier to use raw READS and WRITES and
increment the LBA that is used for the associated TFR or CDB. That means you
will be using either ATA or SCSI passthrough, which means you have acquired
a handle to the physical drive. To acquire the handle to the physical drive
your application MUST be elevated to Admin, but then that restriction also
applies to XP. Be aware, you will not do this on anything less than XP SP2,
Server 2003, or Vista, since Microsoft bork'd ATA pass through in XP and XP
SP1. You will be writing to every LBA of the drive, zero to MaxLBA. If your
requirement is that this functionality MUST work from non-admin users, then
you simply write a service and provide an application interface that permits
a non-admin user to tell the service to open a handle to a disk and then
munge it's way through every LBA.
You do NOT need a filter driver You do NOT need to modify disk.sys. Disk.sys
is fragile enough without the inexperienced tramping though it.
You need to look at IOCTL_SCSI_PASS_THROUGH and IOCTL_ATA_PASS_THROUGH, and
understand what an LBA is, and how it is used in a TFR (which you have to
know) and CDB (something else you have to know). Before it is over you
should be intimate with the SetupDiXxxx API.
--
The personal opinion of
Gary G. Little
"Nidhi Malik" <nidhi.malik@xxxxxxxxxxxxxxx> wrote in message
news:ueF3VlM1HHA.3916@xxxxxxxxxxxxxxxxxxxxxxx
Hi ,
Thanks for the reply
But i want to write driectly on disk for my disk wiping utility in
vc+++.WriteFile() function fails to write on sectors. Software is properly
working on all
other windows operating system accep vista. That is the reasion i want
to write i driver for vista compatibality. Same as EldoS Corporation
Driver (RawDisk) enables access to disk sectors in Windows XP/Vista. Did
you know any other way that can help me to solve my problem.
Wating for reply
Nidhi Malik
"Maxim S. Shatskih" <maxim@xxxxxxxxxxxxxxxx> wrote in message
news:OGD5cfB1HHA.484@xxxxxxxxxxxxxxxxxxxxxxx
This will not give you anything, Vista will fail the writes anyway :-)
IOCTL_DISK_IS_WRITABLE is only for FSD use, for FSD to know whether to
mount itself read-only or writable.
Vista fails the writes only to physical disk LUN device
(\\.\PhysicalDisk%d), and only if the range touched by the write is
covered by
a defined partition.
Writes to volumes (\\.\D: or such) are fine in Vista, provided you are
"administrator enough" for this.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com
"Nidhi Malik" <nidhi.malik@xxxxxxxxxxxxxxx> wrote in message
news:OQ5aCOA1HHA.4880@xxxxxxxxxxxxxxxxxxxxxxx
Hi,------
I want my application to directly write on the disk in vista ( vista
does
not alow it) . I am going to write a disk filter driver that modifies
the
return value for the IOCTL for the disk . Looking at the source code of
disk.sys, i guess the modifcation should be in IOCTL_DISK_IS_WRITABLE
case.
-----------------------------------------------------------------------------
case IOCTL_DISK_IS_WRITABLE: {-
status = STATUS_MEDIA_WRITE_PROTECTED;
break;
}
to
case IOCTL_DISK_IS_WRITABLE: {
status = STATUS_SUCESS;
break;
}
-----------------------------------------------------------------------------
So i want to force disk.sys ( IOCTL_DISK_IS_WRITABLE ) to return
STATUS_SUCESS every time my application want to write on disk using
filter
driver.
So, i need help to know that i am going in right direction or not . If i
am
in right direction how can i do this modification.
Thanks a lot
.
- References:
- Modify the return value of IOCTL in disk.sys
- From: Nidhi Malik
- Re: Modify the return value of IOCTL in disk.sys
- From: Maxim S. Shatskih
- Re: Modify the return value of IOCTL in disk.sys
- From: Nidhi Malik
- Modify the return value of IOCTL in disk.sys
- Prev by Date: Re: INVALID_KERNEL_HANDLE when call ZwClose( )
- Next by Date: Re: PnP and unconfiguring a USB Device
- Previous by thread: Re: Modify the return value of IOCTL in disk.sys
- Next by thread: Re: Modify the return value of IOCTL in disk.sys
- Index(es):
Relevant Pages
|