Solved

ISAPI Dll path

Posted on 2002-07-02
3
996 Views
Last Modified: 2012-06-27
How can I get the path to an ISAPI dll?

With a CGI You can get the path using ExtractFilePath(ParamStr(0)) which returns something like : c:\inetpub\wwwroot\cgi-bin\ ie the location of the cgi executable

Using the same within an ISAPI dll returns C:\WINNT\System32\ ie not the location of the dll.
0
Comment
Question by:StevenB
3 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 100 total points
Comment Utility
ParamStr(0) returns the file name of the executable used to create the current process. That means that when called from a DLL you get the file name of the .exe that loaded the DLL not the file name of the DLL itself.

Instead you can use GetModuleFileName API:

function GetThisModuleFileName: string;
var
  Buf: array[0..MAX_PATH + 1] of Char;
begin
  SetString(Result, Buf, GetModuleFileName(HInstance, Buf, SizeOf(Buf)));
end;

HTH
TOndrej
0
 
LVL 3

Expert Comment

by:rondi
Comment Utility
function GetModulePath: string;
const
  ModNamelen = MAX_PATH * 2 + 1;
var
  ModName: PChar;
  fname: string;
begin
  ModName := StrAlloc(ModNameLen);
  GetModuleFileName(HInstance,ModName,ModNameLen);
  Result := ExtractFilePath(StrPas(ModName));
  StrDispose(ModName);
end;
0
 
LVL 4

Author Comment

by:StevenB
Comment Utility
Thanks both of you, that works great.

sorry rondi, TOndrej just beat you to it :o)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now