Microsoft Internet Security and Acceleration Server 2004 SDK |
The AttachToSession method creates a session filter object when the Microsoft Firewall service detects an event for which the filter is registered. The AttachToSession method also indicates the set of events that the session filter will handle. This set of events includes the events requested in the IFWXFilter::FilterInit method. The events for which the filter is registered are received in a FwxFilterHookEvents structure.
The Firewall service calls this method when it detects an event for which the filter is registered.
HRESULT AttachToSession( IFWXSession* piSession, IFWXSessionFilter** piSessionFilter, PFwxFilterHookEvents pFilterHookEvents );
The following is an example implementation of the AttachToSession method.
HRESULT STDMETHODCALLTYPE AttachToSession(IFWXSession *piSession, IFWXSessionFilter ** piSessionFilter, PFwxFilterHookEvents *ppFilterHookEvents) { UNREFERENCED_PARAMETER(piSession); HRESULT hr = S_OK; // Create an instance of the session filter. CComObject<CMyFWXSessionFilter> *pSessionFilter; hr = CComObject<CMyFWXSessionFilter>::CreateInstance(&pSessionFilter); if (SUCCEEDED(hr)) { pSessionFilter->AddRef(); pSessionFilter->Initialize(this); // Give back the required events and the session filter object *pFilterHookEvents = m_FwxFilterHookEvents; *piSessionFilter = pSessionFilter; return S_OK; } if (FAILED(hr)) { return E_OUTOFMEMORY; } }
Server: Requires Windows Server 2003 or
Windows 2000.
Version: Requires Internet Security and Acceleration
Server 2004.
Header: Declared in Wspfwext.idl.