Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I get the DLL name?

Posted on 1998-01-06
2
Medium Priority
?
768 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 400 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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Screencast - Getting to Know the Pipeline

783 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