WriteServer Callback Function

The WriteServer callback function writes a data buffer to the server.

The WriteServer callback function is declared as:


BOOL WINAPI * WriteServer(
  __in  struct _HTTP_FILTER_CONTEXT* pfc,
  __in  LPVOID Buffer,
  __in  LPDWORD lpdwBytes,
		DWORD dwReserved



Pointer to the HTTP_FILTER_CONTEXT data structure that is associated with the current, active HTTP session. Pass the filter context in this parameter.


Pointer to the buffer to write.


Pointer to the size of the buffer pointed to by the Buffer parameter.


Reserved for future use.

Return Value

This callback function returns TRUE if the call is successful; otherwise, it returns FALSE. To obtain extended error information, call GetLastError.


The WriteServer function can be called after an SF_NOTIFY_FORWARD_RAW_DATA notification is received until an SF_NOTIFY_END_OF_REQUEST notification is received. The WriteServer function should not be called before an SF_NOTIFY_FORWARD_RAW_DATA notification is received because there is no connection with the server. For more information about the types of event notifications that are sent to Web filters, see Event Notifications.

The WriteServer function is called through a pointer that is a member of the WPX_FILTER_CONTEXT structure. To get a pointer to the WPX_FILTER_CONTEXT structure for calling the WriteServer function from the pointer to the HTTP_FILTER_CONTEXT structure provided in the pfc parameter in the call to the HttpWPXFilterProc entry-point function (for an SF_NOTIFY_FORWARD_RAW_DATA notification), use the TO_WPX_FILTER_CONTEXT macro as follows:

if (pwfc != NULL) {

The WriteServer callback function is synchronous and blocks the thread from which it is called until the I/O operation is completed. A Web filter sending a large amount of data in calls to this function can block all of the available worker threads with a resultant denial of service (DoS).


Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).

Declared in Wpxhttpfilt.h.


Requires W3Filter.dll.

See Also

Callback Functions

Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.