🗊 Презентация Context management

Нажмите для полного просмотра!
Context management, слайд №1 Context management, слайд №2 Context management, слайд №3 Context management, слайд №4 Context management, слайд №5 Context management, слайд №6 Context management, слайд №7 Context management, слайд №8 Context management, слайд №9 Context management, слайд №10 Context management, слайд №11 Context management, слайд №12 Context management, слайд №13 Context management, слайд №14 Context management, слайд №15 Context management, слайд №16

Вы можете ознакомиться и скачать презентацию на тему Context management. Доклад-сообщение содержит 16 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


Context Management
Описание слайда:
Context Management

Слайд 2


What are Contexts? Minifilter defined memory associated with Filter Manager objects May be from Paged or Non-paged pool Which objects can have...
Описание слайда:
What are Contexts? Minifilter defined memory associated with Filter Manager objects May be from Paged or Non-paged pool Which objects can have contexts: Volume Instance File (not currently supported) Stream StreamHandle (FileObject) Filter Manager tracks when contexts should be deleted: Object deletion Instance detach Filter unload

Слайд 3


Contexts and 3rd party file systems To support Stream and StreamHandle contexts a file system must use the FSRTL_ADVANCED_FCB_HEADER See...
Описание слайда:
Contexts and 3rd party file systems To support Stream and StreamHandle contexts a file system must use the FSRTL_ADVANCED_FCB_HEADER See FsRtlSetupAdvancedHeader() and FsRtlTeardownPerStreamContexts() in NTIFS.H Also look at the FastFat source in the IFSKit All Microsoft file systems now use this

Слайд 4


Context Registration Specify an array of FLT_CONTEXT_REGISTRATION structures in FLT_REGISTRATION structure The order of the entries in this array...
Описание слайда:
Context Registration Specify an array of FLT_CONTEXT_REGISTRATION structures in FLT_REGISTRATION structure The order of the entries in this array does not matter At least one registration entry must be specified for each context type used by the filter CleanupContext() callback is optional 3 different allocation options: Specify 0-3 explicit context sizes (for given context type). System internally uses Lookaside lists Pool tag must be specified Specify FLT_VARIABLE_SIZED_CONTEXTS, system allocates directly from pool (may be used in conjunction with explicit sizes) Pool tag must be specified Specify your own allocate/free callback routines

Слайд 5


Creating Contexts Use: NTSTATUS FltAllocateContext ( IN PFLT_FILTER Filter, IN FLT_CONTEXT_TYPE ContextType, IN SIZE_T ContextSize, IN POOL_TYPE...
Описание слайда:
Creating Contexts Use: NTSTATUS FltAllocateContext ( IN PFLT_FILTER Filter, IN FLT_CONTEXT_TYPE ContextType, IN SIZE_T ContextSize, IN POOL_TYPE PoolType, OUT PFLT_CONTEXT *ReturnedContext); Volume contexts must be allocated from non-paged pool Contexts limited to 64K in size A context size of zero is supported

Слайд 6


Setting contexts Use: FltSetVolumeContext() FltSetInstanceContext() FltSetFileContext() FltSetStreamContext() FltSetStreamHandleContext() Sample:...
Описание слайда:
Setting contexts Use: FltSetVolumeContext() FltSetInstanceContext() FltSetFileContext() FltSetStreamContext() FltSetStreamHandleContext() Sample: NTSTATUS FltSetStreamHandleContext ( IN PFLT_INSTANCE Instance, IN PFILE_OBJECT FileObject, IN FLT_SET_CONTEXT_OPERATION Operation, IN PFLT_CONTEXT NewContext, OUT PFLT_CONTEXT *OldContext OPTIONAL); FLT_SET_CONTEXT_OPERATION values: FLT_SET_CONTEXT_REPLACE_IF_EXISTS If specified, replaced context returned in OldContext parameter (must be dereferenced) FLT_SET_CONTEXT_KEEP_IF_EXISTS If specified, existing context returned in OldContext parameter (must be dereferenced) Can not set contexts at DPC level

Слайд 7


Supports contexts Use: BOOLEAN FltSupportsFileContexts ( IN PFILE_OBJECT FileObject); BOOLEAN FltSupportsStreamContexts ( IN PFILE_OBJECT...
Описание слайда:
Supports contexts Use: BOOLEAN FltSupportsFileContexts ( IN PFILE_OBJECT FileObject); BOOLEAN FltSupportsStreamContexts ( IN PFILE_OBJECT FileObject); BOOLEAN FltSupportsStreamHandleContexts ( IN PFILE_OBJECT FileObject); Checks to see if contexts are supported on the given FileObject Not supported on paging files Not supported during pre-create Not supported during post-close Not supported during IRP_MJ_NETWORK_QUERY_OPEN FltSupportsFileContexts() currently returns FALSE Not supported on file systems that do not use the FSRTL_ADVANCED_FCB_HEADER

Слайд 8


Getting Contexts Use: FltGetVolumeContext() FltGetInstanceContext() FltGetFileContext() FltGetStreamContext() FltGetStreamHandleContext() Sample:...
Описание слайда:
Getting Contexts Use: FltGetVolumeContext() FltGetInstanceContext() FltGetFileContext() FltGetStreamContext() FltGetStreamHandleContext() Sample: NTSTATUS FltGetStreamContext ( IN PFLT_INSTANCE Instance, IN PFILE_OBJECT FileObject, OUT PFLT_CONTEXT *Context); Designed to be retrieved during each operation Can not get contexts at DPC level – if a context is needed in a postOperation callback: Get it during the preOperation callback and pass it to the postOperation callback Do your postOperation processing at non-DPC level Synchronize operation Use FltDoCompletionProcessingWhenSafe()

Слайд 9


Referencing Contexts Use: VOID FltReferenceContext( IN PFLT_CONTEXT Context); This allows a filter to add their own reference to a context Call...
Описание слайда:
Referencing Contexts Use: VOID FltReferenceContext( IN PFLT_CONTEXT Context); This allows a filter to add their own reference to a context Call FltReleaseContext() to remove added reference

Слайд 10


Releasing Contexts Use: VOID FltReleaseContext ( IN PFLT_CONTEXT Context); Contexts need to be released following: Getting (via FltGetXxxContext())...
Описание слайда:
Releasing Contexts Use: VOID FltReleaseContext ( IN PFLT_CONTEXT Context); Contexts need to be released following: Getting (via FltGetXxxContext()) Creating (Via FltAllocateContext()) Referencing (via FltReferenceContext()) A replaced or previous context returned from FltSetXxxContext() routines Contexts may be held from pre to post operations as well as across multiple operations They must eventually be released or the memory will be leaked It is OK for a context to point to another context Example: stream context contains a pointer to an instance context Contexts can be released at DPC level

Слайд 11


Multiple contexts Use: VOID FltGetContexts ( IN PFLT_RELATED_OBJECTS FltObjects, IN FLT_CONTEXT_TYPE DesiredContexts, OUT PFLT_RELATED_CONTEXTS...
Описание слайда:
Multiple contexts Use: VOID FltGetContexts ( IN PFLT_RELATED_OBJECTS FltObjects, IN FLT_CONTEXT_TYPE DesiredContexts, OUT PFLT_RELATED_CONTEXTS Contexts); VOID FltReleaseContexts ( IN OUT PFLT_RELATED_CONTEXTS Contexts);

Слайд 12


Deleting Contexts Use: FltDeleteContext() FltDeleteVolumeContext() FltDeleteInstanceContext() FltDeleteFileContext() FltDeleteStreamContext()...
Описание слайда:
Deleting Contexts Use: FltDeleteContext() FltDeleteVolumeContext() FltDeleteInstanceContext() FltDeleteFileContext() FltDeleteStreamContext() FltDeleteStreamHandleContext() Sample: VOID FltDeleteContext ( IN PFLT_CONTEXT Context); NTSTATUS FltDeleteVolumeContext ( IN PFLT_FILTER Filter, IN PFLT_VOLUME Volume, OUT PFLT_CONTEXT *OldContext OPTIONAL); Only use if you have an explicit reason to delete an existing context Filter Manager tracks when contexts should be deleted due to objects going away Can not delete contexts at DPC level

Слайд 13


Freeing Contexts Contexts are freed after they are deleted and all outstanding references have been released PFLT_CONTEXT_CLEANUP_CALLBACK Unique...
Описание слайда:
Freeing Contexts Contexts are freed after they are deleted and all outstanding references have been released PFLT_CONTEXT_CLEANUP_CALLBACK Unique routine defined for each context type at registration time May be NULL if you don’t have any cleanup work to do when context is freed Called by Filter Manager before context is freed Contexts are cleaned up in the following hierarchical order StreamHandle Stream File (when implemented) Instance Volume

Слайд 14


Example: Setting a stream context status = FltAllocateContext( FilterHandle, FLT_STREAM_CONTEXT, sizeof(NCONTEXT), PagedPool, &ctx ); if...
Описание слайда:
Example: Setting a stream context status = FltAllocateContext( FilterHandle, FLT_STREAM_CONTEXT, sizeof(NCONTEXT), PagedPool, &ctx ); if (NT_SUCCESS(status)) { /* Initialize Context Here */ status = FltSetStreamContext( FltObjects->Instance, FltObjects->FileObject, FLT_KEEP_CONTEXT_IF_EXISTS, ctx, NULL ); / * Always release. If set fails it will free it */ FltReleaseContext( ctx ); }

Слайд 15


Performance Suggestions If a filter only supports one instance per volume (which most filters do) use instance contexts instead of volume contexts...
Описание слайда:
Performance Suggestions If a filter only supports one instance per volume (which most filters do) use instance contexts instead of volume contexts Consider putting a pointer to your instance context inside your stream or streamhandle contexts

Слайд 16


Sample Look at Ctx minifilter sample
Описание слайда:
Sample Look at Ctx minifilter sample



Теги Context management
Похожие презентации
Mypresentation.ru
Загрузить презентацию