Solved

How do I get the DLL name?

Posted on 1998-01-06
2
755 Views
Last Modified: 2013-12-26
Hi,
When we call a function inside a DLL we'd like to be able to get the name of the DLL itself, but DosQueryModuleName doesn't seem to support a default module handle of NULL, and requires a full path to the DLL, which we don't have. Anyone have a solution for us??

Damian Wilson.
0
Comment
Question by:rddamian
2 Comments
 

Accepted Solution

by:
Michael Schmidt earned 100 total points
ID: 1292097
Hi Damian,

The following code fragment should do what you try to accomplish.  
Note that 'DosQueryModFromEIP' is an undocumented function, which is not available before OS/2 2.1.

EIP is some valid instruction pointer value in this DLL, which you probably have to retrieve via an assembler subroutine.

You find the whole code in many DevCons (look for the exception handler sample).


Good Luck!

Michael



DEF file:

IMPORTS
    DosQueryModFromEIP=DOSCALL1.360


source file:

APIRET APIENTRY DosQueryModFromEIP( HMODULE *phMod,  // output
                                    ULONG *pObjNum,  // output
                                    ULONG BuffLen,   // input
                                    PCHAR Name,      // output
                                    ULONG *pOffset,  // output
                                    PVOID EIP );     // input


rc=DosQueryModFromEIP( &hMod, &ObjNum, CCHMAXPATH, Name,
                       &Offset, EIP);

rc=DosQueryModuleName(hMod,CCHMAXPATH, Name);

0
 

Author Comment

by:rddamian
ID: 1292098
This technique could prove invaluable in the future, thank you! Meanwhile, however, we discovered that Watcom actually provides an undocumented (or poorly documented) global copy of the DLL's module handle and module name so we used that.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASCII Non-Printable characters/codes and their HTML equivalents 6 130
EvenOdd challenge 10 125
Modbus - whats the maximum I can store in one register? 4 80
Message not shown 5 67
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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