Solved

ISAPI Dll path

Posted on 2002-07-02
3
1,013 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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