People, how can I get access to HDD under Win NT 4.0 ? I need write some sectors on phisical level (as int 13h on DOS)
Posted on 2001-01-30 23:24:00 by Sergey Kostenko
I think you can do that with DeviceIOControl (but I'm not sure) Anyway wrong forum --> moving to General
Posted on 2001-02-01 03:28:00 by Hiroshimator
Prievett, Serega! You can use the CreateFile function to open a disk drive or a partition on a disk drive. The function returns a handle to the disk device; that handle can be used with the DeviceIOControl function. The following requirements must be met in order for such a call to succeed: The caller must have administrative privileges for the operation to succeed on a hard disk drive. The lpFileName string should be of the form \\.\PHYSICALDRIVEx to open the hard disk x. Hard disk numbers start at zero. For example: String Meaning \\.\PHYSICALDRIVE2 Obtains a handle to the third physical drive on the user's computer. The lpFileName string should be \\.\x: to open a floppy drive x or a partition x on a hard disk. For example: String Meaning \\.\A: Obtains a handle to drive A on the user's computer. \\.\C: Obtains a handle to drive C on the user's computer.
Posted on 2001-02-01 04:56:00 by The Svin
Short of writing a driver, you can't do this directly yourself under NT. Instructions such as in, out, sti, cli are flagged as "privileged" by the CPU and Windows NT uses this information to disallow such instructions (although Win95 for instance doesn't complain). So unless you're willing to write a driver (kernel level) your wings are pretty well clipped under NT -- you can't set or clear interrupts or read/write to ports. It's a real pain! As for DeviceIOControl, its second parameter is an IOControlCode (a DWORD) and you'd have to know something about the specific driver to know what to set it to -- Windows doesn't define any IOControlCode's directly, it's up to the device driver writer to do that (using the macro CTL_CODE). If you happen to know what this code is, you should be able to use DeviceIOControl okay.
Posted on 2001-02-01 15:03:00 by XMAS