Direct disk access in DOS

This is a discussion on Direct disk access in DOS within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I'm writing a small disk utility that will allow the user to view the bootsector, bootstrap, partition tables, FATs, and ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590

    Direct disk access in DOS

    I'm writing a small disk utility that will allow the user to view the bootsector, bootstrap, partition tables, FATs, and also browse their drive sector by sector.

    I'm using the INT 13 API under Win98SE but Windows is continually blocking my INT 13 calls so that all registers return 0's. I've even issued the Lock Physical Volume INT 21h, subfunction 484Bh, to lock the volume so I can directly access the disk. Still no go. Windows will not even let me get the drive parameters for the drive so it is impossible for me to even do CHS or CHS to LBA translation on the drive.

    Does anyone know how to tell Windows to lock the volume so that I can directly access the disk (hard disk - floppies will work). I really need this information and I've done a lot of research but none of the pages talked about this problem.

    When I issue Lock Physical Volume to DOS 7.20 I get 0005h in AX which means ACCESS DENIED. I have to tell Windows to take a hike before I can access the drive. Please help.

  2. #2
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    erm...

    What compiler you use? I have turboc++ 3.0 which is for DOS only. If you are using vc++ or c++ builder, I think then you are only making console applications. I highly recommend getting turboc++3.0 for dos utilities. I'm pretty sure this will fix your problem. Keep me updated. I'm trying to design a hex viewer(later on, an editor also) for a boot disk.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    I could use BASIC for all it matters. I'm just calling the INT 13h MS extensions to gain access to the drive. That can be done in any language. This is not a language problem and it is not a console app. This is a DOS app.

    The only problem is that MS Windows has patched into the INT 13 chain so that it can intercept viruses and other harmful programs that can damage the FATs, boot sector, boot strap, etc. It is intercepting my INT 13 and discarding it. I wish I could patch into the INT 13 chain, and then patch into the former INT 13 prior to Windows patching it - but since I don't know where or even if MS Windows saved the previous vector, I cannot do that.

    My problem is this:



    BIOS Disk Services -> INT 13 -> MS Windows


    Windows is guarding the INT 13 so I cannot use it. I have to lock the phyical volume (similar to command line LOCK) in order to do this. But I'm calling INT 21h to lock the physical volume but even that is telling me access denied. So if MS Windows will not let me lock the volume, there is no way I can gain access to it.

    A workaround would be this:


    Code:
    BIOS Disk Services-> INT 13 -> MS Windows -> My Handler
                          ^                      ^
                          :----------------------:
    but I do not know where or even if MS Windows saved the previous vector. I would have to patch the bootstrap code to get the original INT 13 vector prior to Windows installing its handler on INT 13. But I cannot patch the bootstrap cuz of my problem. It's a catch 22.

    I could also just find out where in memory the BIOS code resides, but I don't think that is constant for all BIOSes.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    Haha, you scared him off.
    Acos is good

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 09-04-2008, 01:27 PM
  2. Direct memory access?
    By _izua_ in forum Windows Programming
    Replies: 4
    Last Post: 08-01-2008, 02:08 AM
  3. access to devices
    By pastitprogram in forum C++ Programming
    Replies: 1
    Last Post: 06-06-2008, 11:16 PM
  4. Seems I can't access my CD Driver in DOS mode
    By Zewu in forum Tech Board
    Replies: 4
    Last Post: 02-22-2005, 04:20 PM
  5. Small VGA unit for DOS games
    By VirtualAce in forum Game Programming
    Replies: 1
    Last Post: 10-17-2003, 12:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21