Page 1 of 1

Writing and reading at specifical address of hard disk c++

Posted: Sun Mar 05, 2017 11:42 am
by ComputerMail
Hi,

i hope i will get an answer here after done 4 forums. I am looking for how to write and read at specifical address in a hard disk under Windows 7. I mean by specifical address, in a sole physical sector https://en.wikipedia.org/wiki/Disk_sector and without taking care of any file or file system. I am using c++. So i specify again i am looking for a fonction in c++ who asks a physical sector address and go to search all bit who are in this sole sector, this fonction should not have relation with any file or file system.

Re: Writing and reading at specifical address of hard disk c

Posted: Sun Mar 05, 2017 12:37 pm
by dchapiesky
you open the disk device using a special file name...

https://support.microsoft.com/en-us/hel ... nder-win32

open with CreateFile

https://msdn.microsoft.com/en-us/librar ... s.85).aspx


calculate offset into file using sector size and off you go....

cheers

Re: Writing and reading at specifical address of hard disk c

Posted: Sun Mar 05, 2017 5:55 pm
by Schol-R-LEA
dchapiesky wrote:https: //msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx

(the above link is broken intentionally - COPY the link and remove space between https: and // cause the forum does not like the address with .aspx ending)
Wouldn't it have been easier just to wrap it in a BBcode 'url' tag instead?

Re: Writing and reading at specifical address of hard disk c

Posted: Sun Mar 05, 2017 7:09 pm
by dchapiesky
well alrighty then.... thanks!