📄 dxisapi.pas
字号:
unit DXISAPI;
///////////////////////////////////////////////////////////////////////////////
// Component: TDXISAPI
// Author: G.E. Ozz Nixon Jr. (onixon@dxsock.com)
// ========================================================================
// Source Owner: DX, Inc. 1995-2002
// Copyright: All code is the property of DX, Inc. Licensed for
// resell by Brain Patchwork DX (tm) and part of the
// DX (r) product lines, which are (c) 1999-2002
// DX, Inc. Source may not be distributed without
// written permission from both Brain Patchwork DX,
// and DX, Inc.
// License: (Reminder), None of this code can be added to other
// developer products without permission. This includes
// but not limited to DCU's, DCP's, DLL's, OCX's, or
// any other form of merging our technologies. All of
// your products released to a public consumer be it
// shareware, freeware, commercial, etc. must contain a
// license notification somewhere visible in the
// application.
// Example is Internet Explorer - Help->About screen
// shows the licensed code contained in the application.
// Code Version: (3rd Generation Code)
// ========================================================================
// Description:
// ========================================================================
// IMPLEMENTATION OF ISAPI 4.0 SPECIFICATIONS (FEBRUARY 2002)
// Create one instance of the TDXIAPI component in your application. To use:
// TDXISAPI.RegisterDLL(Path+Filename) - Registers the DLL with our DLLManager!
// TDXISAPI.Execute(TDXClientThread;Path+Filename) - Executes the DLL
// TDXISAPI.UnregisterDLL(Path+Filename) - removes from our DLLManager.
//
// You must specify the following events!
// TDXISAPI.GetServerVariable(Session:TDXClientThread;Variable:String;Var Results:String);
//
// All other ISAPI callbacks are actually handled internal to this component.
//
// To achieve HIGH-SPEED, register all known DLL's at the startup of your
// application, and then on termination unregister all of these DLL's. Then
// all you have to do is execute the DLL as needed.
//
// MSDN:
// Important - It is vital that the work performed by ISAPI filters is minimized,
// because the effects on scalability and performance is potentially quite severe.
// For example, if your ISAPI filter implemented your own custom encryption scheme,
// the encryption and decryption would need to take place within your ISAPI filter
// code, but the reading and writing of the data should be handled by IIS.
///////////////////////////////////////////////////////////////////////////////
interface
{$DEFINE USE_DLL_MGR}
{$DEFINE SUPPORT_COM}
Uses
{$IFNDEF LINUX}
Windows,
ComObj, // 12-Jan-2005
{$ENDIF}
Classes,
DXString,
DXServerCore,
{$IFDEF USE_DLL_MGR}
DXDLLManager,
{$ENDIF}
DXSecurity,
DXISAPIFilter,
DXHTTPHeaderTools;
{$I DXSock.def}
Type
HCONN=Integer;
{$IFDEF VER100}
Longword=Cardinal;
{$ENDIF}
{$IFDEF LINUX}
LPDWord=^Longword;
LPCSTR=PChar;
{$ENDIF}
Const
HSE_LOG_BUFFER_LEN=80;
HSE_MAX_EXT_DLL_NAME_LEN=256;
type
TGetServerVariableProc = function ( hConn: HCONN;
VariableName: PChar;
Buffer: Pointer;
Size:LPDWord): BOOLEAN stdcall;
TWriteClientProc = function ( ConnID: HCONN;
Buffer: Pointer;
var Bytes: Longword;
dwReserved: Longword ): BOOLEAN stdcall;
TReadClientProc = function ( ConnID: HCONN;
Buffer: Pointer;
var Size: Longword ): BOOLEAN stdcall;
TServerSupportFunctionProc = function ( hConn: HCONN;
HSERRequest: Longword;
Buffer: Pointer;
Size:Pointer{LPDWord};
DataType: Pointer{LPDWord} ): BOOLEAN stdcall;
//
// passed to extension procedure on a new request
//
type
PEXTENSION_CONTROL_BLOCK = ^TEXTENSION_CONTROL_BLOCK;
TEXTENSION_CONTROL_BLOCK = packed record
cbSize: Longword; // size of this struct.
dwVersion: Longword; // version info of this spec
ConnID: HCONN; // Context number not to be modified!
dwHttpStatusCode: Longword; // HTTP Status code
// null terminated log info specific to this Extension DLL
lpszLogData: array [0..HSE_LOG_BUFFER_LEN-1] of Char;
lpszMethod: PChar; // REQUEST_METHOD
lpszQueryString: PChar; // QUERY_STRING
lpszPathInfo: PChar; // PATH_INFO
lpszPathTranslated: PChar; // PATH_TRANSLATED
cbTotalBytes: Longword; // Total bytes indicated from client
cbAvailable: Longword; // Available number of bytes
lpbData: Pointer; // pointer to cbAvailable bytes
lpszContentType: PChar; // Content type of client data
GetServerVariable: TGetServerVariableProc;
WriteClient: TWriteClientProc;
ReadClient: TReadClientProc;
ServerSupportFunction: TServerSupportFunctionProc;
end;
PHSE_VERSION_INFO = ^HSE_VERSION_INFO;
HSE_VERSION_INFO = packed record
dwExtensionVersion: Longword;
lpszExtensionDesc: array [0..HSE_MAX_EXT_DLL_NAME_LEN-1] of Char;
end;
THSE_VERSION_INFO = HSE_VERSION_INFO;
LPHSE_VERSION_INFO = PHSE_VERSION_INFO;
Type
TDX_GetServerVariable=procedure(ClientThread:TDXClientThread;Variable:String;Var Results:String) of object;
TDX_RedirectHeader=Procedure(ClientThread:TDXClientThread;Location:String;Var Header:String) of object;
TDX_BuildHeader=Procedure(dwHttpStatusCode:Integer;var Results:String) of object;
//Extension Function
TGetExtensionVersion = function (var Ver: THSE_VERSION_INFO): BOOLEAN stdcall;
THttpExtensionProc = function (var ECB: TEXTENSION_CONTROL_BLOCK): Longword stdcall;
TTerminateExtension = function (dwFlags: Longword): BOOLEAN stdcall;
TNotificationFiltersProc = Procedure (Notify:Longword; Buf1:Pointer;
sizeBuf1:Longword; Buf2:Pointer; sizeBuf2:Longword);
TDX_FilterGetServerVariable = function (var pfc: THTTP_FILTER_CONTEXT;
VariableName: PChar; Buffer: Pointer; var Size: Longword ): BOOLEAN of Object;
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// This structure is used to send certificate information to the
// ISAPI extension when the HSE_REQ_GET_CERT_INFO_EX value is set for the
// dwHSERRequest parameter of the ServerSupportFunction.
///////////////////////////////////////////////////////////////////////////////
type
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -