jwh@bodwin.ifs.umich.edu (Jim Howe) (05/22/91)
I am doing some work with Smalltalk V/PM. In order to access functions in DLL's it is often necessary to know the ordinal number of a function as well as which library the function is located in. Is there a utility available which will list the contents of a .LIB file showing the ordinal number of each function and the DLL where the function is found? I was able to find some information by looking at a .LIB file with a hex editor but it would be easier if there was a way to simply dump the information. The listing I get from the LIB utility is insufficient. If there isn't a utility available does anyone know the format of .LIB files? James W. Howe internet: jwh@citi.umich.edu University of Michigan uucp: uunet!mailrus!citi.umich.edu!jwh Ann Arbor, MI 48103-4943
vkessler@ncratl.AtlantaGA.NCR.COM (Vance Kessler) (05/23/91)
You can use the LIB.EXE program to get the numbers you want. You need to determine which LIB goes with the DLL you want to get the ordinal numbers for. Then you simply execute LIB with that library and when asked for operations press return and then give a file name for the list file. Examine this list file and you will see a list of all functions in the library followed by another list of these functions with offsets and sizes. The position of the functions in the second list is the ordinal number. Hope that helps, Vance Kessler
gerry@dialogic.com (Gerry Lachac) (05/23/91)
In article <1991May22.154137.7871@terminator.cc.umich.edu> jwh@bodwin.ifs.umich.edu (Jim Howe) writes: >and the DLL where the function is found? I was able to find >some information by looking at a .LIB file with a hex editor but What can't you get from looking at the .DLL? The format as I understand it from looking at DLL's with a hex editor is: Function_name Ordinal_value Null Some_other_unknown_hex_value That's how I understand it from reverse engineering some of the DLL's I've written. Of course I could be wrong, but that's the way it seems to work out for me... -gerry -- uunet!dialogic!gerry | "Even a dead plant turns | Dialogic Corporation OR | over a new leaf | 300 Littleton Rd gerry@dialogic.UUCP | when the wind blows." | Parsippany, NJ 07054 | | (201)334-8450
towfiq@FTP.COM (Mark Towfiq) (05/25/91)
>>>>> On 22 May 91 15:41:37 GMT, jwh@bodwin.ifs.umich.edu (Jim Howe) said:
Jim> Is there a utility available which will list the contents of a
Jim> .LIB file showing the ordinal number of each function and the DLL
Jim> where the function is found?
Two things: 1) why do you feel you need the ordinal number, instead of
just the name? (I have only found a very limited set of cases where
this is true.) 2) I would recommend using the EXEHDR utility, which
is bundled with both Microsoft C 6.0 and the PM SDK. Then you just
type "exehdr <dllname>" and get a listing of all kinds of relevent
information. Alternatively, you can use the information provided in
the <exehdr.h> header file to read in the DLL yourself.
Hope this helps,
Mark
--
Mark Towfiq towfiq@FTP.COM
Work: +1 617 246 0900 Home: +1 617 488 2818
FTP Software, Wakefield, MA 51 Harvard Avenue, West Medford, MA 02155
"The Earth is but One Country, and Mankind its Citizens" -- Baha'u'llah
jwh@bodwin.citi.umich.edu (Jim Howe) (05/28/91)
In article <TOWFIQ.91May24142256@babyoil.FTP.COM> towfiq@FTP.COM writes: >>>>>> On 22 May 91 15:41:37 GMT, jwh@bodwin.ifs.umich.edu (Jim Howe) said: > >Jim> Is there a utility available which will list the contents of a >Jim> .LIB file showing the ordinal number of each function and the DLL >Jim> where the function is found? > >Two things: 1) why do you feel you need the ordinal number, instead of >just the name? (I have only found a very limited set of cases where >this is true.) 2) I would recommend using the EXEHDR utility, which >is bundled with both Microsoft C 6.0 and the PM SDK. Then you just >type "exehdr <dllname>" and get a listing of all kinds of relevent >information. Alternatively, you can use the information provided in >the <exehdr.h> header file to read in the DLL yourself. > I am programming with Smalltalk V/PM. In order to access certain functions (mostly in DOSCALLS) the ordinal number is needed to access the function. The EXEHDR utility is not helpful for this problem. There are only a handful of functions whose names appear in the DLL. I've managed to use a hex editor on the os2.lib file and figure out where to get the ordinal number for a function. What I haven't been able to easily figure out is what the best way would be to dump the ordinal information from the os2.lib file into an easily read format. Someone has mentioned that the second part of a lib listing shows the functions in ordinal order. As long as there aren't any gaps in the assignment of ordinal numbers examining this list with an editor that shows line numbers would be one way to go. You mention a file called 'exehdr.h'. I have both the IBM PM Toolkit as well as the Microsoft toolkit (version 1.2 for both). I haven't found the file you mention. Where would I find this file? James W. Howe internet: jwh@citi.umich.edu University of Michigan uucp: uunet!mailrus!citi.umich.edu!jwh Ann Arbor, MI 48103-4943
towfiq@FTP.COM (Mark Towfiq) (05/29/91)
>>>>> On 28 May 91 13:41:07 GMT, jwh@bodwin.citi.umich.edu (Jim Howe) said:
Jim> I am programming with Smalltalk V/PM. In order to access certain
Jim> functions (mostly in DOSCALLS) the ordinal number is needed to
Jim> access the function. The EXEHDR utility is not helpful for this
Jim> problem. There are only a handful of functions whose names appear
Jim> in the DLL.
Aha! I now see what you are talking about!
Jim> I've managed to use a hex editor on the os2.lib file and figure
Jim> out where to get the ordinal number for a function. What I
Jim> haven't been able to easily figure out is what the best way would
Jim> be to dump the ordinal information from the os2.lib file into an
Jim> easily read format.
Well, I figured out a klugey kind of way, but it works!
Jim> Someone has mentioned that the second part of a lib listing shows
Jim> the functions in ordinal order.
I'm not sure that's true.
Jim> As long as there aren't any gaps in the assignment of ordinal
Jim> numbers examining this list with an editor that shows line
Jim> numbers would be one way to go.
I wouldn't rely on that method, though. Here's what I did (it took a
few minutes):
1) created a file os2.lis from os2.lib using the LIB utility
2) using an Epsilon editor macro, for just the first set of routines
(which, by inspection of os2.lib, are the ones which reside in
DOSCALLS), I created matching C definitions and calls of the type
extern PASCAL FAR DOSCLOSE();
.
.
.
DOSCLOSE();
3) I put a main() and some other calls around these 400-odd DOS calls,
and then compiled and linked with the /MAP directive, producing a map
file, the important part of which I include below:
Address Publics by Name
0000:0000 Imp DBGETKVAR (DOSCALLS.109)
0000:0000 Imp DBGETOWNER (DOSCALLS.117)
0000:0000 Imp DBMEMFREE (DOSCALLS.116)
0000:0000 Imp DBMEMLOCK (DOSCALLS.112)
0000:0000 Imp DBMEMREALLOC (DOSCALLS.115)
0000:0000 Imp DBMEMUNLOCK (DOSCALLS.113)
0000:0000 Imp DBPHYSINFO (DOSCALLS.118)
0000:0000 Imp DBSEGALLOC (DOSCALLS.114)
0000:0000 Imp DOSALLOCHUGE (DOSCALLS.40)
0000:0000 Imp DOSALLOCSEG (DOSCALLS.34)
0000:0000 Imp DOSALLOCSHRSEG (DOSCALLS.35)
0000:0000 Imp DOSBEEP (DOSCALLS.50)
0000:0000 Imp DOSBUFRESET (DOSCALLS.56)
0000:0000 Imp DOSCALLBACK (DOSCALLS.157)
0000:0000 Imp DOSCHDIR (DOSCALLS.57)
0000:0000 Imp DOSCHGFILEPTR (DOSCALLS.58)
0000:0000 Imp DOSCLIACCESS (DOSCALLS.51)
0000:0000 Imp DOSCLOSE (DOSCALLS.59)
0000:0000 Imp DOSCLOSESEM (DOSCALLS.23)
0000:0000 Imp DOSCOPY (DOSCALLS.201)
0000:0000 Imp DOSCREATECSALIAS (DOSCALLS.43)
0000:0000 Imp DOSCREATESEM (DOSCALLS.24)
0000:0000 Imp DOSCREATETHREAD (DOSCALLS.145)
0000:0000 Imp DOSCWAIT (DOSCALLS.2)
0000:0000 Imp DOSDELETE (DOSCALLS.60)
0000:0000 Imp DOSDEVCONFIG (DOSCALLS.52)
0000:0000 Imp DOSDEVIOCTL (DOSCALLS.53)
0000:0000 Imp DOSDEVIOCTL2 (DOSCALLS.99)
0000:0000 Imp DOSDUPHANDLE (DOSCALLS.61)
0000:0000 Imp DOSDYNAMICTRACE (DOSCALLS.165)
0000:0000 Imp DOSEDITNAME (DOSCALLS.191)
0000:0000 Imp DOSENTERCRITSEC (DOSCALLS.3)
0000:0000 Imp DOSENUMATTRIBUTE (DOSCALLS.204)
0000:0000 Imp DOSERRCLASS (DOSCALLS.139)
0000:0000 Imp DOSERROR (DOSCALLS.120)
0000:0000 Imp DOSEXECPGM (DOSCALLS.144)
0000:0000 Imp DOSEXIT (DOSCALLS.5)
0000:0000 Imp DOSEXITCRITSEC (DOSCALLS.6)
0000:0000 Imp DOSEXITLIST (DOSCALLS.7)
0000:0000 Imp DOSFILEIO (DOSCALLS.186)
0000:0000 Imp DOSFILELOCKS (DOSCALLS.62)
0000:0000 Imp DOSFINDCLOSE (DOSCALLS.63)
0000:0000 Imp DOSFINDFIRST (DOSCALLS.64)
0000:0000 Imp DOSFINDFIRST2 (DOSCALLS.184)
0000:0000 Imp DOSFINDFROMNAME (DOSCALLS.197)
0000:0000 Imp DOSFINDNEXT (DOSCALLS.65)
0000:0000 Imp DOSFINDNOTIFYCLOSE (DOSCALLS.187)
0000:0000 Imp DOSFINDNOTIFYFIRST (DOSCALLS.188)
0000:0000 Imp DOSFINDNOTIFYNEXT (DOSCALLS.189)
0000:0000 Imp DOSFLAGPROCESS (DOSCALLS.15)
0000:0000 Imp DOSFREEMODULE (DOSCALLS.46)
0000:0000 Imp DOSFREERESOURCE (DOSCALLS.208)
0000:0000 Imp DOSFREESEG (DOSCALLS.39)
0000:0000 Imp DOSFSATTACH (DOSCALLS.181)
0000:0000 Imp DOSFSCTL (DOSCALLS.183)
0000:0000 Imp DOSFSRAMSEMCLEAR (DOSCALLS.162)
0000:0000 Imp DOSFSRAMSEMREQUEST (DOSCALLS.161)
0000:0000 Imp DOSGETCP (DOSCALLS.130)
0000:0000 Imp DOSGETDATETIME (DOSCALLS.33)
0000:0000 Imp DOSGETENV (DOSCALLS.91)
0000:0000 Imp DOSGETHUGESHIFT (DOSCALLS.41)
0000:0000 Imp DOSGETINFOSEG (DOSCALLS.8)
0000:0000 Imp DOSGETLOGBUFFER (DOSCALLS.194)
0000:0000 Imp DOSGETMACHINEMODE (DOSCALLS.49)
0000:0000 Imp DOSGETMODHANDLE (DOSCALLS.47)
0000:0000 Imp DOSGETMODNAME (DOSCALLS.48)
0000:0000 Imp DOSGETPID (DOSCALLS.94)
0000:0000 Imp DOSGETPPID (DOSCALLS.156)
0000:0000 Imp DOSGETPROCADDR (DOSCALLS.45)
0000:0000 Imp DOSGETPRTY (DOSCALLS.9)
0000:0000 Imp DOSGETRESOURCE (DOSCALLS.155)
0000:0000 Imp DOSGETRESOURCE2 (DOSCALLS.207)
0000:0000 Imp DOSGETSEG (DOSCALLS.121)
0000:0000 Imp DOSGETSHRSEG (DOSCALLS.36)
0000:0000 Imp DOSGETSTDA (DOSCALLS.119)
0000:0000 Imp DOSGETVERSION (DOSCALLS.92)
0000:0000 Imp DOSGIVESEG (DOSCALLS.37)
0000:0000 Imp DOSGLOBALSEG (DOSCALLS.132)
0000:0000 Imp DOSHOLDSIGNAL (DOSCALLS.13)
0000:0000 Imp DOSHUGEINCR (DOSCALLS.136)
0000:0000 Imp DOSHUGESHIFT (DOSCALLS.135)
0000:0000 Imp DOSICALLBACK (DOSCALLS.158)
0000:0000 Imp DOSICALLNMPIPE (DOSCALLS.168)
0000:0000 Imp DOSICANONICALIZE (DOSCALLS.100)
0000:0000 Imp DOSICONNECTNMPIPE (DOSCALLS.169)
0000:0000 Imp DOSICOPY (DOSCALLS.200)
0000:0000 Imp DOSICREATETHREAD (DOSCALLS.1)
0000:0000 Imp DOSIDISCONNECTNMPIPE (DOSCALLS.170)
0000:0000 Imp DOSIEXECPGM (DOSCALLS.4)
0000:0000 Imp DOSIMAKENMPIPE (DOSCALLS.167)
0000:0000 Imp DOSIPEEKNMPIPE (DOSCALLS.171)
0000:0000 Imp DOSIQAPPTYPE (DOSCALLS.202)
0000:0000 Imp DOSIQNMPHANDSTATE (DOSCALLS.173)
0000:0000 Imp DOSIQNMPIPEINFO (DOSCALLS.172)
0000:0000 Imp DOSIQNMPIPESEMSTATE (DOSCALLS.178)
0000:0000 Imp DOSIRAMSEMREQUEST (DOSCALLS.128)
0000:0000 Imp DOSIRAMSEMWAKE (DOSCALLS.125)
0000:0000 Imp DOSIRAWREADNMPIPE (DOSCALLS.179)
0000:0000 Imp DOSIRAWWRITENMPIPE (DOSCALLS.180)
0000:0000 Imp DOSIREAD (DOSCALLS.79)
0000:0000 Imp DOSISEMREQUEST (DOSCALLS.18)
0000:0000 Imp DOSISEMWAIT (DOSCALLS.21)
0000:0000 Imp DOSISETCP (DOSCALLS.131)
0000:0000 Imp DOSISETNMPHANDSTATE (DOSCALLS.174)
0000:0000 Imp DOSISETNMPIPESEM (DOSCALLS.177)
0000:0000 Imp DOSISYSSEMCLEAR (DOSCALLS.17)
0000:0000 Imp DOSISYSSEMSET (DOSCALLS.19)
0000:0000 Imp DOSITRANSACTNMPIPE (DOSCALLS.175)
0000:0000 Imp DOSIWAITNMPIPE (DOSCALLS.176)
0000:0000 Imp DOSIWRITE (DOSCALLS.87)
0000:0000 Imp DOSKILLPROCESS (DOSCALLS.10)
0000:0000 Imp DOSLIBINIT (DOSCALLS.96)
0000:0000 Imp DOSLOADMODULE (DOSCALLS.44)
0000:0000 Imp DOSLOCKSEG (DOSCALLS.122)
0000:0000 Imp DOSLOGENTRY (DOSCALLS.193)
0000:0000 Imp DOSLOGMODE (DOSCALLS.192)
0000:0000 Imp DOSLOGREAD (DOSCALLS.196)
0000:0000 Imp DOSLOGREGISTER (DOSCALLS.195)
0000:0000 Imp DOSMAKEPIPE (DOSCALLS.16)
0000:0000 Imp DOSMEMAVAIL (DOSCALLS.127)
0000:0000 Imp DOSMKDIR (DOSCALLS.66)
0000:0000 Imp DOSMKDIR2 (DOSCALLS.185)
0000:0000 Imp DOSMOVE (DOSCALLS.67)
0000:0000 Imp DOSMUXSEMWAIT (DOSCALLS.22)
0000:0000 Imp DOSNEWSIZE (DOSCALLS.68)
0000:0000 Imp DOSOPEN (DOSCALLS.70)
0000:0000 Imp DOSOPEN2 (DOSCALLS.95)
0000:0000 Imp DOSOPENSEM (DOSCALLS.25)
0000:0000 Imp DOSOPLOCKRELEASE (DOSCALLS.198)
0000:0000 Imp DOSOPLOCKSHUTDOWN (DOSCALLS.205)
0000:0000 Imp DOSOPLOCKWAIT (DOSCALLS.199)
0000:0000 Imp DOSPHYSICALDISK (DOSCALLS.129)
0000:0000 Imp DOSPORTACCESS (DOSCALLS.69)
0000:0000 Imp DOSPROFILE (DOSCALLS.133)
0000:0000 Imp DOSPTRACE (DOSCALLS.12)
0000:0000 Imp DOSQAPPTYPE (DOSCALLS.163)
0000:0000 Imp DOSQCURDIR (DOSCALLS.71)
0000:0000 Imp DOSQCURDISK (DOSCALLS.72)
0000:0000 Imp DOSQFHANDSTATE (DOSCALLS.73)
0000:0000 Imp DOSQFILEINFO (DOSCALLS.74)
0000:0000 Imp DOSQFILEMODE (DOSCALLS.75)
0000:0000 Imp DOSQFSATTACH (DOSCALLS.182)
0000:0000 Imp DOSQFSINFO (DOSCALLS.76)
0000:0000 Imp DOSQHANDTYPE (DOSCALLS.77)
0000:0000 Imp DOSQPATHINFO (DOSCALLS.98)
0000:0000 Imp DOSQPROCSTATUS (DOSCALLS.154)
0000:0000 Imp DOSQSYSINFO (DOSCALLS.166)
0000:0000 Imp DOSQTRACEINFO (DOSCALLS.93)
0000:0000 Imp DOSQVERIFY (DOSCALLS.78)
0000:0000 Imp DOSR2STACKREALLOC (DOSCALLS.160)
0000:0000 Imp DOSREAD (DOSCALLS.137)
0000:0000 Imp DOSREADASYNC (DOSCALLS.149)
0000:0000 Imp DOSREADPHYS (DOSCALLS.103)
0000:0000 Imp DOSREALLOCHUGE (DOSCALLS.42)
0000:0000 Imp DOSREALLOCSEG (DOSCALLS.38)
0000:0000 Imp DOSRESUMETHREAD (DOSCALLS.26)
0000:0000 Imp DOSRETFORWARD (DOSCALLS.159)
0000:0000 Imp DOSRMDIR (DOSCALLS.80)
0000:0000 Imp DOSSCANENV (DOSCALLS.152)
0000:0000 Imp DOSSEARCHPATH (DOSCALLS.151)
0000:0000 Imp DOSSELECTDISK (DOSCALLS.81)
0000:0000 Imp DOSSEMCLEAR (DOSCALLS.141)
0000:0000 Imp DOSSEMREQUEST (DOSCALLS.140)
0000:0000 Imp DOSSEMSET (DOSCALLS.143)
0000:0000 Imp DOSSEMSETWAIT (DOSCALLS.20)
0000:0000 Imp DOSSEMWAIT (DOSCALLS.142)
0000:0000 Imp DOSSENDSIGNAL (DOSCALLS.134)
0000:0000 Imp DOSSETCP (DOSCALLS.153)
0000:0000 Imp DOSSETDATETIME (DOSCALLS.28)
0000:0000 Imp DOSSETFGND (DOSCALLS.101)
0000:0000 Imp DOSSETFHANDSTATE (DOSCALLS.82)
0000:0000 Imp DOSSETFILEINFO (DOSCALLS.83)
0000:0000 Imp DOSSETFILEMODE (DOSCALLS.84)
0000:0000 Imp DOSSETFSINFO (DOSCALLS.97)
0000:0000 Imp DOSSETMAXFH (DOSCALLS.85)
0000:0000 Imp DOSSETPATHINFO (DOSCALLS.104)
0000:0000 Imp DOSSETPROCCP (DOSCALLS.164)
0000:0000 Imp DOSSETPRTY (DOSCALLS.11)
0000:0000 Imp DOSSETSIGHANDLER (DOSCALLS.14)
0000:0000 Imp DOSSETTRACEINFO (DOSCALLS.190)
0000:0000 Imp DOSSETVEC (DOSCALLS.89)
0000:0000 Imp DOSSETVERIFY (DOSCALLS.86)
0000:0000 Imp DOSSGSWITCH (DOSCALLS.54)
0000:0000 Imp DOSSGSWITCHME (DOSCALLS.55)
0000:0000 Imp DOSSGSWITCHPROC (DOSCALLS.124)
0000:0000 Imp DOSSGSWITCHPROC2 (DOSCALLS.105)
0000:0000 Imp DOSSHUTDOWN (DOSCALLS.206)
0000:0000 Imp DOSSIZESEG (DOSCALLS.126)
0000:0000 Imp DOSSLEEP (DOSCALLS.32)
0000:0000 Imp DOSSUBALLOC (DOSCALLS.147)
0000:0000 Imp DOSSUBFREE (DOSCALLS.148)
0000:0000 Imp DOSSUBSET (DOSCALLS.146)
0000:0000 Imp DOSSUSPENDTHREAD (DOSCALLS.27)
0000:0000 Imp DOSSWAPTASKINIT (DOSCALLS.102)
0000:0000 Imp DOSSYSTEMSERVICE (DOSCALLS.88)
0000:0000 Imp DOSSYSTRACE (DOSCALLS.90)
0000:0000 Imp DOSTIMERASYNC (DOSCALLS.29)
0000:0000 Imp DOSTIMERSTART (DOSCALLS.30)
0000:0000 Imp DOSTIMERSTOP (DOSCALLS.31)
0000:0000 Imp DOSUNLOCKSEG (DOSCALLS.123)
0000:0000 Imp DOSWRITE (DOSCALLS.138)
0000:0000 Imp DOSWRITEASYNC (DOSCALLS.150)
0000:0000 Imp GETADDR (DOSCALLS.111)
0000:0000 Imp GETHEADERS (DOSCALLS.108)
0000:0000 Imp GETSELADDR (DOSCALLS.110)
0000:0000 Imp STRUCHECK (DOSCALLS.106)
0000:0000 Imp STRURESUPDATE (DOSCALLS.107)
That should be a good crack at a list, at least.
Jim> You mention a file called 'exehdr.h'. I have both the IBM PM Toolkit
Jim> as well as the Microsoft toolkit (version 1.2 for both). I haven't
Jim> found the file you mention. Where would I find this file?
I got it from Microsoft Online.
--
Mark Towfiq towfiq@FTP.COM
Work: +1 617 246 0900 Home: +1 617 488 2818
FTP Software, Wakefield, MA 51 Harvard Avenue, West Medford, MA 02155
"The Earth is but One Country, and Mankind its Citizens" -- Baha'u'llah