hello heathprovost, I don't think that IsMultithread needs to be set to anything, you can read it to see if there has been another thread created. I also think that a static array like
myBuffer: array [0..MAX_BUFFER] of char;
will be faster, and less cpu time, because array size does not need to be allocated. If you are a performance freak then you should look at the API QueryPerformanceCounter to get real small time measurements.
var
PerFreq, PerCount2, PerCount3: Int64;
if not QueryPerformanceFrequency(
PerFreq := 0;
{QueryPerformanceFrequency
this PerformanceCounter ticks, it can be above a million ticks
per second}
QueryPerformanceCounter(Pe
//test code goes here
buffSize := MAX_BUFFER;
setLength(myBuffer, buffSize);
GetApiProc(pchar(myBuffer)
//do something with myBuffer
uniquestring(buffSize);
SetApiProc(pchar(myBuffer)
{the PerformanceCounter is a very fast high-resolution counter
which can be used to find out the amount of time between 2 calls
to QueryPerformanceCounter( )}
QueryPerformanceCounter(Pe
Time := Int2Str(((PerCount3-PerCou
Insert('.',Time,Length(Tim
TextOut(FormDC,6,ScrolRect
{this will show the milliseconds between the PerCount2 and PerCount3}
Main Topics
Browse All Topics





by: heathprovostPosted on 2002-06-24 at 18:34:11ID: 7106262
Here is the source code for my filter if it helps... The ISAPIFilter.pas file is just type declarations and stuff, this is all the code.
,HTTP_FILT ER_MAJOR); sc, C_FILTER_DESC);
S;
S(pvNotifi cation^); ATION; ATION;
library hhrfilter;
uses
SysUtils,
Windows,
ISAPIFilters;
const
C_BETA : pchar = 'beta'#0;
C_STAGE : pchar = 'stage'#0;
C_URLHEADER : pchar = 'url'#0;
C_SERVER_NAME = 'SERVER_NAME';
C_REMOTE_ADDR = 'REMOTE_ADDR';
C_FILTER_DESC = 'TGG Host Redirect Filter, v1.0';
C_MAX_URL_LEN = 4096;
function GetFilterVersion(var pVer : HTTP_FILTER_VERSION) : BOOL; export; stdcall;
begin
try
pVer.dwFilterVersion := makelong(HTTP_FILTER_MINOR
pVer.dwFlags := ( SF_NOTIFY_NONSECURE_PORT
or SF_NOTIFY_PREPROC_HEADERS
or SF_NOTIFY_ORDER_DEFAULT
);
StrPCopy(pVer.lpszFilterDe
result := True;
except
result := False;
end;
end;
function HttpFilterProc( var pfc : HTTP_FILTER_CONTEXT;
NotificationType : DWORD;
pvNotification : LPVOID)
: DWORD; export; stdcall;
var
pHeaders : HTTP_FILTER_PREPROC_HEADER
filterHost : string;
filterUrl : string;
returnUrl : string;
getSrvVar : TGetServerVariable;
i : Cardinal;
begin
case NotificationType of
SF_NOTIFY_PREPROC_HEADERS:
begin
try
pHeaders := HTTP_FILTER_PREPROC_HEADER
i := C_MAX_URL_LEN;
setlength(filterUrl, i);
pHeaders.GetHeader(pfc, C_URLHEADER, pchar(filterUrl), @i);
i := C_MAX_URL_LEN;
getSrvVar := pfc.GetServerVariable;
setlength(filterHost, i);
GetSrvVar(pfc, C_SERVER_NAME, pchar(filterHost), @i);
i := pos('.', filterHost);
if i <> 0 then
begin
returnUrl := '/' + copy(filterHost, 1, i - 1) + filterUrl;
uniquestring(returnUrl);
pHeaders.SetHeader(pfc, C_URLHEADER, pchar(returnUrl));
end;
result := SF_STATUS_REQ_NEXT_NOTIFIC
except
result := SF_STATUS_REQ_ERROR;
end;
end;
else
result := SF_STATUS_REQ_NEXT_NOTIFIC
end;
end;
exports
HttpFilterProc,
GetFilterVersion;
begin
IsMultiThread := true;
end.