user kernel communication model
Download
Skip this Video
Download Presentation
User / Kernel Communication Model

Loading in 2 Seconds...

play fullscreen
1 / 11

User / Kernel Communication Model - PowerPoint PPT Presentation


  • 439 Views
  • Uploaded on

User / Kernel Communication Model. Advantages. Bi-directional messaging facility Minifilter defines the security on the channel Fast User-to-Kernel messaging, no buffering Efficient Kernel-to-User messaging with the capability for user mode to reply back to the filter.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'User / Kernel Communication Model' - fausto


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
user kernel communication model

User / Kernel Communication Model

© 2004 Microsoft Corporation. All rights reserved.

advantages
Advantages
  • Bi-directional messaging facility
  • Minifilter defines the security on the channel
  • Fast User-to-Kernel messaging, no buffering
  • Efficient Kernel-to-User messaging with the capability for user mode to reply back to the filter.
  • Can associate I/O completion ports for Kernel-to-User communication

© 2004 Microsoft Corporation. All rights reserved.

communication ports
Communication Ports
  • Filter creates a named communication port
  • Filter implicitly begins to listen for incoming connections on the port
  • Connection will be denied if user doesn’t have sufficient access as specified by security descriptor on listener port
  • Each connection to the listener port gets its own message queue and private endpoints

© 2004 Microsoft Corporation. All rights reserved.

communication ports cont d
Communication Ports (cont’d)
  • Closing either endpoint (kernel/user) terminates that connection
  • Closing listener port handle prevents future connections
    • Existing connections will not be terminated
  • Unload safe
    • When minifilter unloads, Filter manager forcibly terminates existing connections

© 2004 Microsoft Corporation. All rights reserved.

creating communication port
Creating Communication Port
  • Minifilter creates a named port with:
    • FltCreateCommunicationPort(

IN PFLT_FILTER Filter,

OUT PFLT_PORT *ServerPort,

IN POBJECT_ATTRIBUTES ObjectAttributes,

IN PVOID ServerPortCookie OPTIONAL,

IN PFLT_CONNECT_NOTIFY ConnectNotifyCallback,

IN PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback,

IN PFLT_MESSAGE_NOTIFY MessageNotifyCallback,

IN ULONG MaxConnections);

  • Minifilter closes named port with:
    • FltCloseCommunicationPort()

© 2004 Microsoft Corporation. All rights reserved.

establishing a connection from user mode
Establishing a Connection from User-Mode
  • Application connects to named port with:
    • FilterConnectCommunicationPort(

IN LPCWSTR lpPortName,

IN DWORD dwOptions,

IN LPVOID lpContext OPTIONAL,

IN WORD wSizeOfContext,

IN LPSECURITY_ATTRIBUTES lpSecurityAttributes OPTIONAL,

OUT HANDLE *hPort);

  • Application disconnects from named port with:
    • CloseHandle()

© 2004 Microsoft Corporation. All rights reserved.

establishing a connection cont d
Establishing a Connection (cont’d)
  • User connect triggers ConnectNotify() callback in minifilter
    • Receives a handle to the new connection just created
  • On return, user-mode receives a separate handle representing its endpoint to the connection
  • User-mode handle is a file handle
    • Can be used to associate I/O completion ports

© 2004 Microsoft Corporation. All rights reserved.

user to kernel messaging
User-to-Kernel Messaging
  • FilterSendMessage()
    • Sends synchronous message from user to kernel
  • Minifilter receives message via MessageNotify() callback
  • Buffers are raw user buffers
    • Must use try-except(), probe/capture, etc., to safely access buffers

© 2004 Microsoft Corporation. All rights reserved.

kernel to user messaging
Kernel-to-User Messaging
  • FltSendMessage()
    • Sends message to waiting user-mode receiver
    • Can block if no user-mode receivers are available
    • Timeout may be specified, use with care
  • FilterGetMessage()
    • Called by user mode application to receive a message from the minifilter
    • Recommend that you use overlapped structure to issue multiple asynchronous gets
  • FilterReplyMessage()
    • Applications reply to a specific message
  • Requires agreed upon message protocol between application and minifilter

© 2004 Microsoft Corporation. All rights reserved.

terminating a connection
Terminating a Connection
  • User-mode close of handle triggers DisconnectNotify() in minifilter
    • Filter then calls FltCloseClientPort() to finish closing the connection
  • Minifilter unload also triggers DisconnectNotify()

© 2004 Microsoft Corporation. All rights reserved.

sample
Sample
  • Look at Scanner minifilter sample

© 2004 Microsoft Corporation. All rights reserved.

ad