Index: trunk/src/kernel32/KERNEL32.DEF
===================================================================
--- trunk/src/kernel32/KERNEL32.DEF	(revision 10376)
+++ trunk/src/kernel32/KERNEL32.DEF	(revision 10377)
@@ -1,3 +1,3 @@
-; $Id: KERNEL32.DEF,v 1.158 2003-10-28 19:19:21 sandervl Exp $
+; $Id: KERNEL32.DEF,v 1.159 2004-01-11 11:57:50 sandervl Exp $
 
 ;Basis is Windows95 KERNEL32
@@ -1086,4 +1086,5 @@
     _UnregisterLxDll@4                                            @1239
     _RegisterDummyExe@4                                           @1249
+    _IsDummyExeLoaded@0                                           @1250 NONAME
 
 ;VMutex
@@ -1244,4 +1245,10 @@
 
     _OSLibWinCreateObject@32                                      @3111 NONAME
+
+    _MMAP_RegisterMemoryRange@16                                  @3112 NONAME
+    _MMAP_UnregisterMemoryRange@4                                 @3113 NONAME
+
+    _ODIN_SetExceptionHandler@4                                   @3114 NONAME
+    _ODIN_UnsetExceptionHandler@4                                 @3115 NONAME
 
 ; Char functions (forwarders from user32)
Index: trunk/src/kernel32/exceptions.cpp
===================================================================
--- trunk/src/kernel32/exceptions.cpp	(revision 10376)
+++ trunk/src/kernel32/exceptions.cpp	(revision 10377)
@@ -1,3 +1,3 @@
-/* $Id: exceptions.cpp,v 1.72 2003-03-06 10:22:26 sandervl Exp $ */
+/* $Id: exceptions.cpp,v 1.73 2004-01-11 11:57:52 sandervl Exp $ */
 
 /*
@@ -1243,4 +1243,12 @@
         map = Win32MemMapView::findMapByView(pERepRec->ExceptionInfo[1], &offset, accessflag);
         if(map == NULL) {
+            Win32MemMapNotify *map;
+
+            map = Win32MemMapNotify::findMapByView(pERepRec->ExceptionInfo[1], &offset, accessflag);
+            if(!map) 
+                goto continueFail;
+
+            BOOL ret = map->notify(pERepRec->ExceptionInfo[1], offset, fWriteAccess);
+            if(ret == TRUE) goto continueexecution;
             goto continueFail;
         }
@@ -1451,4 +1459,42 @@
 }
 //*****************************************************************************
+// Set exception handler if our handler has not yet been registered
+//*****************************************************************************
+void WIN32API ODIN_SetExceptionHandler(void *pExceptionRegRec)
+{
+  BOOL   fFound = FALSE;
+  USHORT sel = RestoreOS2FS();
+  PEXCEPTIONREGISTRATIONRECORD pExceptRec = (PEXCEPTIONREGISTRATIONRECORD)QueryExceptionChain();
+
+  while(pExceptRec != 0 && (ULONG)pExceptRec != -1) 
+  {
+        if(pExceptRec->ExceptionHandler == OS2ExceptionHandler) 
+        {
+            fFound = TRUE;
+            break;
+        }
+        pExceptRec = pExceptRec->prev_structure;
+  }
+  if(!fFound) 
+  {
+      OS2SetExceptionHandler(pExceptionRegRec);
+  }
+  SetFS(sel);
+}
+//*****************************************************************************
+// Remove exception handler if it was registered previously
+// 
+//*****************************************************************************
+void WIN32API ODIN_UnsetExceptionHandler(void *pExceptionRegRec)
+{
+  USHORT sel = RestoreOS2FS();
+  PEXCEPTIONREGISTRATIONRECORD pExceptRec = (PEXCEPTIONREGISTRATIONRECORD)QueryExceptionChain();
+
+  if(pExceptRec == (PEXCEPTIONREGISTRATIONRECORD)pExceptionRegRec) {
+      OS2UnsetExceptionHandler(pExceptionRegRec);
+  }
+  SetFS(sel);
+}
+//*****************************************************************************
 //*****************************************************************************
 #ifdef DEBUG
Index: trunk/src/kernel32/kernel32dbg.def
===================================================================
--- trunk/src/kernel32/kernel32dbg.def	(revision 10376)
+++ trunk/src/kernel32/kernel32dbg.def	(revision 10377)
@@ -1,3 +1,3 @@
-; $Id: kernel32dbg.def,v 1.33 2003-10-28 19:19:21 sandervl Exp $
+; $Id: kernel32dbg.def,v 1.34 2004-01-11 11:57:52 sandervl Exp $
 
 ;Basis is Windows95 KERNEL32
@@ -1086,4 +1086,5 @@
     _UnregisterLxDll@4                                            @1239
     _RegisterDummyExe@4                                           @1249
+    _IsDummyExeLoaded@0                                           @1250 NONAME
 
 ;VMutex
@@ -1244,4 +1245,10 @@
 
     _OSLibWinCreateObject@32                                      @3111 NONAME
+
+    _MMAP_RegisterMemoryRange@16                                  @3112 NONAME
+    _MMAP_UnregisterMemoryRange@4                                 @3113 NONAME
+
+    _ODIN_SetExceptionHandler@4                                   @3114 NONAME
+    _ODIN_UnsetExceptionHandler@4                                 @3115 NONAME
 
 ; Char functions (forwarders from user32)
Index: trunk/src/kernel32/mmap.cpp
===================================================================
--- trunk/src/kernel32/mmap.cpp	(revision 10376)
+++ trunk/src/kernel32/mmap.cpp	(revision 10377)
@@ -1,3 +1,3 @@
-/* $Id: mmap.cpp,v 1.66 2003-05-06 12:06:10 sandervl Exp $ */
+/* $Id: mmap.cpp,v 1.67 2004-01-11 11:57:53 sandervl Exp $ */
 
 /*
@@ -73,4 +73,10 @@
 //******************************************************************************
 //******************************************************************************
+void FinalizeMemMaps()
+{
+    DosDeleteCriticalSection(&globalmapcritsect);
+}
+//******************************************************************************
+//******************************************************************************
 Win32MemMap::Win32MemMap(HANDLE hfile, ULONG size, ULONG fdwProtect, LPSTR lpszName)
                : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), 
