KeWaitForMultipleObjects

I have some hesitation how to use KeWaitForMultipleObjects.
The next is described in MSDN:
"If the WaitBlockArray parameter is NULL, the Count parameter must be less
than or equal to THREAD_WAIT_OBJECTS or a bug check will occur.

If the WaitBlockArray pointer is nonNULL, the Count parameter must be less
than or equal to MAXIMUM_WAIT_OBJECTS or a bug check will occur. "

I need the second variant but I don’t know exactly how to initialize the
parameter PKWAIT_BLOCK WaitBlockArray to nonNULL value.

Can you help me with some examples or ideas?

Thank you in advance!


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

You would need to define a WaitBlockArray like this one:

KWAIT_BLOCK WaitBlockArray[MAX_OBJTECTS];

MAX_OBJECT is the maximum number of objects that you want to wait for.You
don’t need to initialize this structure.

You,also, need to define two more structures:

  1. an array of pointers for dispatcher objects(for example, events) like
    this :
    PVOID WaitEvents[MAX_OBJECTS]

  2. the array of events you are waiting for:
    KEVENT Event[MAX_OBJECTS]

Also, you must initialize the array of pointers with the array of events.

Now, you can wait for multiple objects with :

KeWaitForMultipleObjects(MAX_OBJECTS,

WaitEvents),
WaitAll,
Executive,
KernelMode,
FALSE,
NULL,

WaitBlockArray);

Besides this, you have to take into account that if one of the handles is
invalid at the moment you start the wait, then you will get a nice
KebugCheck. So you must be sure that all handles are valid before you enter
the wait.This is not as simple as it seems.

Hope this helps.
Jose Mari.

I have some hesitation how to use KeWaitForMultipleObjects.
The next is described in MSDN:
"If the WaitBlockArray parameter is NULL, the Count parameter must be less

than or equal to THREAD_WAIT_OBJECTS or a bug check will occur.

If the WaitBlockArray pointer is nonNULL, the Count parameter must be less

than or equal to MAXIMUM_WAIT_OBJECTS or a bug check will occur. "

I need the second variant but I don’t know exactly how to initialize the
parameter PKWAIT_BLOCK WaitBlockArray to nonNULL value.

Can you help me with some examples or ideas?

Thank you in advance!


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.


You are currently subscribed to ntfsd as: xxxxx@pandasoftware.es
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Thank you very much Jose Mari!
That was exacttly that I needed!
Jack Brown

From: José Mª López Martinez
>Reply-To: “File Systems Developers”
>To: “File Systems Developers”
>Subject: [ntfsd] RE: KeWaitForMultipleObjects
>Date: Tue, 26 Sep 2000 17:12:19 +0200
>
>You would need to define a WaitBlockArray like this one:
>
> KWAIT_BLOCK WaitBlockArray[MAX_OBJTECTS];
>
>MAX_OBJECT is the maximum number of objects that you want to wait for.You
>don’t need to initialize this structure.
>
>You,also, need to define two more structures:
>1) an array of pointers for dispatcher objects(for example, events) like
>this :
> PVOID WaitEvents[MAX_OBJECTS]
>
>2) the array of events you are waiting for:
> KEVENT Event[MAX_OBJECTS]
>
>Also, you must initialize the array of pointers with the array of events.
>
>Now, you can wait for multiple objects with :
>
> KeWaitForMultipleObjects(MAX_OBJECTS,
>
>WaitEvents),
> WaitAll,
> Executive,
> KernelMode,
> FALSE,
> NULL,
>
>WaitBlockArray);
>
>Besides this, you have to take into account that if one of the handles is
>invalid at the moment you start the wait, then you will get a nice
>KebugCheck. So you must be sure that all handles are valid before you enter
>the wait.This is not as simple as it seems.
>
>Hope this helps.
>Jose Mari.
>
>
>
>
>
>
> > I have some hesitation how to use KeWaitForMultipleObjects.
> > The next is described in MSDN:
> > "If the WaitBlockArray parameter is NULL, the Count parameter must be
>less
> >
> > than or equal to THREAD_WAIT_OBJECTS or a bug check will occur.
> >
> > If the WaitBlockArray pointer is nonNULL, the Count parameter must be
>less
> >
> > than or equal to MAXIMUM_WAIT_OBJECTS or a bug check will occur. "
> >
> > I need the second variant but I don’t know exactly how to initialize the
> > parameter PKWAIT_BLOCK WaitBlockArray to nonNULL value.
> >
> > Can you help me with some examples or ideas?
> >
> > Thank you in advance!
> >
>
> > Get Your Private, Free E-mail from MSN Hotmail at
>http://www.hotmail.com.
> >
> > Share information about yourself, create your own public profile at
> > http://profiles.msn.com.
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@pandasoftware.es
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>—
>You are currently subscribed to ntfsd as: xxxxx@hotmail.com
>To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.