Page 1 of 1

Direct Disk Access In Windows

Posted: Fri Mar 18, 2005 9:25 pm
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.

Re:Direct Disk Access In Windows

Posted: Fri Mar 18, 2005 9:51 pm
by XStream
Ignore this, problem solved. thanks.

Re:Direct Disk Access In Windows

Posted: Mon Mar 21, 2005 5:58 am
by Neo
How was it solved? :)

Re: Direct Disk Access In Windows

Posted: Wed Jan 20, 2010 7:59 am
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...... :?

Re: Direct Disk Access In Windows

Posted: Wed Jan 20, 2010 9:13 am
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.

Re: Direct Disk Access In Windows

Posted: Wed Jan 20, 2010 10:02 pm
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

Re: Direct Disk Access In Windows

Posted: Thu Jan 21, 2010 2:02 am
by Combuster
Second STFW in one day.
Image