Click to See Complete Forum and Search --> : can't open drive by CreateFile("\\\\.\\C:")


visor
April 18th, 2005, 10:37 AM
I'm using for open device
CreateFile("\\\\.\\C:", GENERIC_READ,FILE_SHARE_READ| FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

it is working good if another application didn't open drive c: earlier.
How i must use this function or read disk t osolve this problem?

Andreas Masur
April 18th, 2005, 11:05 AM
Well...always check the error code first...take a look at the following FAQ (http://www.codeguru.com/forum/showthread.php?t=318721)...

visor
April 18th, 2005, 12:46 PM
error: File is used by another process.
Can i read disk by another method which hasn't problem like that?

NoHero
April 19th, 2005, 12:55 AM
You always have to give FILE_SHARE_READ | FILE_SHARE_WRITE when opening a complet drive. And you cannot open the system partition where your Windows is on with write access. Only for read.