1 | /* $Id: myldrSetVMflags.cpp,v 1.2 2001-02-10 11:11:47 bird Exp $
|
---|
2 | *
|
---|
3 | * myldrSetVMflags - ldrSetVMflags
|
---|
4 | *
|
---|
5 | * Copyright (c) 2000 knut st. osmundsen
|
---|
6 | *
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 | /*******************************************************************************
|
---|
12 | * Defined Constants And Macros *
|
---|
13 | *******************************************************************************/
|
---|
14 | #define INCL_DOSERRORS
|
---|
15 | #define INCL_NOPMAPI
|
---|
16 |
|
---|
17 | #define INCL_OS2KRNL_VM
|
---|
18 | #define INCL_OS2KRNL_LDR
|
---|
19 |
|
---|
20 | /*******************************************************************************
|
---|
21 | * Header Files *
|
---|
22 | *******************************************************************************/
|
---|
23 | #include <os2.h>
|
---|
24 |
|
---|
25 | #include <memory.h>
|
---|
26 | #include <stdlib.h>
|
---|
27 |
|
---|
28 | #include "devSegDf.h" /* Win32k segment definitions. */
|
---|
29 | #include "log.h"
|
---|
30 | #include "avl.h"
|
---|
31 | #include <peexe.h>
|
---|
32 | #include <exe386.h>
|
---|
33 | #include "OS2Krnl.h"
|
---|
34 | #include "ldr.h"
|
---|
35 |
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Sets the VM flags for an executable object.
|
---|
39 | *
|
---|
40 | * We'll overload this to change the VMA_SELALLOC flag into a VMA_VDM flag
|
---|
41 | * for our executables. This will hopefully bring us a step closer to the
|
---|
42 | * 100% working loaders, page aligning pages - hopefully.
|
---|
43 | *
|
---|
44 | * @returns void
|
---|
45 | * @param pMTE Pointer to the module table entry.
|
---|
46 | * @param flObj LX Object flags.
|
---|
47 | * @param pflFlags1 Pointer to the flFlags1 of VMAllocMem (out).
|
---|
48 | * @param pflFlags2 Pointer to the flFlags2 of VMAllocMem (out).
|
---|
49 | */
|
---|
50 | VOID LDRCALL myldrSetVMflags(PMTE pMTE, ULONG flObj, PULONG pflFlags1, PULONG pflFlags2)
|
---|
51 | {
|
---|
52 | /*
|
---|
53 | * call the orignal and let it do it's work.
|
---|
54 | */
|
---|
55 | ldrSetVMflags(pMTE, flObj, pflFlags1, pflFlags2);
|
---|
56 |
|
---|
57 |
|
---|
58 | /*
|
---|
59 | * If it's our handle then ...
|
---|
60 | */
|
---|
61 | if (GetState(pMTE->mte_sfn) == HSTATE_OUR)
|
---|
62 | {
|
---|
63 | ULONG ul = *pflFlags1;
|
---|
64 |
|
---|
65 | *pflFlags1 = ( (*pflFlags1) & ~VMA_SELALLOC ) | VMA_VDM;
|
---|
66 |
|
---|
67 | kprintf(("myldrSetVMflags: hMte=%04x %.8s flObj=%08x *pflFlags1=%08x (before) *pflFlags1=%08x (after) \n",
|
---|
68 | pMTE->mte_modname, pMTE->mte_handle, flObj, ul, *pflFlags1
|
---|
69 | ));
|
---|
70 | }
|
---|
71 | }
|
---|