Thread: access absolute sector

  1. #1
    Registered User
    Join Date
    Jun 2010
    Location
    beijing
    Posts
    23

    access absolute sector

    how to i write sectors in win7

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    For what purpose do you need to write to sectors?

  3. #3
    Registered User
    Join Date
    Jun 2010
    Location
    beijing
    Posts
    23
    i wanna develop a data recovery software.
    i need to modify the error of sectors
    Last edited by ampc; 02-06-2013 at 09:31 PM.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    As with pretty much any sort of security applications, the methods involved have a great deal of malicious uses.

    I don't think it's too much to tell you to look into CreateFile for this purpose. I'm not sure what the documentation says about Windows 7 though (because it's not mentioned).

  5. #5
    Registered User
    Join Date
    Jun 2010
    Location
    beijing
    Posts
    23
    ReadFile can read the sectors ,but WriteFile can not modify it

  6. #6
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    I don't understand why you need to write the sectors for data recovery? Why wouldn't you just read the sectors off and then recreate the files from there, format the drive and place them back on?

  7. #7
    Registered User
    Join Date
    Jun 2010
    Location
    beijing
    Posts
    23
    for example , i have a removeable disk and its MBR data was broken, so i wannt use my program to modify it. i wanna use NtWriteFile, but it doesn't work

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    NtWriteFile() doesn't allow such things from user code.

    There are plenty of legitimate utilities out there for repairing corrupted drives - with the caveat that all such utilities have to be installed by an administrator. You would be better off finding one of those, rather than rolling your own.

    If you are trying to find a way to do this without cooperation of an administrator, you are essentially asking for help in dodgy practices. That runs you afoul of guidelines here. Refer to this link, particularly #6. (You're barking up the wrong tree, technically, anyway).
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  9. #9
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    And I'm not sure I'd want to touch "data recovery" software written by someone who can't work out how to do the first step.

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 09-04-2008, 01:27 PM
  2. sector per track
    By sunil21 in forum C Programming
    Replies: 1
    Last Post: 09-13-2003, 11:10 PM
  3. sector size
    By elad in forum C++ Programming
    Replies: 5
    Last Post: 07-28-2003, 06:03 AM
  4. Solving bad sector ....
    By beely in forum Tech Board
    Replies: 7
    Last Post: 03-17-2003, 08:22 AM
  5. Fix the boot sector?
    By KrAzY CrAb in forum Tech Board
    Replies: 4
    Last Post: 03-14-2003, 06:07 PM