3 This file is part of the Free Pascal run time library
.
4 Copyright (c
) 1999-2000 by Pierre Muller
,
5 member of the Free Pascal development team
.
7 Unit to Load DXE files
for Go32V2
9 See the file COPYING
.FPC
, included
in this distribution
,
10 for details about the copyright
.
12 This program is distributed
in the hope that it will be useful
,
13 but WITHOUT ANY WARRANTY
; without even the implied warranty of
14 MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE
.
16 **********************************************************************
24 DXE_MAGIC
= $31455844;
33 function
dxe_load(filename
: string
) : pointer
;
37 function
dxe_load(filename
: string
) : pointer
;
39 Copyright (C
) 1995 Charles
Sandmann (sandmann
@clio.rice
.edu
)
40 translated to Free Pascal by Pierre Muller
43 { to avoid range check problems
}
44 pointer_array
= array
[0..maxlongint
] of pointer
;
47 pcardinal
= ^cardinal
;
63 { quit
if no file
!! }
67 blockread(f
,dh
,sizeof(dxe_header
),i
);
68 if (i
<>sizeof(dxe_header
)) or (dh
.magic
<>DXE_MAGIC
) then
73 { get memory
for code
}
74 getmem(data,dh
.element_size
);
77 { get memory
for relocations
}
78 getmem(relocs
,dh
.nrelocs
*sizeof(pointer
));
81 freemem(data,dh
.element_size
);
85 blockread(f
,data^
,dh
.element_size
);
86 blockread(f
,relocs^
,dh
.nrelocs
*sizeof(pointer
));
88 { relocate internal references
}
89 for i
:=0 to dh
.nrelocs-1
do
91 cardinal(addr
):=cardinal(data)+cardinal(relocs^
[i
]);
92 addr^
:=addr^
+cardinal(data);
94 dxe_load
:=pointer( dh
.symbol_offset
+ cardinal(data));
100 Revision
1.1 2002/02/19 08:25:08 sasu
103 Revision
1.1.2.1 2000/12/10 23:03:31 pierre
104 * avoid the longint
+ cardinal to int64 conversion
106 Revision
1.1 2000/07/13 06:30:37 michael
109 Revision
1.5 2000/05/29 05:32:50 jonas
110 * should compile again
112 Revision
1.4 2000/02/09 16:59:28 peter
115 Revision
1.3 2000/01/07 16:41:31 daniel
118 Revision
1.2 2000/01/07 16:32:23 daniel
119 * copyright
2000 added