Problem using FltAllocateContext for FLT_INSTANCE_CONTEXT - Filter Manager Beta

Nir:

Did you initialize FLT_CONTEXT_REGISTRATION with the context? It should be
something like:

const FLT_CONTEXT_REGISTRATION ContextRegistration =
{
{ FLT_INSTANCE_CONTEXT,
0,
NULL,
sizeof( void * ),
YOUR_POOL_TAG },

// Other context descriptions…

{ FLT_CONTEXT_END }
};

Then include ContextRegistration in FLT_REGISTRATION.

HTH,
Ken


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nir Livni
Sent: Thursday, January 20, 2005 10:11 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Problem using FltAllocateContext for FLT_INSTANCE_CONTEXT -
Filter Manager Beta

Hi all,
I am looking into the Filter Manager beta, and trying to learn its features.
(Environment: WinXP SP2)

I am trying to call FltAllocateContext during the InstanceSetup function.
Somehow, the call for FltAllocateContext always fail on

STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND

which is an undocumented return code for that function.

here is the the sample of my InstanceSetup function :

NTSTATUS status;

PFLT_CALLBACK_DATA_QUEUE queue;

PFLT_CONTEXT context;

UNREFERENCED_PARAMETER( Flags );

UNREFERENCED_PARAMETER( VolumeFilesystemType );

PAGED_CODE();

ASSERT( FltObjects->Filter == ScannerData.Filter );

//

// Don’t attach to network volumes.

//

if (VolumeDeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM) {

return STATUS_FLT_DO_NOT_ATTACH;

}

status = FltAllocateContext(

FltObjects->Filter,//IN PFLT_FILTER Filter,

FLT_INSTANCE_CONTEXT,//IN FLT_CONTEXT_TYPE ContextType,

sizeof(void *),//IN SIZE_T ContextSize,

NonPagedPool ,//IN POOL_TYPE PoolType,

&context //OUT PFLT_CONTEXT *ReturnedContext

);

if (! (NT_SUCCESS(status))) {

DbgPrint(“Failed allocating context %x\n”,status); //this one fails on
STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND

}

queue = InitializeIrpQueue();

if (!queue) {

DbgPrint(“Failed allocating queue\n”);

}

DbgPrint(“Filter %x Instance %x\n”,FltObjects->Filter,FltObjects->Instance);

status = FltSetInstanceContext(

FltObjects->Instance,//IN PFLT_INSTANCE Instance,

FLT_SET_CONTEXT_KEEP_IF_EXISTS,//IN FLT_SET_CONTEXT_OPERATION Operation,

(PFLT_CONTEXT)queue,//IN PFLT_CONTEXT NewContext,

NULL//OUT PFLT_CONTEXT *OldContext OPTIONAL

);

status = FltCbdqInitialize(

FltObjects->Instance,

queue,

IrpQueueInsertIo,

IrpQueueRemoveIo,

IrpQueuePeekNextIo,

IrpQueueAcquire,

IrpQueueRelease,

IrpQueueCompleteCanceledIo);

return STATUS_SUCCESS ;

I guess i am missing something here.
Am I ?

Thanks,
Nir

Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com