Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Syntax to open a raw windows 2000 partition using CreateFile

Posted on 2005-05-02
6
Medium Priority
?
1,720 Views
Last Modified: 2013-12-03

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.

0
Comment
Question by:kdkirmse
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:_corey_
ID: 13914317
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
0
 
LVL 86

Expert Comment

by:jkr
ID: 13914340
>>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:"
0
 
LVL 8

Expert Comment

by:_corey_
ID: 13914355
>>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
0
 
LVL 86

Expert Comment

by:jkr
ID: 13914393
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"
0
 
LVL 8

Accepted Solution

by:
_corey_ earned 750 total points
ID: 13957013
Hey guys,

In user mode looks like you should be able to use:

\\?\GLOBALROOT\Device\HarddiskVolumeX and partition

and

\\.\GLOBALROOT\C:\Partition0

Use this to read the raw sectors/etc.

corey
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question