1 | /* $Id: myldrOpen.cpp,v 1.1 1999-09-06 02:20:01 bird Exp $
|
---|
2 | *
|
---|
3 | * myldrOpen - _ldrOpen.
|
---|
4 | *
|
---|
5 | * Copyright (c) 1998-1999 knut st. osmundsen
|
---|
6 | *
|
---|
7 | */
|
---|
8 |
|
---|
9 |
|
---|
10 | /*******************************************************************************
|
---|
11 | * Defined Constants And Macros *
|
---|
12 | *******************************************************************************/
|
---|
13 | #define INCL_DOSERRORS
|
---|
14 | #define INCL_NOPMAPI
|
---|
15 |
|
---|
16 | /*******************************************************************************
|
---|
17 | * Header Files *
|
---|
18 | *******************************************************************************/
|
---|
19 | #include <os2.h>
|
---|
20 |
|
---|
21 | #include <string.h>
|
---|
22 |
|
---|
23 | #include "OS2Krnl.h"
|
---|
24 | #include "log.h"
|
---|
25 | #include "malloc.h"
|
---|
26 | #if 0
|
---|
27 | #include "lxFile.h"
|
---|
28 | #else
|
---|
29 | #define LXFile class { public: BOOL queryIsModuleName(const char *) {return FALSE;}}
|
---|
30 | #endif
|
---|
31 | #include "ldr.h"
|
---|
32 | #include "ldrCalls.h"
|
---|
33 |
|
---|
34 |
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * _ldrOpen override.
|
---|
38 | * @returns Return code.
|
---|
39 | * @param phFile Pointer to file handler. Holds filehandle on output.
|
---|
40 | * @param pszFilename Pointer to filename.
|
---|
41 | * @parma param3 Probably some flags.
|
---|
42 | */
|
---|
43 | ULONG LDRCALL myldrOpen(PSFN phFile, char *pszFilename, ULONG param3)
|
---|
44 | {
|
---|
45 | ULONG rc;
|
---|
46 | int i;
|
---|
47 |
|
---|
48 | rc = _ldrOpen(phFile, pszFilename, param3);
|
---|
49 |
|
---|
50 | if (rc == NO_ERROR)
|
---|
51 | kprintf(("_ldrOpen: phFile=%#.4x, flags=%#.8x, pszFn=%s\n", *phFile, param3, pszFilename));
|
---|
52 |
|
---|
53 | if (rc == NO_ERROR)
|
---|
54 | {
|
---|
55 | i = getFreeUncertainEntry();
|
---|
56 | if (i != -1)
|
---|
57 | {
|
---|
58 | ahUncertain[i].offsetNEHdr = 0;
|
---|
59 | ahUncertain[i].fMZ = 0;
|
---|
60 | ahUncertain[i].fPE = 0;
|
---|
61 | ahUncertain[i].hFile = *phFile;
|
---|
62 | ahUncertain[i].pszName = (char*)malloc(strlen(pszFilename)+1);
|
---|
63 | if (ahUncertain[i].pszName != NULL)
|
---|
64 | {
|
---|
65 | strcpy(ahUncertain[i].pszName, pszFilename);
|
---|
66 | SetState(*phFile, HSTATE_CHECK);
|
---|
67 | }
|
---|
68 | else
|
---|
69 | {
|
---|
70 | kprintf(("myldrOpen: warning - malloc returned NULL\n"));
|
---|
71 | freeUncertainEntry(*phFile);
|
---|
72 | SetState(*phFile, HSTATE_NOT_PE);
|
---|
73 | }
|
---|
74 | }
|
---|
75 | else
|
---|
76 | kprintf(("getFreeUncertainEntry failed\n"));
|
---|
77 | }
|
---|
78 | return rc;
|
---|
79 | }
|
---|