[OT] Re: abstract file (support multi-part)

From: Anton Altaparmakov (aia21@cam.ac.uk)
Date: Thu Aug 24 2000 - 17:09:47 EST


At 03:55 21/08/2000, Albert D. Cahalan wrote:
[snip - Talking about NTFS and Windows NT]

>You have a drive f: with a file "bar" in the current directory.

You mean that current directory is on drive f:, right? (You can't have a
drive f: inside the current directory whatever the current directory is. -
This is a contradiction in terms!)

If so, then you open bar using the native API call ZwOpenFile. - The
ObjectName passed to this API call would be the name of the file (i.e.
"bar") and the RootDirectory handle would be obtained by a previous call
for example to ZwOpenFile/ZwCreateFile. Alternatively, the ObjectName would
be the fully qualified path to the file and RootDirectory would be NULL
(i.e. even if bar is in the root directory you still need to specify
"\??\f:\bar" to be fully qualified!). [ No problems for NT so far. ]

>You have a directory "f" in the current directory on the current drive.

Just ZwOpenFile or ZwCreateFile it as "\??\f:\f" if in root directory or as
"f" and then use RootDirectory handle which you need to obtain first (see
above). [ No problems for NT so far. ]

>Directory "f" has an EA called "bar".

First open the directory as described above and then to query the EA "bar"
use ZwQueryEaFile or to write to the EA use ZwSetEaFile. - "Bar" is
provided in the optional EaList argument (embedded in a
FILE_GET_EA_INFORMATION struct) when calling ZwQueryEaFile and in the
Buffer (of type PFILE_FULL_EA_INFORMATION) when calling ZwSetEaFile. [ No
problems for NT so far. ]

>Directory "f" has a stream called "bar".

AFAICS this would be done using ZwOpenFile setting the object name to
"f:bar". [ Note, I am not 100% sure about this, never done this in kernel
mode... Assuming I am right, again, no problems for NT so far. ]

>In the same place as "f", you have a file named "f:bar".

You can't have a file called f:bar! The colon is a reserved character and
cannot be used in filenames. - In my understanding the ZwXXX calls would
take "f:bar" to mean fileobject "f" and named data stream "bar". - In this
case "f" is already a directory fileobject as you have defined above,
therefore "f:bar" will access directory "f", named data stream "bar". [ You
can't have both a file and a directory of the same name in the same
directory since both are fileobjects. Again, no problems for NT. ]

[snip]
>I say we find out how the _native_ NT API deals with all this shit.
>By that I don't mean Win32, because that is just a subsystem sitting
>on top of the native API.

Well, The ZwXXX calls I describe ARE the _native_ NT API and are used when
coding kernel mode code such as device drivers and such like.

>I'd ask the guys at www.sysinternals.com, but seeing the crap they
>wrote about Linux having fundamental limitations sure doesn't look
>encouraging. Any non-hostile NT kernel experts?

Well, I do not consider myself to be an NT kernel expert but I certainly am
not hostile. (-;

Sorry for the off topic post but the questions were asked...

Regards,

         Anton

--

"Education is what remains after one has forgotten everything he learned in school." - Albert Einstein

-- Anton Altaparmakov Voice: 01223-333541(lab) / 07712-632205(mobile) Christ's College eMail: AntonA@bigfoot.com Cambridge CB2 3BU ICQ: 8561279 United Kingdom WWW: http://www-stu.christs.cam.ac.uk/~aia21/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:14 EST