Your ISAPI application is a library (DLL), therefore you can use this approach to get its folder:
ExtractFilePath(GetModuleName(HInstance))
Use ExtractFileDir()
instead of ExtractFilePath()
if you don't need the last backslash.
Rationale: According to Delphi docs,
Several variables declared in the System unit are of special interest to those programming libraries. ... During a library's lifetime, HInstance contains its instance handle.
Using GetModuleName() you get that DLL's file name. ParamStr(0), on the other hand, contains the name of the main EXE where this DLL has been loaded to.