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

Programming, for all ages and all languages.
Post Reply
ComputerMail
Posts: 11
Joined: Fri Jan 20, 2017 4:35 pm

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

Post 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.
User avatar
dchapiesky
Member
Member
Posts: 204
Joined: Sun Dec 25, 2016 1:54 am
Libera.chat IRC: dchapiesky

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

Post 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
Last edited by dchapiesky on Sun Mar 05, 2017 7:09 pm, edited 1 time in total.
Plagiarize. Plagiarize. Let not one line escape thine eyes...
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

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

Post 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?
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
dchapiesky
Member
Member
Posts: 204
Joined: Sun Dec 25, 2016 1:54 am
Libera.chat IRC: dchapiesky

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

Post by dchapiesky »

well alrighty then.... thanks!
Plagiarize. Plagiarize. Let not one line escape thine eyes...
Post Reply