home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
ENUMP2.ZIP
/
TEST.C
< prev
Wrap
C/C++ Source or Header
|
1988-05-30
|
1KB
|
51 lines
/* test.c -- tester for enumproc.c */
/* enumerates exported procs from OS/2 or Windows DLL file */
/* Andrew Schulman 28-May-1988 */
#include <stdio.h>
#include <string.h>
#include "doscalls.h"
char *enumproc(char *dll, char *buf, unsigned *ord);
main(int argc, char *argv[])
{
char buf[256]; /* must be large enough to accept proc name */
char filename[128];
unsigned ord;
if (argc < 2)
{
printf("ENUMPROC <module name>\n");
return 1;
}
strcpy(filename, argv[1]);
/* if they didn't pass in full filename, try to get it for them */
if (! strchr(filename, '.'))
{
unsigned handle;
if (DOSGETMODHANDLE(argv[1], &handle))
{ printf("Can't locate %s\n", argv[1]); return 1; }
else
{
if (DOSGETMODNAME(handle, sizeof(filename), filename))
{ printf("Can't locate %s\n", argv[1]); return 1; }
else
puts(filename);
}
}
if (enumproc(filename, buf, &ord))
{
/* first entry is just module name, ordinal number zero */
printf("Module: %s\n", buf);
while (enumproc(0, buf, &ord))
printf("%s (#%u)\n", buf, ord);
}
return 0;
}