read raw from the hd

This is a discussion on read raw from the hd within the Windows Programming forums, part of the Platform Specific Boards category; Is there a way to read the bytes directly from the harddrive? I mean the FS, dirt, "deleted" stuff and ...

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,668

    read raw from the hd

    Is there a way to read the bytes directly from the harddrive? I mean the FS, dirt, "deleted" stuff and everything.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

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

    gg

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,668
    Cool, thanks; I didn't think it'd be that easy.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,668
    GetLastError after a failed call to DeviceIoControl returns 5 (access denied).

    How do I get permission to access the harddrive?

    I am running the program under an admin account.
    Last edited by Yarin; 03-27-2008 at 12:33 PM.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  5. #5
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,249
    Quote Originally Posted by Yarin View Post
    GetLastError after a failed call to DeviceIoControl returns 5 (access denied).

    How do I get permission to access the harddrive?

    I am running the program under an admin account.
    Are you on Vista, where "administrator" isn't really "administrator" anymore?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You must also not have mounted the drive. So if you are trying to access a drive that you can "see" in Windows, it's not going to allow you access.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    And what IOCTL are you attempting?

    gg

  8. #8
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by matsp View Post
    You must also not have mounted the drive. So if you are trying to access a drive that you can "see" in Windows, it's not going to allow you access.
    Windows always mounts all drives it recognizes, so that's probably the case...
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  9. #9
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,668
    >> Are you on Vista, where "administrator" isn't really "administrator" anymore?
    No, XP. But tell more about this.

    >> You must also not have mounted the drive. So if you are trying to access a drive that you can "see" in Windows, it's not going to allow you access.
    Okay, that's probably it, I'll try doing that first.

    >> And what IOCTL are you attempting?
    DISK_GET_DRIVE_LAYOUT
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Quote Originally Posted by Yarin View Post
    >> Are you on Vista, where "administrator" isn't really "administrator" anymore?
    No, XP. But tell more about this.
    You know about UAC, right?
    It means then unless the application asks for admin privileges, you don't have them. This is true for administrator accounts, too.
    So running your app with UAC enabled on Vista would guarantee failure because you would be running it as a limited user unless you specified in the manifest to run it as admin or disabled UAC.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Access it through a system service, they run in session 0 if installed form the admin acount. Don't use vista, they broke a lot of the security stuff in an effort to make it harder to write applications that perform useful work.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  12. #12
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,668
    I found another way to enumerate the partitions, but now when I use CreateFile on "\\.\C:", ReadFile failed. It seems I can't do it like that. When I said read raw from the hd, I literally meant read EVERYTHING, like a disk defragmentor.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  13. #13
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Yarin View Post
    I found another way to enumerate the partitions, but now when I use CreateFile on "\\.\C:", ReadFile failed. It seems I can't do it like that. When I said read raw from the hd, I literally meant read EVERYTHING, like a disk defragmentor.
    That's usually done by drivers...
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Yarin View Post
    I found another way to enumerate the partitions, but now when I use CreateFile on "\\.\C:", ReadFile failed. It seems I can't do it like that. When I said read raw from the hd, I literally meant read EVERYTHING, like a disk defragmentor.
    I'm pretty sure that a disk defragmentor uses another interface than "read raw disk data".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #15
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Quote Originally Posted by Yarin View Post
    I found another way to enumerate the partitions, but now when I use CreateFile on "\\.\C:", ReadFile failed. It seems I can't do it like that. When I said read raw from the hd, I literally meant read EVERYTHING, like a disk defragmentor.
    Defragmentor with source code

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I know the actual bytes read in a file read
    By pliang in forum C++ Programming
    Replies: 1
    Last Post: 06-08-2005, 04:23 PM
  2. What Would You Use To Read User Input?
    By djwicks in forum C Programming
    Replies: 11
    Last Post: 04-05-2005, 03:32 PM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. Read Array pro!!Plz help!!
    By Supra in forum C Programming
    Replies: 2
    Last Post: 03-04-2002, 02:49 PM
  5. Help! Can't read decimal number
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 09-07-2001, 02:09 AM

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