Thread: Direct Disk Read/Write

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195

    Direct Disk Read/Write

    Is there a way to direcly read and write the physical data to the drive sectors through windows?
    I've been looking at DeviceIOControl(), but msdn doesnt seem to list any control codes for actually reading and writing the data, just for partition info, etc. What I'm looking for is direct RAW access to the volume's sector data. Doing this in DOS was fairly easy using INT 0x13, but I want to update an old project to a windows application.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    http://support.microsoft.com/kb/100027

    Use SetFilePointer() to a particular sector, then ReadFile() or WriteFile(). The memory that you read or write to/from has to be sector aligned. Memory from VirtualAlloc is always at least sector aligned.

    gg

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Everything from the reading and writing: http://msdn.microsoft.com/en-us/libr...47(VS.85).aspx

    gg

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Disk failure in 3 disk RAID0 & 5?
    By cpjust in forum Tech Board
    Replies: 12
    Last Post: 12-22-2008, 10:09 AM
  2. lost disk
    By Benzakhar in forum Linux Programming
    Replies: 7
    Last Post: 01-11-2004, 06:18 PM
  3. Formatting Output
    By Aakash Datt in forum C++ Programming
    Replies: 2
    Last Post: 05-16-2003, 08:20 PM
  4. Towers of Hanoi, special output.
    By spoon_ in forum C Programming
    Replies: 3
    Last Post: 03-15-2003, 06:08 PM
  5. Direct disk access in DOS
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-26-2002, 02:52 PM