I had the same problem a while back when i wrote an ISAPI DLL to execute
proprietery scripts.  I ended up using the SCRIPT_NAME server variable to
find out the name of the script being called and then extract the path.

ie

/example/scriptname.jasp
or if your calling the isapi dll directly 
/example/example.dll

then i used the "HSE_REQ_MAP_URL_TO_PATH" server function to map the virtual
url to a physical path

i.e.

function mapURLToPath (const ECB : PECB; const url : string) : string;
var
  buffer  : array [0..1023] of char;
  dwLen   : DWORD;
  dwDataType : DWORD;
begin
  result := '';
  if length (url) > sizeOf (buffer) then
    exit;

  fillChar (buffer, sizeOf (buffer), 0);
  strPCopy (@buffer, url);
  dwLen := sizeOf (buffer);
  dwDataType := 0;

  if ECB.ServerSupportFunction (ECB.ConnID, HSE_REQ_MAP_URL_TO_PATH,
@buffer, @dwLen, @dwDataType) then
    result := buffer;
end;


It only works when a page is being requested.  Seemed slightly messy but it
was the only way i found.


Wilfred.


-----Original Message-----
From: C Fraser [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 11:58 AM
To: Multiple recipients of list delphi
Subject: [DUG]: Some ISAPI Questions...


Hi all,

I just have some questions on building ISAPI dlls.

First... I want to find the dir where my dll is running.  The
PathTranslated seems to return wrong information. From the documentation
it looks like PathTranslated is what I want, but it doesn't work as
expected. 

On the web server machine I have a Home directory as D:\Inetpub\wwwroot
(not to sure what a home directory exactly means). I also have a virtual
directory /Test which points to D:\InetPub\Test. My ISAPI ISAPITest.dll
is located in D:\InetPub\Test\Scripts.  

>From a web browser, I can go
computername/Test/Scripts/ISAPITest.dll/Test and I get a path translated
D:\Inetpub\Test which is correct, all fine and dandy.

Then I go computername/Test/Scripts/ISAPITest.dll/Test2 and I get a path
translated D:\Inetpub\wwwroot\Test2. 

So it seems if my URL path matches my directory path all seems to work.
If my URL path does not match (which will usually be the case) I get the
home directory coming in.

To summarise... I am a bit confused! I just want to get the path to my
dll in code so I can use this in the generated html scripts to make it
easier to move the dll from server to server, directory to directory...

I have other questions... But I shall try and solve this one first.

Any help appreciated.

Regards
Colin


######################################################################
Attention:
The information in this email and in any attachments is confidential.  
If you are not the intended recipient then please do not distribute, 
copy or use this information. Please notify us immediately by return 
email and then delete the message from your computer.
Any views or opinions presented are solely those of the author.
######################################################################
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

This e-mail message has been scanned and cleared by MailMarshal 
http://www.gen-i.co.nz

This e-mail message has been scanned and cleared by MailMarshal 
http://www.gen-i.co.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to