\Harddisk0\Partition1

Hi.

I know this is a filesystem question but I need an answer quite quickly and I am hoping it is quite a quick question to answer.

I have managed to take a path and convert it into the \Device\Harddisk0\Partition0 format. Unfortunately it seems the driver doesn?t like opening files which begin with this and would prefer it if a file began with \Device\HarddiskVolume1\

The question is how do I interchange between the two styles and why does it really matter?

Thanks.

>The question is how do I interchange between the two styles and why does it really matter?

On my machine (2008 SP2) \Device\Harddisk2\Partition1 is a symlink pointing to \Device\HarddiskVolume1

I think that ftdisk/volmgr does the same from w2k up, to avoid having 2 names pointing to 2 different device objects (one in Disk another in volmgr).

\Device\Harddisk%d directory and \Device\Harddisk%d\Partition0 full-drive device object name, with ??\PhysicalDrive%d symlink pointing to it, are created by Disk.sys itself.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“On my machine (2008 SP2) \Device\Harddisk2\Partition1 is a symlink pointing to
\Device\HarddiskVolume1”

In that case something is wrong because I can ZwOpen the file “\Device\HarddiskVolume1\WINDOWS\file.dat” but I cannot open “\Device\Harddisk0\Partition1\WINDOWS\anotherfile.dat”

Unless symlinks mean something different in a driver.

>\WINDOWS\file.dat" but I cannot open “\Device\Harddisk0\Partition1\WINDOWS\anotherfile.dat”

What is the error code?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

BAD_PATH 0xC000003B and with occansions 0xC0000033

xxxxx@hotmail.co.uk wrote:

“On my machine (2008 SP2) \Device\Harddisk2\Partition1 is a symlink pointing to
\Device\HarddiskVolume1”

In that case something is wrong because I can ZwOpen the file “\Device\HarddiskVolume1\WINDOWS\file.dat” but I cannot open “\Device\Harddisk0\Partition1\WINDOWS\anotherfile.dat”

Are you sure the partition is on Harddisk0? Have you tried the winobj
utility to view the kernel namespace? That will show you the symlink
mappings.

(On my XP machine, \Device\Harddisk0\Partition1 is a symlink to
\Device\HarddiskVolume1.)

Unless symlinks mean something different in a driver.

Well, that’s really the ONLY place where symlinks mean anything.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

If it isn?t I have a problem because I am using ZwQuerySymbolicLinkObject to find it.

\Device\HarddiskVolume1 is pointed to by \Device\Harddisk0\Partition1

So what could be the problem?

xxxxx@hotmail.co.uk wrote:

“On my machine (2008 SP2) \Device\Harddisk2\Partition1 is a symlink pointing
to
\Device\HarddiskVolume1”

In that case something is wrong because I can ZwOpen the file
“\Device\HarddiskVolume1\WINDOWS\file.dat” but I cannot open
“\Device\Harddisk0\Partition1\WINDOWS\anotherfile.dat”

Are you sure the partition is on Harddisk0? Have you tried the winobj
utility to view the kernel namespace? That will show you the symlink
mappings.

(On my XP machine, \Device\Harddisk0\Partition1 is a symlink to
\Device\HarddiskVolume1.)

Unless symlinks mean something different in a driver.

Well, that’s really the ONLY place where symlinks mean anything.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@hotmail.co.uk wrote:

\Device\HarddiskVolume1 is pointed to by \Device\Harddisk0\Partition1

So what could be the problem?

Why don’t you post the code? Maybe there’s something that another set
of eyes can spot.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thankyou. I forgot to set the UnicodeString Length. I learnt something. Thankyou.

Hi Nv can you help me. I'm also doing the same. But still, I'm not able to create the file. here I'm posting the code. can you look into it tell what is the problem with the code? Thank You.
  UNICODE_STRING     uniName;
OBJECT_ATTRIBUTES  objAttr;
NTSTATUS ntstatus = 0;
RtlInitUnicodeString(&uniName, L"\\Device\\Haarddisk1\\Partition0\\abc.txt");
UNICODE_STRING    ResultString;

ResultString.Buffer = ExAllocatePoolWithTag(NonPagedPool, uniName.Length, 'frPD');

if (ResultString.Buffer != NULL) {
	//NTSTATUS status;
	RtlCopyUnicodeString(&ResultString, &uniName);
	//status = RtlUnicodeStringCat(&ResultString, &stt);
}
///RtlUnicodeStringCat(&uniName, &stt);
// or L"\\SystemRoot\\example.txt"
InitializeObjectAttributes(&objAttr, &ResultString,
	OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
	NULL, NULL);

The dead have been raised!

For one thing, you never call any function to create the file. I’m sure it must be in your code, but you didn’t show it to us.

Excuse me, are there more than one char ‘a’ int the string “\Device\Haarddisk1\Partition0\abc.txt” ?