source: trunk/src/win32k/ldr/myldrSetVMflags.cpp@ 4227

Last change on this file since 4227 was 4227, checked in by bird, 25 years ago

Experimenting with ldrSetVMflags. Page alignment possible.

File size: 2.2 KB
Line 
1/* $Id: myldrSetVMflags.cpp,v 1.1 2000-09-08 21:34:12 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
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <os2.h>
23
24#include <memory.h>
25#include <stdlib.h>
26
27#include "devSegDf.h" /* Win32k segment definitions. */
28#include "log.h"
29#include "avl.h"
30#include <peexe.h>
31#include <exe386.h>
32#include "OS2Krnl.h"
33#include "ldr.h"
34#include "ldrCalls.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 */
50VOID 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}
Note: See TracBrowser for help on using the repository browser.