I think, I made a typo. Your path should read.
L"\SystemRoot\system32\drivers\file.txt"
From Walter Oney’s White paper on file I/O
(http://www.oneysoft.com/whitepaper.htm)
File Naming
Windows 98 and Windows 2000 both use the same file system model,
wherein disks identified by driver letters have a hierarchy of
directories containing files. If you’re trying to open a file
during what might turn out to be the initialization phase of
Windows 2000, however, you can’t use normal drive letters because
the file system infrastructure supporting drive letters won’t
yet have been initialized. You can, however, freely access files
that are located within the Windows directory (\WINNT on some
disk, for example) by using the special name prefix "\SystemRoot".
For example, this filename:
\SystemRoot\system32\drivers\fileio.jnk
identifies a file named “fileio.jnk” in the drivers directory.
The advantage of naming the file this way is that ZwCreateFile
can always find it, no matter what stage of initialization the
system happens to be in.
Niraj
-----Original Message-----
From: Dan Sullivan [mailto:xxxxx@emulex.com]
Sent: Tuesday, May 15, 2001 1:17 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Determining boot disk from a driver
Niraj,
Thanks for getting back to me with this help.
Let me see if I understand what you are saying. If I code up my call to
IoInitializeObject Attributes() like so, I will open a file on the boot disk
RtlInitUnicodeString(&FileName,
L"\??\SystemRoot\WINNT\system32\drivers\file.txt");
InitializeObjectAttributes(&Attributes,
&FileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jaiswal, Niraj
Sent: Tuesday, May 15, 2001 3:53 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Determining boot disk from a driver
Using \SystemRoot.… will help you determine the boot disk.
\SystemRoot is a symbolic link that effectively converts to
\Device\HarddiskX\PartitionX<windows directory>
This will let you access the files in the directory or the
sub directories because that’s the only form of name that
will work no matter when your driver is being loaded.
Niraj
-----Original Message-----
From: xxxxx@emulex.com [mailto:xxxxx@emulex.com]
Sent: Monday, May 14, 2001 6:01 PM
To: NT Developers Interest List
Subject: [ntdev] Determining boot disk from a driver
Is it possible to determine the boot disk (e.g., C:, D:, etc.) from a
driver? I’d like to open a file on the disk and the ZwCreateFile and
ZwOpenFile want the full path to it. I’m not sure the best way of
determining the disk from within the driver.
Thanks
Dan
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com