Solved

ISAPI Dll path

Posted on 2002-07-02
3
1,009 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 100 total points
ID: 7126236
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
ID: 7126283
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
ID: 7129160
Thanks both of you, that works great.

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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