Direct Disk Access In Windows

Programming, for all ages and all languages.
Locked
XStream

Direct Disk Access In Windows

Post by XStream »

Hi,

I am wondering if anyone knows how the program 'partcopy' accesses the disk directly in windows. I have a couple of methods that work, but they only seem to work about 25% of the time, but when I use partcopy it works 100% of the time. I have tried putting Sleep() statements between my code to allow the floppy to catch up but it doesn't work.

I was simply going to use partcopy from within my program but I need more detailed information about errors and stuff, simply redirecting console output does not give me what I need.

Cheers.
XStream

Re:Direct Disk Access In Windows

Post by XStream »

Ignore this, problem solved. thanks.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:Direct Disk Access In Windows

Post by Neo »

How was it solved? :)
Only Human
User avatar
paulqddinh
Posts: 9
Joined: Thu Jan 14, 2010 9:12 am
Location: Hanoi, VN

Re: Direct Disk Access In Windows

Post by paulqddinh »

gud day,
let me push up this topic again pls

i can access sectors of logical drive (indicated in Mbr) by visual c++
using CreateFile, ReadFile, WriteFile

but i still dont know how to access physical drive through visual c++
on windows

help... me...... :?
Asus EeePC 1000H/XP Pro
x86 Intel Atom N270 1.6GHz -- 1GB RAM
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Direct Disk Access In Windows

Post by Combuster »

You may want to use dd for any images anywhere. It works and saves you from writing your own stuff.

Visual c++ is a compiler, not an image writer. Also, CreateFile is the correct system call. MSDN has the necessary information about all this. Please don't be stupid enough to overwrite your harddisk's MBR.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
paulqddinh
Posts: 9
Joined: Thu Jan 14, 2010 9:12 am
Location: Hanoi, VN

Re: Direct Disk Access In Windows

Post by paulqddinh »

tkx, i've found it how,
just use \\.\PhysicalDriveN in CreateFile function

you know how to differentiate between HDD & USB?
coz my USB is also listed as physical drive
Asus EeePC 1000H/XP Pro
x86 Intel Atom N270 1.6GHz -- 1GB RAM
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Direct Disk Access In Windows

Post by Combuster »

Second STFW in one day.
Image
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Locked