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?
>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.
“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.
“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.
“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.
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);