🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17187

Re: Does a DLL know its own path?

#17187
From: Nick B. Cassos
Date: Wed, 02 Apr 2003 07:27
26 lines
1976 bytes
On Tue, 1 Apr 2003 10:12:33 -0600, "Early Ehlinger"
<early@respower.com> wrote:

>"Nick B. Cassos" <nbc@no_spam.ath.forthnet.gr> wrote:
>> I think, you should start with GetModuleFileName() to obtain the path
>> of your DLL's process. Armed with this info, you can follow Window's
>> logic to look first in the process's directory, then the current one,
>> system, windows, and anything in the PATH environment string. If there
>> are 2 or more instances of your DLL in several directories then I give
>> up.
>
>GetModuleFileName returns the fully-qualified filename, so there's no need
>to search any paths.  Simply pass this API the HINSTANCE that the OS passes
>to you in DllMain:
>

The original poster asked for the path of his own DLL and not of the
process where the DLL is attached.

According to SDK: "If a DLL is loaded in two processes, its file name
in one process may differ in case from its file name in the other
process."

-- 

Nick B. Cassos
Technical Details
Message-ID: <fv3l8v4q3fguthh808a3htirmii4lj4c0o@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e89a8e5$1@newsgroups.borland.com> <ikcj8vkkoh627qccc57je6qv2d1uruhav1@4ax.com> <3e89ba73@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9b751bad45db0bc8
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-01 23:38:25 PST
From: Nick B. Cassos <nbc@no_spam.ath.forthnet.gr>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Does a DLL know its own path?
Date: Wed, 02 Apr 2003 10:27:18 +0300
Message-ID: <fv3l8v4q3fguthh808a3htirmii4lj4c0o@4ax.com>
References: <3e89a8e5$1@newsgroups.borland.com> <ikcj8vkkoh627qccc57je6qv2d1uruhav1@4ax.com> <3e89ba73@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.16.148.25
X-Trace: newsgroups.borland.com 1049268440 213.16.148.25 (1 Apr 2003 23:27:20 -0800)
Lines: 26
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail