Results 1 to 8 of 8

Thread: read hard disk sector

  1. #1
    lek_70
    Guest

    read hard disk sector

    does anyone know how to read the hard disk sector via C or MASM ??? I am running in Win Me and using visual studio C++ 6.0 and MASM 6.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You might want to take a look on MSDN at DeviceIoControl - I can't quote anything here because there's a fair amount of it
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    lek_70
    Guest

    read sector

    i do try to use the deviceIoControl but it only can works on the floppy not the hard disk

  4. #4
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106
    Here is a class that demonstrates sector read on a hard disk.
    Attached Files Attached Files
    ****

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Nice code, but why this?
    Code:
    #ifndef _STDEXCEPT_
       #include <stdexcept>
    #endif
    
    #ifndef _IOSTREAM_
       #include <iostream>
    #endif
    
    #ifndef _FSTREAM_
       #include <fstream>
    #endif
    The headers guard themselves internally so you don't need to.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106
    Not in all compilers. It is not really needed on windows systems as there are only a few compilers that are commonly used.
    I often use it on *nix systems for compiler compatabilty.
    ****

  7. #7
    lek_70
    Guest

    read sector

    FantastichenEin,
    the example given by you only works in Windows NT environment. How can we read the sector in windows 9x or windows Me??

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by FantastichenEin
    Not in all compilers. It is not really needed on windows systems as there are only a few compilers that are commonly used.
    I often use it on *nix systems for compiler compatabilty.
    What? I'm slightly dubious at that...all the Unix compilers I've ever used don't need that.

    And what if they don't use that EXACT symbol? You're trying to use insider knowledge of the implementation, which is never a good thing to do.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width