2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: DOS function LoadSeg()
11 #include <dos/dosextens.h>
12 #include <proto/dos.h>
13 #include <aros/debug.h>
14 #include "dos_intern.h"
16 /*****************************************************************************
19 #include <proto/dos.h>
21 AROS_LH1(BPTR
, LoadSeg
,
24 AROS_LHA(CONST_STRPTR
, name
, D1
),
27 struct DosLibrary
*, DOSBase
, 25, Dos
)
30 Loads an executable file into memory. Each hunk of the loadfile
31 is loaded into its own memory section and a handle on all of them
32 is returned. The segments can be freed with UnLoadSeg().
35 name - NUL terminated name of the file.
38 Handle to the loaded executable or NULL if the load failed.
39 IoErr() gives additional information in that case.
42 This function is built on top of InternalLoadSeg()
53 *****************************************************************************/
57 void (* FunctionArray
[3])();
60 FunctionArray
[0] = __AROS_GETVECADDR(DOSBase
,7); /* Read() */
61 FunctionArray
[1] = __AROS_GETVECADDR(SysBase
,33); /* AllocMem() */
62 FunctionArray
[2] = __AROS_GETVECADDR(SysBase
,35); /* FreeMem() */
65 D(bug("[LoadSeg] Opening '%s'...\n", name
));
66 file
= Open (name
, FMF_READ
);
70 D(bug("[LoadSeg] Loading '%s'...\n", name
));
72 segs
= InternalLoadSeg(file
, NULL
, (void *)FunctionArray
, NULL
);
77 bug("[LoadSeg] Failed to load '%s'\n", name
);
81 bug("[LoadSeg] Failed to open '%s'\n", name
));