-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdll.c
69 lines (56 loc) · 1.54 KB
/
dll.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
*
* Copyright (c) 1997, 1998 Timpanogas Research Group, Inc. All Rights
* Reserved.
*
* AUTHOR : Jeff V. Merkey
* FILE : DLL.C
* DESCRIP : Microsoft DLL Explicit Loader for MANOS v1.0
* DATE : February 24, 1998
*
***************************************************************************/
#include "stdarg.h"
#include "stdio.h"
#include "stdlib.h"
#include "ctype.h"
#include "string.h"
#include "kernel.h"
#include "keyboard.h"
#include "screen.h"
#include "types.h"
#include "emit.h"
#include "dos.h"
#include "tss.h"
#include "os.h"
#include "mps.h"
#include "hal.h"
#include "timer.h"
#include "dosfile.h"
#include "peexe.h"
#include "extrnvar.h"
#include "line.h"
#include "loader.h"
#include "exports.h"
extern LONG ImportExportedAddress(BYTE *name, BYTE *moduleName,
MODULE_HANDLE **module, EXPORT **export);
extern LONG LoadFile(BYTE *filename, MODULE_HANDLE **newModule);
MODULE_HANDLE *LoadLibrary(BYTE *name)
{
register LONG retCode;
MODULE_HANDLE *module = 0;
retCode = LoadFile(name, &module);
if (retCode)
module = 0;
return module;
}
LONG GetProcAddress(MODULE_HANDLE *module, BYTE *function)
{
MODULE_HANDLE *newModule;
EXPORT *export;
register LONG retCode;
retCode = ImportExportedAddress(function, module->ModuleShortName,
&newModule, &export);
if (retCode == (LONG) -1)
retCode = 0;
return retCode;
}