Make CallTo16 return stub segment owned by KERNEL.
diff --git a/if1632/relay.c b/if1632/relay.c
index 44a3c49..c07ebb9 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -40,8 +40,9 @@
extern DWORD CALL32_CBClientEx_RetAddr;
codesel = GLOBAL_CreateBlock( GMEM_FIXED, (void *)Call16_Ret_Start,
- (int)Call16_Ret_End - (int)Call16_Ret_Start,
- 0, TRUE, TRUE, FALSE, NULL );
+ (int)Call16_Ret_End - (int)Call16_Ret_Start,
+ GetModuleHandle16( "KERNEL" ),
+ TRUE, TRUE, FALSE, NULL );
if (!codesel) return FALSE;
/* Patch the return addresses for CallTo16 routines */
diff --git a/loader/main.c b/loader/main.c
index 27e7c27..dea1b95 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -101,9 +101,6 @@
/* Read DOS config.sys */
if (!DOSCONF_ReadConfig()) return FALSE;
- /* Initialize relay code */
- if (!RELAY_Init()) return FALSE;
-
return TRUE;
}
@@ -155,6 +152,10 @@
NE_SetEntryPoint( hModule, 194, DOSMEM_BiosSysSeg ); /* KERNEL.194: __F000H */
#undef SET_ENTRY_POINT
}
+
+ /* Initialize relay code */
+ if (!RELAY_Init()) return FALSE;
+
return TRUE;
}