Sasha,
The following should work for both NT and 2K …
Open the file in System Context, and save its File Handle and its File Object, which you have to reference via ObReferenceObjectByHandle API.
To access the file, if in system context, use the handle that you got when you opened it. In the context of other processes, get the context safe handle via
ObOpenObjectByPointer API, using the File Object. Make sure to close the handle that was created via ObOpenObjectByPointer.
Once you are done with the file, close it in system context, and dereference the File Object.
-Ilya.
-----Original Message-----
From: Sasha Bublik - (BS) [mailto:xxxxx@mastereye.kiev.ua]
Sent: Tuesday, July 13, 2004 10:55 AM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] File handle for ANY process context
Thanks Maxim.
But I need some solution for NT4 too.
What would you suggest for it?
Thanks.
Bye,
Sab
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, July 13, 2004 5:28 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] File handle for ANY process context
Use the OBJ_KERNEL_HANDLE flag, this will solve the problem.
This flag is not supported on NT4 though.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Sasha Bublik - (BS) mailto:xxxxx
To: Windows File Systems Devs Interest List mailto:xxxxx
Sent: Tuesday, July 13, 2004 6:04 PM
Subject: [ntfsd] File handle for ANY process context
Hello guys,
I have a such problem.
In my driver I use function ZwCreateFile to create/open a file. In result I have file handle. Of course, this handle is valid only in the process, in the context of which ZwCreateFile was called. So the question is: I need to operate with that file (by ZwReadFile/ZwWriteFile/etc.) in ANY process contexts. How can I receive handle for that file (for ZwXxx functions) which will be valid for other processes?
I tried next way but without success:
- ObReferenceObjectByHandle gives me pointer to the kernel Object
- then it looks like that in any process context I can get file handle with the help of ObInsertObject, but in reality I have BSOD
Thanks.
–
Bye,
—
Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@softricity.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:xxxxx>