Index: trunk/src/win32k/dev16/probkrnl.c
===================================================================
--- trunk/src/win32k/dev16/probkrnl.c	(revision 4225)
+++ trunk/src/win32k/dev16/probkrnl.c	(revision 4227)
@@ -1,3 +1,3 @@
-/* $Id: probkrnl.c,v 1.24 2000-09-08 15:29:01 bird Exp $
+/* $Id: probkrnl.c,v 1.25 2000-09-08 21:34:09 bird Exp $
  *
  * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
@@ -134,5 +134,7 @@
     {FALSE, -1, 16, "_ldrpFileNameBuf",     -1,  -1,  -1,  -1, EPT_VARIMPORT32},   /* 40 */
     {FALSE, -1, 14, "SecPathFromSFN",       -1,  -1,  -1,  -1, EPT_PROCIMPORTNR32},/* 41 */
-
+#if 0/* experimenting...*/
+    {FALSE, -1, 14, "_ldrSetVMflags",       -1,  -1,  -1,  -1, EPT_PROC32},        /* 42 */
+#endif
 };
 
Index: trunk/src/win32k/dev32/d32init.c
===================================================================
--- trunk/src/win32k/dev32/d32init.c	(revision 4225)
+++ trunk/src/win32k/dev32/d32init.c	(revision 4227)
@@ -1,3 +1,3 @@
-/* $Id: d32init.c,v 1.22 2000-09-04 16:40:49 bird Exp $
+/* $Id: d32init.c,v 1.23 2000-09-08 21:34:10 bird Exp $
  *
  * d32init.c - 32-bits init routines.
@@ -1218,5 +1218,8 @@
         0,                              /* 39 */
         0,                              /* 40 */
-        (unsigned)nopSecPathFromSFN,    /* 41 */
+        (unsigned)nopSecPathFromSFN     /* 41 */
+        #if 0 /* experimenting */
+        ,(unsigned)myldrSetVMflags,      /* 42 */
+        #endif
     };
     int i;
@@ -1517,4 +1520,7 @@
         {(unsigned)&fakeldrpFileNameBuf,    3},
         {(unsigned)&fakeSecPathFromSFN,     3}
+        #if 0 /* experimenting */
+        ,{(unsigned)&fakeldrSetVMflags,      1}
+        #endif
     };
     int i;
Index: trunk/src/win32k/include/LdrCalls.h
===================================================================
--- trunk/src/win32k/include/LdrCalls.h	(revision 4225)
+++ trunk/src/win32k/include/LdrCalls.h	(revision 4227)
@@ -1,3 +1,3 @@
-/* $Id: LdrCalls.h,v 1.4 2000-09-02 21:08:02 bird Exp $
+/* $Id: LdrCalls.h,v 1.5 2000-09-08 21:34:11 bird Exp $
  *
  * Prototypes for the loader overrided function.
@@ -224,4 +224,22 @@
 
 /**
+ * Sets the VM flags for an executable object.
+ * @returns     void
+ * @param       pMTE        Pointer to the module table entry.
+ * @param       flObj       LX Object flags.
+ * @param       pflFlags1   Pointer to the flFlags1 of VMAllocMem (out).
+ * @param       pflFlags2   Pointer to the flFlags2 of VMAllocMem (out).
+ */
+extern VOID LDRCALL  ldrSetVMflags( /* retd  0x10 */
+    PMTE        pMTE,               /* ebp + 0x08 */
+    ULONG       flObj,              /* ebp + 0x0c */
+    PULONG      pflFlags1,          /* ebp + 0x10 */
+    PULONG      pflFlags2           /* ebp + 0x14 */
+    );
+
+VOID LDRCALL myldrSetVMflags(PMTE pMTE, ULONG flObj, PULONG pflFlags1, PULONG pflFlags2);
+
+
+/**
  * Pointer to the loader filename buffer.
  * Upon return from ldrOpen (and ldrOpenPath which calls ldrOpen) this is
Index: trunk/src/win32k/include/OS2KVM.h
===================================================================
--- trunk/src/win32k/include/OS2KVM.h	(revision 4225)
+++ trunk/src/win32k/include/OS2KVM.h	(revision 4227)
@@ -1,3 +1,3 @@
-/* $Id: OS2KVM.h,v 1.5 2000-09-02 21:08:00 bird Exp $
+/* $Id: OS2KVM.h,v 1.6 2000-09-08 21:34:11 bird Exp $
  *
  * OS/2 kernel VM functions.
@@ -13,53 +13,69 @@
 #define _OS2KVM_h_
 
+
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
+
+/*                                            v8086.h */
+#define VM_PG_W            0x00000002      /* VPMPG_W       - Page Writeable. */
+#define VM_PG_U            0x00000004      /* VPMPG_U       - Page User Mode Accessible.*/
+#define VM_PG_X            0x00000008      /* VPMPG_X       - Page Executable. */
+#define VM_PG_R            0x00000010      /* VPMPG_R       - Page Readable. */
+#define VM_PG_RESERVED     0x00001000      /* VPMPG_RESERVED- Reservered */
+
+/*                                            vpmx2.h */
+#define VM_PG_SWAPPABLE    0x00000000      /* Swappable */
+
+
+
 /*
  * VMAlloc flFlag1 guessings
  */
-#define VMA_CONTIG          0x00000001  /* VMDHA_CONTIG */
-#define VMA_WRITE           0x00000002  /* PAG_WRITE and OB_WRITE */
-#define VMA_USER            0x00000004  /* OB_USER */
-#define VMA_EXECUTE         0x00000008  /* PAG_EXECUTE and OB_READ !! */
-#define VMA_READ            0x00000010  /* PAG_READ and OB_EXEC !! */
-#define VMA_LOWMEM          0x00000020  /* OB_LOWMEM < 1MB physical */
-#define VMA_GUARD           0x00000040  /* PAG_GUARD and VMDHA_16M and OB_GUARD */
+#define VMA_CONTIG          0x00000001UL  /* VMDHA_CONTIG */
+#define VMA_WRITE           VM_PG_W     /* PAG_WRITE and OB_WRITE */
+#define VMA_USER            VM_PG_U     /* OB_USER */
+#define VMA_EXECUTE         VM_PG_X     /* PAG_EXECUTE and OB_READ !! */
+#define VMA_READ            VM_PG_R     /* PAG_READ and OB_EXEC !! */
+#define VMA_LOWMEM          0x00000020UL  /* OB_LOWMEM < 1MB physical */
+#define VMA_GUARD           0x00000040UL  /* PAG_GUARD and VMDHA_16M and OB_GUARD */
 #if 0
-#define VMA_RESIDENT        0x00000080  /* OB_RESIDENT */
-#define VMA_ZEROINIT        0x00000100  /* OB_ZEROINIT */
-#define VMA_PHYS            0x00000200  /* VMDHA_PHYS */
-#define VMA_FIXED           0x00000400  /* VMDHA_FIXED and OB_SHARED */
+#define VMA_RESIDENT        0x00000080UL  /* OB_RESIDENT */
+#define VMA_ZEROINIT        0x00000100UL  /* OB_ZEROINIT */
+#define VMA_PHYS            0x00000200UL  /* VMDHA_PHYS */
+#define VMA_FIXED           0x00000400UL  /* VMDHA_FIXED and OB_SHARED */
 #else
-#define VMA_ZEROFILL        0x00000080
-#define VMA_SWAPONWRITE     0x00000100
-#define VMA_UVIRT           0x00000200  /* VMDHA_PHYS */
-#define VMA_RESIDENT        0x00000400  /* VMDHA_FIXED and OB_SHARED */
+#define VMA_ZEROFILL        0x00000080UL
+#define VMA_SWAPONWRITE     0x00000100UL
+#define VMA_UVIRT           0x00000200UL  /* VMDHA_PHYS */
+#define VMA_RESIDENT        0x00000400UL  /* VMDHA_FIXED and OB_SHARED */
 #endif
-#define VMA_DISCARDABLE     0x00000800  /* discarable object */
-#define VMA_SHARE           0x00001000  /* OBJSHARE and OBJEXEC (which implies shared) */
-#define VMA_PROTECTED       0x00004000  /* PAG_PROTECTED */
-#define VMA_LOWMEM2         0x00010000  /* OB_LOWMEM */
-#define VMA_VDM             0x00040000  /* VDM */
-#define VMA_DECOMMIT        0x00080000  /* PAG_DECOMMIT */
-#define VMA_TILE            0x00400000  /* OBJ_TILE */
-#define VMA_SELALLOC        0x00400000  /* Allocates selector */
-#define VMA_SHRINKABLE      0x00800000  /* OB_SHRINKABLE */
-#define VMA_HUGH            0x01000000  /* OB_HUGH */
+#define VMA_DISCARDABLE     0x00000800UL  /* discarable object */
+#define VMA_SHARE           0x00001000UL  /* OBJSHARE and OBJEXEC (which implies shared) */
+#define VMA_PROTECTED       0x00004000UL  /* PAG_PROTECTED */
+#define VMA_LOWMEM2         0x00010000UL  /* OB_LOWMEM */
+#define VMA_VDM             0x00040000UL  /* (VPMVMAC_VDM)    VDM allocation */
+#define VMA_DECOMMIT        0x00080000UL  /* PAG_DECOMMIT */
+#define VMA_TILE            0x00400000UL  /* OBJ_TILE */
+#define VMA_SELALLOC        0x00400000UL  /* Allocates selector */
+#define VMA_SHRINKABLE      0x00800000UL  /* OB_SHRINKABLE */
+#define VMA_HUGH            0x01000000UL  /* OB_HUGH */
 
-#define VMA_ARENASHARED     0x04000000  /* Shared Arena */
-#define VMA_ARENASYSTEM     0x00000000  /* System Arena */
-#define VMA_ARENAPRIVATE    0x02000000  /* Private Arena */
-#define VMA_ARENAHEAP       0x06000000  /* Heap Arena */
-#define VMA_ARENAHIGHA      0x00008000  /* High shared arena (Warp >= fp13) */
+#define VMA_ARENASHARED     0x04000000UL  /* Shared Arena */
+#define VMA_ARENASYSTEM     0x00000000UL  /* System Arena */
+#define VMA_ARENAPRIVATE    0x02000000UL  /* (VPMVMAC_ARENAPRV) Private Arena */
+#define VMA_ARENAHEAP       0x06000000UL  /* Heap Arena */
+#define VMA_ARENAHIGHA      0x00008000UL  /* High shared arena (Warp >= fp13) */
 #define VMA_ARENAHIGH   (options.ulBuild >= MERLINFP13 ? VMA_ARENAHIGHA : 0UL)
-#define VMA_ARENAMASKW      0x06000000  /* Warp < fp13 Arena Mask */
-#define VMA_ARENAMASKA      0x06008000  /* Aurora Arena Mask */
+#define VMA_ARENAMASKW      0x06000000UL  /* Warp < fp13 Arena Mask */
+#define VMA_ARENAMASKA      0x06008000UL  /* Aurora Arena Mask */
 #define VMA_ARENAMASK   (options.ulBuild >= MERLINFP13 ? VMA_ARENAMASKA : VMA_ARENAMASKW)
 
-#define VMA_LOCMASK         0xC0000000  /* Location mask */
-#define VMA_LOCSPECIFIC     0x80000000  /* Specific location */
-#define VMA_LOCABOVE        0x40000000  /* Above or equal to specified location */
-#define VMA_LOCANY          0x00000000  /* Anywhere */
+#define VMA_ALIGNPAGE       0x18000000UL  /* (VPMVMAC_ALIGNPAGE)      Page alignment */
+
+#define VMA_LOCMASK         0xC0000000UL  /* Location mask */
+#define VMA_LOCSPECIFIC     0x80000000UL  /* (VPMVMAC_LOCSPECIFIC)    Specific location */
+#define VMA_LOCABOVE        0x40000000UL  /* (VPMVMAC_LOCABOVE)       Above or equal to specified location */
+#define VMA_LOCANY          0x00000000UL  /* Anywhere */
 
 
@@ -68,5 +84,12 @@
  * VMAlloc flFlags2 guessings
  */
-#define VMAF2_WRITE         0x00000002 /* PAG_WRITE */
+#if 0 /*???*/
+#define VDHAM_FIXED         0x0000UL
+#define VDHAM_SWAPPABLE     0x0001UL
+#define VPMVMFM_VDM         0x00000004UL  /* Request on behalf of VDM */
+#endif
+
+#define VMAF2_WRITE         0x00000002UL  /* PAG_WRITE */
+
 
 
Index: trunk/src/win32k/include/test.h
===================================================================
--- trunk/src/win32k/include/test.h	(revision 4225)
+++ trunk/src/win32k/include/test.h	(revision 4227)
@@ -1,3 +1,3 @@
-/* $Id: test.h,v 1.2 2000-09-02 21:08:04 bird Exp $
+/* $Id: test.h,v 1.3 2000-09-08 21:34:11 bird Exp $
  *
  * Definitions and declarations for test moduls.
@@ -45,4 +45,11 @@
     PVOID   pvPTDA
     );
+ULONG LDRCALL fakeldrSetVMflags(
+    PMTE        pMTE,
+    ULONG       flObj,
+    PULONG      pflFlags1,
+    PULONG      pflFlags2
+    );
+
 APIRET KRNLCALL fakeIOSftOpen(
     PSZ pszFilename,
Index: trunk/src/win32k/ldr/calltab.asm
===================================================================
--- trunk/src/win32k/ldr/calltab.asm	(revision 4225)
+++ trunk/src/win32k/ldr/calltab.asm	(revision 4227)
@@ -1,3 +1,3 @@
-; $Id: calltab.asm,v 1.13 2000-09-02 21:08:06 bird Exp $
+; $Id: calltab.asm,v 1.14 2000-09-08 21:34:12 bird Exp $
 ;
 ; callTab - Call back again table - table with entry for each function or
@@ -359,4 +359,8 @@
 SecPathFromSFN ENDP
 
+; 42
+_ldrSetVMflags@16 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_ldrSetVMflags@16 ENDP
 
 CALLTAB ENDS
Index: trunk/src/win32k/ldr/myldrSetVMflags.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrSetVMflags.cpp	(revision 4227)
+++ trunk/src/win32k/ldr/myldrSetVMflags.cpp	(revision 4227)
@@ -0,0 +1,71 @@
+/* $Id: myldrSetVMflags.cpp,v 1.1 2000-09-08 21:34:12 bird Exp $
+ *
+ * myldrSetVMflags - ldrSetVMflags
+ *
+ * Copyright (c) 2000 knut st. osmundsen
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define INCL_DOSERRORS
+#define INCL_NOPMAPI
+
+#define INCL_OS2KRNL_VM
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <os2.h>
+
+#include <memory.h>
+#include <stdlib.h>
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+#include "log.h"
+#include "avl.h"
+#include <peexe.h>
+#include <exe386.h>
+#include "OS2Krnl.h"
+#include "ldr.h"
+#include "ldrCalls.h"
+
+
+/**
+ * Sets the VM flags for an executable object.
+ *
+ * We'll overload this to change the VMA_SELALLOC flag into a VMA_VDM flag
+ * for our executables. This will hopefully bring us a step closer to the
+ * 100% working loaders, page aligning pages - hopefully.
+ *
+ * @returns     void
+ * @param       pMTE        Pointer to the module table entry.
+ * @param       flObj       LX Object flags.
+ * @param       pflFlags1   Pointer to the flFlags1 of VMAllocMem (out).
+ * @param       pflFlags2   Pointer to the flFlags2 of VMAllocMem (out).
+ */
+VOID LDRCALL myldrSetVMflags(PMTE pMTE, ULONG flObj, PULONG pflFlags1, PULONG pflFlags2)
+{
+    /*
+     * call the orignal and let it do it's work.
+     */
+    ldrSetVMflags(pMTE, flObj, pflFlags1, pflFlags2);
+
+
+    /*
+     * If it's our handle then ...
+     */
+    if (GetState(pMTE->mte_sfn) == HSTATE_OUR)
+    {
+        ULONG ul = *pflFlags1;
+
+        *pflFlags1 = ( (*pflFlags1) & ~VMA_SELALLOC ) | VMA_VDM;
+
+        kprintf(("myldrSetVMflags: hMte=%04x %.8s flObj=%08x  *pflFlags1=%08x (before)  *pflFlags1=%08x (after) \n",
+                 pMTE->mte_modname,  pMTE->mte_handle, flObj, ul, *pflFlags1
+                 ));
+    }
+}
Index: trunk/src/win32k/test/fake.c
===================================================================
--- trunk/src/win32k/test/fake.c	(revision 4225)
+++ trunk/src/win32k/test/fake.c	(revision 4227)
@@ -1,3 +1,3 @@
-/* $Id: fake.c,v 1.2 2000-09-02 21:08:20 bird Exp $
+/* $Id: fake.c,v 1.3 2000-09-08 21:34:12 bird Exp $
  *
  * Fake stubs for the ldr and kernel functions we imports or overloads.
@@ -313,4 +313,26 @@
 
     return NO_ERROR;
+}
+
+
+/**
+ * Sets the VM flags for an executable object.
+ * @returns     void
+ * @param       pMTE        Pointer to the module table entry.
+ * @param       flObj       LX Object flags.
+ * @param       pflFlags1   Pointer to the flFlags1 of VMAllocMem (out).
+ * @param       pflFlags2   Pointer to the flFlags2 of VMAllocMem (out).
+ */
+ULONG LDRCALL fakeldrSetVMflags(
+    PMTE        pMTE,
+    ULONG       flObj,
+    PULONG      pflFlags1,
+    PULONG      pflFlags2
+    )
+{
+    *pflFlags1 = 0;
+    *pflFlags2 = 0;
+    flObj = flObj;
+    pMTE = pMTE;
 }
 
