Das Interface
Beim Erstellen der Interface-Datei habe ich mich bewusst auf die sehr ausgereifte ISAPI - Schnittstelle des IIS konzentriert, denn man kann schon sagen, dass der IIS den größten Funktionsumfang zur Verfügung stellt in vielen anderen Implementierungen wie z.B. beim Apache wurde auf einige Möglichkeiten verzichtet, denn hier steht auch eine andere Schnittstelle zur Verfügung.
Wie schon erwähnt konnte ich es mir zunutze machen, dass bereits in C Header -Dateien zu diesem Interface zur Verfügung stehen, die nur nach Pascal portiert werden mussten. Im Internet findet man dazu einiges (wenn man nach isapi.pas sucht), aber leider sind die Ergebnisse nicht aktuell und auch leider nicht immer fehlerfrei und auch leider nicht direkt für Free Pascal zu gebrauchen.
Die aus den Recherchen im Internet entstandene Interface-Datei ist gleichermaßen für Lazarus / Free Pascal als auch für Delphi geeignet. Sie stellt die Definitionen der drei zu jeder Schnittstelle zu exportierten Funktionen zur Verfügung.
Bei dem Filter wären das:
GetFilterVersion , welche Informationen zum Filter übergibt, vor allem für welche Events das Filter geschrieben wurde.
HttpFilterProc die Hauptfunktion, welche eigentliche Verarbeitung vornimmt.
TerminateFilter , die das Beenden des Filters einleitet.
Bei der Extension wären das:
GetExtensionVersion , welche Informationen zur Extension übergibt.
HttpExtensionProc die Hauptfunktion, welche eigentliche Verarbeitung des Requests vornimmt.
TerminateExtension , die das Beenden der Extension einleitet.
isapi.pas Pascal (52,38 kByte) 04.09.2015 00:24
unit isapi;
{$WEAKPACKAGEUNIT}
{$ifdef fpc}
{$mode objfpc}
{$endif}
{$H+}
interface
{$HPPEMIT '#include <httpext.h>'}
{$HPPEMIT '#include <httpfilt.h>'}
const
MAX_PATH = 260 ;
type
BOOL = longbool;
LONG = longint;
LONGLONG = int64;
PWCHAR = Pwidechar;
LPDWORD = ^DWORD;
const
HSE_VERSION_MAJOR = 7 ; {$EXTERNALSYM HSE_VERSION_MAJOR}
HSE_VERSION_MINOR = 0 ; {$EXTERNALSYM HSE_VERSION_MINOR}
HSE_LOG_BUFFER_LEN = 80 ;
{$EXTERNALSYM HSE_LOG_BUFFER_LEN}
HSE_MAX_EXT_DLL_NAME_LEN = 256 ;
{$EXTERNALSYM HSE_MAX_EXT_DLL_NAME_LEN}
HSE_VERSION = $00070000 ;
{$EXTERNALSYM HSE_VERSION}
HSE_STATUS_SUCCESS = 1 ;
{$EXTERNALSYM HSE_STATUS_SUCCESS}
HSE_STATUS_SUCCESS_AND_KEEP_CONN = 2 ;
{$EXTERNALSYM HSE_STATUS_SUCCESS_AND_KEEP_CONN}
HSE_STATUS_PENDING = 3 ;
{$EXTERNALSYM HSE_STATUS_PENDING}
HSE_STATUS_ERROR = 4 ;
{$EXTERNALSYM HSE_STATUS_ERROR}
HSE_REQ_BASE = 0 ;
{$EXTERNALSYM HSE_REQ_BASE}
HSE_REQ_SEND_URL_REDIRECT_RESP = ( HSE_REQ_BASE + 1 );
{$EXTERNALSYM HSE_REQ_SEND_URL_REDIRECT_RESP}
HSE_REQ_SEND_URL = ( HSE_REQ_BASE + 2 );
{$EXTERNALSYM HSE_REQ_SEND_URL}
HSE_REQ_SEND_RESPONSE_HEADER = ( HSE_REQ_BASE + 3 );
{$EXTERNALSYM HSE_REQ_SEND_RESPONSE_HEADER}
HSE_REQ_DONE_WITH_SESSION = ( HSE_REQ_BASE + 4 );
{$EXTERNALSYM HSE_REQ_DONE_WITH_SESSION}
HSE_REQ_END_RESERVED = 1000 ;
{$EXTERNALSYM HSE_REQ_END_RESERVED}
HSE_REQ_MAP_URL_TO_PATH = (HSE_REQ_END_RESERVED+ 1 );
{$EXTERNALSYM HSE_REQ_MAP_URL_TO_PATH}
HSE_REQ_GET_SSPI_INFO = (HSE_REQ_END_RESERVED+ 2 );
{$EXTERNALSYM HSE_REQ_GET_SSPI_INFO}
HSE_APPEND_LOG_PARAMETER = (HSE_REQ_END_RESERVED+ 3 );
{$EXTERNALSYM HSE_APPEND_LOG_PARAMETER}
HSE_REQ_SEND_URL_EX = (HSE_REQ_END_RESERVED+ 4 );
{$EXTERNALSYM HSE_REQ_SEND_URL_EX}
HSE_REQ_IO_COMPLETION = (HSE_REQ_END_RESERVED+ 5 );
{$EXTERNALSYM HSE_REQ_IO_COMPLETION}
HSE_REQ_TRANSMIT_FILE = (HSE_REQ_END_RESERVED+ 6 );
{$EXTERNALSYM HSE_REQ_TRANSMIT_FILE}
HSE_REQ_REFRESH_ISAPI_ACL = (HSE_REQ_END_RESERVED+ 7 );
{$EXTERNALSYM HSE_REQ_REFRESH_ISAPI_ACL}
HSE_REQ_IS_KEEP_CONN = (HSE_REQ_END_RESERVED+ 8 );
{$EXTERNALSYM HSE_REQ_IS_KEEP_CONN}
HSE_REQ_ASYNC_READ_CLIENT = (HSE_REQ_END_RESERVED+ 10 );
{$EXTERNALSYM HSE_REQ_ASYNC_READ_CLIENT}
HSE_REQ_GET_IMPERSONATION_TOKEN = (HSE_REQ_END_RESERVED+ 11 );
{$EXTERNALSYM HSE_REQ_GET_IMPERSONATION_TOKEN}
HSE_REQ_MAP_URL_TO_PATH_EX = (HSE_REQ_END_RESERVED+ 12 );
{$EXTERNALSYM HSE_REQ_MAP_URL_TO_PATH_EX}
HSE_REQ_ABORTIVE_CLOSE = (HSE_REQ_END_RESERVED+ 14 );
{$EXTERNALSYM HSE_REQ_ABORTIVE_CLOSE}
HSE_REQ_GET_CERT_INFO_EX = (HSE_REQ_END_RESERVED+ 15 );
{$EXTERNALSYM HSE_REQ_GET_CERT_INFO_EX}
HSE_REQ_SEND_RESPONSE_HEADER_EX = (HSE_REQ_END_RESERVED+ 16 );
{$EXTERNALSYM HSE_REQ_SEND_RESPONSE_HEADER_EX}
HSE_REQ_CLOSE_CONNECTION = (HSE_REQ_END_RESERVED+ 17 );
{$EXTERNALSYM HSE_REQ_CLOSE_CONNECTION}
HSE_REQ_IS_CONNECTED = (HSE_REQ_END_RESERVED+ 18 );
{$EXTERNALSYM HSE_REQ_IS_CONNECTED}
HSE_REQ_MAP_UNICODE_URL_TO_PATH = (HSE_REQ_END_RESERVED+ 23 );
{$EXTERNALSYM HSE_REQ_MAP_UNICODE_URL_TO_PATH}
HSE_REQ_MAP_UNICODE_URL_TO_PATH_EX = (HSE_REQ_END_RESERVED+ 24 );
{$EXTERNALSYM HSE_REQ_MAP_UNICODE_URL_TO_PATH_EX}
HSE_REQ_EXEC_UNICODE_URL = (HSE_REQ_END_RESERVED+ 25 );
{$EXTERNALSYM HSE_REQ_EXEC_UNICODE_URL}
HSE_REQ_EXEC_URL = (HSE_REQ_END_RESERVED+ 26 );
{$EXTERNALSYM HSE_REQ_EXEC_URL}
HSE_REQ_GET_EXEC_URL_STATUS = (HSE_REQ_END_RESERVED+ 27 );
{$EXTERNALSYM HSE_REQ_GET_EXEC_URL_STATUS}
HSE_REQ_SEND_CUSTOM_ERROR = (HSE_REQ_END_RESERVED+ 28 );
{$EXTERNALSYM HSE_REQ_SEND_CUSTOM_ERROR}
HSE_REQ_IS_IN_PROCESS = (HSE_REQ_END_RESERVED+ 30 );
{$EXTERNALSYM HSE_REQ_IS_IN_PROCESS}
HSE_REQ_REPORT_UNHEALTHY = (HSE_REQ_END_RESERVED+ 32 );
{$EXTERNALSYM HSE_REQ_REPORT_UNHEALTHY}
HSE_REQ_NORMALIZE_URL = (HSE_REQ_END_RESERVED+ 33 );
{$EXTERNALSYM HSE_REQ_NORMALIZE_URL}
HSE_REQ_VECTOR_SEND = (HSE_REQ_END_RESERVED+ 37 );
{$EXTERNALSYM HSE_REQ_VECTOR_SEND}
HSE_REQ_GET_ANONYMOUS_TOKEN = (HSE_REQ_END_RESERVED+ 38 );
{$EXTERNALSYM HSE_REQ_GET_ANONYMOUS_TOKEN}
HSE_REQ_GET_CACHE_INVALIDATION_CALLBACK = (HSE_REQ_END_RESERVED+ 40 );
{$EXTERNALSYM HSE_REQ_GET_CACHE_INVALIDATION_CALLBACK}
HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN = (HSE_REQ_END_RESERVED+ 41 );
{$EXTERNALSYM HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN}
HSE_REQ_GET_TRACE_INFO = (HSE_REQ_END_RESERVED+ 42 );
{$EXTERNALSYM HSE_REQ_GET_TRACE_INFO}
HSE_REQ_SET_FLUSH_FLAG = (HSE_REQ_END_RESERVED+ 43 );
{$EXTERNALSYM HSE_REQ_SET_FLUSH_FLAG}
HSE_REQ_GET_TRACE_INFO_EX = (HSE_REQ_END_RESERVED+ 44 );
{$EXTERNALSYM HSE_REQ_RAISE_TRACE_EVENT}
HSE_REQ_RAISE_TRACE_EVENT = (HSE_REQ_END_RESERVED+ 45 );
{$EXTERNALSYM HSE_REQ_GET_CONFIG_OBJECT}
HSE_REQ_GET_CONFIG_OBJECT = (HSE_REQ_END_RESERVED+ 46 );
{$EXTERNALSYM HSE_REQ_GET_WORKER_PROCESS_SETTINGS}
HSE_REQ_GET_WORKER_PROCESS_SETTINGS = (HSE_REQ_END_RESERVED+ 47 );
{$EXTERNALSYM HSE_REQ_GET_PROTOCOL_MANAGER_CUSTOM_INTERFACE_CALLBACK}
HSE_REQ_GET_PROTOCOL_MANAGER_CUSTOM_INTERFACE_CALLBACK = (HSE_REQ_END_RESERVED+ 48 );
{$EXTERNALSYM HSE_REQ_CANCEL_IO}
HSE_REQ_CANCEL_IO = (HSE_REQ_END_RESERVED+ 49 );
{$EXTERNALSYM HSE_REQ_GET_CHANNEL_BINDING_TOKEN}
HSE_REQ_GET_CHANNEL_BINDING_TOKEN = (HSE_REQ_END_RESERVED+ 50 );
HSE_TERM_ADVISORY_UNLOAD = $00000001 ;
{$EXTERNALSYM HSE_TERM_ADVISORY_UNLOAD}
HSE_TERM_MUST_UNLOAD = $00000002 ;
{$EXTERNALSYM HSE_TERM_MUST_UNLOAD}
HSE_IO_SYNC = $00000001 ; {$EXTERNALSYM HSE_IO_SYNC}
HSE_IO_ASYNC = $00000002 ; {$EXTERNALSYM HSE_IO_ASYNC}
HSE_IO_DISCONNECT_AFTER_SEND = $00000004 ; {$EXTERNALSYM HSE_IO_DISCONNECT_AFTER_SEND}
HSE_IO_SEND_HEADERS = $00000008 ; {$EXTERNALSYM HSE_IO_SEND_HEADERS}
HSE_IO_NODELAY = $00001000 ; {$EXTERNALSYM HSE_IO_NODELAY}
HSE_IO_FINAL_SEND = $00000010 ;
{$EXTERNALSYM HSE_IO_FINAL_SEND}
HSE_IO_CACHE_RESPONSE = $00000020 ;
{$EXTERNALSYM HSE_IO_CACHE_RESPONSE}
HSE_IO_TRY_SKIP_CUSTOM_ERRORS = $00000040 ;
{$EXTERNALSYM HSE_IO_TRY_SKIP_CUSTOM_ERRORS}
type
HCONN = THandle;
{$EXTERNALSYM HCONN}
PHSE_VERSION_INFO = ^HSE_VERSION_INFO;
HSE_VERSION_INFO = packed record
dwExtensionVersion: DWORD;
lpszExtensionDesc: array [0.. HSE_MAX_EXT_DLL_NAME_LEN- 1 ] of Char;
end ;
{$EXTERNALSYM HSE_VERSION_INFO}
THSE_VERSION_INFO = HSE_VERSION_INFO;
LPHSE_VERSION_INFO = PHSE_VERSION_INFO;
{$EXTERNALSYM LPHSE_VERSION_INFO}
TGetServerVariableProc = function ( hConn: HCONN; VariableName: PChar;
Buffer: Pointer; var Size: DWORD ): BOOL stdcall ;
TWriteClientProc = function ( ConnID: HCONN; Buffer: Pointer;
var Bytes: DWORD; dwReserved: DWORD ): BOOL stdcall ;
TReadClientProc = function ( ConnID: HCONN; Buffer: Pointer;
var Size: DWORD ): BOOL stdcall ;
TServerSupportFunctionProc = function ( hConn: HCONN; HSERRequest: DWORD;
Buffer: Pointer; Size: LPDWORD; DataType: LPDWORD ): BOOL stdcall ;
PEXTENSION_CONTROL_BLOCK = ^TEXTENSION_CONTROL_BLOCK;
TEXTENSION_CONTROL_BLOCK = packed record
cbSize: DWORD; dwVersion: DWORD; ConnID: HCONN; dwHttpStatusCode: DWORD; lpszLogData: array [0.. HSE_LOG_BUFFER_LEN- 1 ] of Char; {$ifdef WIN64}
__padding: DWORD;
{$endif}
lpszMethod: PChar; lpszQueryString: PChar; lpszPathInfo: PChar; lpszPathTranslated: PChar; cbTotalBytes: DWORD; cbAvailable: DWORD; lpbData: Pointer; lpszContentType: PChar;
GetServerVariable: TGetServerVariableProc;
WriteClient: TWriteClientProc;
ReadClient: TReadClientProc;
ServerSupportFunction: TServerSupportFunctionProc;
end ;
const
HSE_URL_FLAGS_READ = $00000001 ; {$EXTERNALSYM HSE_URL_FLAGS_READ}
HSE_URL_FLAGS_WRITE = $00000002 ; {$EXTERNALSYM HSE_URL_FLAGS_WRITE}
HSE_URL_FLAGS_EXECUTE = $00000004 ; {$EXTERNALSYM HSE_URL_FLAGS_EXECUTE}
HSE_URL_FLAGS_SSL = $00000008 ; {$EXTERNALSYM HSE_URL_FLAGS_SSL}
HSE_URL_FLAGS_DONT_CACHE = $00000010 ; {$EXTERNALSYM HSE_URL_FLAGS_DONT_CACHE}
HSE_URL_FLAGS_NEGO_CERT = $00000020 ; {$EXTERNALSYM HSE_URL_FLAGS_NEGO_CERT}
HSE_URL_FLAGS_REQUIRE_CERT = $00000040 ; {$EXTERNALSYM HSE_URL_FLAGS_REQUIRE_CERT}
HSE_URL_FLAGS_MAP_CERT = $00000080 ; {$EXTERNALSYM HSE_URL_FLAGS_MAP_CERT}
HSE_URL_FLAGS_SSL128 = $00000100 ; {$EXTERNALSYM HSE_URL_FLAGS_SSL128}
HSE_URL_FLAGS_SCRIPT = $00000200 ; {$EXTERNALSYM HSE_URL_FLAGS_SCRIPT}
HSE_URL_FLAGS_SCRIPT_SOURCE = $00000400 ; {$EXTERNALSYM HSE_URL_FLAGS_SCRIPT_SOURCE}
HSE_URL_FLAGS_MASK = $000003FF ;
{$EXTERNALSYM HSE_URL_FLAGS_MASK}
type
PHSE_URL_MAPEX_INFO = ^THSE_URL_MAPEX_INFO;
THSE_URL_MAPEX_INFO = packed record
lpszPath: array [0.. MAX_PATH- 1 ] of Char; dwFlags: DWORD; cchMatchingPath: DWORD; cchMatchingURL: DWORD; dwReserved1: DWORD;
dwReserved2: DWORD;
end ;
PHSE_UNICODE_URL_MAPEX_INFO = ^THSE_UNICODE_URL_MAPEX_INFO;
THSE_UNICODE_URL_MAPEX_INFO = packed record
lpszPath: array [0.. MAX_PATH- 1 ] of WideChar; dwFlags: DWORD; cchMatchingPath: DWORD; cchMatchingURL: DWORD; end ;
THseIoCompletion = procedure (var ECB: TEXTENSION_CONTROL_BLOCK;
pContext: Pointer; cbIO: DWORD; dwError: DWORD) stdcall ;
PHSE_TF_INFO = ^THSE_TF_INFO;
THSE_TF_INFO = record
pfnHseIO: THseIoCompletion;
pContext: Pointer;
hFile: THandle;
pszStatusCode: PChar;
BytesToWrite: DWORD; Offset: DWORD;
pHead: Pointer; HeadLength: DWORD; {$ifdef WIN64}
__padding: DWORD; {$endif}
pTail: Pointer; TailLength: DWORD;
dwFlags: DWORD; end ;
PHSE_SEND_HEADER_EX_INFO = ^THSE_SEND_HEADER_EX_INFO;
THSE_SEND_HEADER_EX_INFO = record
pszStatus: PChar; pszHeader: PChar;
cchStatus: DWORD; cchHeader: DWORD;
fKeepConn: BOOL; {$ifdef WIN64}
__padding: DWORD;
{$endif}
end ;
const
HSE_EXEC_URL_NO_HEADERS = $00000002 ;
HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR = $00000004 ;
HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE = $00000010 ;
HSE_EXEC_URL_DISABLE_CUSTOM_ERROR = $00000020 ;
HSE_EXEC_URL_SSI_CMD = $00000040 ;
HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE = $00000080 ;
type
PHSE_EXEC_URL_USER_INFO = ^THSE_EXEC_URL_USER_INFO;
THSE_EXEC_URL_USER_INFO = record
hImpersonationToken: THandle; pszCustomUserName: PChar;
pszCustomAuthType: PChar;
end ;
PHSE_EXEC_URL_ENTITY_INFO = ^THSE_EXEC_URL_ENTITY_INFO;
THSE_EXEC_URL_ENTITY_INFO = record
cbAvailable: DWORD;
{$ifdef WIN64}
__padding: DWORD;
{$endif}
lpbData: Pointer;
end ;
PHSE_EXEC_URL_STATUS = ^THSE_EXEC_URL_STATUS;
THSE_EXEC_URL_STATUS = record
uHttpStatusCode: WORD; uHttpSubStatus: WORD; dwWin32Error: DWORD;
end ;
PHSE_EXEC_URL_INFO = ^THSE_EXEC_URL_INFO;
THSE_EXEC_URL_INFO = record
pszUrl: PChar; pszMethod: PChar; pszChildHeaders: PChar; pUserInfo: THSE_EXEC_URL_USER_INFO; pEntity: THSE_EXEC_URL_ENTITY_INFO; dwExecUrlFlags: DWORD; {$ifdef WIN64}
__padding: DWORD;
{$endif}
end ;
PHSE_EXEC_UNICODE_URL_USER_INFO = ^THSE_EXEC_UNICODE_URL_USER_INFO;
THSE_EXEC_UNICODE_URL_USER_INFO = record
hImpersonationToken: THandle;
pszCustomUserName: PChar;
pszCustomAuthType: PChar;
end ;
PHSE_EXEC_UNICODE_URL_INFO = ^THSE_EXEC_UNICODE_URL_INFO;
THSE_EXEC_UNICODE_URL_INFO = record
pszUrl: PWideChar; pszMethod: PChar; pszChildHeaders: PChar; pUserInfo: THSE_EXEC_UNICODE_URL_USER_INFO; pEntity: THSE_EXEC_URL_ENTITY_INFO; dwExecUrlFlags: DWORD; {$ifdef WIN64}
__padding: DWORD;
{$endif}
end ;
PHSE_CUSTOM_ERROR_INFO = ^THSE_CUSTOM_ERROR_INFO;
THSE_CUSTOM_ERROR_INFO = record
pszStatus: Char;
uHttpSubError: WORD; {$ifdef WIN64}
__padding: WORD;
{$endif}
fAsync: BOOL; end ;
const
HSE_VECTOR_ELEMENT_TYPE_MEMORY_BUFFER = 0 ;
HSE_VECTOR_ELEMENT_TYPE_FILE_HANDLE = 1 ;
type
PHSE_VECTOR_ELEMENT = ^THSE_VECTOR_ELEMENT;
THSE_VECTOR_ELEMENT = record
ElementType: DWORD; {$ifdef WIN64}
__padding: DWORD;
{$endif}
pvContext: Pointer; cbOffset: LONGLONG; cbSize: LONGLONG; end ;
PHSE_VECTOR_ELEMENT_Array = ^THSE_VECTOR_ELEMENT_Array;
THSE_VECTOR_ELEMENT_Array = array [0..0 ] of THSE_VECTOR_ELEMENT;
PHSE_RESPONSE_VECTOR = ^THSE_RESPONSE_VECTOR;
THSE_RESPONSE_VECTOR = record
dwFlags: DWORD; {$ifdef WIN64}
__padding1: DWORD;
{$endif}
pszStatus: PChar; pszHeaders: PChar; nElementCount: DWORD;{$ifdef WIN64}
__padding2: DWORD;
{$endif}
lpElementArray: THSE_VECTOR_ELEMENT_Array; end ;
TInvalidationCallBack = function (pszUrl: WideChar): hresult stdcall ;
PHSE_TRACE_INFO = ^THSE_TRACE_INFO;
THSE_TRACE_INFO = record
fTraceRequest: BOOL; TraceContextId: array [0..15 ] of Byte; {$ifdef WIN64}
__padding: DWORD;
{$endif}
dwReserved1: DWORD;
dwReserved2: DWORD;
end ;
TProtocolManagerCustomInterfaceCallback = function (
pszProtocolManagerDll: PWChar; pszProtocolManagerDllInitFunction: PWChar;
dwCustomInterfaceId: DWORD; ppCustomInterface: Pointer): hresult stdcall ;
const
HSE_APP_FLAG_IN_PROCESS = 0 ;
HSE_APP_FLAG_ISOLATED_OOP = 1 ;
HSE_APP_FLAG_POOLED_OOP = 2 ;
type
TGetExtensionVersion = function (var Ver: THSE_VERSION_INFO): BOOL stdcall ;
THttpExtensionProc = function (var ECB: TEXTENSION_CONTROL_BLOCK): DWORD stdcall ;
TTerminateExtension = function (dwFlags: DWORD): BOOL stdcall ;
IISAPIExtension = interface
function GetExtensionVersion (var Ver: THSE_VERSION_INFO): BOOL; stdcall ;
function HttpExtensionProc (var ECB: TEXTENSION_CONTROL_BLOCK): DWORD; stdcall ;
function TerminateExtension (dwFlags: DWORD): BOOL; stdcall ;
end ;
const
HTTP_FILTER_REVISION = $00070000 ;
{$EXTERNALSYM HTTP_FILTER_REVISION}
SF_MAX_USERNAME = (256 + 1 );
{$EXTERNALSYM SF_MAX_USERNAME}
SF_MAX_PASSWORD = (256 + 1 );
{$EXTERNALSYM SF_MAX_PASSWORD}
SF_MAX_AUTH_TYPE = (32 + 1 );
{$EXTERNALSYM SF_MAX_AUTH_TYPE}
SF_MAX_FILTER_DESC_LEN = (256 + 1 );
{$EXTERNALSYM SF_MAX_FILTER_DESC_LEN}
SF_REQ_SEND_RESPONSE_HEADER = 0 ;
{$EXTERNALSYM SF_REQ_SEND_RESPONSE_HEADER}
SF_REQ_ADD_HEADERS_ON_DENIAL = 1 ;
{$EXTERNALSYM SF_REQ_ADD_HEADERS_ON_DENIAL}
SF_REQ_SET_NEXT_READ_SIZE = 2 ;
{$EXTERNALSYM SF_REQ_SET_NEXT_READ_SIZE}
SF_REQ_SET_PROXY_INFO = 3 ;
{$EXTERNALSYM SF_REQ_SET_PROXY_INFO}
SF_REQ_GET_CONNID = 4 ;
{$EXTERNALSYM SF_REQ_GET_CONNID}
SF_REQ_SET_CERTIFICATE_INFO = 5 ;
{$EXTERNALSYM SF_REQ_SET_CERTIFICATE_INFO}
SF_REQ_GET_PROPERTY = 6 ;
{$EXTERNALSYM SF_REQ_GET_PROPERTY}
SF_REQ_NORMALIZE_URL = 7 ;
{$EXTERNALSYM SF_REQ_NORMALIZE_URL}
SF_REQ_DISABLE_NOTIFICATIONS = 8 ;
{$EXTERNALSYM SF_REQ_DISABLE_NOTIFICATIONS}
SF_PROPERTY_SSL_CTXT = 0 ;
{$EXTERNALSYM SF_PROPERTY_SSL_CTXT}
SF_PROPERTY_INSTANCE_NUM_ID = 1 ;
{$EXTERNALSYM SF_PROPERTY_INSTANCE_NUM_ID}
SF_STATUS_REQ_FINISHED = $8000000 ;
{$EXTERNALSYM SF_STATUS_REQ_FINISHED}
SF_STATUS_REQ_FINISHED_KEEP_CONN = $8000001 ;
{$EXTERNALSYM SF_STATUS_REQ_FINISHED_KEEP_CONN}
SF_STATUS_REQ_NEXT_NOTIFICATION = $8000002 ;
{$EXTERNALSYM SF_STATUS_REQ_NEXT_NOTIFICATION}
SF_STATUS_REQ_HANDLED_NOTIFICATION = $8000003 ;
{$EXTERNALSYM SF_STATUS_REQ_HANDLED_NOTIFICATION}
SF_STATUS_REQ_ERROR = $8000004 ;
{$EXTERNALSYM SF_STATUS_REQ_ERROR}
SF_STATUS_REQ_READ_NEXT = $8000005 ;
{$EXTERNALSYM SF_STATUS_REQ_READ_NEXT}
type
TFilterGetServerVariableProc = function (var pfc;
VariableName: PChar; Buffer: Pointer; var Size: DWORD ): BOOL stdcall ;
TFilterAddResponseHeadersProc = function (var pfc;
lpszHeaders: PChar; dwReserved: DWORD): BOOL stdcall ;
TFilterWriteClientProc = function (var pfc;
Buffer: Pointer; var Bytes: DWORD; dwReserved: DWORD ): BOOL stdcall ;
TFilterAllocMemProc = function (var pfc;
cbSize: DWORD; dwReserved: DWORD): Pointer stdcall ;
TFilterServerSupportFunctionProc = function (var pfc;
sfReq: DWORD; pData: Pointer; ul1, ul2: DWORD): BOOL stdcall ;
PHTTP_FILTER_CONTEXT = ^THTTP_FILTER_CONTEXT;
THTTP_FILTER_CONTEXT = record
cbSize: DWORD;
Revision: DWORD; ServerContext: Pointer; ulReserved: DWORD;
fIsSecurePort: BOOL; pFilterContext: Pointer; GetServerVariable: TFilterGetServerVariableProc;
AddResponseHeaders: TFilterAddResponseHeadersProc;
WriteClient: TFilterWriteClientProc;
AllocMem: TFilterAllocMemProc;
ServerSupportFunction: TFilterServerSupportFunctionProc;
end ;
HTTP_FILTER_CONTEXT = THTTP_FILTER_CONTEXT;
PHTTP_FILTER_RAW_DATA = ^HTTP_FILTER_RAW_DATA;
HTTP_FILTER_RAW_DATA = record
pvInData: Pointer; cbInData: DWORD; cbInBuffer: DWORD; dwReserved: DWORD;
end ;
{$EXTERNALSYM HTTP_FILTER_RAW_DATA}
THTTP_FILTER_RAW_DATA = HTTP_FILTER_RAW_DATA;
LPHTTP_FILTER_RAW_DATA = PHTTP_FILTER_RAW_DATA;
{$EXTERNALSYM LPHTTP_FILTER_RAW_DATA}
TGetHeaderProc = function (var pfc: THTTP_FILTER_CONTEXT; lpszName: PChar;
out lpvBuffer; out lpdwSize: DWORD): BOOL stdcall ;
TSetHeaderProc = function (var pfc: THTTP_FILTER_CONTEXT; lpszName,
lpszValue: PChar): BOOL stdcall ;
TAddHeaderProc = function (var pfc: THTTP_FILTER_CONTEXT; lpszName,
lpszValue: PChar): BOOL; stdcall ;
PHTTP_FILTER_PREPROC_HEADERS = ^HTTP_FILTER_PREPROC_HEADERS;
HTTP_FILTER_PREPROC_HEADERS = record
GetHeader: TGetHeaderProc;
SetHeader: TSetHeaderProc;
AddHeader: TAddHeaderProc;
HttpStatus: DWORD; dwReserved: DWORD; end ;
{$EXTERNALSYM HTTP_FILTER_PREPROC_HEADERS}
THTTP_FILTER_PREPROC_HEADERS = HTTP_FILTER_PREPROC_HEADERS;
LPHTTP_FILTER_PREPROC_HEADERS = PHTTP_FILTER_PREPROC_HEADERS;
{$EXTERNALSYM LPHTTP_FILTER_PREPROC_HEADERS}
PHTTP_FILTER_SEND_RESPONSE = ^HTTP_FILTER_SEND_RESPONSE;
HTTP_FILTER_SEND_RESPONSE = HTTP_FILTER_PREPROC_HEADERS;
{$EXTERNALSYM HTTP_FILTER_SEND_RESPONSE}
THTTP_FILTER_SEND_RESPONSE = HTTP_FILTER_SEND_RESPONSE;
LPHTTP_FILTER_SEND_RESPONSE = PHTTP_FILTER_SEND_RESPONSE;
{$EXTERNALSYM LPHTTP_FILTER_SEND_RESPONSE}
PHTTP_FILTER_AUTHENT = ^HTTP_FILTER_AUTHENT;
HTTP_FILTER_AUTHENT = record
pszUser: PChar;
cbUserBuff: DWORD;
pszPassword: PChar;
cbPasswordBuff: DWORD;
end ;
{$EXTERNALSYM HTTP_FILTER_AUTHENT}
THTTP_FILTER_AUTHENT = HTTP_FILTER_AUTHENT;
LPHTTP_FILTER_AUTHENT = PHTTP_FILTER_AUTHENT;
{$EXTERNALSYM LPHTTP_FILTER_AUTHENT}
PHTTP_FILTER_URL_MAP = ^HTTP_FILTER_URL_MAP;
HTTP_FILTER_URL_MAP = record
pszURL: PChar; pszPhysicalPath: PChar;
cbPathBuff: DWORD;
end ;
{$EXTERNALSYM HTTP_FILTER_URL_MAP}
THTTP_FILTER_URL_MAP = HTTP_FILTER_URL_MAP;
LPHTTP_FILTER_URL_MAP = PHTTP_FILTER_URL_MAP;
{$EXTERNALSYM LPHTTP_FILTER_URL_MAP}
PHTTP_FILTER_URL_MAP_EX = ^HTTP_FILTER_URL_MAP_EX;
HTTP_FILTER_URL_MAP_EX = record
pszURL: PChar; pszPhysicalPath: PChar;
cbPathBuff: DWORD;
dwFlags: DWORD; cchMatchingPath: DWORD; cchMatchingURL: DWORD; pszScriptMapEntry: PChar; end ;
{$EXTERNALSYM HTTP_FILTER_URL_MAP_EX}
THTTP_FILTER_URL_MAP_EX = HTTP_FILTER_URL_MAP_EX;
LPHTTP_FILTER_URL_MAP_EX = PHTTP_FILTER_URL_MAP_EX;
{$EXTERNALSYM LPHTTP_FILTER_URL_MAP_EX}
const
SF_DENIED_LOGON = $00000001 ;
{$EXTERNALSYM SF_DENIED_LOGON}
SF_DENIED_RESOURCE = $00000002 ;
{$EXTERNALSYM SF_DENIED_RESOURCE}
SF_DENIED_FILTER = $00000004 ;
{$EXTERNALSYM SF_DENIED_FILTER}
SF_DENIED_APPLICATION = $00000008 ;
{$EXTERNALSYM SF_DENIED_APPLICATION}
SF_DENIED_BY_CONFIG = $00010000 ;
{$EXTERNALSYM SF_DENIED_BY_CONFIG}
type
PHTTP_FILTER_ACCESS_DENIED = ^HTTP_FILTER_ACCESS_DENIED;
HTTP_FILTER_ACCESS_DENIED = record
pszURL: PChar; pszPhysicalPath: PChar; dwReason: DWORD; end ;
{$EXTERNALSYM HTTP_FILTER_ACCESS_DENIED}
THTTP_FILTER_ACCESS_DENIED = HTTP_FILTER_ACCESS_DENIED;
LPHTTP_FILTER_ACCESS_DENIED = PHTTP_FILTER_ACCESS_DENIED;
{$EXTERNALSYM LPHTTP_FILTER_ACCESS_DENIED}
PHTTP_FILTER_LOG = ^HTTP_FILTER_LOG;
HTTP_FILTER_LOG = record
pszClientHostName: PChar; pszClientUserName: PChar; pszServerName: PChar; pszOperation: PChar; pszTarget: PChar; pszParameters: PChar; dwHttpStatus: DWORD; dwWin32Status: DWORD; dwBytesSent: DWORD; dwBytesRecvd: DWORD; msTimeForProcessing: DWORD; end ;
{$EXTERNALSYM HTTP_FILTER_LOG}
THTTP_FILTER_LOG = HTTP_FILTER_LOG;
LPHTTP_FILTER_LOG = PHTTP_FILTER_LOG;
{$EXTERNALSYM LPHTTP_FILTER_LOG}
TGetUserTokenProc = function (var pfc: THTTP_FILTER_CONTEXT; phToken: THandle): BOOL stdcall ;
PHTTP_FILTER_AUTH_COMPLETE_INFO = ^HTTP_FILTER_AUTH_COMPLETE_INFO;
HTTP_FILTER_AUTH_COMPLETE_INFO = record
GetHeader: TGetHeaderProc;
SetHeader: TSetHeaderProc;
AddHeader: TAddHeaderProc;
GetUserToken: TGetUserTokenProc;
HttpStatus: DWORD;
fResetAuth: BOOL;
dwReserved: DWORD;
end ;
{$EXTERNALSYM HTTP_FILTER_AUTH_COMPLETE_INFO}
THTTP_FILTER_AUTH_COMPLETE_INFO = HTTP_FILTER_AUTH_COMPLETE_INFO;
LPHTTP_FILTER_AUTH_COMPLETE_INFO = PHTTP_FILTER_AUTH_COMPLETE_INFO;
{$EXTERNALSYM LPHTTP_FILTER_AUTH_COMPLETE_INFO}
const
SF_NOTIFY_SECURE_PORT = $00000001 ;
{$EXTERNALSYM SF_NOTIFY_SECURE_PORT}
SF_NOTIFY_NONSECURE_PORT = $00000002 ;
{$EXTERNALSYM SF_NOTIFY_NONSECURE_PORT}
SF_NOTIFY_READ_RAW_DATA = $00008000 ;
{$EXTERNALSYM SF_NOTIFY_READ_RAW_DATA}
SF_NOTIFY_PREPROC_HEADERS = $00004000 ;
{$EXTERNALSYM SF_NOTIFY_PREPROC_HEADERS}
SF_NOTIFY_URL_MAP = $00001000 ;
{$EXTERNALSYM SF_NOTIFY_URL_MAP}
SF_NOTIFY_AUTHENTICATION = $00002000 ;
{$EXTERNALSYM SF_NOTIFY_AUTHENTICATION}
SF_NOTIFY_ACCESS_DENIED = $00000800 ;
{$EXTERNALSYM SF_NOTIFY_ACCESS_DENIED}
SF_NOTIFY_AUTH_COMPLETE = $04000000 ;
{$EXTERNALSYM SF_NOTIFY_AUTH_COMPLETE}
SF_NOTIFY_SEND_RESPONSE = $00000040 ;
{$EXTERNALSYM SF_NOTIFY_SEND_RESPONSE}
SF_NOTIFY_SEND_RAW_DATA = $00000400 ;
{$EXTERNALSYM SF_NOTIFY_SEND_RAW_DATA}
SF_NOTIFY_END_OF_REQUEST = $00000080 ;
{$EXTERNALSYM SF_NOTIFY_END_OF_REQUEST}
SF_NOTIFY_LOG = $00000200 ;
{$EXTERNALSYM SF_NOTIFY_LOG}
SF_NOTIFY_END_OF_NET_SESSION = $00000100 ;
{$EXTERNALSYM SF_NOTIFY_END_OF_NET_SESSION}
SF_NOTIFY_ORDER_HIGH = $00080000 ;
{$EXTERNALSYM SF_NOTIFY_ORDER_HIGH}
SF_NOTIFY_ORDER_MEDIUM = $00040000 ;
{$EXTERNALSYM SF_NOTIFY_ORDER_MEDIUM}
SF_NOTIFY_ORDER_LOW = $00020000 ;
{$EXTERNALSYM SF_NOTIFY_ORDER_LOW}
SF_NOTIFY_ORDER_DEFAULT = SF_NOTIFY_ORDER_LOW;
{$EXTERNALSYM SF_NOTIFY_ORDER_DEFAULT}
SF_NOTIFY_ORDER_MASK = SF_NOTIFY_ORDER_HIGH or
SF_NOTIFY_ORDER_MEDIUM or
SF_NOTIFY_ORDER_LOW;
{$EXTERNALSYM SF_NOTIFY_ORDER_MASK}
type
PHTTP_FILTER_VERSION = ^HTTP_FILTER_VERSION;
HTTP_FILTER_VERSION = record
dwServerFilterVersion: DWORD; dwFilterVersion: DWORD; lpszFilterDesc: array [0.. SF_MAX_FILTER_DESC_LEN - 1 ] of Char;
dwFlags: DWORD;
end ;
{$EXTERNALSYM HTTP_FILTER_VERSION}
THTTP_FILTER_VERSION = HTTP_FILTER_VERSION;
LPHTTP_FILTER_VERSION = PHTTP_FILTER_VERSION;
{$EXTERNALSYM LPHTTP_FILTER_VERSION}
TGetFilterVersion = function (var pVer: THTTP_FILTER_VERSION): BOOL stdcall ;
THttpFilterProc = function (var pfc: THTTP_FILTER_CONTEXT;
Notificationtype: DWORD; pvNotification: Pointer): DWORD stdcall ;
TTerminateFilter = function (dwFlags: DWORD): BOOL stdcall ;
IISAPIFilter = interface
function GetFilterVersion (var pVer: HTTP_FILTER_VERSION): BOOL; stdcall ;
function HttpFilterProc (var pfc: THTTP_FILTER_CONTEXT; NotificationType: DWORD; pvNotification: Pointer): DWORD; stdcall ;
function TerminateFilter (dwFlags: DWORD): BOOL; stdcall ;
end ;
implementation
end .