I need to call the windows api :
BOOL WINAPI * ServerSupportFunction(
_In_ struct _HTTP_FILTER_CONTEXT *pfc,
_In_ enum SF_REQ_TYPE sfReq,
_In_ PVOID pData,
_In_ DWORD ul1,
DWORD ul2
);
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ff827495(v=vs.85)
That is translated in delphi like:
function (
var pfc{: THTTP_FILTER_CONTEXT};
sfReq: DWORD;
pData: Pointer;
ul1, ul2: DWORD): BOOL; stdcall;
The winApi doc say that UL1 (DWORD) must Points to an optional null-terminated string that contains the headers to add. So I naively try like this (delphi code) :
Var LUrl: ansiString;
LUrl := 'Location: https://myserver'+#13#10#13#10
pfc.ServerSupportFunction(
pfc, // var pfc{: THTTP_FILTER_CONTEXT};
SF_REQ_SEND_RESPONSE_HEADER, // sfReq: DWORD
PANSIchar('307 Temporary Redirect'), // pData: Pointer
Dword(@LUrl[1]), // ul1: DWORD
0);
but this miserably fail with access violation. But as I m on 64 bit, I don't understand how Dword(@LUrl[1])
will even work as @ return 64 bit address
So how I can do ? Is their a way to force a pointer to stay in 32 bit space so that I can convert it to DWORD ? Or I simply miss something ?