Again, it sounds like you are mixing too freely simple structs, true
Object Manager objects, and object handles. KeWait… and ZwXyzFile
are very particular about what form of synchronization “object” you
pass.
As far as I know, KeWaitForSingleObject() only works on pointers to
structs that start with a DISPATCHER_HEADER struct, such as KEVENT.
You cannot use any sort of handle (it’s not a pointer to a struct),
and I imagine you cannot use a FILE_OBJECT pointer because it doesn’t
start with a DISPATCHER_HEADER.
On the other hand, the “event” you pass to ZwReadFile() MUST be a handle
to an event, not a pointer to a KEVENT you’ve set up with
KeInitializeEvent().
If you have a handle (event or file-object) and want to wait on it,
try ZwWaitForSingleObject(), and its kindred, which are documented in
Nebbett’s Native API Reference, but not in the DDK. These work on
handles, not DISPATCHER_HEADER structs. ZwWaitForSingleObject() is
prototyped in NTIFS.H.
Dave Cox
Hewlett-Packard Co.
HPSO/SSMO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox
-----Original Message-----
From: david c. steere [mailto:xxxxx@cse.ogi.edu]
Sent: Monday, May 08, 2000 9:18 PM
To: File Systems Developers
Subject: [ntfsd] RE: YASQ
I’ve tried waiting in 2 different ways:
- KeWait… on a handle returned from ZwCreateFile and on a file
object
- passing an event (alloc’d from the nonpaged pool and initialized
via KeInitEvent()) to ZwReadFile, and waiting on it with KeWait…
The first method failed in a BSOD, either on the wait or later (when the
process exited). The second method failed because ZwReadFile returned an
error (invalid handle). I have successfully used events, some that were
allocated in the non-paged pool and some that were part of the device
extension (which is non-paged). Several people have mentioned waiting on a
file object but I’ve yet been able to successfully do it.
david.
At 03:42 PM 5/8/00 -0600, you wrote:
KeWait… doesn’t operate on handles. You need to reference the
handle to get an object pointer.
How are you getting a handle to the event you create?
KeInitializeEvent() operates on nonpaged pool memory to create a valid
KEVENT object, but not a handle.
Dave Cox
Hewlett-Packard Co.
HPSO/SSMO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox
-----Original Message-----
From: david c. steere [mailto:xxxxx@cse.ogi.edu]
Sent: Monday, May 08, 2000 2:04 PM
To: File Systems Developers
Subject: [ntfsd] YASQ
Yet another stupid question…
I’ve been having a heck of a time with blocking user requests. I tracked a
BSOD problem I was having to calling KeWaitForSingleObject with a KEVENT
allocated in the paged pool. However, I’m now stuck trying to block a
thread
for the completion of a pending read via ZwReadFile().
The NT4 DDK docs say you can wait on a HANDLE returned by ZwCreateFile()
(if
you specify the SYNCHRONIZE flag). Being somewhat naive, I tried doing just
that but I get a BSOD when I call KeWaitForSingleObject on the handle.
Alternatively, I can create an event (in non-paged memory of course) but
when I pass it into ZwReadFile (as the 2nd argument) I get a
STATUS_INVALID_HANDLE.
So, the question is how does one go about waiting on handles or file
objects
if they aren’t allocated as non-paged? Or, how does one create an event
that
can be passed to ZwReadFile?
thanks,
david
ps, seems like there have been lots of dispatcher-object related questions
on this list of late. Is there something I should read that would make this
all clear to me? (I’ve read bits of DDK documentation in MSDN, Inside
WinNT,
the OSR driver book, and Nagar’s FS book.)
You are currently subscribed to ntfsd as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
You are currently subscribed to ntfsd as: xxxxx@cse.ogi.edu
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
You are currently subscribed to ntfsd as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)