The CompleteAsyncIO method receives a notification from the Microsoft Firewall service when an asynchronous Windows I/O operation involving reading or writing to a file on a disk completes.
HRESULT CompleteAsyncIO( [in] BOOL fSuccess, [in] DWORD NumberOfBytesTransfered, [in] DWORD Win32ErrorCode, [in] IFWXOverlapped* pOverlapped, [in] UserContextType UserData );
Success flag. If TRUE, the I/O operation succeeded. If FALSE, it failed.
Number of bytes transferred during a successful I/O operation.
Windows error code for a failed I/O operation.
Pointer to the IFWXOverlapped interface on the overlapped object used for this operation.
The UserData parameter set in the call to the IFWXOverlapped::SetNotificationInterface method.
Implementations of this method should handle any run-time error and return S_OK.
This example implementation of IFWXExternalIOCompletion::CompleteAsycnIO is taken from the Exeblock sample filter.
HRESULT STDMETHODCALLTYPE CEBScannerDataFilter::CompleteAsyncIO( /* [in] */ BOOL fSuccess, /* [in] */ DWORD NumberOfBytesTransfered, /* [in] */ DWORD Win32ErrorCode, /* [in] */ IFWXOverlapped __RPC_FAR *pOverlapped, /* [in] */ UserContextType UserData) { UNREFERENCED_PARAMETER(UserData); UNREFERENCED_PARAMETER(Win32ErrorCode); UNREFERENCED_PARAMETER(NumberOfBytesTransfered); // The _Abort method closes and releases both sockets. if (!fSuccess) _Abort(); pOverlapped->Release(); IFWXSocket *pISocket = _GetExternalSocket(); if (pISocket) { pISocket->Recv(NULL, this, 0); pISocket->Release(); } return S_OK; }
If the Firewall service is performing asynchronous I/O for an operating system file, it must have access to the Windows Sockets OVERLAPPED structure and a means of setting up a callback when the I/O is completed.
The IFWXOverlapped interface gets a pointer to the Windows Sockets OVERLAPPED structure. The IFWXOverlapped interface also provides the link between the OVERLAPPED structure and a completion notification interface and includes user context information that allows the filter to distinguish between different notifications.
Use the IFWXOverlapped::SetNotificationInterface method to set the notification interface and user context. Then use the IFWXOverlapped::GetOverlapped method to get an OVERLAPPED structure that will be used in a call to an asynchronous Windows API.
The call to the Windows API must use a handle that is associated with the Firewall service's completion port. For more information, see the IFWXFirewall::HookToCompletionPort method.
When the overlapped operation completes, the Firewall service will get the completion notification in its completion port and will call the completion notification method of the specified interface.
The UserData parameter provides a context to the notification. You can use the same notification interface for completion notifications from distinct network socket objects and differentiate between them by using different values for the UserData parameter.
Server | Requires Windows Server 2008. |
---|---|
Version | Requires Forefront Threat Management Gateway (TMG). |
Header |
Declared in Wspfwext.idl. |
Send comments about this topic to Microsoft
Build date: 11/30/2009
© 2008 Microsoft Corporation. All rights reserved.