Hi
I’m developing a legacy
filesystem filter driver.
I use generic table to store
specific data for some currently open files.
this is a structure I insert in generic table.
typedef struct
_ FileInfo {
PVOID
FsContext;
ULONG RefCount;
} FileInfo,*FileInfo;
// use FsContext to determine a
specific file that is open instead of file objects.
?
I initialized FsContext field in
create completion routine,
FileInfo->FsContext = Irp->FileObject->FsContext;
then I call
RtlInsertElementGenericTable routine in create completion to insert element in
generic table but I deal with two problems:
?
1)completion routine are often
invoked at high IRQL and it is not unusual to have completion routine invoked
at IRQL Dispatch_Level But the callers
of RtlInsertElementGenericTable must be
running at? IRQL < Dispatch_Level .
So what should I do to ensure
RtlInsertElementGenericTable running at safe IRQL?
- for exclusively synchronizing access to the generic
table I call KeAcquireFastMutex?
befor? RtlInsertElementGenericTable But
again I have IRQL problem because callers of KeAcquireFastMutex routine must be running at
IRQL<= APC_Level.Please guide me.
???
Read the documentation again. What it actually says is :
Callers of RtlInsertElementGenericTable must be running at IRQL <
DISPATCH_LEVEL if either of the following conditions holds:
* The caller-allocated memory at Table or at Buffer is pageable.
* The caller-supplied CompareRoutine or AllocateRoutine contains
pageable code.
In other words, so long as your table and the element stored in the
table come from non-paged pool you can call the function at DISPATCH_LEVEL.
To conserve non-paged pool you can split your records, use a small
non-paged buffer to contain just the essential table indexing
information which then points at a larger paged pool structure with
all the other stuff in it that you only need when running below DISPATCH_LEVEL.
Mark.
At 13:01 19/07/2008, fatima Gh wrote:
Hi
I’m developing a legacy filesystem filter driver.
I use generic table to store specific data for some currently open files.
this is a structure I insert in generic table.
typedef struct _ FileInfo {
PVOID FsContext;
ULONG RefCount;
} FileInfo,*FileInfo;
// use FsContext to determine a specific file that is open instead
of file objects.
I initialized FsContext field in create completion routine,
FileInfo->FsContext = Irp->FileObject->FsContext;
then I call RtlInsertElementGenericTable routine in create
completion to insert element in generic table but I deal with two problems:
1)completion routine are often invoked at high IRQL and it is not
unusual to have completion routine invoked at IRQL Dispatch_Level
But the callers of RtlInsertElementGenericTable must be running
at IRQL < Dispatch_Level .
So what should I do to ensure RtlInsertElementGenericTable running
at safe IRQL?
- for exclusively synchronizing access to the generic table I call
KeAcquireFastMutex befor RtlInsertElementGenericTable But again I
have IRQL problem because callers of KeAcquireFastMutex routine must
be running at IRQL<= APC_Level.
Please guide me.
There’s also a good introduction in a fairly recent issue of the NT Insider (http://www.osronline.com/article.cfm?id=516) to Splay
Trees, which includes some information about generic tables as well.
Good luck,
mm
Mark S. Edwards wrote:
Read the documentation again. What it actually says is :
Callers of *RtlInsertElementGenericTable* must be running at IRQL <
DISPATCH_LEVEL if either of the following conditions holds:
* The caller-allocated memory at /Table/ or at /Buffer/ is pageable.
* The caller-supplied /CompareRoutine/ or /AllocateRoutine/ contains
pageable code.
In other words, so long as your table and the element stored in the
table come from non-paged pool you can call the function at DISPATCH_LEVEL.
To conserve non-paged pool you can split your records, use a small
non-paged buffer to contain just the essential table indexing
information which then points at a larger paged pool structure with all
the other stuff in it that you only need when running below DISPATCH_LEVEL.
Mark.
At 13:01 19/07/2008, fatima Gh wrote:
> Hi
>
> I’m developing a legacy filesystem filter driver.
>
> I use generic table to store specific data for some currently open files.
> this is a structure I insert in generic table.
>
> typedef struct _ FileInfo {
>
> PVOID FsContext;
>
> ULONG RefCount;
> } FileInfo,*FileInfo;
>
> // use FsContext to determine a specific file that is open instead of
> file objects.
>
>
>
> I initialized FsContext field in create completion routine,
>
> FileInfo->FsContext = Irp->FileObject->FsContext;
>
> then I call RtlInsertElementGenericTable routine in create completion
> to insert element in generic table but I deal with two problems:
>
>
>
> 1)completion routine are often invoked at high IRQL and it is not
> unusual to have completion routine invoked at IRQL Dispatch_Level But
> the callers of RtlInsertElementGenericTable must be running at IRQL <
> Dispatch_Level .
>
> So what should I do to ensure RtlInsertElementGenericTable running at
> safe IRQL?
>
> 2) for exclusively synchronizing access to the generic table I call
> KeAcquireFastMutex befor RtlInsertElementGenericTable But again I
> have IRQL problem because callers of KeAcquireFastMutex routine must
> be running at IRQL<= APC_Level.
>
> Please guide me.
>
>