Link to home
Start Free TrialLog in
Avatar of kdkirmse
kdkirmse

asked on

Syntax to open a raw windows 2000 partition using CreateFile


What would be the correct naming scheme to open a raw windows 2000 partition using CreateFile?

hDevice = CreateFile("\\Device\\Harddisk0\\Partition0",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);

fails with the error

"The system cannot find the path specified"

My understanding is that \Device\Harddisk0\Partition0 is actually a symbolic link.

Avatar of _corey_
_corey_

Well, you are able to open drives and volumes using the syntax:

\\.\PHYSICALDRIVE# where # is the volume number.

What kind of access do you need?

corey
Avatar of jkr
>>My understanding is that \Device\Harddisk0\Partition0

It is - in the kernel's namespace, though. Have you tried "\\\\?\\Device\\Harddisk0\\Partition0" (yes, this is a shotin the dark from userland)? Apart from that, I'd suggest using the drive letter like '\\.\C:' aka "\\\\.\\C:"
>>Have you tried "\\\\?\\Device\\Harddisk0\\Partition0"

Possibly it's not accessible in user land.  Using the \\?\ mode would simply not do path parsing, so probably less of a chance.

I think only volumes and mount points are accessible, but I'd be interested to hear if not.

corey
That's why I called it "a shot in the dark :o)

'NtCreateFile()' (http://msdn.microsoft.com/library/en-us/devnotes/winprog/ntcreatefile.asp) should work, though - especially with "\\Device\\Harddisk0\\Partition0"
ASKER CERTIFIED SOLUTION
Avatar of _corey_
_corey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial