Index: trunk/src/win32k/Makefile
===================================================================
--- trunk/src/win32k/Makefile	(revision 4152)
+++ trunk/src/win32k/Makefile	(revision 4164)
@@ -1,4 +1,4 @@
 ################################################################################
-# $Id: Makefile,v 1.43 2000-05-25 22:12:49 bird Exp $
+# $Id: Makefile,v 1.44 2000-09-02 21:07:52 bird Exp $
 #
 # Win32k makefile.
@@ -40,7 +40,7 @@
 CC          = icc
 !if "$(CCENV)" == "VAC36"
-ILIB        = ilib /nofree
+ILIB        = ilib /nofree /nobackup /nologo
 !else
-ILIB        = ilib
+ILIB        = ilib /nobackup /nologo
 !endif
 LD          = ilink
@@ -48,11 +48,17 @@
 
 CFLAGS      = -q -Ge -Gs- -Gr+ -Rn -Ss+ -Mp -Wall+ppt-ppc-inl-cnv-gnr-vft-gen-uni-ext-
-CFLAGS16    = -c -W4 -Asfw /NTCODE16 /NDDATA16 -G2s -Zp -Zl -nologo -Fo$@ -Fa
+CFLAGS16    = -c -W3 -Asfw /NTCODE16 /NDDATA16 -G2s -Zp -Zl -nologo
 CPPFLAGS    = -q -Ge -Gs- -Gr+ -Rn -Ss+ -Mp -Gx -Wall+ppt-ppc-inl-cnv-gnr-vft-
 ASFLAGS     = -Sv:ALP -Mb -Li
-LFLAGS      = /nologo /MAP /NOI /NOE /NOD /A:16
-CDEFINES    = -DWIN32K -DRING0 -D__WIN32OS2__ -D__WINE__
-CDEFINES16  = -DRING0
-ADEFINES    = -D:WIN32K
+LFLAGS      = /nologo /MAP /NOI /NOE /NOD /A:16 /PACKCODE /PACKDATA
+CDEFINESB   = -DWIN32K -DRING0 -D__WIN32OS2__ -D__WINE__
+CDEFINESB16 = -DRING0
+ASDEFINES   = -D:WIN32K
+
+!if "$(CCENV)" == "VAC36"
+VACLIB      = $(VACPATH)\lib\cpprni36.lib
+!else
+VACLIB      = $(VACPATH)\lib\cppon30.lib
+!endif
 
 
@@ -64,7 +70,7 @@
 CFLAGS16    = $(CFLAGS16)   -Ogeitln -Gs
 CPPFLAGS    = $(CPPFLAGS)   -G5 -O+
-LFLAGS      = $(LFLAGS)     /EXEPACK:2 /NODEBUG /PACKC /PACKD
-CDEFINES    = $(CDEFINES)   -DRELEASE
-CDEFINES16  = $(CDEFINES16) -DRELEASE
+LFLAGS      = $(LFLAGS)     /EXEPACK:2 /NODEBUG
+CDEFINES    = $(CDEFINESB)  -DRELEASE
+CDEFINES16  = $(CDEFINESB16) -DRELEASE
 ASDEFINES   = $(ASDEFINES)  -D:RELEASE
 
@@ -72,20 +78,24 @@
 
 # DEBUG
-CFLAGS      = $(CFLAGS)     -O- -Ti+
+CFLAGS      = $(CFLAGS)     -O+ -Os- -Ti+
 CFLAGS16    = $(CFLAGS16)   -Zi -Od
-CPPFLAGS    = $(CPPFLAGS)   -O- -Ti+
-LFLAGS      = $(LFLAGS)     /NOEXEPACK /DEBUG  /NODEB
+CPPFLAGS    = $(CPPFLAGS)   -O+ -Os- -Ti+
+LFLAGS      = $(LFLAGS)     /NOEXEPACK /DEBUG
 ASFLAGS     = $(ASFLAGS)    -Od+
-CDEFINES    = $(CDEFINES)   -DDEBUG
-CDEFINES16  = $(CDEFINES16) -DDEBUG
+CDEFINES    = $(CDEFINESB)  -DDEBUG
+CDEFINES16  = $(CDEFINESB16) -DDEBUG
 ASDEFINES   = $(ASDEFINES)  -D:DEBUG
 !endif
 
 !ifdef NODEBUGINFO
-LFLAGS      = $(LFLAGS)     /NODEB /EXEPACK:2 /PACKD /PACKC
+LFLAGS      = $(LFLAGS)     /NODEB /EXEPACK:2
 CFLAGS16    = $(CFLAGS16)   -Owis
-CFLAGS      = $(CFLAGS)     -O+ -Oi-
-CPPFLAGS    = $(CPPFLAGS)   -O+ -Oi-
-!endif
+CFLAGS      = $(CFLAGS)     -O+ -Os- -Oi-
+CPPFLAGS    = $(CPPFLAGS)   -O+ -Os- -Oi-
+!endif
+
+CDEFINES_TST    = $(CDEFINES)   -DR3TST
+CDEFINES16_TST  = $(CDEFINES16) -DR3TST
+
 
 ################################################################################
@@ -101,9 +111,5 @@
              -I$(PDWIN32_INCLUDE)\win
 
-CINCLUDES16= -I$(WIN32KINCLUDE) \
-             -I. \
-             -I$(DDKPATH)\h \
-             -I$(MSCPATH)\include \
-             -I$(PDWIN32_INCLUDE)
+CINCLUDES16= -I$(WIN32KINCLUDE) -I. -I$(DDKPATH)\h -I$(MSCPATH)\include -I$(PDWIN32_INCLUDE)
 
 
@@ -117,10 +123,21 @@
 .SUFFIXES: .obj .cpp .c .asm
 
-{dev16}.c{$(WIN32KOBJ)}.obj:
+{dev16}.c.obj:
+    @$(ECHO) compiling 16bit: $< ($@)
+    $(CC16) -c $(CFLAGS16) $(CDEFINES16) $(CINCLUDES16) -Fo$(WIN32KOBJ)\$(*B).obj -Fa$(WIN32KLIST)\$(*B).s $<
+
+{dev16}.c.obj_init:
+    @$(ECHO) compiling 16bit: $< ($@)
+    $(CC16) -c $(CFLAGS16) $(CDEFINES16) $(CINCLUDES16) /NTCODE16_INIT /NDDATA16_INIT -Fo$(WIN32KOBJ)\$(*B).obj_init -Fa$(WIN32KLIST)\$(*B).s $<
+    $(CP) $@ $@.obj
+
+{dev16}.c.obj_tst:
     @$(ECHO) compiling 16bit: $<
-    @$(CC16) $(CFLAGS16) $(CDEFINES16) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES16) $<
-{dev16}.c.obj:
+    $(CC16) -c $(CFLAGS16) $(CDEFINES16_TST) $(CINCLUDES16) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@B).obj_tst $<
+    $(CP) $@ $@.obj
+{dev16}.c.obj_tst_init:
     @$(ECHO) compiling 16bit: $<
-    @$(CC16) $(CFLAGS16) $(CDEFINES16) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES16) $<
+    $(CC16) -c $(CFLAGS16) $(CDEFINES16_TST) $(CINCLUDES16) /NDDATA16_INIT /NTCODE16_INIT -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@B).obj_tst_init $<
+    $(CP) $@ $@.obj
 
 
@@ -139,4 +156,13 @@
     @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES) $<
 
+{dev32}.c{$(WIN32KOBJ)}.obj_tst:
+    @$(ECHO) compiling 32bit: $<
+    @$(CC) -c $(CFLAGS) $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $<
+    @$(CP) $@ $@.obj
+{dev32}.c.obj_tst:
+    @$(ECHO) compiling 32bit: $<
+    @$(CC) -c $(CFLAGS) $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES) $<
+    @$(CP) $@ $@.obj
+
 {dev32}.cpp{$(WIN32KOBJ)}.obj:
     @$(ECHO) compiling 32bit: $<
@@ -147,4 +173,26 @@
 
 
+{test}.asm{$(WIN32KOBJ)}.obj:
+    @$(ECHO) assembling:      $<
+    @$(AS) $(ASFLAGS) $(ADEFINES) $(AINCLUDES) $< -Fo:$@ -Fl:$(WIN32KLIST)\$(*B).lst
+{test}.asm.obj:
+    @$(ECHO) assembling:      $<
+    @$(AS) $(ASFLAGS) $(ADEFINES) $(AINCLUDES) $< -Fo:$(WIN32KOBJ)\$(@F) -Fl:$(WIN32KLIST)\$(*B).lst
+
+{test}.c{$(WIN32KOBJ)}.obj:
+    @$(ECHO) compiling 32bit: $<
+    @$(CC) -c $(CFLAGS) -O- -Ge+ $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $<
+{test}.c.obj:
+    @$(ECHO) compiling 32bit: $<
+    @$(CC) -c $(CFLAGS) -O- -Ge+ $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES) $<
+
+{test}.cpp{$(WIN32KOBJ)}.obj:
+    @$(ECHO) compiling 32bit: $<
+    @$(CC) -c $(CPPFLAGS) -O- -Ge+ $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $<
+{test}.cpp.obj:
+    @$(ECHO) compiling 32bit: $<
+    @$(CC) -c $(CPPFLAGS) -O- -Ge+ $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES) $<
+
+
 {k32}.asm{$(WIN32KOBJ)}.obj:
     @$(ECHO) assembling:      $<
@@ -204,4 +252,13 @@
     @$(ECHO) compiling 32bit: $<
     @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES) $<
+
+{misc}.c{$(WIN32KOBJ)}.obj_tst:
+    @$(ECHO) compiling 32bit: $<
+    $(CC) -c $(CFLAGS) $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $<
+    @$(CP) $@ $@.obj
+{misc}.c.obj_tst:
+    @$(ECHO) compiling 32bit: $<
+    $(CC) -c $(CFLAGS) $(CDEFINES_TST) -Fa$(WIN32KLIST)\$(*B).s -Fo$(WIN32KOBJ)\$(@F) $(CINCLUDES) $<
+    @$(CP) $@ $@.obj
 
 {misc}.cpp{$(WIN32KOBJ)}.obj:
@@ -251,5 +308,5 @@
 all: pe2lx.exe
 !else
-all: $(WIN32KBIN)\$(NAME).sys pe2lx.exe
+all: $(WIN32KBIN)\$(NAME).sys pe2lx.exe kRx.exe lib Win32kCC.exe
 !endif
 
@@ -258,53 +315,114 @@
 # OBJECTS and LIBRARIES - Don't mess with the order or objects and libraries!
 ################################################################################
-OBJS  = $(WIN32KOBJ)\devfirst.obj \
-        $(WIN32KOBJ)\d16strat.obj \
-        $(WIN32KOBJ)\d32hlp.obj \
-        $(WIN32KOBJ)\d32globals.obj \
-        $(WIN32KOBJ)\d16globl.obj \
-        $(WIN32KOBJ)\asmutils.obj \
-        $(WIN32KOBJ)\calltab.obj \
-        $(WIN32KOBJ)\malloc.obj \
-        $(WIN32KOBJ)\smalloc_avl.obj \
-        $(WIN32KOBJ)\avl.obj \
-        $(WIN32KOBJ)\rmalloc_avl.obj \
-        $(WIN32KOBJ)\new.obj \
-        $(WIN32KOBJ)\stricmp.obj \
-        $(WIN32KOBJ)\yield.obj \
-        $(WIN32KOBJ)\vsprintf.obj \
-        $(WIN32KOBJ)\vprintf.obj \
-        $(WIN32KOBJ)\ldr.obj \
-        $(WIN32KOBJ)\myldrClose.obj \
-        $(WIN32KOBJ)\myldrOpen.obj \
-        $(WIN32KOBJ)\myldrRead.obj \
-        $(WIN32KOBJ)\myLDRQAppType.obj \
-        $(WIN32KOBJ)\myldrEnum32bitRelRecs.obj \
-        $(WIN32KOBJ)\pe2lx.obj \
-        $(WIN32KOBJ)\ModuleBase.obj \
-        $(WIN32KOBJ)\d32ElfIOCtl.obj \
-        $(WIN32KOBJ)\d32Win32kIOCtl.obj \
-        $(WIN32KOBJ)\k32AllocMemEx.obj \
-        $(WIN32KOBJ)\buffer.obj \
-        $(WIN32KOBJ)\mytkExecPgm.obj
-
-
-OBJSINIT = \
-        $(WIN32KOBJ)\d16init.obj \
-        $(WIN32KOBJ)\d32init.obj \
-        $(WIN32KOBJ)\ProbKrnl.obj \
-        $(WIN32KOBJ)\SymDB.obj \
-        $(WIN32KOBJ)\vprntf16.obj
-
-LIBS = \
-!if "$(CCENV)" == "VAC36"
-        $(VACPATH)\lib\cpprni36.lib \
-!else
-        $(VACPATH)\lib\cppon30.lib  \
-!endif
-        $(DDKPATH)\lib\os2286.lib
-
-LIBSINIT = \
-        $(WIN32KOBJ)\devhelp.lib \
-        $(WIN32KOBJ)\clib.lib
+OBJS  =\
+    $(WIN32KOBJ)\devfirst.obj \
+    $(WIN32KOBJ)\d16strat.obj \
+    $(WIN32KOBJ)\d32hlp.obj \
+    $(WIN32KOBJ)\d32globals.obj \
+    $(WIN32KOBJ)\d16globl.obj \
+    $(WIN32KOBJ)\asmutils.obj \
+    $(WIN32KOBJ)\calltab.obj \
+    $(WIN32KOBJ)\malloc.obj \
+    $(WIN32KOBJ)\smalloc_avl.obj \
+    $(WIN32KOBJ)\avl.obj \
+    $(WIN32KOBJ)\rmalloc_avl.obj \
+    $(WIN32KOBJ)\new.obj \
+    $(WIN32KOBJ)\env.obj \
+    $(WIN32KOBJ)\stricmp.obj \
+    $(WIN32KOBJ)\yield.obj \
+    $(WIN32KOBJ)\vsprintf.obj \
+    $(WIN32KOBJ)\vprintf.obj \
+    $(WIN32KOBJ)\ldr.obj \
+    $(WIN32KOBJ)\myldrClose.obj \
+    $(WIN32KOBJ)\myldrOpen.obj \
+    $(WIN32KOBJ)\myldrRead.obj \
+    $(WIN32KOBJ)\myLDRQAppType.obj \
+    $(WIN32KOBJ)\myldrEnum32bitRelRecs.obj \
+    $(WIN32KOBJ)\myldrOpenPath.obj \
+    $(WIN32KOBJ)\OS2KTCB.obj \
+    $(WIN32KOBJ)\OS2KPTDA.obj \
+    $(WIN32KOBJ)\pe2lx.obj \
+    $(WIN32KOBJ)\ModuleBase.obj \
+    $(WIN32KOBJ)\d32ElfIOCtl.obj \
+    $(WIN32KOBJ)\d32Win32kIOCtl.obj \
+    $(WIN32KOBJ)\k32AllocMemEx.obj \
+    $(WIN32KOBJ)\k32QueryOTEs.obj \
+    $(WIN32KOBJ)\k32QueryOptionsStatus.obj \
+    $(WIN32KOBJ)\k32SetOptions.obj \
+    $(WIN32KOBJ)\mytkExecPgm.obj \
+    $(WIN32KOBJ)\mytkStartProcess.obj \
+    $(WIN32KOBJ)\vprntf16.obj \
+    $(WIN32KOBJ)\d32init.obj \
+    $(WIN32KOBJ)\SymDB.obj \
+    $(WIN32KOBJ)\d16init.obj_init \
+    $(WIN32KOBJ)\ProbKrnl.obj_init
+
+LASTOBJ =\
+    $(WIN32KOBJ)\devlast.obj
+
+LIBS =\
+    $(VACLIB) \
+    $(DDKPATH)\lib\os2386.lib \
+    $(WIN32KOBJ)\devhelp.lib \
+    $(WIN32KOBJ)\clib.lib
+
+#
+# Win32ktst.exe object configuration
+#
+TSTOBJS =\
+    $(WIN32KOBJ)\devfirst.obj \
+    $(WIN32KOBJ)\$(NAME)tst.obj \
+    $(WIN32KOBJ)\dh.obj \
+    $(WIN32KOBJ)\dos.obj \
+    $(WIN32KOBJ)\dosa.obj \
+    $(WIN32KOBJ)\init.obj \
+    $(WIN32KOBJ)\fake.obj \
+    $(WIN32KOBJ)\fakea.obj \
+    $(WIN32KOBJ)\d16strat.obj \
+    $(WIN32KOBJ)\d32hlp.obj \
+    $(WIN32KOBJ)\d32globals.obj \
+    $(WIN32KOBJ)\d16globl.obj \
+    $(WIN32KOBJ)\asmutils.obj \
+    $(WIN32KOBJ)\calltab.obj \
+    $(WIN32KOBJ)\malloc.obj_tst \
+    $(WIN32KOBJ)\smalloc_avl.obj \
+    $(WIN32KOBJ)\avl.obj \
+    $(WIN32KOBJ)\rmalloc_avl.obj \
+    $(WIN32KOBJ)\new.obj \
+    $(WIN32KOBJ)\env.obj \
+    $(WIN32KOBJ)\stricmp.obj \
+    $(WIN32KOBJ)\yield.obj \
+    $(WIN32KOBJ)\vsprintf.obj \
+    $(WIN32KOBJ)\vprintf.obj_tst \
+    $(WIN32KOBJ)\ldr.obj \
+    $(WIN32KOBJ)\myldrClose.obj \
+    $(WIN32KOBJ)\myldrOpen.obj \
+    $(WIN32KOBJ)\myldrRead.obj \
+    $(WIN32KOBJ)\myLDRQAppType.obj \
+    $(WIN32KOBJ)\myldrEnum32bitRelRecs.obj \
+    $(WIN32KOBJ)\myldrOpenPath.obj \
+    $(WIN32KOBJ)\OS2KTCB.obj \
+    $(WIN32KOBJ)\OS2KPTDA.obj \
+    $(WIN32KOBJ)\pe2lx.obj \
+    $(WIN32KOBJ)\ModuleBase.obj \
+    $(WIN32KOBJ)\d32ElfIOCtl.obj \
+    $(WIN32KOBJ)\d32Win32kIOCtl.obj \
+    $(WIN32KOBJ)\k32AllocMemEx.obj \
+    $(WIN32KOBJ)\k32QueryOTEs.obj \
+    $(WIN32KOBJ)\k32QueryOptionsStatus.obj \
+    $(WIN32KOBJ)\k32SetOptions.obj \
+    $(WIN32KOBJ)\mytkExecPgm.obj \
+    $(WIN32KOBJ)\mytkStartProcess.obj \
+    $(WIN32KOBJ)\vprntf16.obj_tst \
+    $(WIN32KOBJ)\d32init.obj_tst \
+    $(WIN32KOBJ)\SymDB.obj \
+    $(WIN32KOBJ)\d16init.obj_tst_init \
+    $(WIN32KOBJ)\ProbKrnl.obj_tst_init
+
+TSTLASTOBJ = $(LASTOBJ)
+
+TSTLIBS = $(LIBS)
+
+
 
 
@@ -313,14 +431,15 @@
 ################################################################################
 Probkrnl.exe: $(WIN32KBIN)\ProbKrnl.exe
+    $(CP) $** $@
 $(WIN32KBIN)\ProbKrnl.exe: dev16\ProbKrnl.c dev16\symdb.c dev16\vprntf16.c \
               $(WIN32KINCLUDE)\sym.h \
               $(WIN32KINCLUDE)\probKrnl.h
-    $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \
+    $(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \
         -DDEBUG -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B)_p.s     \
         -Fo$(WIN32KOBJ)\probkrnl_p.obj $(CINCLUDES16) dev16\probkrnl.c
-    $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \
+    $(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \
         -DDEBUG -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B)_p.s     \
         -Fo$(WIN32KOBJ)\symdb_p.obj $(CINCLUDES16) dev16\symdb.c
-    $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \
+    $(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \
         -DDEBUG -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B)_p.s     \
         -Fo$(WIN32KOBJ)\vprntf16_p.obj $(CINCLUDES16) dev16\vprntf16.c
@@ -329,28 +448,23 @@
         $@, $(WIN32KBIN)\probkrnl.map, \
         $(TOOLKIT)\lib\os2286.lib + $(MSCPATH)\lib\clibcep.lib;
-    $(CP) $@
 
 extract.exe: $(WIN32KBIN)\extract.exe
+    $(CP) $** $@
 $(WIN32KBIN)\extract.exe: dev16\ProbKrnl.c dev16\vprntf16.c \
              $(WIN32KINCLUDE)\sym.h \
              $(WIN32KINCLUDE)\probKrnl.h
-    $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \
+    $(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \
         -DDEBUG -DEXTRACT -Fa$(WIN32KLIST)\$(*B)_e.s     \
         -Fo$(WIN32KOBJ)\probkrnl_e.obj $(CINCLUDES16) dev16\probkrnl.c
-    $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \
+    $(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \
         -DDEBUG -DEXTRACT -Fa$(WIN32KLIST)\$(*B)_e.s     \
         -Fo$(WIN32KOBJ)\vprntf16_e.obj $(CINCLUDES16) dev16\vprntf16.c
+    $(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \
+        -DDEBUG -DEXTRACT -Fa$(WIN32KLIST)\$(*B)_e.s     \
+        -Fo$(WIN32KOBJ)\d16globl_e.obj $(CINCLUDES16) dev16\d16globl.c
     link /NOD /MAP:FULL /CO /pmtype:vio \
-        $(WIN32KOBJ)\probkrnl_e.obj + $(WIN32KOBJ)\vprntf16_e.obj, \
+        $(WIN32KOBJ)\probkrnl_e.obj + $(WIN32KOBJ)\vprntf16_e.obj + $(WIN32KOBJ)\d16globl_e.obj, \
         $@, $(WIN32KBIN)\$(*B).map, \
         $(TOOLKIT)\lib\os2286.lib + $(MSCPATH)\lib\clibcep.lib;
-    $(CP) $@
-
-d32init.exe: $(WIN32KBIN)\d32init.exe
-$(WIN32KBIN)\d32init.exe: dev32\d32init.c
-    icc -Ti+ -Ss /Gr+ $(CINCLUDES) -DRING3 -DDEBUGR3 -DDEBUG \
-        -Fo$(WIN32KOBJ)\$(*B).r3obj -Fe$@ -Fm$(WIN32KBIN)\$(*B).map \
-        dev32\$(*B).c
-    $(CP) $@
 
 
@@ -360,19 +474,17 @@
 ################################################################################
 $(NAME).sys: $(WIN32KBIN)\$(NAME).sys
-$(WIN32KBIN)\$(NAME).sys: $(OBJS) $(LIBS) $(NAME).def \
-            $(WIN32KOBJ)\last.lib \
-            $(WIN32KOBJ)\init.lib \
-            $(LIBSINIT)
+$(WIN32KBIN)\$(NAME).sys: $(OBJS) $(LIBS) $(NAME).def $(LASTOBJ) $(LIBSINIT) makefile
     -@$(ECHO) linking: $@
-    $(LD) $(LFLAGS) @<<ole
+    -4 $(LD) $(LFLAGS) @<<$(WIN32KOBJ)\$(@B).lnk
 /OUT:$@
 /MAP:$(WIN32KBIN)\$(@B).map
-$(OBJS)
-$(LIBS)
-$(WIN32KOBJ)\last.lib
-$(WIN32KOBJ)\init.lib
-/IG $(LIBSINIT)
+$(OBJS:  =^
+)
+/IG
+$(LIBS:  =^
+)
+$(LASTOBJ)
 $(NAME).def
-<<keep
+<<KEEP
     cd $(WIN32KBIN)
     @mapsym $(*B).map > nul
@@ -384,4 +496,26 @@
 
 ################################################################################
+# Win32ktst.exe rule.
+################################################################################
+$(NAME)tst.exe: $(WIN32KBIN)\$(NAME)tst.exe
+    $(CP) $(WIN32KBIN)\$@ $@
+
+$(WIN32KBIN)\$(NAME)tst.exe: $(NAME)tst.def $(TSTOBJS) $(TSTLIBS) $(LASTOBJS) makefile
+    -@$(ECHO) linking: $@
+    -4 $(LD) $(LFLAGS) @<<$(WIN32KOBJ)\$(@B).lnk
+/DEBUG
+/OUT:$@
+/MAP:$(WIN32KBIN)\$(@B).map
+$(TSTOBJS:  =^
+)
+/IG
+$(TSTLIBS:  =^
+)
+$(LASTOBJ)
+$(NAME)tst.def
+<<KEEP
+
+
+################################################################################
 # Pe2Lx.exe rule
 ################################################################################
@@ -400,24 +534,72 @@
 
 ################################################################################
+# Win32k Control Center Rule.
+################################################################################
+Win32kCC.exe:
+    cd utils
+    $(MAKE_CMD)
+    cd ..
+
+################################################################################
+# kRx.EXE - Pure Rexx interpreter
+################################################################################
+kRx.exe:
+    cd rexx
+    $(MAKE_CMD)
+    cd ..
+
+################################################################################
 # Libraries - segments are renamed for the 16-bit libraries.
 ################################################################################
-$(WIN32KOBJ)\devhelp.lib: $(DDKPATH)\lib\dhcalls.lib $(WIN32KBIN)\libconv.exe
-    $(WIN32KBIN)\libconv $(DDKPATH)\lib\dhcalls.lib $@
-    $(ILIB) /nologo /nobackup /convformat $@;
-
-$(WIN32KOBJ)\clib.lib: $(MSCPATH)\lib\clibcep.lib $(WIN32KBIN)\libconv.exe
-    $(WIN32KBIN)\libconv $(MSCPATH)\lib\clibcep.lib $@ > nul
-    $(ILIB) /nologo /nobackup /convformat $@;
+DHLPOBJS =  +$(WIN32KOBJ)\dhcall5b.obj +$(WIN32KOBJ)\dhcal11a.obj \
+            +$(WIN32KOBJ)\dhcal11g.obj +$(WIN32KOBJ)\dhret.obj
+
+$(WIN32KOBJ)\devhelp.lib: $(DDKPATH)\lib\dhcalls.lib $(WIN32KBIN)\libconv.exe $(DHLPOBJS:+=)
+#!if "$(CCENV)" == "VAC36"
+    @$(RM) $@
+    @cd $(WIN32KOBJ)
+    $(DDKPATH)\tools\lib /nologo $@ $(DHLPOBJS);
+    @cd $(MAKEDIR)
+#!else
+#    $(WIN32KBIN)\libconv  $(DDKPATH)\lib\dhcalls.lib $@
+#!endif
+
+$(WIN32KOBJ)\devhelp_.lib: $(DDKPATH)\lib\dhcalls.lib
+    $(WIN32KBIN)\libconv $** $@
+
+$(DHLPOBJS:+=): $(WIN32KOBJ)\devhelp_.lib
+    @cd $(WIN32KOBJ)
+    $(DDKPATH)\tools\lib /nologo $** *$@;
+    @cd $(MAKEDIR)
+
+
+CLIBOBJS =  +$(WIN32KOBJ)\inp.obj       +$(WIN32KOBJ)\outp.obj \
+            +$(WIN32KOBJ)\anfalmul.obj  +$(WIN32KOBJ)\anfaldiv.obj \
+            +$(WIN32KOBJ)\anfalrem.obj  +$(WIN32KOBJ)\anfauldi.obj \
+            +$(WIN32KOBJ)\anuldiv.obj   +$(WIN32KOBJ)\fmemcpy.obj \
+            +$(WIN32KOBJ)\anulrem.obj   +$(WIN32KOBJ)\anlmul.obj \
+            +$(WIN32KOBJ)\__AHINCR.obj
+
+$(WIN32KOBJ)\clib.lib: $(MSCPATH)\lib\clibcep.lib $(WIN32KBIN)\libconv.exe $(CLIBOBJS:+=)
+    @$(RM) $@
+    @cd $(WIN32KOBJ)
+    $(DDKPATH)\tools\lib /nologo $@ $(CLIBOBJS);
+    @cd $(MAKEDIR)
+
+$(WIN32KOBJ)\clib_.lib: $(MSCPATH)\lib\clibcep.lib
+    $(WIN32KBIN)\libconv $** $@ > nul
+
+$(CLIBOBJS:+=): $(WIN32KOBJ)\clib_.lib
+    @cd $(WIN32KOBJ)
+    $(ILIB) $** *$@;
+    @cd $(MAKEDIR)
+
 
 $(WIN32KOBJ)\last.lib: $(WIN32KOBJ)\devlast.obj
     -@$(RM) $@ > nul 2> nul
-    $(ILIB) /nologo /nobackup $@ $**;
-
-$(WIN32KOBJ)\init.lib: $(OBJSINIT)
-    -@$(RM) $@ > nul 2> nul
-    $(ILIB) /nologo /nobackup $@ $**;
+    $(ILIB) $@ $**;
 
 $(WIN32KBIN)\libconv.exe: libconv.c
-    icc -Q+ -Fe$@ -Fo$(WIN32KOBJ)\$(*B).obj libconv.c
+    icc -Q+ -Ti+ -Fe$@ -Fo$(WIN32KOBJ)\$(*B).obj libconv.c
 
 
@@ -426,12 +608,13 @@
 ################################################################################
 lxdoc:
-   exp cpp2sds -o DocsA\ -i include\lx.h pe2lx\lx*.cpp
-   cd Docs
-   exp sds2doc -ai *.sds
+    cpp2sds -o DocsA\ -i include\modulebase.h include\pe2lx.h ldr\modulebase.cpp \
+        pe2lx\pe2lx.cpp
+    cd DocsA
+    exp sds2doc -ai *.sds
 
 fulldoc:
-   exp cpp2sds -o DocsA\ -i include\*.h *.cpp ldr\*.cpp misc\*.cpp pe2lx\*.cpp
-   cd Docs
-   exp sds2doc -ai *.sds
+    exp cpp2sds -o DocsA\ -i include\*.h *.cpp ldr\*.cpp misc\*.cpp pe2lx\*.cpp
+    cd DocsA
+    exp sds2doc -ai *.sds
 
 #################################################################################
@@ -454,5 +637,6 @@
 !endif
 !if "$(WIN32KOBJ)" != ""
-    $(RM) $(WIN32KOBJ)\*obj $(WIN32KOBJ)\*lib $(WIN32KOBJ)\*pch
+    $(RM) $(WIN32KOBJ)\*obj $(WIN32KOBJ)\*lib $(WIN32KOBJ)\*pch \
+        $(WIN32KOBJ)\*.obj_tst
 !endif
 !if "$(WIN32KLIST)" != ""
@@ -472,9 +656,11 @@
 dep:
     $(PDWIN32_TOOLS)\fastdep -o$$(WIN32KOBJ) $(CINCLUDES) misc\*.c* ldr\*.c* \
-        dev32\*.c* pe2lx\*.c* k32\*.c* lib\*.c elf2lx\*.c* \
+        dev32\*.c* pe2lx\*.c* k32\*.c* lib\*.c elf2lx\*.c* test\*.c* \
         $(WIN32KINCLUDE)\*.h
+    $(PDWIN32_TOOLS)\fastdep -a+ -objobj_tst -o$$(WIN32KOBJ) $(CINCLUDES) misc\*.c* ldr\*.c* \
+        dev32\*.c* pe2lx\*.c* k32\*.c* lib\*.c elf2lx\*.c* test\*.c*
     $(PDWIN32_TOOLS)\fastdep -a+ -o$$(WIN32KOBJ) $(CINCLUDES16) dev16\*.c*
     $(PDWIN32_TOOLS)\fastdep -a+ -o$$(WIN32KOBJ) -I$(WIN32KINCLUDE) \
-        -I$(DDKPATH)\inc dev32\*.asm ldr\*.asm misc\*.asm include\*.inc
+        -I$(DDKPATH)\inc dev32\*.asm ldr\*.asm misc\*.asm test\*.asm include\*.inc
     cd pe2lx
     $(MAKE_CMD) dep
@@ -494,20 +680,2 @@
 !endif
 
-
-################################################################################
-# Create output directories.
-################################################################################
-!if [mkdir bin > nul 2>&1]
-!endif
-!if [mkdir $(WIN32KBIN) > nul 2>&1]
-!endif
-!if [mkdir list > nul 2>&1]
-!endif
-!if [mkdir $(WIN32KLIST) > nul 2>&1]
-!endif
-!if [mkdir object > nul 2>&1]
-!endif
-!if [mkdir $(WIN32KOBJ) > nul 2>&1]
-!endif
-
-
Index: trunk/src/win32k/configure.cmd
===================================================================
--- trunk/src/win32k/configure.cmd	(revision 4152)
+++ trunk/src/win32k/configure.cmd	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: configure.cmd,v 1.10 2000-03-08 09:23:04 bird Exp $
+/* $Id: configure.cmd,v 1.11 2000-09-02 21:07:53 bird Exp $
  *
  * Configuration script.
@@ -105,4 +105,22 @@
         call stream sIncFile, 'c', 'close';
 
+        /*
+         * Create output directories.
+         */
+        'mkdir Bin > nul 2> nul'
+        'mkdir Bin\Release > nul 2> nul'
+        'mkdir Bin\Debug > nul 2> nul'
+
+        'mkdir List > nul 2> nul'
+        'mkdir List\Release > nul 2> nul'
+        'mkdir List\Debug > nul 2> nul'
+
+        'mkdir Object > nul 2> nul'
+        'mkdir Object\Debug > nul 2> nul'
+        'mkdir Object\Release > nul 2> nul'
+
+        /*
+         * Display output.
+         */
         if (fInteractive = 1) then
         do
Index: trunk/src/win32k/dev16/SymDB.c
===================================================================
--- trunk/src/win32k/dev16/SymDB.c	(revision 4152)
+++ trunk/src/win32k/dev16/SymDB.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: SymDB.c,v 1.3 2000-04-05 18:40:37 bird Exp $
+/* $Id: SymDB.c,v 1.4 2000-09-02 21:07:54 bird Exp $
 *
 * Autogenerated kernel symbol database.
@@ -12,9 +12,208 @@
 #define INCL_NOBASEAPI
 #include <os2.h>
+#include "devSegDf.h"
 #include "probkrnl.h"
-KRNLDBENTRY aKrnlSymDB[] = 
+#include "options.h"
+
+KRNLDBENTRY DATA16_INIT aKrnlSymDB[] =
 {
+#ifdef ALLKERNELS
+    { /* 14039AS.SYM */
+        14039, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000a0b8}, /* _ldrRead */
+            {16, 0x00075c40}, /* _ldrOpen */
+            {16, 0x00077130}, /* _ldrClose */
+            {16, 0x00077215}, /* _LDRQAppType */
+            {16, 0x00072c10}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00006188}, /* _IOSftOpen */
+            {16, 0x00006a90}, /* _IOSftClose */
+            {16, 0x00006b8c}, /* _IOSftTransPath */
+            {16, 0x0000666c}, /* _IOSftReadAt */
+            {16, 0x00006673}, /* _IOSftWriteAt */
+            {16, 0x00006cc4}, /* _SftFileSize */
+            {16, 0x00070a40}, /* _VMAllocMem */
+            {16, 0x0005e4b3}, /* _VMGetOwner */
+            {16, 0x000824c0}, /* g_tkExecPgm */
+            {16, 0x0007ad58}, /* _tkStartProcess */
+            {13, 0x0000aca8}, /* f_FuStrLenZ */
+            {13, 0x0000ac28}, /* f_FuStrLen */
+            {13, 0x0000ae74}, /* f_FuBuff */
+            {16, 0x00058490}, /* _VMObjHandleInfo */
+            {16, 0x00083510}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00075fc0}, /* _ldrOpenPath */
+            {16, 0x000701d0}, /* _LDRClearSem */
+            {16, 0x0007b7f3}, /* _ldrFindModule */
+            {16, 0x0000e470}, /* _KSEMRequestMutex */
+            {16, 0x0000e584}, /* _KSEMReleaseMutex */
+            {16, 0x0000e5e4}, /* _KSEMQueryMutex */
+            {16, 0x0000e968}, /* _KSEMInit */
+            {11, 0x0002c940}, /* _LdrSem */
+            {11, 0x0002c9d4}, /* _LDRLibPath */
+            {16, 0x00067924}, /* _TKSuBuff */
+            {16, 0x00041620}, /* _TKFuBuff */
+            {16, 0x00041371}, /* _TKFuBufLen */
+            {16, 0x000701a0}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {5 , 0x0000f884}, /* ptda_start */
+            {5 , 0x0000f99e}, /* ptda_environ */
+            {5 , 0x0000fea8}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9a0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002e80c}, /* _ldrpFileNameBuf */
+            {16, 0x0006d6c0}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14039AU.SYM */
+        14039, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x000087a8}, /* _ldrRead */
+            {15, 0x0006a810}, /* _ldrOpen */
+            {15, 0x0006bc40}, /* _ldrClose */
+            {15, 0x0006bd25}, /* _LDRQAppType */
+            {15, 0x00067ae0}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00005158}, /* _IOSftOpen */
+            {15, 0x000059c4}, /* _IOSftClose */
+            {15, 0x00005aa0}, /* _IOSftTransPath */
+            {15, 0x000055f8}, /* _IOSftReadAt */
+            {15, 0x000055ff}, /* _IOSftWriteAt */
+            {15, 0x00005bc8}, /* _SftFileSize */
+            {15, 0x00065af0}, /* _VMAllocMem */
+            {15, 0x00052ef3}, /* _VMGetOwner */
+            {15, 0x00076140}, /* g_tkExecPgm */
+            {15, 0x0006f250}, /* _tkStartProcess */
+            {11, 0x0000f838}, /* f_FuStrLenZ */
+            {11, 0x0000f7ec}, /* f_FuStrLen */
+            {11, 0x0000f954}, /* f_FuBuff */
+            {15, 0x0004d127}, /* _VMObjHandleInfo */
+            {15, 0x00076fe0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0006ab90}, /* _ldrOpenPath */
+            {15, 0x000652f0}, /* _LDRClearSem */
+            {15, 0x0006fc83}, /* _ldrFindModule */
+            {15, 0x0000c20c}, /* _KSEMRequestMutex */
+            {15, 0x0000c320}, /* _KSEMReleaseMutex */
+            {15, 0x0000c380}, /* _KSEMQueryMutex */
+            {15, 0x0000c704}, /* _KSEMInit */
+            {10, 0x0002c63c}, /* _LdrSem */
+            {10, 0x0002c6d0}, /* _LDRLibPath */
+            {15, 0x0005d6d4}, /* _TKSuBuff */
+            {15, 0x00037c71}, /* _TKFuBuff */
+            {15, 0x00037a10}, /* _TKFuBufLen */
+            {15, 0x000652c0}, /* _ldrValidateMteHandle */
+            {10, 0x0002bf90}, /* _pTCBCur */
+            {10, 0x0002bf8c}, /* _pPTDACur */
+            {4 , 0x0000f89c}, /* ptda_start */
+            {4 , 0x0000f9b6}, /* ptda_environ */
+            {4 , 0x0000fec0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9b8}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002e62c}, /* _ldrpFileNameBuf */
+            {15, 0x00062c40}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14039HS.SYM */
+        14039, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x00008fd8}, /* _ldrRead */
+            {16, 0x00063a80}, /* _ldrOpen */
+            {16, 0x00064e20}, /* _ldrClose */
+            {16, 0x00064f05}, /* _LDRQAppType */
+            {16, 0x00061030}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005308}, /* _IOSftOpen */
+            {16, 0x00005c01}, /* _IOSftClose */
+            {16, 0x00005cfc}, /* _IOSftTransPath */
+            {16, 0x000057e0}, /* _IOSftReadAt */
+            {16, 0x000057e7}, /* _IOSftWriteAt */
+            {16, 0x00005e26}, /* _SftFileSize */
+            {16, 0x0005f410}, /* _VMAllocMem */
+            {16, 0x0004f30b}, /* _VMGetOwner */
+            {16, 0x0006efde}, /* g_tkExecPgm */
+            {16, 0x00068511}, /* _tkStartProcess */
+            {13, 0x00009ef0}, /* f_FuStrLenZ */
+            {13, 0x00009e70}, /* f_FuStrLen */
+            {13, 0x0000a099}, /* f_FuBuff */
+            {16, 0x0004b024}, /* _VMObjHandleInfo */
+            {16, 0x0006fec0}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00063dc0}, /* _ldrOpenPath */
+            {16, 0x0005ee60}, /* _LDRClearSem */
+            {16, 0x00068f53}, /* _ldrFindModule */
+            {16, 0x0000cf60}, /* _KSEMRequestMutex */
+            {16, 0x0000d037}, /* _KSEMReleaseMutex */
+            {16, 0x0000d062}, /* _KSEMQueryMutex */
+            {16, 0x0000d302}, /* _KSEMInit */
+            {11, 0x0001d838}, /* _LdrSem */
+            {11, 0x0001d8c0}, /* _LDRLibPath */
+            {16, 0x00057427}, /* _TKSuBuff */
+            {16, 0x00038a10}, /* _TKFuBuff */
+            {16, 0x000387a1}, /* _TKFuBufLen */
+            {16, 0x0005ee30}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {5 , 0x0000f890}, /* ptda_start */
+            {5 , 0x0000f9aa}, /* ptda_environ */
+            {5 , 0x0000feb4}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9ac}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001ed44}, /* _ldrpFileNameBuf */
+            {16, 0x0005c980}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14039HU.SYM */
+        14039, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00007a54}, /* _ldrRead */
+            {15, 0x00059380}, /* _ldrOpen */
+            {15, 0x0005a650}, /* _ldrClose */
+            {15, 0x0005a735}, /* _LDRQAppType */
+            {15, 0x00056c10}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004618}, /* _IOSftOpen */
+            {15, 0x00004e74}, /* _IOSftClose */
+            {15, 0x00004f4d}, /* _IOSftTransPath */
+            {15, 0x00004aac}, /* _IOSftReadAt */
+            {15, 0x00004ab3}, /* _IOSftWriteAt */
+            {15, 0x00005066}, /* _SftFileSize */
+            {15, 0x000551d0}, /* _VMAllocMem */
+            {15, 0x000448eb}, /* _VMGetOwner */
+            {15, 0x000639be}, /* g_tkExecPgm */
+            {15, 0x0005d76b}, /* _tkStartProcess */
+            {11, 0x0000e640}, /* f_FuStrLenZ */
+            {11, 0x0000e5f6}, /* f_FuStrLen */
+            {11, 0x0000e738}, /* f_FuBuff */
+            {15, 0x00040813}, /* _VMObjHandleInfo */
+            {15, 0x00064710}, /* _ldrASMpMTEFromHandle */
+            {15, 0x000596c0}, /* _ldrOpenPath */
+            {15, 0x00054c80}, /* _LDRClearSem */
+            {15, 0x0005e143}, /* _ldrFindModule */
+            {15, 0x0000b178}, /* _KSEMRequestMutex */
+            {15, 0x0000b24f}, /* _KSEMReleaseMutex */
+            {15, 0x0000b27a}, /* _KSEMQueryMutex */
+            {15, 0x0000b51a}, /* _KSEMInit */
+            {10, 0x0001e2ac}, /* _LdrSem */
+            {10, 0x0001e334}, /* _LDRLibPath */
+            {15, 0x0004dee9}, /* _TKSuBuff */
+            {15, 0x0002fa00}, /* _TKFuBuff */
+            {15, 0x0002f7e0}, /* _TKFuBufLen */
+            {15, 0x00054c50}, /* _ldrValidateMteHandle */
+            {10, 0x0001dca4}, /* _pTCBCur */
+            {10, 0x0001dca0}, /* _pPTDACur */
+            {4 , 0x0000f8a4}, /* ptda_start */
+            {4 , 0x0000f9be}, /* ptda_environ */
+            {4 , 0x0000fec8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001f7c4}, /* _ldrpFileNameBuf */
+            {15, 0x00052bb0}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 14039RS.SYM */
-        14039, 'R', TYPE_SMP, 15,
+        14039, KF_SMP, 15,
         {
             {14, 0x00008390}, /* _ldrRead */
@@ -32,11 +231,36 @@
             {14, 0x0004ce4b}, /* _VMGetOwner */
             {14, 0x0006ca7e}, /* g_tkExecPgm */
+            {14, 0x00065fc1}, /* _tkStartProcess */
             {11, 0x00009e10}, /* f_FuStrLenZ */
             {11, 0x00009d90}, /* f_FuStrLen */
             {11, 0x00009fb9}, /* f_FuBuff */
+            {14, 0x00048b64}, /* _VMObjHandleInfo */
+            {14, 0x0006d960}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00061870}, /* _ldrOpenPath */
+            {14, 0x0005c910}, /* _LDRClearSem */
+            {14, 0x000669f3}, /* _ldrFindModule */
+            {14, 0x0000c20c}, /* _KSEMRequestMutex */
+            {14, 0x0000c29f}, /* _KSEMReleaseMutex */
+            {14, 0x0000c2ca}, /* _KSEMQueryMutex */
+            {14, 0x0000c4df}, /* _KSEMInit */
+            {9 , 0x0000d298}, /* _LdrSem */
+            {9 , 0x0000d320}, /* _LDRLibPath */
+            {14, 0x00054ed3}, /* _TKSuBuff */
+            {14, 0x00036680}, /* _TKFuBuff */
+            {14, 0x00036411}, /* _TKFuBufLen */
+            {14, 0x0005c8e0}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {3 , 0x0000f890}, /* ptda_start */
+            {3 , 0x0000f9aa}, /* ptda_environ */
+            {3 , 0x0000feb4}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9ac}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000e794}, /* _ldrpFileNameBuf */
+            {14, 0x0005a430}, /* SecPathFromSFN */
         }
     },
     { /* 14039RU.SYM */
-        14039, 'R', TYPE_UNI, 14,
+        14039, KF_UNI, 14,
         {
             {13, 0x000070e4}, /* _ldrRead */
@@ -54,11 +278,330 @@
             {13, 0x00042dcb}, /* _VMGetOwner */
             {13, 0x00061dde}, /* g_tkExecPgm */
-            {9, 0x0000e640}, /* f_FuStrLenZ */
-            {9, 0x0000e5f6}, /* f_FuStrLen */
-            {9, 0x0000e738}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0005bbab}, /* _tkStartProcess */
+            {9 , 0x0000e640}, /* f_FuStrLenZ */
+            {9 , 0x0000e5f6}, /* f_FuStrLen */
+            {9 , 0x0000e738}, /* f_FuBuff */
+            {13, 0x0003ecf3}, /* _VMObjHandleInfo */
+            {13, 0x00062b30}, /* _ldrASMpMTEFromHandle */
+            {13, 0x00057b10}, /* _ldrOpenPath */
+            {13, 0x000530d0}, /* _LDRClearSem */
+            {13, 0x0005c563}, /* _ldrFindModule */
+            {13, 0x0000a760}, /* _KSEMRequestMutex */
+            {13, 0x0000a7f3}, /* _KSEMReleaseMutex */
+            {13, 0x0000a81e}, /* _KSEMQueryMutex */
+            {13, 0x0000aa33}, /* _KSEMInit */
+            {8 , 0x0000dd20}, /* _LdrSem */
+            {8 , 0x0000dda8}, /* _LDRLibPath */
+            {13, 0x0004c335}, /* _TKSuBuff */
+            {13, 0x0002e010}, /* _TKFuBuff */
+            {13, 0x0002ddf0}, /* _TKFuBufLen */
+            {13, 0x000530a0}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d714}, /* _pTCBCur */
+            {8 , 0x0000d710}, /* _pPTDACur */
+            {2 , 0x0000f8a4}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f228}, /* _ldrpFileNameBuf */
+            {13, 0x00051000}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 14040A4.SYM */
+        14040, KF_UNI | KF_W4 | KF_ALLSTRICT, 16,
+        {
+            {15, 0x00008744}, /* _ldrRead */
+            {15, 0x0006a6d0}, /* _ldrOpen */
+            {15, 0x0006bb00}, /* _ldrClose */
+            {15, 0x0006bbe5}, /* _LDRQAppType */
+            {15, 0x000679a0}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00005158}, /* _IOSftOpen */
+            {15, 0x000059c4}, /* _IOSftClose */
+            {15, 0x00005aa0}, /* _IOSftTransPath */
+            {15, 0x000055f8}, /* _IOSftReadAt */
+            {15, 0x000055ff}, /* _IOSftWriteAt */
+            {15, 0x00005bc8}, /* _SftFileSize */
+            {15, 0x000659d0}, /* _VMAllocMem */
+            {15, 0x00052ee3}, /* _VMGetOwner */
+            {15, 0x00076050}, /* g_tkExecPgm */
+            {15, 0x0006f100}, /* _tkStartProcess */
+            {11, 0x0000f938}, /* f_FuStrLenZ */
+            {11, 0x0000f8ec}, /* f_FuStrLen */
+            {11, 0x0000fa54}, /* f_FuBuff */
+            {15, 0x0004d0d7}, /* _VMObjHandleInfo */
+            {15, 0x00076ef0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0006aa50}, /* _ldrOpenPath */
+            {15, 0x000651d0}, /* _LDRClearSem */
+            {15, 0x0006fb33}, /* _ldrFindModule */
+            {15, 0x0000c31c}, /* _KSEMRequestMutex */
+            {15, 0x0000c430}, /* _KSEMReleaseMutex */
+            {15, 0x0000c490}, /* _KSEMQueryMutex */
+            {15, 0x0000c814}, /* _KSEMInit */
+            {10, 0x0002b654}, /* _LdrSem */
+            {10, 0x0002b6e8}, /* _LDRLibPath */
+            {15, 0x0005d6f4}, /* _TKSuBuff */
+            {15, 0x00037c91}, /* _TKFuBuff */
+            {15, 0x00037a30}, /* _TKFuBufLen */
+            {15, 0x000651a0}, /* _ldrValidateMteHandle */
+            {10, 0x0002afa8}, /* _pTCBCur */
+            {10, 0x0002afa4}, /* _pPTDACur */
+            {4 , 0x0000f898}, /* ptda_start */
+            {4 , 0x0000f9b6}, /* ptda_environ */
+            {4 , 0x0000fec0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9b8}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002d614}, /* _ldrpFileNameBuf */
+            {15, 0x00062b20}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14040AS.SYM */
+        14040, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000a054}, /* _ldrRead */
+            {16, 0x00075c00}, /* _ldrOpen */
+            {16, 0x000770f0}, /* _ldrClose */
+            {16, 0x000771d5}, /* _LDRQAppType */
+            {16, 0x00072be0}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00006188}, /* _IOSftOpen */
+            {16, 0x00006a90}, /* _IOSftClose */
+            {16, 0x00006b8c}, /* _IOSftTransPath */
+            {16, 0x0000666c}, /* _IOSftReadAt */
+            {16, 0x00006673}, /* _IOSftWriteAt */
+            {16, 0x00006cc4}, /* _SftFileSize */
+            {16, 0x00070a30}, /* _VMAllocMem */
+            {16, 0x0005e583}, /* _VMGetOwner */
+            {16, 0x000824c0}, /* g_tkExecPgm */
+            {16, 0x0007ad08}, /* _tkStartProcess */
+            {13, 0x0000aca0}, /* f_FuStrLenZ */
+            {13, 0x0000ac20}, /* f_FuStrLen */
+            {13, 0x0000ae6c}, /* f_FuBuff */
+            {16, 0x000584f0}, /* _VMObjHandleInfo */
+            {16, 0x00083510}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00075f80}, /* _ldrOpenPath */
+            {16, 0x000701c0}, /* _LDRClearSem */
+            {16, 0x0007b7a3}, /* _ldrFindModule */
+            {16, 0x0000e580}, /* _KSEMRequestMutex */
+            {16, 0x0000e694}, /* _KSEMReleaseMutex */
+            {16, 0x0000e6f4}, /* _KSEMQueryMutex */
+            {16, 0x0000ea78}, /* _KSEMInit */
+            {11, 0x0002b9b0}, /* _LdrSem */
+            {11, 0x0002ba44}, /* _LDRLibPath */
+            {16, 0x00067a44}, /* _TKSuBuff */
+            {16, 0x00041710}, /* _TKFuBuff */
+            {16, 0x00041461}, /* _TKFuBufLen */
+            {16, 0x00070190}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {5 , 0x0000f880}, /* ptda_start */
+            {5 , 0x0000f99e}, /* ptda_environ */
+            {5 , 0x0000fea8}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9a0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002d854}, /* _ldrpFileNameBuf */
+            {16, 0x0006d6c0}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14040AU.SYM */
+        14040, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x00008744}, /* _ldrRead */
+            {15, 0x0006a740}, /* _ldrOpen */
+            {15, 0x0006bb70}, /* _ldrClose */
+            {15, 0x0006bc55}, /* _LDRQAppType */
+            {15, 0x00067a10}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00005158}, /* _IOSftOpen */
+            {15, 0x000059c4}, /* _IOSftClose */
+            {15, 0x00005aa0}, /* _IOSftTransPath */
+            {15, 0x000055f8}, /* _IOSftReadAt */
+            {15, 0x000055ff}, /* _IOSftWriteAt */
+            {15, 0x00005bc8}, /* _SftFileSize */
+            {15, 0x00065a40}, /* _VMAllocMem */
+            {15, 0x00052f53}, /* _VMGetOwner */
+            {15, 0x000760c0}, /* g_tkExecPgm */
+            {15, 0x0006f170}, /* _tkStartProcess */
+            {11, 0x0000f938}, /* f_FuStrLenZ */
+            {11, 0x0000f8ec}, /* f_FuStrLen */
+            {11, 0x0000fa54}, /* f_FuBuff */
+            {15, 0x0004d147}, /* _VMObjHandleInfo */
+            {15, 0x00076f60}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0006aac0}, /* _ldrOpenPath */
+            {15, 0x00065240}, /* _LDRClearSem */
+            {15, 0x0006fba3}, /* _ldrFindModule */
+            {15, 0x0000c31c}, /* _KSEMRequestMutex */
+            {15, 0x0000c430}, /* _KSEMReleaseMutex */
+            {15, 0x0000c490}, /* _KSEMQueryMutex */
+            {15, 0x0000c814}, /* _KSEMInit */
+            {10, 0x0002b68c}, /* _LdrSem */
+            {10, 0x0002b720}, /* _LDRLibPath */
+            {15, 0x0005d764}, /* _TKSuBuff */
+            {15, 0x00037d01}, /* _TKFuBuff */
+            {15, 0x00037aa0}, /* _TKFuBufLen */
+            {15, 0x00065210}, /* _ldrValidateMteHandle */
+            {10, 0x0002afe0}, /* _pTCBCur */
+            {10, 0x0002afdc}, /* _pPTDACur */
+            {4 , 0x0000f898}, /* ptda_start */
+            {4 , 0x0000f9b6}, /* ptda_environ */
+            {4 , 0x0000fec0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9b8}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002d64c}, /* _ldrpFileNameBuf */
+            {15, 0x00062b90}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14040H4.SYM */
+        14040, KF_UNI | KF_W4 | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00007a4c}, /* _ldrRead */
+            {15, 0x00059260}, /* _ldrOpen */
+            {15, 0x0005a530}, /* _ldrClose */
+            {15, 0x0005a615}, /* _LDRQAppType */
+            {15, 0x00056af0}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004618}, /* _IOSftOpen */
+            {15, 0x00004e74}, /* _IOSftClose */
+            {15, 0x00004f4d}, /* _IOSftTransPath */
+            {15, 0x00004aac}, /* _IOSftReadAt */
+            {15, 0x00004ab3}, /* _IOSftWriteAt */
+            {15, 0x00005066}, /* _SftFileSize */
+            {15, 0x000550d0}, /* _VMAllocMem */
+            {15, 0x0004491b}, /* _VMGetOwner */
+            {15, 0x000638ee}, /* g_tkExecPgm */
+            {15, 0x0005d63b}, /* _tkStartProcess */
+            {11, 0x0000e74c}, /* f_FuStrLenZ */
+            {11, 0x0000e702}, /* f_FuStrLen */
+            {11, 0x0000e845}, /* f_FuBuff */
+            {15, 0x00040823}, /* _VMObjHandleInfo */
+            {15, 0x00064640}, /* _ldrASMpMTEFromHandle */
+            {15, 0x000595a0}, /* _ldrOpenPath */
+            {15, 0x00054b80}, /* _LDRClearSem */
+            {15, 0x0005e013}, /* _ldrFindModule */
+            {15, 0x0000b2ec}, /* _KSEMRequestMutex */
+            {15, 0x0000b3c3}, /* _KSEMReleaseMutex */
+            {15, 0x0000b3ee}, /* _KSEMQueryMutex */
+            {15, 0x0000b68e}, /* _KSEMInit */
+            {10, 0x0001e348}, /* _LdrSem */
+            {10, 0x0001e3d0}, /* _LDRLibPath */
+            {15, 0x0004df49}, /* _TKSuBuff */
+            {15, 0x0002fab0}, /* _TKFuBuff */
+            {15, 0x0002f890}, /* _TKFuBufLen */
+            {15, 0x00054b50}, /* _ldrValidateMteHandle */
+            {10, 0x0001dd40}, /* _pTCBCur */
+            {10, 0x0001dd3c}, /* _pPTDACur */
+            {4 , 0x0000f8a0}, /* ptda_start */
+            {4 , 0x0000f9be}, /* ptda_environ */
+            {4 , 0x0000fec8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001f838}, /* _ldrpFileNameBuf */
+            {15, 0x00052ab0}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14040HS.SYM */
+        14040, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x00008fd4}, /* _ldrRead */
+            {16, 0x00063af0}, /* _ldrOpen */
+            {16, 0x00064e90}, /* _ldrClose */
+            {16, 0x00064f75}, /* _LDRQAppType */
+            {16, 0x000610a0}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005308}, /* _IOSftOpen */
+            {16, 0x00005c01}, /* _IOSftClose */
+            {16, 0x00005cfc}, /* _IOSftTransPath */
+            {16, 0x000057e0}, /* _IOSftReadAt */
+            {16, 0x000057e7}, /* _IOSftWriteAt */
+            {16, 0x00005e26}, /* _SftFileSize */
+            {16, 0x0005f4a0}, /* _VMAllocMem */
+            {16, 0x0004f44b}, /* _VMGetOwner */
+            {16, 0x0006f08e}, /* g_tkExecPgm */
+            {16, 0x00068571}, /* _tkStartProcess */
+            {13, 0x00009eec}, /* f_FuStrLenZ */
+            {13, 0x00009e6c}, /* f_FuStrLen */
+            {13, 0x0000a096}, /* f_FuBuff */
+            {16, 0x0004b104}, /* _VMObjHandleInfo */
+            {16, 0x0006ff70}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00063e30}, /* _ldrOpenPath */
+            {16, 0x0005eef0}, /* _LDRClearSem */
+            {16, 0x00068fb3}, /* _ldrFindModule */
+            {16, 0x0000d0d8}, /* _KSEMRequestMutex */
+            {16, 0x0000d1af}, /* _KSEMReleaseMutex */
+            {16, 0x0000d1da}, /* _KSEMQueryMutex */
+            {16, 0x0000d47a}, /* _KSEMInit */
+            {11, 0x0001d8d4}, /* _LdrSem */
+            {11, 0x0001d95c}, /* _LDRLibPath */
+            {16, 0x000575b7}, /* _TKSuBuff */
+            {16, 0x00038b90}, /* _TKFuBuff */
+            {16, 0x00038921}, /* _TKFuBufLen */
+            {16, 0x0005eec0}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {5 , 0x0000f88c}, /* ptda_start */
+            {5 , 0x0000f9aa}, /* ptda_environ */
+            {5 , 0x0000feb4}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9ac}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001edb8}, /* _ldrpFileNameBuf */
+            {16, 0x0005ca00}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 14040HU.SYM */
+        14040, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00007a4c}, /* _ldrRead */
+            {15, 0x000592d0}, /* _ldrOpen */
+            {15, 0x0005a5a0}, /* _ldrClose */
+            {15, 0x0005a685}, /* _LDRQAppType */
+            {15, 0x00056b60}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004618}, /* _IOSftOpen */
+            {15, 0x00004e74}, /* _IOSftClose */
+            {15, 0x00004f4d}, /* _IOSftTransPath */
+            {15, 0x00004aac}, /* _IOSftReadAt */
+            {15, 0x00004ab3}, /* _IOSftWriteAt */
+            {15, 0x00005066}, /* _SftFileSize */
+            {15, 0x00055140}, /* _VMAllocMem */
+            {15, 0x0004498b}, /* _VMGetOwner */
+            {15, 0x0006395e}, /* g_tkExecPgm */
+            {15, 0x0005d6ab}, /* _tkStartProcess */
+            {11, 0x0000e74c}, /* f_FuStrLenZ */
+            {11, 0x0000e702}, /* f_FuStrLen */
+            {11, 0x0000e845}, /* f_FuBuff */
+            {15, 0x00040893}, /* _VMObjHandleInfo */
+            {15, 0x000646b0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00059610}, /* _ldrOpenPath */
+            {15, 0x00054bf0}, /* _LDRClearSem */
+            {15, 0x0005e083}, /* _ldrFindModule */
+            {15, 0x0000b2ec}, /* _KSEMRequestMutex */
+            {15, 0x0000b3c3}, /* _KSEMReleaseMutex */
+            {15, 0x0000b3ee}, /* _KSEMQueryMutex */
+            {15, 0x0000b68e}, /* _KSEMInit */
+            {10, 0x0001e348}, /* _LdrSem */
+            {10, 0x0001e3d0}, /* _LDRLibPath */
+            {15, 0x0004dfb9}, /* _TKSuBuff */
+            {15, 0x0002fb20}, /* _TKFuBuff */
+            {15, 0x0002f900}, /* _TKFuBufLen */
+            {15, 0x00054bc0}, /* _ldrValidateMteHandle */
+            {10, 0x0001dd40}, /* _pTCBCur */
+            {10, 0x0001dd3c}, /* _pPTDACur */
+            {4 , 0x0000f8a0}, /* ptda_start */
+            {4 , 0x0000f9be}, /* ptda_environ */
+            {4 , 0x0000fec8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001f838}, /* _ldrpFileNameBuf */
+            {15, 0x00052b20}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 14040R4.SYM */
-        14040, 'R', TYPE_W4, 14,
+        14040, KF_UNI | KF_W4, 14,
         {
             {13, 0x000070dc}, /* _ldrRead */
@@ -76,11 +619,463 @@
             {13, 0x00042ecb}, /* _VMGetOwner */
             {13, 0x00061dde}, /* g_tkExecPgm */
-            {9, 0x0000e74c}, /* f_FuStrLenZ */
-            {9, 0x0000e702}, /* f_FuStrLen */
-            {9, 0x0000e845}, /* f_FuBuff */
+            {13, 0x0005bb4b}, /* _tkStartProcess */
+            {9 , 0x0000e74c}, /* f_FuStrLenZ */
+            {9 , 0x0000e702}, /* f_FuStrLen */
+            {9 , 0x0000e845}, /* f_FuBuff */
+            {13, 0x0003edd3}, /* _VMObjHandleInfo */
+            {13, 0x00062b30}, /* _ldrASMpMTEFromHandle */
+            {13, 0x00057ac0}, /* _ldrOpenPath */
+            {13, 0x000530a0}, /* _LDRClearSem */
+            {13, 0x0005c503}, /* _ldrFindModule */
+            {13, 0x0000a8d4}, /* _KSEMRequestMutex */
+            {13, 0x0000a967}, /* _KSEMReleaseMutex */
+            {13, 0x0000a992}, /* _KSEMQueryMutex */
+            {13, 0x0000aba7}, /* _KSEMInit */
+            {8 , 0x0000dd2c}, /* _LdrSem */
+            {8 , 0x0000ddb4}, /* _LDRLibPath */
+            {13, 0x0004c465}, /* _TKSuBuff */
+            {13, 0x0002e190}, /* _TKFuBuff */
+            {13, 0x0002df70}, /* _TKFuBufLen */
+            {13, 0x00053070}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d720}, /* _pTCBCur */
+            {8 , 0x0000d71c}, /* _pPTDACur */
+            {2 , 0x0000f8a0}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f1fc}, /* _ldrpFileNameBuf */
+            {13, 0x00050fd0}, /* SecPathFromSFN */
+        }
+    },
+    { /* 14040RS.SYM */
+        14040, KF_SMP, 15,
+        {
+            {14, 0x0000838c}, /* _ldrRead */
+            {14, 0x00061650}, /* _ldrOpen */
+            {14, 0x000629f0}, /* _ldrClose */
+            {14, 0x00062ad5}, /* _LDRQAppType */
+            {14, 0x0005ec00}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00005268}, /* _IOSftOpen */
+            {14, 0x00005b61}, /* _IOSftClose */
+            {14, 0x00005c5c}, /* _IOSftTransPath */
+            {14, 0x00005740}, /* _IOSftReadAt */
+            {14, 0x00005747}, /* _IOSftWriteAt */
+            {14, 0x00005d86}, /* _SftFileSize */
+            {14, 0x0005d000}, /* _VMAllocMem */
+            {14, 0x0004d03b}, /* _VMGetOwner */
+            {14, 0x0006cbde}, /* g_tkExecPgm */
+            {14, 0x000660d1}, /* _tkStartProcess */
+            {11, 0x00009e0c}, /* f_FuStrLenZ */
+            {11, 0x00009d8c}, /* f_FuStrLen */
+            {11, 0x00009fb6}, /* f_FuBuff */
+            {14, 0x00048cf4}, /* _VMObjHandleInfo */
+            {14, 0x0006dac0}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00061990}, /* _ldrOpenPath */
+            {14, 0x0005ca50}, /* _LDRClearSem */
+            {14, 0x00066b03}, /* _ldrFindModule */
+            {14, 0x0000c384}, /* _KSEMRequestMutex */
+            {14, 0x0000c417}, /* _KSEMReleaseMutex */
+            {14, 0x0000c442}, /* _KSEMQueryMutex */
+            {14, 0x0000c657}, /* _KSEMInit */
+            {9 , 0x0000d2a4}, /* _LdrSem */
+            {9 , 0x0000d32c}, /* _LDRLibPath */
+            {14, 0x00055113}, /* _TKSuBuff */
+            {14, 0x000368b0}, /* _TKFuBuff */
+            {14, 0x00036641}, /* _TKFuBufLen */
+            {14, 0x0005ca20}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {3 , 0x0000f88c}, /* ptda_start */
+            {3 , 0x0000f9aa}, /* ptda_environ */
+            {3 , 0x0000feb4}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9ac}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000e768}, /* _ldrpFileNameBuf */
+            {14, 0x0005a560}, /* SecPathFromSFN */
+        }
+    },
+    { /* 14040RU.SYM */
+        14040, KF_UNI, 14,
+        {
+            {13, 0x000070dc}, /* _ldrRead */
+            {13, 0x000577f0}, /* _ldrOpen */
+            {13, 0x00058ac0}, /* _ldrClose */
+            {13, 0x00058ba5}, /* _LDRQAppType */
+            {13, 0x00055080}, /* _ldrEnum32bitRelRecs */
+            {13, 0x00004598}, /* _IOSftOpen */
+            {13, 0x00004df4}, /* _IOSftClose */
+            {13, 0x00004ecd}, /* _IOSftTransPath */
+            {13, 0x00004a2c}, /* _IOSftReadAt */
+            {13, 0x00004a33}, /* _IOSftWriteAt */
+            {13, 0x00004fe6}, /* _SftFileSize */
+            {13, 0x00053660}, /* _VMAllocMem */
+            {13, 0x00042f3b}, /* _VMGetOwner */
+            {13, 0x00061e4e}, /* g_tkExecPgm */
+            {13, 0x0005bbbb}, /* _tkStartProcess */
+            {9 , 0x0000e74c}, /* f_FuStrLenZ */
+            {9 , 0x0000e702}, /* f_FuStrLen */
+            {9 , 0x0000e845}, /* f_FuBuff */
+            {13, 0x0003ee43}, /* _VMObjHandleInfo */
+            {13, 0x00062ba0}, /* _ldrASMpMTEFromHandle */
+            {13, 0x00057b30}, /* _ldrOpenPath */
+            {13, 0x00053110}, /* _LDRClearSem */
+            {13, 0x0005c573}, /* _ldrFindModule */
+            {13, 0x0000a8d4}, /* _KSEMRequestMutex */
+            {13, 0x0000a967}, /* _KSEMReleaseMutex */
+            {13, 0x0000a992}, /* _KSEMQueryMutex */
+            {13, 0x0000aba7}, /* _KSEMInit */
+            {8 , 0x0000dd2c}, /* _LdrSem */
+            {8 , 0x0000ddb4}, /* _LDRLibPath */
+            {13, 0x0004c4d5}, /* _TKSuBuff */
+            {13, 0x0002e200}, /* _TKFuBuff */
+            {13, 0x0002dfe0}, /* _TKFuBufLen */
+            {13, 0x000530e0}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d720}, /* _pTCBCur */
+            {8 , 0x0000d71c}, /* _pPTDACur */
+            {2 , 0x0000f8a0}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f1fc}, /* _ldrpFileNameBuf */
+            {13, 0x00051040}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 14044HU.SYM */
+        14044, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x0000873c}, /* _ldrRead */
+            {15, 0x0006a010}, /* _ldrOpen */
+            {15, 0x0006b440}, /* _ldrClose */
+            {15, 0x0006b525}, /* _LDRQAppType */
+            {15, 0x00067640}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00005138}, /* _IOSftOpen */
+            {15, 0x000059a4}, /* _IOSftClose */
+            {15, 0x00005a80}, /* _IOSftTransPath */
+            {15, 0x000055d8}, /* _IOSftReadAt */
+            {15, 0x000055df}, /* _IOSftWriteAt */
+            {15, 0x00005ba8}, /* _SftFileSize */
+            {15, 0x000657a0}, /* _VMAllocMem */
+            {15, 0x00052d33}, /* _VMGetOwner */
+            {15, 0x00075710}, /* g_tkExecPgm */
+            {15, 0x0006ea50}, /* _tkStartProcess */
+            {11, 0x0000f938}, /* f_FuStrLenZ */
+            {11, 0x0000f8ec}, /* f_FuStrLen */
+            {11, 0x0000fa54}, /* f_FuBuff */
+            {15, 0x0004cf27}, /* _VMObjHandleInfo */
+            {15, 0x000765b0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0006a390}, /* _ldrOpenPath */
+            {15, 0x00064fa0}, /* _LDRClearSem */
+            {15, 0x0006f483}, /* _ldrFindModule */
+            {15, 0x0000bc7c}, /* _KSEMRequestMutex */
+            {15, 0x0000bd90}, /* _KSEMReleaseMutex */
+            {15, 0x0000bdf0}, /* _KSEMQueryMutex */
+            {15, 0x0000c174}, /* _KSEMInit */
+            {10, 0x0002b8f8}, /* _LdrSem */
+            {10, 0x0002b98c}, /* _LDRLibPath */
+            {15, 0x0005d548}, /* _TKSuBuff */
+            {15, 0x00037cf1}, /* _TKFuBuff */
+            {15, 0x00037a90}, /* _TKFuBufLen */
+            {15, 0x00064f70}, /* _ldrValidateMteHandle */
+            {10, 0x0002b24c}, /* _pTCBCur */
+            {10, 0x0002b248}, /* _pPTDACur */
+            {4 , 0x0000f898}, /* ptda_start */
+            {4 , 0x0000f9b6}, /* ptda_environ */
+            {4 , 0x0000fec0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9b8}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002d8b8}, /* _ldrpFileNameBuf */
+            {15, 0x00062930}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 14044R4.SYM */
+        14044, KF_UNI | KF_W4, 14,
+        {
+            {13, 0x000070e0}, /* _ldrRead */
+            {13, 0x00056f40}, /* _ldrOpen */
+            {13, 0x00058210}, /* _ldrClose */
+            {13, 0x000582f5}, /* _LDRQAppType */
+            {13, 0x00054aa0}, /* _ldrEnum32bitRelRecs */
+            {13, 0x00004588}, /* _IOSftOpen */
+            {13, 0x00004de4}, /* _IOSftClose */
+            {13, 0x00004ebd}, /* _IOSftTransPath */
+            {13, 0x00004a1c}, /* _IOSftReadAt */
+            {13, 0x00004a23}, /* _IOSftWriteAt */
+            {13, 0x00004fd6}, /* _SftFileSize */
+            {13, 0x000531e0}, /* _VMAllocMem */
+            {13, 0x00042b3b}, /* _VMGetOwner */
+            {13, 0x0006132e}, /* g_tkExecPgm */
+            {13, 0x0005b2fb}, /* _tkStartProcess */
+            {9 , 0x0000e74c}, /* f_FuStrLenZ */
+            {9 , 0x0000e702}, /* f_FuStrLen */
+            {9 , 0x0000e845}, /* f_FuBuff */
+            {13, 0x0003ea43}, /* _VMObjHandleInfo */
+            {13, 0x00062080}, /* _ldrASMpMTEFromHandle */
+            {13, 0x00057280}, /* _ldrOpenPath */
+            {13, 0x00052c90}, /* _LDRClearSem */
+            {13, 0x0005bcb3}, /* _ldrFindModule */
+            {13, 0x0000a128}, /* _KSEMRequestMutex */
+            {13, 0x0000a1bb}, /* _KSEMReleaseMutex */
+            {13, 0x0000a1e6}, /* _KSEMQueryMutex */
+            {13, 0x0000a3fb}, /* _KSEMInit */
+            {8 , 0x0000dd28}, /* _LdrSem */
+            {8 , 0x0000ddb0}, /* _LDRLibPath */
+            {13, 0x0004c0d5}, /* _TKSuBuff */
+            {13, 0x0002dfb0}, /* _TKFuBuff */
+            {13, 0x0002dd90}, /* _TKFuBufLen */
+            {13, 0x00052c60}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d71c}, /* _pTCBCur */
+            {8 , 0x0000d718}, /* _pPTDACur */
+            {2 , 0x0000f8a0}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f1f8}, /* _ldrpFileNameBuf */
+            {13, 0x00050c00}, /* SecPathFromSFN */
+        }
+    },
+    { /* 14045R4.SYM */
+        14045, KF_UNI | KF_W4, 14,
+        {
+            {13, 0x000070ec}, /* _ldrRead */
+            {13, 0x00056f60}, /* _ldrOpen */
+            {13, 0x00058230}, /* _ldrClose */
+            {13, 0x00058315}, /* _LDRQAppType */
+            {13, 0x00054ac0}, /* _ldrEnum32bitRelRecs */
+            {13, 0x00004588}, /* _IOSftOpen */
+            {13, 0x00004de4}, /* _IOSftClose */
+            {13, 0x00004ebd}, /* _IOSftTransPath */
+            {13, 0x00004a1c}, /* _IOSftReadAt */
+            {13, 0x00004a23}, /* _IOSftWriteAt */
+            {13, 0x00004fd6}, /* _SftFileSize */
+            {13, 0x00053200}, /* _VMAllocMem */
+            {13, 0x00042b5b}, /* _VMGetOwner */
+            {13, 0x0006134e}, /* g_tkExecPgm */
+            {13, 0x0005b31b}, /* _tkStartProcess */
+            {9 , 0x0000e74c}, /* f_FuStrLenZ */
+            {9 , 0x0000e702}, /* f_FuStrLen */
+            {9 , 0x0000e845}, /* f_FuBuff */
+            {13, 0x0003ea63}, /* _VMObjHandleInfo */
+            {13, 0x000620a0}, /* _ldrASMpMTEFromHandle */
+            {13, 0x000572a0}, /* _ldrOpenPath */
+            {13, 0x00052cb0}, /* _LDRClearSem */
+            {13, 0x0005bcd3}, /* _ldrFindModule */
+            {13, 0x0000a140}, /* _KSEMRequestMutex */
+            {13, 0x0000a1d3}, /* _KSEMReleaseMutex */
+            {13, 0x0000a1fe}, /* _KSEMQueryMutex */
+            {13, 0x0000a413}, /* _KSEMInit */
+            {8 , 0x0000dd28}, /* _LdrSem */
+            {8 , 0x0000ddb0}, /* _LDRLibPath */
+            {13, 0x0004c0f5}, /* _TKSuBuff */
+            {13, 0x0002dfd0}, /* _TKFuBuff */
+            {13, 0x0002ddb0}, /* _TKFuBufLen */
+            {13, 0x00052c80}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d71c}, /* _pTCBCur */
+            {8 , 0x0000d718}, /* _pPTDACur */
+            {2 , 0x0000f8a0}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f1f8}, /* _ldrpFileNameBuf */
+            {13, 0x00050c20}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 14046A4.SYM */
+        14046, KF_UNI | KF_W4 | KF_ALLSTRICT, 16,
+        {
+            {15, 0x00007a3c}, /* _ldrRead */
+            {15, 0x00058a30}, /* _ldrOpen */
+            {15, 0x00059d00}, /* _ldrClose */
+            {15, 0x00059de5}, /* _LDRQAppType */
+            {15, 0x00056590}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004608}, /* _IOSftOpen */
+            {15, 0x00004e64}, /* _IOSftClose */
+            {15, 0x00004f3d}, /* _IOSftTransPath */
+            {15, 0x00004a9c}, /* _IOSftReadAt */
+            {15, 0x00004aa3}, /* _IOSftWriteAt */
+            {15, 0x00005056}, /* _SftFileSize */
+            {15, 0x00054cd0}, /* _VMAllocMem */
+            {15, 0x0004459b}, /* _VMGetOwner */
+            {15, 0x00062e4e}, /* g_tkExecPgm */
+            {15, 0x0005cdfb}, /* _tkStartProcess */
+            {11, 0x0000e74c}, /* f_FuStrLenZ */
+            {11, 0x0000e702}, /* f_FuStrLen */
+            {11, 0x0000e845}, /* f_FuBuff */
+            {15, 0x000404a3}, /* _VMObjHandleInfo */
+            {15, 0x00063ba0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00058d70}, /* _ldrOpenPath */
+            {15, 0x00054780}, /* _LDRClearSem */
+            {15, 0x0005d7d3}, /* _ldrFindModule */
+            {15, 0x0000ab1c}, /* _KSEMRequestMutex */
+            {15, 0x0000abf3}, /* _KSEMReleaseMutex */
+            {15, 0x0000ac1e}, /* _KSEMQueryMutex */
+            {15, 0x0000aebe}, /* _KSEMInit */
+            {10, 0x0001e344}, /* _LdrSem */
+            {10, 0x0001e3cc}, /* _LDRLibPath */
+            {15, 0x0004dbc9}, /* _TKSuBuff */
+            {15, 0x0002f8c0}, /* _TKFuBuff */
+            {15, 0x0002f6a0}, /* _TKFuBufLen */
+            {15, 0x00054750}, /* _ldrValidateMteHandle */
+            {10, 0x0001dd3c}, /* _pTCBCur */
+            {10, 0x0001dd38}, /* _pPTDACur */
+            {4 , 0x0000f8a0}, /* ptda_start */
+            {4 , 0x0000f9be}, /* ptda_environ */
+            {4 , 0x0000fec8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001f834}, /* _ldrpFileNameBuf */
+            {15, 0x000526f0}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 14046R4.SYM */
+        14046, KF_UNI | KF_W4, 14,
+        {
+            {13, 0x000070cc}, /* _ldrRead */
+            {13, 0x00056f30}, /* _ldrOpen */
+            {13, 0x00058200}, /* _ldrClose */
+            {13, 0x000582e5}, /* _LDRQAppType */
+            {13, 0x00054a90}, /* _ldrEnum32bitRelRecs */
+            {13, 0x00004588}, /* _IOSftOpen */
+            {13, 0x00004de4}, /* _IOSftClose */
+            {13, 0x00004ebd}, /* _IOSftTransPath */
+            {13, 0x00004a1c}, /* _IOSftReadAt */
+            {13, 0x00004a23}, /* _IOSftWriteAt */
+            {13, 0x00004fd6}, /* _SftFileSize */
+            {13, 0x000531d0}, /* _VMAllocMem */
+            {13, 0x00042b2b}, /* _VMGetOwner */
+            {13, 0x0006131e}, /* g_tkExecPgm */
+            {13, 0x0005b2eb}, /* _tkStartProcess */
+            {9 , 0x0000e74c}, /* f_FuStrLenZ */
+            {9 , 0x0000e702}, /* f_FuStrLen */
+            {9 , 0x0000e845}, /* f_FuBuff */
+            {13, 0x0003ea33}, /* _VMObjHandleInfo */
+            {13, 0x00062070}, /* _ldrASMpMTEFromHandle */
+            {13, 0x00057270}, /* _ldrOpenPath */
+            {13, 0x00052c80}, /* _LDRClearSem */
+            {13, 0x0005bca3}, /* _ldrFindModule */
+            {13, 0x0000a100}, /* _KSEMRequestMutex */
+            {13, 0x0000a193}, /* _KSEMReleaseMutex */
+            {13, 0x0000a1be}, /* _KSEMQueryMutex */
+            {13, 0x0000a3d3}, /* _KSEMInit */
+            {8 , 0x0000dd28}, /* _LdrSem */
+            {8 , 0x0000ddb0}, /* _LDRLibPath */
+            {13, 0x0004c0c5}, /* _TKSuBuff */
+            {13, 0x0002df80}, /* _TKFuBuff */
+            {13, 0x0002dd60}, /* _TKFuBufLen */
+            {13, 0x00052c50}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d71c}, /* _pTCBCur */
+            {8 , 0x0000d718}, /* _pPTDACur */
+            {2 , 0x0000f8a0}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f1f8}, /* _ldrpFileNameBuf */
+            {13, 0x00050bf0}, /* SecPathFromSFN */
+        }
+    },
+    { /* 14048RS.SYM */
+        14048, KF_SMP, 15,
+        {
+            {14, 0x0000836c}, /* _ldrRead */
+            {14, 0x00060e10}, /* _ldrOpen */
+            {14, 0x000621b0}, /* _ldrClose */
+            {14, 0x00062295}, /* _LDRQAppType */
+            {14, 0x0005e690}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00005248}, /* _IOSftOpen */
+            {14, 0x00005b41}, /* _IOSftClose */
+            {14, 0x00005c3c}, /* _IOSftTransPath */
+            {14, 0x00005720}, /* _IOSftReadAt */
+            {14, 0x00005727}, /* _IOSftWriteAt */
+            {14, 0x00005d66}, /* _SftFileSize */
+            {14, 0x0005cbd0}, /* _VMAllocMem */
+            {14, 0x0004cc8b}, /* _VMGetOwner */
+            {14, 0x0006c13e}, /* g_tkExecPgm */
+            {14, 0x00065871}, /* _tkStartProcess */
+            {11, 0x00009e0c}, /* f_FuStrLenZ */
+            {11, 0x00009d8c}, /* f_FuStrLen */
+            {11, 0x00009fb6}, /* f_FuBuff */
+            {14, 0x00048944}, /* _VMObjHandleInfo */
+            {14, 0x0006d020}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00061150}, /* _ldrOpenPath */
+            {14, 0x0005c620}, /* _LDRClearSem */
+            {14, 0x000662a3}, /* _ldrFindModule */
+            {14, 0x0000bb3c}, /* _KSEMRequestMutex */
+            {14, 0x0000bbcf}, /* _KSEMReleaseMutex */
+            {14, 0x0000bbfa}, /* _KSEMQueryMutex */
+            {14, 0x0000be0f}, /* _KSEMInit */
+            {9 , 0x0000d2a0}, /* _LdrSem */
+            {9 , 0x0000d328}, /* _LDRLibPath */
+            {14, 0x00054d63}, /* _TKSuBuff */
+            {14, 0x000366a0}, /* _TKFuBuff */
+            {14, 0x00036431}, /* _TKFuBufLen */
+            {14, 0x0005c5f0}, /* _ldrValidateMteHandle */
+            {0 , 0x00000aa4}, /* _pTCBCur */
+            {0 , 0x00000aa0}, /* _pPTDACur */
+            {3 , 0x0000f88c}, /* ptda_start */
+            {3 , 0x0000f9aa}, /* ptda_environ */
+            {3 , 0x0000feb4}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9ac}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000e764}, /* _ldrpFileNameBuf */
+            {14, 0x0005a170}, /* SecPathFromSFN */
+        }
+    },
+    { /* 14048RU.SYM */
+        14048, KF_UNI, 14,
+        {
+            {13, 0x000070cc}, /* _ldrRead */
+            {13, 0x00056fa0}, /* _ldrOpen */
+            {13, 0x00058270}, /* _ldrClose */
+            {13, 0x00058355}, /* _LDRQAppType */
+            {13, 0x00054b00}, /* _ldrEnum32bitRelRecs */
+            {13, 0x00004588}, /* _IOSftOpen */
+            {13, 0x00004de4}, /* _IOSftClose */
+            {13, 0x00004ebd}, /* _IOSftTransPath */
+            {13, 0x00004a1c}, /* _IOSftReadAt */
+            {13, 0x00004a23}, /* _IOSftWriteAt */
+            {13, 0x00004fd6}, /* _SftFileSize */
+            {13, 0x00053240}, /* _VMAllocMem */
+            {13, 0x00042b9b}, /* _VMGetOwner */
+            {13, 0x0006138e}, /* g_tkExecPgm */
+            {13, 0x0005b35b}, /* _tkStartProcess */
+            {9 , 0x0000e74c}, /* f_FuStrLenZ */
+            {9 , 0x0000e702}, /* f_FuStrLen */
+            {9 , 0x0000e845}, /* f_FuBuff */
+            {13, 0x0003eaa3}, /* _VMObjHandleInfo */
+            {13, 0x000620e0}, /* _ldrASMpMTEFromHandle */
+            {13, 0x000572e0}, /* _ldrOpenPath */
+            {13, 0x00052cf0}, /* _LDRClearSem */
+            {13, 0x0005bd13}, /* _ldrFindModule */
+            {13, 0x0000a100}, /* _KSEMRequestMutex */
+            {13, 0x0000a193}, /* _KSEMReleaseMutex */
+            {13, 0x0000a1be}, /* _KSEMQueryMutex */
+            {13, 0x0000a3d3}, /* _KSEMInit */
+            {8 , 0x0000dd28}, /* _LdrSem */
+            {8 , 0x0000ddb0}, /* _LDRLibPath */
+            {13, 0x0004c135}, /* _TKSuBuff */
+            {13, 0x0002dff0}, /* _TKFuBuff */
+            {13, 0x0002ddd0}, /* _TKFuBufLen */
+            {13, 0x00052cc0}, /* _ldrValidateMteHandle */
+            {8 , 0x0000d71c}, /* _pTCBCur */
+            {8 , 0x0000d718}, /* _pPTDACur */
+            {2 , 0x0000f8a0}, /* ptda_start */
+            {2 , 0x0000f9be}, /* ptda_environ */
+            {2 , 0x0000fec8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000f9c0}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000f1f8}, /* _ldrpFileNameBuf */
+            {13, 0x00050c60}, /* SecPathFromSFN */
         }
     },
     { /* 8255RS.SYM */
-        8255, 'R', TYPE_SMP, 15,
+        8255, KF_SMP, 15,
         {
             {14, 0x0000b434}, /* _ldrRead */
@@ -98,11 +1093,36 @@
             {14, 0x00026624}, /* _VMGetOwner */
             {14, 0x0004f84e}, /* g_tkExecPgm */
+            {14, 0x0004c099}, /* _tkStartProcess */
             {11, 0x0000a168}, /* f_FuStrLenZ */
             {11, 0x0000a0e8}, /* f_FuStrLen */
             {11, 0x0000a311}, /* f_FuBuff */
+            {14, 0x0002527b}, /* _VMObjHandleInfo */
+            {14, 0x00050240}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00045aba}, /* _ldrOpenPath */
+            {14, 0x00042324}, /* _LDRClearSem */
+            {14, 0x0004b762}, /* _ldrFindModule */
+            {14, 0x0000ca44}, /* _KSEMRequestMutex */
+            {14, 0x0000cad7}, /* _KSEMReleaseMutex */
+            {14, 0x0000cb02}, /* _KSEMQueryMutex */
+            {14, 0x0000cd17}, /* _KSEMInit */
+            {9 , 0x0000d0b4}, /* _LdrSem */
+            {9 , 0x0000b64c}, /* _LDRLibPath */
+            {14, 0x0003242f}, /* _TKSuBuff */
+            {14, 0x00031fc4}, /* _TKFuBuff */
+            {14, 0x0003218e}, /* _TKFuBufLen */
+            {14, 0x00042370}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {3 , 0x0000f8cc}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000ce7c}, /* _ldrpFileNameBuf */
+            {13, 0xffffffff}, /* SecPathFromSFN */
         }
     },
     { /* 8255RU.SYM */
-        8255, 'R', TYPE_UNI, 13,
+        8255, KF_UNI, 13,
         {
             {12, 0x0000932c}, /* _ldrRead */
@@ -120,11 +1140,279 @@
             {12, 0x0001ccde}, /* _VMGetOwner */
             {12, 0x0004265e}, /* g_tkExecPgm */
-            {9, 0x0000e124}, /* f_FuStrLenZ */
-            {9, 0x0000e0da}, /* f_FuStrLen */
-            {9, 0x0000e218}, /* f_FuBuff */
-        }
-    },
+            {12, 0x0003e377}, /* _tkStartProcess */
+            {9 , 0x0000e124}, /* f_FuStrLenZ */
+            {9 , 0x0000e0da}, /* f_FuStrLen */
+            {9 , 0x0000e218}, /* f_FuBuff */
+            {12, 0x0001c048}, /* _VMObjHandleInfo */
+            {12, 0x00043010}, /* _ldrASMpMTEFromHandle */
+            {12, 0x0003a283}, /* _ldrOpenPath */
+            {12, 0x00036cc8}, /* _LDRClearSem */
+            {12, 0x0003ef41}, /* _ldrFindModule */
+            {12, 0x0000a6b0}, /* _KSEMRequestMutex */
+            {12, 0x0000a743}, /* _KSEMReleaseMutex */
+            {12, 0x0000a76e}, /* _KSEMQueryMutex */
+            {12, 0x0000a983}, /* _KSEMInit */
+            {8 , 0x0000c7dc}, /* _LdrSem */
+            {8 , 0x00009c60}, /* _LDRLibPath */
+            {12, 0x00027845}, /* _TKSuBuff */
+            {12, 0x0002747b}, /* _TKFuBuff */
+            {12, 0x00027605}, /* _TKFuBufLen */
+            {12, 0x00036d04}, /* _ldrValidateMteHandle */
+            {8 , 0x000070b8}, /* _pTCBCur */
+            {8 , 0x000070b4}, /* _pPTDACur */
+            {2 , 0x0000f9a8}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bb70}, /* _ldrpFileNameBuf */
+            {12, 0x00032ff3}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8256AS.SYM */
+        8256, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000c628}, /* _ldrRead */
+            {16, 0x00057294}, /* _ldrOpen */
+            {16, 0x00057db0}, /* _ldrClose */
+            {16, 0x00057e00}, /* _LDRQAppType */
+            {16, 0x00055584}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005538}, /* _IOSftOpen */
+            {16, 0x00005ac4}, /* _IOSftClose */
+            {16, 0x00005b7c}, /* _IOSftTransPath */
+            {16, 0x00005808}, /* _IOSftReadAt */
+            {16, 0x000059d4}, /* _IOSftWriteAt */
+            {16, 0x00005cb4}, /* _SftFileSize */
+            {16, 0x000528e4}, /* _VMAllocMem */
+            {16, 0x0002e6c6}, /* _VMGetOwner */
+            {16, 0x00062590}, /* g_tkExecPgm */
+            {16, 0x0005e418}, /* _tkStartProcess */
+            {13, 0x0000a830}, /* f_FuStrLenZ */
+            {13, 0x0000a7b0}, /* f_FuStrLen */
+            {13, 0x0000a9fc}, /* f_FuBuff */
+            {16, 0x0002ceef}, /* _VMObjHandleInfo */
+            {16, 0x00063058}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005752e}, /* _ldrOpenPath */
+            {16, 0x0005357c}, /* _LDRClearSem */
+            {16, 0x0005da41}, /* _ldrFindModule */
+            {16, 0x0000e2e8}, /* _KSEMRequestMutex */
+            {16, 0x0000e3fc}, /* _KSEMReleaseMutex */
+            {16, 0x0000e45c}, /* _KSEMQueryMutex */
+            {16, 0x0000e7e0}, /* _KSEMInit */
+            {11, 0x0001ae5c}, /* _LdrSem */
+            {11, 0x00018880}, /* _LDRLibPath */
+            {16, 0x0003d458}, /* _TKSuBuff */
+            {16, 0x0003cfa7}, /* _TKFuBuff */
+            {16, 0x0003d1b3}, /* _TKFuBufLen */
+            {16, 0x00053614}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001aa4c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8256HS.SYM */
+        8256, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000b50c}, /* _ldrRead */
+            {16, 0x00047adc}, /* _ldrOpen */
+            {16, 0x000484d8}, /* _ldrClose */
+            {16, 0x00048528}, /* _LDRQAppType */
+            {16, 0x00046018}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00004a58}, /* _IOSftOpen */
+            {16, 0x00004fd6}, /* _IOSftClose */
+            {16, 0x0000508d}, /* _IOSftTransPath */
+            {16, 0x00004d1e}, /* _IOSftReadAt */
+            {16, 0x00004ee7}, /* _IOSftWriteAt */
+            {16, 0x000051b7}, /* _SftFileSize */
+            {16, 0x00043c0c}, /* _VMAllocMem */
+            {16, 0x00027cc4}, /* _VMGetOwner */
+            {16, 0x00051bca}, /* g_tkExecPgm */
+            {16, 0x0004e335}, /* _tkStartProcess */
+            {13, 0x0000a168}, /* f_FuStrLenZ */
+            {13, 0x0000a0e8}, /* f_FuStrLen */
+            {13, 0x0000a311}, /* f_FuBuff */
+            {16, 0x0002691b}, /* _VMObjHandleInfo */
+            {16, 0x000525bc}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00047d5e}, /* _ldrOpenPath */
+            {16, 0x000445cc}, /* _LDRClearSem */
+            {16, 0x0004d9fe}, /* _ldrFindModule */
+            {16, 0x0000cc4c}, /* _KSEMRequestMutex */
+            {16, 0x0000cd23}, /* _KSEMReleaseMutex */
+            {16, 0x0000cd4e}, /* _KSEMQueryMutex */
+            {16, 0x0000cfee}, /* _KSEMInit */
+            {11, 0x0000d644}, /* _LdrSem */
+            {11, 0x0000bbd4}, /* _LDRLibPath */
+            {16, 0x00033acf}, /* _TKSuBuff */
+            {16, 0x00033664}, /* _TKFuBuff */
+            {16, 0x0003382e}, /* _TKFuBufLen */
+            {16, 0x00044618}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {5 , 0x0000f8cc}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0000d40c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8256RS.SYM */
-        8256, 'R', TYPE_SMP, 15,
+        8256, KF_SMP, 15,
+        {
+            {14, 0x0000b434}, /* _ldrRead */
+            {14, 0x00045838}, /* _ldrOpen */
+            {14, 0x00046234}, /* _ldrClose */
+            {14, 0x00046284}, /* _LDRQAppType */
+            {14, 0x00043d70}, /* _ldrEnum32bitRelRecs */
+            {14, 0x000049d4}, /* _IOSftOpen */
+            {14, 0x00004f52}, /* _IOSftClose */
+            {14, 0x00005009}, /* _IOSftTransPath */
+            {14, 0x00004c9a}, /* _IOSftReadAt */
+            {14, 0x00004e63}, /* _IOSftWriteAt */
+            {14, 0x00005133}, /* _SftFileSize */
+            {14, 0x00041964}, /* _VMAllocMem */
+            {14, 0x00026624}, /* _VMGetOwner */
+            {14, 0x0004f84e}, /* g_tkExecPgm */
+            {14, 0x0004c099}, /* _tkStartProcess */
+            {11, 0x0000a168}, /* f_FuStrLenZ */
+            {11, 0x0000a0e8}, /* f_FuStrLen */
+            {11, 0x0000a311}, /* f_FuBuff */
+            {14, 0x0002527b}, /* _VMObjHandleInfo */
+            {14, 0x00050240}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00045aba}, /* _ldrOpenPath */
+            {14, 0x00042324}, /* _LDRClearSem */
+            {14, 0x0004b762}, /* _ldrFindModule */
+            {14, 0x0000ca44}, /* _KSEMRequestMutex */
+            {14, 0x0000cad7}, /* _KSEMReleaseMutex */
+            {14, 0x0000cb02}, /* _KSEMQueryMutex */
+            {14, 0x0000cd17}, /* _KSEMInit */
+            {9 , 0x0000d0b4}, /* _LdrSem */
+            {9 , 0x0000b64c}, /* _LDRLibPath */
+            {14, 0x0003242f}, /* _TKSuBuff */
+            {14, 0x00031fc4}, /* _TKFuBuff */
+            {14, 0x0003218e}, /* _TKFuBufLen */
+            {14, 0x00042370}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {3 , 0x0000f8cc}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000ce7c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8257AS.SYM */
+        8257, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000c628}, /* _ldrRead */
+            {16, 0x000574b4}, /* _ldrOpen */
+            {16, 0x00057fd0}, /* _ldrClose */
+            {16, 0x00058020}, /* _LDRQAppType */
+            {16, 0x0005579c}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005538}, /* _IOSftOpen */
+            {16, 0x00005ac4}, /* _IOSftClose */
+            {16, 0x00005b7c}, /* _IOSftTransPath */
+            {16, 0x00005808}, /* _IOSftReadAt */
+            {16, 0x000059d4}, /* _IOSftWriteAt */
+            {16, 0x00005cb4}, /* _SftFileSize */
+            {16, 0x00052afc}, /* _VMAllocMem */
+            {16, 0x0002e896}, /* _VMGetOwner */
+            {16, 0x000628d4}, /* g_tkExecPgm */
+            {16, 0x0005e75c}, /* _tkStartProcess */
+            {13, 0x0000a830}, /* f_FuStrLenZ */
+            {13, 0x0000a7b0}, /* f_FuStrLen */
+            {13, 0x0000a9fc}, /* f_FuBuff */
+            {16, 0x0002d0bf}, /* _VMObjHandleInfo */
+            {16, 0x0006339c}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005774e}, /* _ldrOpenPath */
+            {16, 0x00053794}, /* _LDRClearSem */
+            {16, 0x0005dd85}, /* _ldrFindModule */
+            {16, 0x0000e3a8}, /* _KSEMRequestMutex */
+            {16, 0x0000e4bc}, /* _KSEMReleaseMutex */
+            {16, 0x0000e51c}, /* _KSEMQueryMutex */
+            {16, 0x0000e8a0}, /* _KSEMInit */
+            {11, 0x0001ae5c}, /* _LdrSem */
+            {11, 0x00018880}, /* _LDRLibPath */
+            {16, 0x0003d628}, /* _TKSuBuff */
+            {16, 0x0003d177}, /* _TKFuBuff */
+            {16, 0x0003d383}, /* _TKFuBufLen */
+            {16, 0x0005382c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001aa4c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8257HS.SYM */
+        8257, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000b50c}, /* _ldrRead */
+            {16, 0x00047cf4}, /* _ldrOpen */
+            {16, 0x000486f0}, /* _ldrClose */
+            {16, 0x00048740}, /* _LDRQAppType */
+            {16, 0x0004622c}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00004a58}, /* _IOSftOpen */
+            {16, 0x00004fd6}, /* _IOSftClose */
+            {16, 0x0000508d}, /* _IOSftTransPath */
+            {16, 0x00004d1e}, /* _IOSftReadAt */
+            {16, 0x00004ee7}, /* _IOSftWriteAt */
+            {16, 0x000051b7}, /* _SftFileSize */
+            {16, 0x00043e20}, /* _VMAllocMem */
+            {16, 0x00027ea0}, /* _VMGetOwner */
+            {16, 0x00051eb6}, /* g_tkExecPgm */
+            {16, 0x0004e621}, /* _tkStartProcess */
+            {13, 0x0000a168}, /* f_FuStrLenZ */
+            {13, 0x0000a0e8}, /* f_FuStrLen */
+            {13, 0x0000a311}, /* f_FuBuff */
+            {16, 0x00026af7}, /* _VMObjHandleInfo */
+            {16, 0x000528a8}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00047f76}, /* _ldrOpenPath */
+            {16, 0x000447e0}, /* _LDRClearSem */
+            {16, 0x0004dcea}, /* _ldrFindModule */
+            {16, 0x0000cd0c}, /* _KSEMRequestMutex */
+            {16, 0x0000cde3}, /* _KSEMReleaseMutex */
+            {16, 0x0000ce0e}, /* _KSEMQueryMutex */
+            {16, 0x0000d0ae}, /* _KSEMInit */
+            {11, 0x0000d644}, /* _LdrSem */
+            {11, 0x0000bbd4}, /* _LDRLibPath */
+            {16, 0x00033cab}, /* _TKSuBuff */
+            {16, 0x00033840}, /* _TKFuBuff */
+            {16, 0x00033a0a}, /* _TKFuBufLen */
+            {16, 0x0004482c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {5 , 0x0000f8cc}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0000d40c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 8257RS.SYM */
+        8257, KF_SMP, 15,
         {
             {14, 0x0000b434}, /* _ldrRead */
@@ -142,33 +1430,232 @@
             {14, 0x00026800}, /* _VMGetOwner */
             {14, 0x0004fb4a}, /* g_tkExecPgm */
+            {14, 0x0004c395}, /* _tkStartProcess */
             {11, 0x0000a168}, /* f_FuStrLenZ */
             {11, 0x0000a0e8}, /* f_FuStrLen */
             {11, 0x0000a311}, /* f_FuBuff */
-        }
-    },
-    { /* 8256RU.SYM */
-        8256, 'R', TYPE_UNI, 13,
-        {
-            {12, 0x0000932c}, /* _ldrRead */
-            {12, 0x00039ff8}, /* _ldrOpen */
-            {12, 0x0003a87c}, /* _ldrClose */
-            {12, 0x0003a8cc}, /* _LDRQAppType */
-            {12, 0x00038218}, /* _ldrEnum32bitRelRecs */
-            {12, 0x000034a0}, /* _IOSftOpen */
-            {12, 0x0000390c}, /* _IOSftClose */
-            {12, 0x000039a1}, /* _IOSftTransPath */
-            {12, 0x0000375a}, /* _IOSftReadAt */
-            {12, 0x00003761}, /* _IOSftWriteAt */
-            {12, 0x00003aba}, /* _SftFileSize */
-            {12, 0x00036574}, /* _VMAllocMem */
-            {12, 0x0001ccde}, /* _VMGetOwner */
-            {12, 0x00042632}, /* g_tkExecPgm */
-            {9, 0x0000e124}, /* f_FuStrLenZ */
-            {9, 0x0000e0da}, /* f_FuStrLen */
-            {9, 0x0000e218}, /* f_FuBuff */
-        }
-    },
-    { /* 8257RS.SYM */
-        8257, 'R', TYPE_SMP, 15,
+            {14, 0x00025457}, /* _VMObjHandleInfo */
+            {14, 0x0005053c}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00045cd2}, /* _ldrOpenPath */
+            {14, 0x00042538}, /* _LDRClearSem */
+            {14, 0x0004ba5e}, /* _ldrFindModule */
+            {14, 0x0000cb04}, /* _KSEMRequestMutex */
+            {14, 0x0000cb97}, /* _KSEMReleaseMutex */
+            {14, 0x0000cbc2}, /* _KSEMQueryMutex */
+            {14, 0x0000cdd7}, /* _KSEMInit */
+            {9 , 0x0000d0b4}, /* _LdrSem */
+            {9 , 0x0000b64c}, /* _LDRLibPath */
+            {14, 0x0003260b}, /* _TKSuBuff */
+            {14, 0x000321a0}, /* _TKFuBuff */
+            {14, 0x0003236a}, /* _TKFuBufLen */
+            {14, 0x00042584}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {3 , 0x0000f8cc}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000ce7c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8258AS.SYM */
+        8258, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000c628}, /* _ldrRead */
+            {16, 0x00057510}, /* _ldrOpen */
+            {16, 0x0005802c}, /* _ldrClose */
+            {16, 0x0005807c}, /* _LDRQAppType */
+            {16, 0x000557f8}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005538}, /* _IOSftOpen */
+            {16, 0x00005ac4}, /* _IOSftClose */
+            {16, 0x00005b7c}, /* _IOSftTransPath */
+            {16, 0x00005808}, /* _IOSftReadAt */
+            {16, 0x000059d4}, /* _IOSftWriteAt */
+            {16, 0x00005cb4}, /* _SftFileSize */
+            {16, 0x00052b54}, /* _VMAllocMem */
+            {16, 0x0002e8b2}, /* _VMGetOwner */
+            {16, 0x000629a8}, /* g_tkExecPgm */
+            {16, 0x0005e7fc}, /* _tkStartProcess */
+            {13, 0x0000a830}, /* f_FuStrLenZ */
+            {13, 0x0000a7b0}, /* f_FuStrLen */
+            {13, 0x0000a9fc}, /* f_FuBuff */
+            {16, 0x0002d0db}, /* _VMObjHandleInfo */
+            {16, 0x00063470}, /* _ldrASMpMTEFromHandle */
+            {16, 0x000577aa}, /* _ldrOpenPath */
+            {16, 0x000537f0}, /* _LDRClearSem */
+            {16, 0x0005de29}, /* _ldrFindModule */
+            {16, 0x0000e3a8}, /* _KSEMRequestMutex */
+            {16, 0x0000e4bc}, /* _KSEMReleaseMutex */
+            {16, 0x0000e51c}, /* _KSEMQueryMutex */
+            {16, 0x0000e8a0}, /* _KSEMInit */
+            {11, 0x0001ae5c}, /* _LdrSem */
+            {11, 0x00018880}, /* _LDRLibPath */
+            {16, 0x0003d674}, /* _TKSuBuff */
+            {16, 0x0003d1c3}, /* _TKFuBuff */
+            {16, 0x0003d3cf}, /* _TKFuBufLen */
+            {16, 0x00053888}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001aa4c}, /* _ldrpFileNameBuf */
+            {12, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8258AU.SYM */
+        8258, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a1fc}, /* _ldrRead */
+            {15, 0x0004a160}, /* _ldrOpen */
+            {15, 0x0004aaf8}, /* _ldrClose */
+            {15, 0x0004ab48}, /* _LDRQAppType */
+            {15, 0x00048088}, /* _ldrEnum32bitRelRecs */
+            {15, 0x000044a0}, /* _IOSftOpen */
+            {15, 0x00004918}, /* _IOSftClose */
+            {15, 0x000049b0}, /* _IOSftTransPath */
+            {15, 0x00004764}, /* _IOSftReadAt */
+            {15, 0x0000476b}, /* _IOSftWriteAt */
+            {15, 0x00004ad8}, /* _SftFileSize */
+            {15, 0x00045a08}, /* _VMAllocMem */
+            {15, 0x00023626}, /* _VMGetOwner */
+            {15, 0x00053a84}, /* g_tkExecPgm */
+            {15, 0x000501f4}, /* _tkStartProcess */
+            {11, 0x0000e9c8}, /* f_FuStrLenZ */
+            {11, 0x0000e97c}, /* f_FuStrLen */
+            {11, 0x0000eae0}, /* f_FuBuff */
+            {15, 0x00022570}, /* _VMObjHandleInfo */
+            {15, 0x0005451c}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a3eb}, /* _ldrOpenPath */
+            {15, 0x000464bc}, /* _LDRClearSem */
+            {15, 0x0004f8f5}, /* _ldrFindModule */
+            {15, 0x0000bb6c}, /* _KSEMRequestMutex */
+            {15, 0x0000bc80}, /* _KSEMReleaseMutex */
+            {15, 0x0000bce0}, /* _KSEMQueryMutex */
+            {15, 0x0000c064}, /* _KSEMInit */
+            {10, 0x0002a1e8}, /* _LdrSem */
+            {10, 0x000269e4}, /* _LDRLibPath */
+            {15, 0x000315ac}, /* _TKSuBuff */
+            {15, 0x0003119e}, /* _TKFuBuff */
+            {15, 0x0003136a}, /* _TKFuBufLen */
+            {15, 0x00046544}, /* _ldrValidateMteHandle */
+            {10, 0x0000b758}, /* _pTCBCur */
+            {10, 0x0000b754}, /* _pPTDACur */
+            {4 , 0x0000f9a0}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x000293a0}, /* _ldrpFileNameBuf */
+            {15, 0x000421eb}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8258HS.SYM */
+        8258, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000b50c}, /* _ldrRead */
+            {16, 0x00047c50}, /* _ldrOpen */
+            {16, 0x00048648}, /* _ldrClose */
+            {16, 0x00048698}, /* _LDRQAppType */
+            {16, 0x00046184}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00004a58}, /* _IOSftOpen */
+            {16, 0x00004fd6}, /* _IOSftClose */
+            {16, 0x0000508d}, /* _IOSftTransPath */
+            {16, 0x00004d1e}, /* _IOSftReadAt */
+            {16, 0x00004ee7}, /* _IOSftWriteAt */
+            {16, 0x000051b7}, /* _SftFileSize */
+            {16, 0x00043d74}, /* _VMAllocMem */
+            {16, 0x00027da0}, /* _VMGetOwner */
+            {16, 0x00051e16}, /* g_tkExecPgm */
+            {16, 0x0004e591}, /* _tkStartProcess */
+            {13, 0x0000a168}, /* f_FuStrLenZ */
+            {13, 0x0000a0e8}, /* f_FuStrLen */
+            {13, 0x0000a311}, /* f_FuBuff */
+            {16, 0x000269fb}, /* _VMObjHandleInfo */
+            {16, 0x00052808}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00047ed2}, /* _ldrOpenPath */
+            {16, 0x00044738}, /* _LDRClearSem */
+            {16, 0x0004dc5e}, /* _ldrFindModule */
+            {16, 0x0000cd0c}, /* _KSEMRequestMutex */
+            {16, 0x0000cde3}, /* _KSEMReleaseMutex */
+            {16, 0x0000ce0e}, /* _KSEMQueryMutex */
+            {16, 0x0000d0ae}, /* _KSEMInit */
+            {11, 0x0000d644}, /* _LdrSem */
+            {11, 0x0000bbd4}, /* _LDRLibPath */
+            {16, 0x00033bcb}, /* _TKSuBuff */
+            {16, 0x00033760}, /* _TKFuBuff */
+            {16, 0x0003392a}, /* _TKFuBufLen */
+            {16, 0x00044784}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {5 , 0x0000f8cc}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0000d40c}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8258HU.SYM */
+        8258, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00009238}, /* _ldrRead */
+            {15, 0x0003be78}, /* _ldrOpen */
+            {15, 0x0003c700}, /* _ldrClose */
+            {15, 0x0003c750}, /* _LDRQAppType */
+            {15, 0x0003a074}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a24}, /* _IOSftOpen */
+            {15, 0x00003e90}, /* _IOSftClose */
+            {15, 0x00003f25}, /* _IOSftTransPath */
+            {15, 0x00003cde}, /* _IOSftReadAt */
+            {15, 0x00003ce5}, /* _IOSftWriteAt */
+            {15, 0x0000403e}, /* _SftFileSize */
+            {15, 0x00038340}, /* _VMAllocMem */
+            {15, 0x0001dfd2}, /* _VMGetOwner */
+            {15, 0x000445e6}, /* g_tkExecPgm */
+            {15, 0x000415b7}, /* _tkStartProcess */
+            {11, 0x0000d794}, /* f_FuStrLenZ */
+            {11, 0x0000d74a}, /* f_FuStrLen */
+            {11, 0x0000d888}, /* f_FuBuff */
+            {15, 0x0001d334}, /* _VMObjHandleInfo */
+            {15, 0x00044fac}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c0ef}, /* _ldrOpenPath */
+            {15, 0x00038a88}, /* _LDRClearSem */
+            {15, 0x00040d59}, /* _ldrFindModule */
+            {15, 0x0000a6ac}, /* _KSEMRequestMutex */
+            {15, 0x0000a783}, /* _KSEMReleaseMutex */
+            {15, 0x0000a7ae}, /* _KSEMQueryMutex */
+            {15, 0x0000aa4e}, /* _KSEMInit */
+            {10, 0x0001c9ec}, /* _LdrSem */
+            {10, 0x00019e58}, /* _LDRLibPath */
+            {15, 0x00028c95}, /* _TKSuBuff */
+            {15, 0x000288cb}, /* _TKFuBuff */
+            {15, 0x00028a55}, /* _TKFuBufLen */
+            {15, 0x00038ac4}, /* _ldrValidateMteHandle */
+            {10, 0x000070bc}, /* _pTCBCur */
+            {10, 0x000070b8}, /* _pPTDACur */
+            {4 , 0x0000f9a8}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bd7c}, /* _ldrpFileNameBuf */
+            {15, 0x000350e7}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 8258RS.SYM */
+        8258, KF_SMP, 15,
         {
             {14, 0x0000b434}, /* _ldrRead */
@@ -186,33 +1673,183 @@
             {14, 0x000266f8}, /* _VMGetOwner */
             {14, 0x0004fa96}, /* g_tkExecPgm */
+            {14, 0x0004c2f9}, /* _tkStartProcess */
             {11, 0x0000a168}, /* f_FuStrLenZ */
             {11, 0x0000a0e8}, /* f_FuStrLen */
             {11, 0x0000a311}, /* f_FuBuff */
-        }
-    },
-    { /* 8257RU.SYM */
-        8257, 'R', TYPE_UNI, 13,
-        {
-            {12, 0x0000932c}, /* _ldrRead */
-            {12, 0x00039ff0}, /* _ldrOpen */
-            {12, 0x0003a874}, /* _ldrClose */
-            {12, 0x0003a8c4}, /* _LDRQAppType */
-            {12, 0x00038210}, /* _ldrEnum32bitRelRecs */
-            {12, 0x000034a0}, /* _IOSftOpen */
-            {12, 0x0000390c}, /* _IOSftClose */
-            {12, 0x000039a1}, /* _IOSftTransPath */
-            {12, 0x0000375a}, /* _IOSftReadAt */
-            {12, 0x00003761}, /* _IOSftWriteAt */
-            {12, 0x00003aba}, /* _SftFileSize */
-            {12, 0x00036564}, /* _VMAllocMem */
-            {12, 0x0001ccd6}, /* _VMGetOwner */
-            {12, 0x0004263e}, /* g_tkExecPgm */
-            {9, 0x0000e124}, /* f_FuStrLenZ */
-            {9, 0x0000e0da}, /* f_FuStrLen */
-            {9, 0x0000e218}, /* f_FuBuff */
-        }
-    },
-    { /* 8258RS.SYM */
-        8258, 'R', TYPE_SMP, 15,
+            {14, 0x00025353}, /* _VMObjHandleInfo */
+            {14, 0x00050488}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00045c22}, /* _ldrOpenPath */
+            {14, 0x00042488}, /* _LDRClearSem */
+            {14, 0x0004b9c6}, /* _ldrFindModule */
+            {14, 0x0000cb04}, /* _KSEMRequestMutex */
+            {14, 0x0000cb97}, /* _KSEMReleaseMutex */
+            {14, 0x0000cbc2}, /* _KSEMQueryMutex */
+            {14, 0x0000cdd7}, /* _KSEMInit */
+            {9 , 0x0000d0b4}, /* _LdrSem */
+            {9 , 0x0000b64c}, /* _LDRLibPath */
+            {14, 0x00032523}, /* _TKSuBuff */
+            {14, 0x000320b8}, /* _TKFuBuff */
+            {14, 0x00032282}, /* _TKFuBufLen */
+            {14, 0x000424d4}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b44}, /* _pTCBCur */
+            {0 , 0x00000b40}, /* _pPTDACur */
+            {3 , 0x0000f8cc}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000ce7c}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8259AS.SYM */
+        8259, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d370}, /* _ldrRead */
+            {16, 0x000583bc}, /* _ldrOpen */
+            {16, 0x00058edc}, /* _ldrClose */
+            {16, 0x00058f2c}, /* _LDRQAppType */
+            {16, 0x00056674}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00006170}, /* _IOSftOpen */
+            {16, 0x000066fc}, /* _IOSftClose */
+            {16, 0x000067b4}, /* _IOSftTransPath */
+            {16, 0x00006440}, /* _IOSftReadAt */
+            {16, 0x0000660c}, /* _IOSftWriteAt */
+            {16, 0x000068ec}, /* _SftFileSize */
+            {16, 0x000539d4}, /* _VMAllocMem */
+            {16, 0x0002f6e6}, /* _VMGetOwner */
+            {16, 0x000637b8}, /* g_tkExecPgm */
+            {16, 0x0005f5e8}, /* _tkStartProcess */
+            {13, 0x0000a68c}, /* f_FuStrLenZ */
+            {13, 0x0000a60c}, /* f_FuStrLen */
+            {13, 0x0000a854}, /* f_FuBuff */
+            {16, 0x0002df0b}, /* _VMObjHandleInfo */
+            {16, 0x00064290}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00058656}, /* _ldrOpenPath */
+            {16, 0x00054670}, /* _LDRClearSem */
+            {16, 0x0005ec21}, /* _ldrFindModule */
+            {16, 0x0000f060}, /* _KSEMRequestMutex */
+            {16, 0x0000f174}, /* _KSEMReleaseMutex */
+            {16, 0x0000f1d4}, /* _KSEMQueryMutex */
+            {16, 0x0000f558}, /* _KSEMInit */
+            {11, 0x0002c45c}, /* _LdrSem */
+            {11, 0x00029e68}, /* _LDRLibPath */
+            {16, 0x0003e460}, /* _TKSuBuff */
+            {16, 0x0003dfaf}, /* _TKFuBuff */
+            {16, 0x0003e1bb}, /* _TKFuBufLen */
+            {16, 0x00054708}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c048}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8259HS.SYM */
+        8259, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000bee0}, /* _ldrRead */
+            {16, 0x000488dc}, /* _ldrOpen */
+            {16, 0x000492d8}, /* _ldrClose */
+            {16, 0x00049328}, /* _LDRQAppType */
+            {16, 0x00046dd4}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005310}, /* _IOSftOpen */
+            {16, 0x0000588e}, /* _IOSftClose */
+            {16, 0x00005945}, /* _IOSftTransPath */
+            {16, 0x000055d6}, /* _IOSftReadAt */
+            {16, 0x0000579f}, /* _IOSftWriteAt */
+            {16, 0x00005a6f}, /* _SftFileSize */
+            {16, 0x000449c4}, /* _VMAllocMem */
+            {16, 0x000289c2}, /* _VMGetOwner */
+            {16, 0x00052956}, /* g_tkExecPgm */
+            {16, 0x0004f1ad}, /* _tkStartProcess */
+            {13, 0x00009fdc}, /* f_FuStrLenZ */
+            {13, 0x00009f5c}, /* f_FuStrLen */
+            {13, 0x0000a185}, /* f_FuBuff */
+            {16, 0x0002761b}, /* _VMObjHandleInfo */
+            {16, 0x0005335c}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00048b5e}, /* _ldrOpenPath */
+            {16, 0x00045388}, /* _LDRClearSem */
+            {16, 0x0004e886}, /* _ldrFindModule */
+            {16, 0x0000d650}, /* _KSEMRequestMutex */
+            {16, 0x0000d727}, /* _KSEMReleaseMutex */
+            {16, 0x0000d752}, /* _KSEMQueryMutex */
+            {16, 0x0000d9f2}, /* _KSEMInit */
+            {11, 0x0001d6c4}, /* _LdrSem */
+            {11, 0x0001bc40}, /* _LDRLibPath */
+            {16, 0x000347a7}, /* _TKSuBuff */
+            {16, 0x0003433c}, /* _TKFuBuff */
+            {16, 0x00034506}, /* _TKFuBufLen */
+            {16, 0x000453d4}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8cc}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d488}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8259HU.SYM */
+        8259, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000092c8}, /* _ldrRead */
+            {15, 0x0003bf00}, /* _ldrOpen */
+            {15, 0x0003c788}, /* _ldrClose */
+            {15, 0x0003c7d8}, /* _LDRQAppType */
+            {15, 0x0003a0fc}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a24}, /* _IOSftOpen */
+            {15, 0x00003e90}, /* _IOSftClose */
+            {15, 0x00003f25}, /* _IOSftTransPath */
+            {15, 0x00003cde}, /* _IOSftReadAt */
+            {15, 0x00003ce5}, /* _IOSftWriteAt */
+            {15, 0x0000403e}, /* _SftFileSize */
+            {15, 0x000383c8}, /* _VMAllocMem */
+            {15, 0x0001e146}, /* _VMGetOwner */
+            {15, 0x0004466e}, /* g_tkExecPgm */
+            {15, 0x0004163f}, /* _tkStartProcess */
+            {11, 0x0000d7a4}, /* f_FuStrLenZ */
+            {11, 0x0000d75a}, /* f_FuStrLen */
+            {11, 0x0000d898}, /* f_FuBuff */
+            {15, 0x0001d4a8}, /* _VMObjHandleInfo */
+            {15, 0x00045034}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c177}, /* _ldrOpenPath */
+            {15, 0x00038b10}, /* _LDRClearSem */
+            {15, 0x00040de1}, /* _ldrFindModule */
+            {15, 0x0000a73c}, /* _KSEMRequestMutex */
+            {15, 0x0000a813}, /* _KSEMReleaseMutex */
+            {15, 0x0000a83e}, /* _KSEMQueryMutex */
+            {15, 0x0000aade}, /* _KSEMInit */
+            {10, 0x0001c9ec}, /* _LdrSem */
+            {10, 0x00019e58}, /* _LDRLibPath */
+            {15, 0x00028e09}, /* _TKSuBuff */
+            {15, 0x00028a3f}, /* _TKFuBuff */
+            {15, 0x00028bc9}, /* _TKFuBufLen */
+            {15, 0x00038b4c}, /* _ldrValidateMteHandle */
+            {10, 0x000070bc}, /* _pTCBCur */
+            {10, 0x000070b8}, /* _pPTDACur */
+            {4 , 0x0000f9a8}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bd7c}, /* _ldrpFileNameBuf */
+            {15, 0x0003525b}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 8259RS.SYM */
+        8259, KF_SMP, 15,
         {
             {14, 0x0000bdd0}, /* _ldrRead */
@@ -230,77 +1867,232 @@
             {14, 0x000271aa}, /* _VMGetOwner */
             {14, 0x0005065e}, /* g_tkExecPgm */
+            {14, 0x0004cdad}, /* _tkStartProcess */
             {11, 0x00009fdc}, /* f_FuStrLenZ */
             {11, 0x00009f5c}, /* f_FuStrLen */
             {11, 0x0000a185}, /* f_FuBuff */
-        }
-    },
-    { /* 8258RU.SYM */
-        8258, 'R', TYPE_UNI, 14,
-        {
-            {13, 0x000091a4}, /* _ldrRead */
-            {13, 0x0003a580}, /* _ldrOpen */
-            {13, 0x0003ae08}, /* _ldrClose */
-            {13, 0x0003ae58}, /* _LDRQAppType */
-            {13, 0x0003877c}, /* _ldrEnum32bitRelRecs */
-            {13, 0x000039a4}, /* _IOSftOpen */
-            {13, 0x00003e10}, /* _IOSftClose */
-            {13, 0x00003ea5}, /* _IOSftTransPath */
-            {13, 0x00003c5e}, /* _IOSftReadAt */
-            {13, 0x00003c65}, /* _IOSftWriteAt */
-            {13, 0x00003fbe}, /* _SftFileSize */
-            {13, 0x00036a48}, /* _VMAllocMem */
-            {13, 0x0001d16a}, /* _VMGetOwner */
-            {13, 0x00042d56}, /* g_tkExecPgm */
-            {9, 0x0000d794}, /* f_FuStrLenZ */
-            {9, 0x0000d74a}, /* f_FuStrLen */
-            {9, 0x0000d888}, /* f_FuBuff */
-        }
-    },
-    { /* 8259RS.SYM */
-        8259, 'R', TYPE_SMP, 15,
-        {
-            {14, 0x0000bdd0}, /* _ldrRead */
-            {14, 0x000465c0}, /* _ldrOpen */
-            {14, 0x00046fbc}, /* _ldrClose */
-            {14, 0x0004700c}, /* _LDRQAppType */
-            {14, 0x00044ab8}, /* _ldrEnum32bitRelRecs */
-            {14, 0x0000526c}, /* _IOSftOpen */
-            {14, 0x000057ea}, /* _IOSftClose */
-            {14, 0x000058a1}, /* _IOSftTransPath */
-            {14, 0x00005532}, /* _IOSftReadAt */
-            {14, 0x000056fb}, /* _IOSftWriteAt */
-            {14, 0x000059cb}, /* _SftFileSize */
-            {14, 0x000426a8}, /* _VMAllocMem */
-            {14, 0x000272ae}, /* _VMGetOwner */
-            {14, 0x00050812}, /* g_tkExecPgm */
-            {11, 0x00009fdc}, /* f_FuStrLenZ */
-            {11, 0x00009f5c}, /* f_FuStrLen */
-            {11, 0x0000a185}, /* f_FuBuff */
-        }
-    },
-    { /* 8259RU.SYM */
-        8259, 'R', TYPE_UNI, 14,
-        {
-            {13, 0x00009234}, /* _ldrRead */
-            {13, 0x0003a608}, /* _ldrOpen */
-            {13, 0x0003ae90}, /* _ldrClose */
-            {13, 0x0003aee0}, /* _LDRQAppType */
-            {13, 0x00038804}, /* _ldrEnum32bitRelRecs */
-            {13, 0x000039a4}, /* _IOSftOpen */
-            {13, 0x00003e10}, /* _IOSftClose */
-            {13, 0x00003ea5}, /* _IOSftTransPath */
-            {13, 0x00003c5e}, /* _IOSftReadAt */
-            {13, 0x00003c65}, /* _IOSftWriteAt */
-            {13, 0x00003fbe}, /* _SftFileSize */
-            {13, 0x00036ad0}, /* _VMAllocMem */
-            {13, 0x0001d2de}, /* _VMGetOwner */
-            {13, 0x00042de2}, /* g_tkExecPgm */
-            {9, 0x0000d7a4}, /* f_FuStrLenZ */
-            {9, 0x0000d75a}, /* f_FuStrLen */
-            {9, 0x0000d898}, /* f_FuBuff */
-        }
-    },
+            {14, 0x00025e03}, /* _VMObjHandleInfo */
+            {14, 0x00051064}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004673e}, /* _ldrOpenPath */
+            {14, 0x00042f68}, /* _LDRClearSem */
+            {14, 0x0004c486}, /* _ldrFindModule */
+            {14, 0x0000d410}, /* _KSEMRequestMutex */
+            {14, 0x0000d4a3}, /* _KSEMReleaseMutex */
+            {14, 0x0000d4ce}, /* _KSEMQueryMutex */
+            {14, 0x0000d6e3}, /* _KSEMInit */
+            {9 , 0x0000d12c}, /* _LdrSem */
+            {9 , 0x0000b6b0}, /* _LDRLibPath */
+            {14, 0x00032f8f}, /* _TKSuBuff */
+            {14, 0x00032b24}, /* _TKFuBuff */
+            {14, 0x00032cee}, /* _TKFuBufLen */
+            {14, 0x00042fb4}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8cc}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cef0}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8260AS.SYM */
+        8260, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d38c}, /* _ldrRead */
+            {16, 0x000587b0}, /* _ldrOpen */
+            {16, 0x000592d0}, /* _ldrClose */
+            {16, 0x00059320}, /* _LDRQAppType */
+            {16, 0x00056a68}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00006180}, /* _IOSftOpen */
+            {16, 0x0000670c}, /* _IOSftClose */
+            {16, 0x000067c4}, /* _IOSftTransPath */
+            {16, 0x00006450}, /* _IOSftReadAt */
+            {16, 0x0000661c}, /* _IOSftWriteAt */
+            {16, 0x000068fc}, /* _SftFileSize */
+            {16, 0x00053dc8}, /* _VMAllocMem */
+            {16, 0x0002f9d2}, /* _VMGetOwner */
+            {16, 0x00063cf8}, /* g_tkExecPgm */
+            {16, 0x0005fb2c}, /* _tkStartProcess */
+            {13, 0x0000a618}, /* f_FuStrLenZ */
+            {13, 0x0000a598}, /* f_FuStrLen */
+            {13, 0x0000a7e0}, /* f_FuBuff */
+            {16, 0x0002e1f7}, /* _VMObjHandleInfo */
+            {16, 0x000647d0}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00058a4a}, /* _ldrOpenPath */
+            {16, 0x00054a64}, /* _LDRClearSem */
+            {16, 0x0005f162}, /* _ldrFindModule */
+            {16, 0x0000f07c}, /* _KSEMRequestMutex */
+            {16, 0x0000f190}, /* _KSEMReleaseMutex */
+            {16, 0x0000f1f0}, /* _KSEMQueryMutex */
+            {16, 0x0000f574}, /* _KSEMInit */
+            {11, 0x0002c474}, /* _LdrSem */
+            {11, 0x00029e80}, /* _LDRLibPath */
+            {16, 0x0003e7cc}, /* _TKSuBuff */
+            {16, 0x0003e31b}, /* _TKFuBuff */
+            {16, 0x0003e527}, /* _TKFuBufLen */
+            {16, 0x00054afc}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c060}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8260AU.SYM */
+        8260, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a2a0}, /* _ldrRead */
+            {15, 0x0004a19c}, /* _ldrOpen */
+            {15, 0x0004ab34}, /* _ldrClose */
+            {15, 0x0004ab84}, /* _LDRQAppType */
+            {15, 0x000480c4}, /* _ldrEnum32bitRelRecs */
+            {15, 0x000044a0}, /* _IOSftOpen */
+            {15, 0x00004918}, /* _IOSftClose */
+            {15, 0x000049b0}, /* _IOSftTransPath */
+            {15, 0x00004764}, /* _IOSftReadAt */
+            {15, 0x0000476b}, /* _IOSftWriteAt */
+            {15, 0x00004ad8}, /* _SftFileSize */
+            {15, 0x00045a44}, /* _VMAllocMem */
+            {15, 0x0002376a}, /* _VMGetOwner */
+            {15, 0x00053b5c}, /* g_tkExecPgm */
+            {15, 0x000502d0}, /* _tkStartProcess */
+            {11, 0x0000e9d4}, /* f_FuStrLenZ */
+            {11, 0x0000e988}, /* f_FuStrLen */
+            {11, 0x0000eaec}, /* f_FuBuff */
+            {15, 0x000226b4}, /* _VMObjHandleInfo */
+            {15, 0x000545f4}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a427}, /* _ldrOpenPath */
+            {15, 0x000464f8}, /* _LDRClearSem */
+            {15, 0x0004f9d0}, /* _ldrFindModule */
+            {15, 0x0000bbcc}, /* _KSEMRequestMutex */
+            {15, 0x0000bce0}, /* _KSEMReleaseMutex */
+            {15, 0x0000bd40}, /* _KSEMQueryMutex */
+            {15, 0x0000c0c4}, /* _KSEMInit */
+            {10, 0x0002a1d8}, /* _LdrSem */
+            {10, 0x000269d4}, /* _LDRLibPath */
+            {15, 0x000316d8}, /* _TKSuBuff */
+            {15, 0x000312ca}, /* _TKFuBuff */
+            {15, 0x00031496}, /* _TKFuBufLen */
+            {15, 0x00046580}, /* _ldrValidateMteHandle */
+            {10, 0x0000b740}, /* _pTCBCur */
+            {10, 0x0000b73c}, /* _pPTDACur */
+            {4 , 0x0000f9a0}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x00029390}, /* _ldrpFileNameBuf */
+            {15, 0x0004231f}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8260HS.SYM */
+        8260, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000befc}, /* _ldrRead */
+            {16, 0x00048c8c}, /* _ldrOpen */
+            {16, 0x00049688}, /* _ldrClose */
+            {16, 0x000496d8}, /* _LDRQAppType */
+            {16, 0x00047184}, /* _ldrEnum32bitRelRecs */
+            {16, 0x0000531c}, /* _IOSftOpen */
+            {16, 0x0000589a}, /* _IOSftClose */
+            {16, 0x00005951}, /* _IOSftTransPath */
+            {16, 0x000055e2}, /* _IOSftReadAt */
+            {16, 0x000057ab}, /* _IOSftWriteAt */
+            {16, 0x00005a7b}, /* _SftFileSize */
+            {16, 0x00044d74}, /* _VMAllocMem */
+            {16, 0x00028c56}, /* _VMGetOwner */
+            {16, 0x00052e52}, /* g_tkExecPgm */
+            {16, 0x0004f6a9}, /* _tkStartProcess */
+            {13, 0x00009f7c}, /* f_FuStrLenZ */
+            {13, 0x00009efc}, /* f_FuStrLen */
+            {13, 0x0000a125}, /* f_FuBuff */
+            {16, 0x000278af}, /* _VMObjHandleInfo */
+            {16, 0x00053858}, /* _ldrASMpMTEFromHandle */
+            {16, 0x00048f0e}, /* _ldrOpenPath */
+            {16, 0x00045738}, /* _LDRClearSem */
+            {16, 0x0004ed83}, /* _ldrFindModule */
+            {16, 0x0000d66c}, /* _KSEMRequestMutex */
+            {16, 0x0000d743}, /* _KSEMReleaseMutex */
+            {16, 0x0000d76e}, /* _KSEMQueryMutex */
+            {16, 0x0000da0e}, /* _KSEMInit */
+            {11, 0x0001d6f0}, /* _LdrSem */
+            {11, 0x0001bc6c}, /* _LDRLibPath */
+            {16, 0x00034ad3}, /* _TKSuBuff */
+            {16, 0x00034668}, /* _TKFuBuff */
+            {16, 0x00034832}, /* _TKFuBufLen */
+            {16, 0x00045784}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8cc}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d4b4}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8260HU.SYM */
+        8260, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000092d8}, /* _ldrRead */
+            {15, 0x0003bf10}, /* _ldrOpen */
+            {15, 0x0003c798}, /* _ldrClose */
+            {15, 0x0003c7e8}, /* _LDRQAppType */
+            {15, 0x0003a10c}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a24}, /* _IOSftOpen */
+            {15, 0x00003e90}, /* _IOSftClose */
+            {15, 0x00003f25}, /* _IOSftTransPath */
+            {15, 0x00003cde}, /* _IOSftReadAt */
+            {15, 0x00003ce5}, /* _IOSftWriteAt */
+            {15, 0x0000403e}, /* _SftFileSize */
+            {15, 0x000383d8}, /* _VMAllocMem */
+            {15, 0x0001e156}, /* _VMGetOwner */
+            {15, 0x00044716}, /* g_tkExecPgm */
+            {15, 0x000416e7}, /* _tkStartProcess */
+            {11, 0x0000d7a4}, /* f_FuStrLenZ */
+            {11, 0x0000d75a}, /* f_FuStrLen */
+            {11, 0x0000d898}, /* f_FuBuff */
+            {15, 0x0001d4b8}, /* _VMObjHandleInfo */
+            {15, 0x000450dc}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c187}, /* _ldrOpenPath */
+            {15, 0x00038b20}, /* _LDRClearSem */
+            {15, 0x00040e88}, /* _ldrFindModule */
+            {15, 0x0000a74c}, /* _KSEMRequestMutex */
+            {15, 0x0000a823}, /* _KSEMReleaseMutex */
+            {15, 0x0000a84e}, /* _KSEMQueryMutex */
+            {15, 0x0000aaee}, /* _KSEMInit */
+            {10, 0x0001c9f4}, /* _LdrSem */
+            {10, 0x00019e60}, /* _LDRLibPath */
+            {15, 0x00028e15}, /* _TKSuBuff */
+            {15, 0x00028a4b}, /* _TKFuBuff */
+            {15, 0x00028bd5}, /* _TKFuBufLen */
+            {15, 0x00038b5c}, /* _ldrValidateMteHandle */
+            {10, 0x000070bc}, /* _pTCBCur */
+            {10, 0x000070b8}, /* _pPTDACur */
+            {4 , 0x0000f9a8}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bd84}, /* _ldrpFileNameBuf */
+            {15, 0x0003526b}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8260RS.SYM */
-        8260, 'R', TYPE_SMP, 15,
+        8260, KF_SMP, 15,
         {
             {14, 0x0000bdec}, /* _ldrRead */
@@ -318,11 +2110,36 @@
             {14, 0x0002743a}, /* _VMGetOwner */
             {14, 0x00050b4a}, /* g_tkExecPgm */
+            {14, 0x0004d299}, /* _tkStartProcess */
             {11, 0x00009f7c}, /* f_FuStrLenZ */
             {11, 0x00009efc}, /* f_FuStrLen */
             {11, 0x0000a125}, /* f_FuBuff */
+            {14, 0x00026093}, /* _VMObjHandleInfo */
+            {14, 0x00051550}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00046ada}, /* _ldrOpenPath */
+            {14, 0x00043304}, /* _LDRClearSem */
+            {14, 0x0004c973}, /* _ldrFindModule */
+            {14, 0x0000d42c}, /* _KSEMRequestMutex */
+            {14, 0x0000d4bf}, /* _KSEMReleaseMutex */
+            {14, 0x0000d4ea}, /* _KSEMQueryMutex */
+            {14, 0x0000d6ff}, /* _KSEMInit */
+            {9 , 0x0000d158}, /* _LdrSem */
+            {9 , 0x0000b6dc}, /* _LDRLibPath */
+            {14, 0x000332b7}, /* _TKSuBuff */
+            {14, 0x00032e4c}, /* _TKFuBuff */
+            {14, 0x00033016}, /* _TKFuBufLen */
+            {14, 0x00043350}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8cc}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cf1c}, /* _ldrpFileNameBuf */
+            {15, 0xffffffff}, /* SecPathFromSFN */
         }
     },
     { /* 8260RU.SYM */
-        8260, 'R', TYPE_UNI, 14,
+        8260, KF_UNI, 14,
         {
             {13, 0x00009244}, /* _ldrRead */
@@ -340,11 +2157,232 @@
             {13, 0x0001d2ee}, /* _VMGetOwner */
             {13, 0x00042e8a}, /* g_tkExecPgm */
-            {9, 0x0000d7a4}, /* f_FuStrLenZ */
-            {9, 0x0000d75a}, /* f_FuStrLen */
-            {9, 0x0000d898}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0003fe7f}, /* _tkStartProcess */
+            {9 , 0x0000d7a4}, /* f_FuStrLenZ */
+            {9 , 0x0000d75a}, /* f_FuStrLen */
+            {9 , 0x0000d898}, /* f_FuBuff */
+            {13, 0x0001c650}, /* _VMObjHandleInfo */
+            {13, 0x00043850}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a88f}, /* _ldrOpenPath */
+            {13, 0x00037228}, /* _LDRClearSem */
+            {13, 0x0003f620}, /* _ldrFindModule */
+            {13, 0x0000a590}, /* _KSEMRequestMutex */
+            {13, 0x0000a623}, /* _KSEMReleaseMutex */
+            {13, 0x0000a64e}, /* _KSEMQueryMutex */
+            {13, 0x0000a863}, /* _KSEMInit */
+            {8 , 0x0000c830}, /* _LdrSem */
+            {8 , 0x00009ca0}, /* _LDRLibPath */
+            {13, 0x00027fad}, /* _TKSuBuff */
+            {13, 0x00027be3}, /* _TKFuBuff */
+            {13, 0x00027d6d}, /* _TKFuBufLen */
+            {13, 0x00037264}, /* _ldrValidateMteHandle */
+            {8 , 0x000070bc}, /* _pTCBCur */
+            {8 , 0x000070b8}, /* _pPTDACur */
+            {2 , 0x0000f9a8}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bbc0}, /* _ldrpFileNameBuf */
+            {13, 0x00033973}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8261AS.SYM */
+        8261, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d7d8}, /* _ldrRead */
+            {16, 0x0005c3d0}, /* _ldrOpen */
+            {16, 0x0005cf18}, /* _ldrClose */
+            {16, 0x0005cf68}, /* _LDRQAppType */
+            {16, 0x0005a674}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00006320}, /* _IOSftOpen */
+            {16, 0x00006808}, /* _IOSftClose */
+            {16, 0x000068c0}, /* _IOSftTransPath */
+            {16, 0x0000661c}, /* _IOSftReadAt */
+            {16, 0x00006623}, /* _IOSftWriteAt */
+            {16, 0x000069f8}, /* _SftFileSize */
+            {16, 0x000579d4}, /* _VMAllocMem */
+            {16, 0x0002fef6}, /* _VMGetOwner */
+            {16, 0x00067a48}, /* g_tkExecPgm */
+            {16, 0x00063818}, /* _tkStartProcess */
+            {13, 0x0000a824}, /* f_FuStrLenZ */
+            {13, 0x0000a7a4}, /* f_FuStrLen */
+            {13, 0x0000a9ec}, /* f_FuBuff */
+            {16, 0x0002e717}, /* _VMObjHandleInfo */
+            {16, 0x00068608}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005c68a}, /* _ldrOpenPath */
+            {16, 0x00058670}, /* _LDRClearSem */
+            {16, 0x00062e50}, /* _ldrFindModule */
+            {16, 0x0000f4fc}, /* _KSEMRequestMutex */
+            {16, 0x0000f610}, /* _KSEMReleaseMutex */
+            {16, 0x0000f670}, /* _KSEMQueryMutex */
+            {16, 0x0000f9f4}, /* _KSEMInit */
+            {11, 0x0002c800}, /* _LdrSem */
+            {11, 0x0002a20c}, /* _LDRLibPath */
+            {16, 0x0003f29c}, /* _TKSuBuff */
+            {16, 0x0003eded}, /* _TKFuBuff */
+            {16, 0x0003eff9}, /* _TKFuBufLen */
+            {16, 0x00058708}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8b4}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c3ec}, /* _ldrpFileNameBuf */
+            {16, 0x0005362a}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8261AU.SYM */
+        8261, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a328}, /* _ldrRead */
+            {15, 0x0004a48c}, /* _ldrOpen */
+            {15, 0x0004ae2c}, /* _ldrClose */
+            {15, 0x0004ae7c}, /* _LDRQAppType */
+            {15, 0x00048394}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004520}, /* _IOSftOpen */
+            {15, 0x00004998}, /* _IOSftClose */
+            {15, 0x00004a30}, /* _IOSftTransPath */
+            {15, 0x000047e4}, /* _IOSftReadAt */
+            {15, 0x000047eb}, /* _IOSftWriteAt */
+            {15, 0x00004b58}, /* _SftFileSize */
+            {15, 0x00045d10}, /* _VMAllocMem */
+            {15, 0x0002384a}, /* _VMGetOwner */
+            {15, 0x00053f24}, /* g_tkExecPgm */
+            {15, 0x0005065c}, /* _tkStartProcess */
+            {11, 0x0000ea04}, /* f_FuStrLenZ */
+            {11, 0x0000e9b8}, /* f_FuStrLen */
+            {11, 0x0000eb1c}, /* f_FuBuff */
+            {15, 0x00022794}, /* _VMObjHandleInfo */
+            {15, 0x000549ec}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a717}, /* _ldrOpenPath */
+            {15, 0x000467c4}, /* _LDRClearSem */
+            {15, 0x0004fd5c}, /* _ldrFindModule */
+            {15, 0x0000bc54}, /* _KSEMRequestMutex */
+            {15, 0x0000bd68}, /* _KSEMReleaseMutex */
+            {15, 0x0000bdc8}, /* _KSEMQueryMutex */
+            {15, 0x0000c14c}, /* _KSEMInit */
+            {10, 0x0002a394}, /* _LdrSem */
+            {10, 0x00026b90}, /* _LDRLibPath */
+            {15, 0x000317f0}, /* _TKSuBuff */
+            {15, 0x000313e0}, /* _TKFuBuff */
+            {15, 0x000315ac}, /* _TKFuBufLen */
+            {15, 0x0004684c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b84c}, /* _pTCBCur */
+            {10, 0x0000b848}, /* _pPTDACur */
+            {4 , 0x0000f994}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002954c}, /* _ldrpFileNameBuf */
+            {15, 0x000425d9}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8261HS.SYM */
+        8261, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000c2ec}, /* _ldrRead */
+            {16, 0x0004c87c}, /* _ldrOpen */
+            {16, 0x0004d2a4}, /* _ldrClose */
+            {16, 0x0004d2f4}, /* _LDRQAppType */
+            {16, 0x0004ad6c}, /* _ldrEnum32bitRelRecs */
+            {16, 0x0000547c}, /* _IOSftOpen */
+            {16, 0x00005955}, /* _IOSftClose */
+            {16, 0x00005a0c}, /* _IOSftTransPath */
+            {16, 0x0000576c}, /* _IOSftReadAt */
+            {16, 0x00005773}, /* _IOSftWriteAt */
+            {16, 0x00005b36}, /* _SftFileSize */
+            {16, 0x0004895c}, /* _VMAllocMem */
+            {16, 0x000292bc}, /* _VMGetOwner */
+            {16, 0x00056d3a}, /* g_tkExecPgm */
+            {16, 0x00053415}, /* _tkStartProcess */
+            {13, 0x0000a158}, /* f_FuStrLenZ */
+            {13, 0x0000a0d8}, /* f_FuStrLen */
+            {13, 0x0000a301}, /* f_FuBuff */
+            {16, 0x00027f13}, /* _VMObjHandleInfo */
+            {16, 0x00057824}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0004cb22}, /* _ldrOpenPath */
+            {16, 0x00049320}, /* _LDRClearSem */
+            {16, 0x00052af1}, /* _ldrFindModule */
+            {16, 0x0000da8c}, /* _KSEMRequestMutex */
+            {16, 0x0000db63}, /* _KSEMReleaseMutex */
+            {16, 0x0000db8e}, /* _KSEMQueryMutex */
+            {16, 0x0000de2e}, /* _KSEMInit */
+            {11, 0x0001d780}, /* _LdrSem */
+            {11, 0x0001bcfc}, /* _LDRLibPath */
+            {16, 0x000356e7}, /* _TKSuBuff */
+            {16, 0x0003527a}, /* _TKFuBuff */
+            {16, 0x00035444}, /* _TKFuBufLen */
+            {16, 0x0004936c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d544}, /* _ldrpFileNameBuf */
+            {16, 0x00044c8a}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8261HU.SYM */
+        8261, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00009328}, /* _ldrRead */
+            {15, 0x0003c120}, /* _ldrOpen */
+            {15, 0x0003c9ac}, /* _ldrClose */
+            {15, 0x0003c9fc}, /* _LDRQAppType */
+            {15, 0x0003a308}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a70}, /* _IOSftOpen */
+            {15, 0x00003edc}, /* _IOSftClose */
+            {15, 0x00003f71}, /* _IOSftTransPath */
+            {15, 0x00003d2a}, /* _IOSftReadAt */
+            {15, 0x00003d31}, /* _IOSftWriteAt */
+            {15, 0x0000408a}, /* _SftFileSize */
+            {15, 0x000385d4}, /* _VMAllocMem */
+            {15, 0x0001e156}, /* _VMGetOwner */
+            {15, 0x00044a9a}, /* g_tkExecPgm */
+            {15, 0x00041a0b}, /* _tkStartProcess */
+            {11, 0x0000d7d0}, /* f_FuStrLenZ */
+            {11, 0x0000d786}, /* f_FuStrLen */
+            {11, 0x0000d8c4}, /* f_FuBuff */
+            {15, 0x0001d4bc}, /* _VMObjHandleInfo */
+            {15, 0x00045490}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c397}, /* _ldrOpenPath */
+            {15, 0x00038d1c}, /* _LDRClearSem */
+            {15, 0x000411ac}, /* _ldrFindModule */
+            {15, 0x0000a79c}, /* _KSEMRequestMutex */
+            {15, 0x0000a873}, /* _KSEMReleaseMutex */
+            {15, 0x0000a89e}, /* _KSEMQueryMutex */
+            {15, 0x0000ab3e}, /* _KSEMInit */
+            {10, 0x0001ca30}, /* _LdrSem */
+            {10, 0x00019e9c}, /* _LDRLibPath */
+            {15, 0x00028e31}, /* _TKSuBuff */
+            {15, 0x00028a67}, /* _TKFuBuff */
+            {15, 0x00028bf1}, /* _TKFuBufLen */
+            {15, 0x00038d58}, /* _ldrValidateMteHandle */
+            {10, 0x000070e4}, /* _pTCBCur */
+            {10, 0x000070e0}, /* _pPTDACur */
+            {4 , 0x0000f99c}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bdc0}, /* _ldrpFileNameBuf */
+            {15, 0x00035455}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8261RS.SYM */
-        8261, 'R', TYPE_SMP, 15,
+        8261, KF_SMP, 15,
         {
             {14, 0x0000c1dc}, /* _ldrRead */
@@ -362,11 +2400,36 @@
             {14, 0x00027aa0}, /* _VMGetOwner */
             {14, 0x000547fe}, /* g_tkExecPgm */
+            {14, 0x00050ff1}, /* _tkStartProcess */
             {11, 0x0000a158}, /* f_FuStrLenZ */
             {11, 0x0000a0d8}, /* f_FuStrLen */
             {11, 0x0000a301}, /* f_FuBuff */
+            {14, 0x000266f7}, /* _VMObjHandleInfo */
+            {14, 0x000552e8}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004a712}, /* _ldrOpenPath */
+            {14, 0x00046f10}, /* _LDRClearSem */
+            {14, 0x000506cd}, /* _ldrFindModule */
+            {14, 0x0000d84c}, /* _KSEMRequestMutex */
+            {14, 0x0000d8df}, /* _KSEMReleaseMutex */
+            {14, 0x0000d90a}, /* _KSEMQueryMutex */
+            {14, 0x0000db1f}, /* _KSEMInit */
+            {9 , 0x0000d1e8}, /* _LdrSem */
+            {9 , 0x0000b76c}, /* _LDRLibPath */
+            {14, 0x00033ecb}, /* _TKSuBuff */
+            {14, 0x00033a5e}, /* _TKFuBuff */
+            {14, 0x00033c28}, /* _TKFuBufLen */
+            {14, 0x00046f5c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8c0}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cfac}, /* _ldrpFileNameBuf */
+            {14, 0x0004287a}, /* SecPathFromSFN */
         }
     },
     { /* 8261RU.SYM */
-        8261, 'R', TYPE_UNI, 14,
+        8261, KF_UNI, 14,
         {
             {13, 0x00009294}, /* _ldrRead */
@@ -384,11 +2447,232 @@
             {13, 0x0001d2ee}, /* _VMGetOwner */
             {13, 0x0004315a}, /* g_tkExecPgm */
-            {9, 0x0000d7d0}, /* f_FuStrLenZ */
-            {9, 0x0000d786}, /* f_FuStrLen */
-            {9, 0x0000d8c4}, /* f_FuBuff */
-        }
-    },
+            {13, 0x000400eb}, /* _tkStartProcess */
+            {9 , 0x0000d7d0}, /* f_FuStrLenZ */
+            {9 , 0x0000d786}, /* f_FuStrLen */
+            {9 , 0x0000d8c4}, /* f_FuBuff */
+            {13, 0x0001c654}, /* _VMObjHandleInfo */
+            {13, 0x00043b50}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003aab3}, /* _ldrOpenPath */
+            {13, 0x00037438}, /* _LDRClearSem */
+            {13, 0x0003f88c}, /* _ldrFindModule */
+            {13, 0x0000a5e0}, /* _KSEMRequestMutex */
+            {13, 0x0000a673}, /* _KSEMReleaseMutex */
+            {13, 0x0000a69e}, /* _KSEMQueryMutex */
+            {13, 0x0000a8b3}, /* _KSEMInit */
+            {8 , 0x0000c86c}, /* _LdrSem */
+            {8 , 0x00009cdc}, /* _LDRLibPath */
+            {13, 0x00027fc9}, /* _TKSuBuff */
+            {13, 0x00027bff}, /* _TKFuBuff */
+            {13, 0x00027d89}, /* _TKFuBufLen */
+            {13, 0x00037474}, /* _ldrValidateMteHandle */
+            {8 , 0x000070e4}, /* _pTCBCur */
+            {8 , 0x000070e0}, /* _pPTDACur */
+            {2 , 0x0000f99c}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bbfc}, /* _ldrpFileNameBuf */
+            {13, 0x00033b71}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8262AS.SYM */
+        8262, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d7d8}, /* _ldrRead */
+            {16, 0x0005c2d0}, /* _ldrOpen */
+            {16, 0x0005ce18}, /* _ldrClose */
+            {16, 0x0005ce68}, /* _LDRQAppType */
+            {16, 0x0005a574}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00006320}, /* _IOSftOpen */
+            {16, 0x00006808}, /* _IOSftClose */
+            {16, 0x000068c0}, /* _IOSftTransPath */
+            {16, 0x0000661c}, /* _IOSftReadAt */
+            {16, 0x00006623}, /* _IOSftWriteAt */
+            {16, 0x000069f8}, /* _SftFileSize */
+            {16, 0x000578d4}, /* _VMAllocMem */
+            {16, 0x0002fdf6}, /* _VMGetOwner */
+            {16, 0x00067948}, /* g_tkExecPgm */
+            {16, 0x00063718}, /* _tkStartProcess */
+            {13, 0x0000a824}, /* f_FuStrLenZ */
+            {13, 0x0000a7a4}, /* f_FuStrLen */
+            {13, 0x0000a9ec}, /* f_FuBuff */
+            {16, 0x0002e617}, /* _VMObjHandleInfo */
+            {16, 0x00068508}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005c58a}, /* _ldrOpenPath */
+            {16, 0x00058570}, /* _LDRClearSem */
+            {16, 0x00062d50}, /* _ldrFindModule */
+            {16, 0x0000f4fc}, /* _KSEMRequestMutex */
+            {16, 0x0000f610}, /* _KSEMReleaseMutex */
+            {16, 0x0000f670}, /* _KSEMQueryMutex */
+            {16, 0x0000f9f4}, /* _KSEMInit */
+            {11, 0x0002c800}, /* _LdrSem */
+            {11, 0x0002a20c}, /* _LDRLibPath */
+            {16, 0x0003f19c}, /* _TKSuBuff */
+            {16, 0x0003eced}, /* _TKFuBuff */
+            {16, 0x0003eef9}, /* _TKFuBufLen */
+            {16, 0x00058608}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8b4}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c3ec}, /* _ldrpFileNameBuf */
+            {16, 0x0005352a}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8262AU.SYM */
+        8262, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a328}, /* _ldrRead */
+            {15, 0x0004a3a8}, /* _ldrOpen */
+            {15, 0x0004ad48}, /* _ldrClose */
+            {15, 0x0004ad98}, /* _LDRQAppType */
+            {15, 0x000482b0}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004520}, /* _IOSftOpen */
+            {15, 0x00004998}, /* _IOSftClose */
+            {15, 0x00004a30}, /* _IOSftTransPath */
+            {15, 0x000047e4}, /* _IOSftReadAt */
+            {15, 0x000047eb}, /* _IOSftWriteAt */
+            {15, 0x00004b58}, /* _SftFileSize */
+            {15, 0x00045c2c}, /* _VMAllocMem */
+            {15, 0x00023766}, /* _VMGetOwner */
+            {15, 0x00053e40}, /* g_tkExecPgm */
+            {15, 0x00050578}, /* _tkStartProcess */
+            {11, 0x0000ea08}, /* f_FuStrLenZ */
+            {11, 0x0000e9bc}, /* f_FuStrLen */
+            {11, 0x0000eb20}, /* f_FuBuff */
+            {15, 0x000226b0}, /* _VMObjHandleInfo */
+            {15, 0x00054908}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a633}, /* _ldrOpenPath */
+            {15, 0x000466e0}, /* _LDRClearSem */
+            {15, 0x0004fc78}, /* _ldrFindModule */
+            {15, 0x0000bc54}, /* _KSEMRequestMutex */
+            {15, 0x0000bd68}, /* _KSEMReleaseMutex */
+            {15, 0x0000bdc8}, /* _KSEMQueryMutex */
+            {15, 0x0000c14c}, /* _KSEMInit */
+            {10, 0x0002a394}, /* _LdrSem */
+            {10, 0x00026b90}, /* _LDRLibPath */
+            {15, 0x0003170c}, /* _TKSuBuff */
+            {15, 0x000312fc}, /* _TKFuBuff */
+            {15, 0x000314c8}, /* _TKFuBufLen */
+            {15, 0x00046768}, /* _ldrValidateMteHandle */
+            {10, 0x0000b84c}, /* _pTCBCur */
+            {10, 0x0000b848}, /* _pPTDACur */
+            {4 , 0x0000f994}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002954c}, /* _ldrpFileNameBuf */
+            {15, 0x000424f5}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8262HS.SYM */
+        8262, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000c2ec}, /* _ldrRead */
+            {16, 0x0004c77c}, /* _ldrOpen */
+            {16, 0x0004d1a4}, /* _ldrClose */
+            {16, 0x0004d1f4}, /* _LDRQAppType */
+            {16, 0x0004ac6c}, /* _ldrEnum32bitRelRecs */
+            {16, 0x0000547c}, /* _IOSftOpen */
+            {16, 0x00005955}, /* _IOSftClose */
+            {16, 0x00005a0c}, /* _IOSftTransPath */
+            {16, 0x0000576c}, /* _IOSftReadAt */
+            {16, 0x00005773}, /* _IOSftWriteAt */
+            {16, 0x00005b36}, /* _SftFileSize */
+            {16, 0x0004885c}, /* _VMAllocMem */
+            {16, 0x000291bc}, /* _VMGetOwner */
+            {16, 0x00056c3a}, /* g_tkExecPgm */
+            {16, 0x00053315}, /* _tkStartProcess */
+            {13, 0x0000a15c}, /* f_FuStrLenZ */
+            {13, 0x0000a0dc}, /* f_FuStrLen */
+            {13, 0x0000a305}, /* f_FuBuff */
+            {16, 0x00027e13}, /* _VMObjHandleInfo */
+            {16, 0x00057724}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0004ca22}, /* _ldrOpenPath */
+            {16, 0x00049220}, /* _LDRClearSem */
+            {16, 0x000529f1}, /* _ldrFindModule */
+            {16, 0x0000da8c}, /* _KSEMRequestMutex */
+            {16, 0x0000db63}, /* _KSEMReleaseMutex */
+            {16, 0x0000db8e}, /* _KSEMQueryMutex */
+            {16, 0x0000de2e}, /* _KSEMInit */
+            {11, 0x0001d780}, /* _LdrSem */
+            {11, 0x0001bcfc}, /* _LDRLibPath */
+            {16, 0x000355e7}, /* _TKSuBuff */
+            {16, 0x0003517a}, /* _TKFuBuff */
+            {16, 0x00035344}, /* _TKFuBufLen */
+            {16, 0x0004926c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d544}, /* _ldrpFileNameBuf */
+            {16, 0x00044b8a}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8262HU.SYM */
+        8262, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00009328}, /* _ldrRead */
+            {15, 0x0003c03c}, /* _ldrOpen */
+            {15, 0x0003c8c8}, /* _ldrClose */
+            {15, 0x0003c918}, /* _LDRQAppType */
+            {15, 0x0003a224}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a70}, /* _IOSftOpen */
+            {15, 0x00003edc}, /* _IOSftClose */
+            {15, 0x00003f71}, /* _IOSftTransPath */
+            {15, 0x00003d2a}, /* _IOSftReadAt */
+            {15, 0x00003d31}, /* _IOSftWriteAt */
+            {15, 0x0000408a}, /* _SftFileSize */
+            {15, 0x000384f0}, /* _VMAllocMem */
+            {15, 0x0001e072}, /* _VMGetOwner */
+            {15, 0x000449b6}, /* g_tkExecPgm */
+            {15, 0x00041927}, /* _tkStartProcess */
+            {11, 0x0000d7d4}, /* f_FuStrLenZ */
+            {11, 0x0000d78a}, /* f_FuStrLen */
+            {11, 0x0000d8c8}, /* f_FuBuff */
+            {15, 0x0001d3d8}, /* _VMObjHandleInfo */
+            {15, 0x000453ac}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c2b3}, /* _ldrOpenPath */
+            {15, 0x00038c38}, /* _LDRClearSem */
+            {15, 0x000410c8}, /* _ldrFindModule */
+            {15, 0x0000a79c}, /* _KSEMRequestMutex */
+            {15, 0x0000a873}, /* _KSEMReleaseMutex */
+            {15, 0x0000a89e}, /* _KSEMQueryMutex */
+            {15, 0x0000ab3e}, /* _KSEMInit */
+            {10, 0x0001ca30}, /* _LdrSem */
+            {10, 0x00019e9c}, /* _LDRLibPath */
+            {15, 0x00028d4d}, /* _TKSuBuff */
+            {15, 0x00028983}, /* _TKFuBuff */
+            {15, 0x00028b0d}, /* _TKFuBufLen */
+            {15, 0x00038c74}, /* _ldrValidateMteHandle */
+            {10, 0x000070e4}, /* _pTCBCur */
+            {10, 0x000070e0}, /* _pPTDACur */
+            {4 , 0x0000f99c}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bdc0}, /* _ldrpFileNameBuf */
+            {15, 0x00035371}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8262RS.SYM */
-        8262, 'R', TYPE_SMP, 15,
+        8262, KF_SMP, 15,
         {
             {14, 0x0000c1dc}, /* _ldrRead */
@@ -406,11 +2690,36 @@
             {14, 0x000279a0}, /* _VMGetOwner */
             {14, 0x000546fe}, /* g_tkExecPgm */
+            {14, 0x00050ef1}, /* _tkStartProcess */
             {11, 0x0000a15c}, /* f_FuStrLenZ */
             {11, 0x0000a0dc}, /* f_FuStrLen */
             {11, 0x0000a305}, /* f_FuBuff */
+            {14, 0x000265f7}, /* _VMObjHandleInfo */
+            {14, 0x000551e8}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004a612}, /* _ldrOpenPath */
+            {14, 0x00046e10}, /* _LDRClearSem */
+            {14, 0x000505cd}, /* _ldrFindModule */
+            {14, 0x0000d84c}, /* _KSEMRequestMutex */
+            {14, 0x0000d8df}, /* _KSEMReleaseMutex */
+            {14, 0x0000d90a}, /* _KSEMQueryMutex */
+            {14, 0x0000db1f}, /* _KSEMInit */
+            {9 , 0x0000d1e8}, /* _LdrSem */
+            {9 , 0x0000b76c}, /* _LDRLibPath */
+            {14, 0x00033dcb}, /* _TKSuBuff */
+            {14, 0x0003395e}, /* _TKFuBuff */
+            {14, 0x00033b28}, /* _TKFuBufLen */
+            {14, 0x00046e5c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8c0}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cfac}, /* _ldrpFileNameBuf */
+            {14, 0x0004277a}, /* SecPathFromSFN */
         }
     },
     { /* 8262RU.SYM */
-        8262, 'R', TYPE_UNI, 14,
+        8262, KF_UNI, 14,
         {
             {13, 0x00009294}, /* _ldrRead */
@@ -428,11 +2737,232 @@
             {13, 0x0001d20a}, /* _VMGetOwner */
             {13, 0x00043076}, /* g_tkExecPgm */
-            {9, 0x0000d7d4}, /* f_FuStrLenZ */
-            {9, 0x0000d78a}, /* f_FuStrLen */
-            {9, 0x0000d8c8}, /* f_FuBuff */
-        }
-    },
+            {13, 0x00040007}, /* _tkStartProcess */
+            {9 , 0x0000d7d4}, /* f_FuStrLenZ */
+            {9 , 0x0000d78a}, /* f_FuStrLen */
+            {9 , 0x0000d8c8}, /* f_FuBuff */
+            {13, 0x0001c570}, /* _VMObjHandleInfo */
+            {13, 0x00043a6c}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a9cf}, /* _ldrOpenPath */
+            {13, 0x00037354}, /* _LDRClearSem */
+            {13, 0x0003f7a8}, /* _ldrFindModule */
+            {13, 0x0000a5e0}, /* _KSEMRequestMutex */
+            {13, 0x0000a673}, /* _KSEMReleaseMutex */
+            {13, 0x0000a69e}, /* _KSEMQueryMutex */
+            {13, 0x0000a8b3}, /* _KSEMInit */
+            {8 , 0x0000c86c}, /* _LdrSem */
+            {8 , 0x00009cdc}, /* _LDRLibPath */
+            {13, 0x00027ee5}, /* _TKSuBuff */
+            {13, 0x00027b1b}, /* _TKFuBuff */
+            {13, 0x00027ca5}, /* _TKFuBufLen */
+            {13, 0x00037390}, /* _ldrValidateMteHandle */
+            {8 , 0x000070e4}, /* _pTCBCur */
+            {8 , 0x000070e0}, /* _pPTDACur */
+            {2 , 0x0000f99c}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bbfc}, /* _ldrpFileNameBuf */
+            {13, 0x00033a8d}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8263AS.SYM */
+        8263, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d854}, /* _ldrRead */
+            {16, 0x0005c3ac}, /* _ldrOpen */
+            {16, 0x0005cef4}, /* _ldrClose */
+            {16, 0x0005cf44}, /* _LDRQAppType */
+            {16, 0x0005a644}, /* _ldrEnum32bitRelRecs */
+            {16, 0x0000632c}, /* _IOSftOpen */
+            {16, 0x00006814}, /* _IOSftClose */
+            {16, 0x000068cc}, /* _IOSftTransPath */
+            {16, 0x00006628}, /* _IOSftReadAt */
+            {16, 0x0000662f}, /* _IOSftWriteAt */
+            {16, 0x00006a04}, /* _SftFileSize */
+            {16, 0x000579a4}, /* _VMAllocMem */
+            {16, 0x0002fe72}, /* _VMGetOwner */
+            {16, 0x00067990}, /* g_tkExecPgm */
+            {16, 0x000637f4}, /* _tkStartProcess */
+            {13, 0x0000a838}, /* f_FuStrLenZ */
+            {13, 0x0000a7b8}, /* f_FuStrLen */
+            {13, 0x0000aa00}, /* f_FuBuff */
+            {16, 0x0002e693}, /* _VMObjHandleInfo */
+            {16, 0x00068550}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005c666}, /* _ldrOpenPath */
+            {16, 0x00058640}, /* _LDRClearSem */
+            {16, 0x00062e2c}, /* _ldrFindModule */
+            {16, 0x0000f578}, /* _KSEMRequestMutex */
+            {16, 0x0000f68c}, /* _KSEMReleaseMutex */
+            {16, 0x0000f6ec}, /* _KSEMQueryMutex */
+            {16, 0x0000fa70}, /* _KSEMInit */
+            {11, 0x0002c84c}, /* _LdrSem */
+            {11, 0x0002a230}, /* _LDRLibPath */
+            {16, 0x0003f218}, /* _TKSuBuff */
+            {16, 0x0003ed69}, /* _TKFuBuff */
+            {16, 0x0003ef75}, /* _TKFuBufLen */
+            {16, 0x000586d8}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8b4}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c434}, /* _ldrpFileNameBuf */
+            {16, 0x000535dc}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8263AU.SYM */
+        8263, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a3a4}, /* _ldrRead */
+            {15, 0x0004a5b0}, /* _ldrOpen */
+            {15, 0x0004af50}, /* _ldrClose */
+            {15, 0x0004afa0}, /* _LDRQAppType */
+            {15, 0x000484b4}, /* _ldrEnum32bitRelRecs */
+            {15, 0x0000452c}, /* _IOSftOpen */
+            {15, 0x000049a4}, /* _IOSftClose */
+            {15, 0x00004a3c}, /* _IOSftTransPath */
+            {15, 0x000047f0}, /* _IOSftReadAt */
+            {15, 0x000047f7}, /* _IOSftWriteAt */
+            {15, 0x00004b64}, /* _SftFileSize */
+            {15, 0x00045e30}, /* _VMAllocMem */
+            {15, 0x000237e2}, /* _VMGetOwner */
+            {15, 0x0005403c}, /* g_tkExecPgm */
+            {15, 0x00050754}, /* _tkStartProcess */
+            {11, 0x0000ea08}, /* f_FuStrLenZ */
+            {11, 0x0000e9bc}, /* f_FuStrLen */
+            {11, 0x0000eb20}, /* f_FuBuff */
+            {15, 0x0002272c}, /* _VMObjHandleInfo */
+            {15, 0x00054b04}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a83b}, /* _ldrOpenPath */
+            {15, 0x000468e4}, /* _LDRClearSem */
+            {15, 0x0004fe40}, /* _ldrFindModule */
+            {15, 0x0000bcd0}, /* _KSEMRequestMutex */
+            {15, 0x0000bde4}, /* _KSEMReleaseMutex */
+            {15, 0x0000be44}, /* _KSEMQueryMutex */
+            {15, 0x0000c1c8}, /* _KSEMInit */
+            {10, 0x0002a3e8}, /* _LdrSem */
+            {10, 0x00026bbc}, /* _LDRLibPath */
+            {15, 0x00031788}, /* _TKSuBuff */
+            {15, 0x00031378}, /* _TKFuBuff */
+            {15, 0x00031544}, /* _TKFuBufLen */
+            {15, 0x0004696c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b868}, /* _pTCBCur */
+            {10, 0x0000b864}, /* _pPTDACur */
+            {4 , 0x0000f994}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002959c}, /* _ldrpFileNameBuf */
+            {15, 0x000425a7}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8263HS.SYM */
+        8263, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000c360}, /* _ldrRead */
+            {16, 0x0004c870}, /* _ldrOpen */
+            {16, 0x0004d298}, /* _ldrClose */
+            {16, 0x0004d2e8}, /* _LDRQAppType */
+            {16, 0x0004ad54}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005484}, /* _IOSftOpen */
+            {16, 0x0000595d}, /* _IOSftClose */
+            {16, 0x00005a14}, /* _IOSftTransPath */
+            {16, 0x00005774}, /* _IOSftReadAt */
+            {16, 0x0000577b}, /* _IOSftWriteAt */
+            {16, 0x00005b3e}, /* _SftFileSize */
+            {16, 0x00048944}, /* _VMAllocMem */
+            {16, 0x00029230}, /* _VMGetOwner */
+            {16, 0x00056cde}, /* g_tkExecPgm */
+            {16, 0x000533b5}, /* _tkStartProcess */
+            {13, 0x0000a170}, /* f_FuStrLenZ */
+            {13, 0x0000a0f0}, /* f_FuStrLen */
+            {13, 0x0000a319}, /* f_FuBuff */
+            {16, 0x00027e87}, /* _VMObjHandleInfo */
+            {16, 0x000577c0}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0004cb16}, /* _ldrOpenPath */
+            {16, 0x00049308}, /* _LDRClearSem */
+            {16, 0x00052a91}, /* _ldrFindModule */
+            {16, 0x0000db00}, /* _KSEMRequestMutex */
+            {16, 0x0000dbd7}, /* _KSEMReleaseMutex */
+            {16, 0x0000dc02}, /* _KSEMQueryMutex */
+            {16, 0x0000dea2}, /* _KSEMInit */
+            {11, 0x0001d7c0}, /* _LdrSem */
+            {11, 0x0001bd14}, /* _LDRLibPath */
+            {16, 0x0003565b}, /* _TKSuBuff */
+            {16, 0x000351ee}, /* _TKFuBuff */
+            {16, 0x000353b8}, /* _TKFuBufLen */
+            {16, 0x00049354}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d580}, /* _ldrpFileNameBuf */
+            {16, 0x00044c34}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8263HU.SYM */
+        8263, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x0000939c}, /* _ldrRead */
+            {15, 0x0003c1c4}, /* _ldrOpen */
+            {15, 0x0003ca50}, /* _ldrClose */
+            {15, 0x0003caa0}, /* _LDRQAppType */
+            {15, 0x0003a3a4}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a78}, /* _IOSftOpen */
+            {15, 0x00003ee4}, /* _IOSftClose */
+            {15, 0x00003f79}, /* _IOSftTransPath */
+            {15, 0x00003d32}, /* _IOSftReadAt */
+            {15, 0x00003d39}, /* _IOSftWriteAt */
+            {15, 0x00004092}, /* _SftFileSize */
+            {15, 0x00038670}, /* _VMAllocMem */
+            {15, 0x0001e0e6}, /* _VMGetOwner */
+            {15, 0x00044b5e}, /* g_tkExecPgm */
+            {15, 0x00041ac3}, /* _tkStartProcess */
+            {11, 0x0000d7d4}, /* f_FuStrLenZ */
+            {11, 0x0000d78a}, /* f_FuStrLen */
+            {11, 0x0000d8c8}, /* f_FuBuff */
+            {15, 0x0001d44c}, /* _VMObjHandleInfo */
+            {15, 0x00045554}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c43b}, /* _ldrOpenPath */
+            {15, 0x00038db8}, /* _LDRClearSem */
+            {15, 0x00041250}, /* _ldrFindModule */
+            {15, 0x0000a810}, /* _KSEMRequestMutex */
+            {15, 0x0000a8e7}, /* _KSEMReleaseMutex */
+            {15, 0x0000a912}, /* _KSEMQueryMutex */
+            {15, 0x0000abb2}, /* _KSEMInit */
+            {10, 0x0001ca70}, /* _LdrSem */
+            {10, 0x00019eb4}, /* _LDRLibPath */
+            {15, 0x00028dc1}, /* _TKSuBuff */
+            {15, 0x000289f7}, /* _TKFuBuff */
+            {15, 0x00028b81}, /* _TKFuBufLen */
+            {15, 0x00038df4}, /* _ldrValidateMteHandle */
+            {10, 0x000070ec}, /* _pTCBCur */
+            {10, 0x000070e8}, /* _pPTDACur */
+            {4 , 0x0000f99c}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bdfc}, /* _ldrpFileNameBuf */
+            {15, 0x0003541b}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8263RS.SYM */
-        8263, 'R', TYPE_SMP, 15,
+        8263, KF_SMP, 15,
         {
             {14, 0x0000c250}, /* _ldrRead */
@@ -450,11 +2980,36 @@
             {14, 0x00027a14}, /* _VMGetOwner */
             {14, 0x000547a2}, /* g_tkExecPgm */
+            {14, 0x00050f91}, /* _tkStartProcess */
             {11, 0x0000a170}, /* f_FuStrLenZ */
             {11, 0x0000a0f0}, /* f_FuStrLen */
             {11, 0x0000a319}, /* f_FuBuff */
+            {14, 0x0002666b}, /* _VMObjHandleInfo */
+            {14, 0x00055284}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004a706}, /* _ldrOpenPath */
+            {14, 0x00046ef8}, /* _LDRClearSem */
+            {14, 0x0005066d}, /* _ldrFindModule */
+            {14, 0x0000d8c0}, /* _KSEMRequestMutex */
+            {14, 0x0000d953}, /* _KSEMReleaseMutex */
+            {14, 0x0000d97e}, /* _KSEMQueryMutex */
+            {14, 0x0000db93}, /* _KSEMInit */
+            {9 , 0x0000d228}, /* _LdrSem */
+            {9 , 0x0000b784}, /* _LDRLibPath */
+            {14, 0x00033e3f}, /* _TKSuBuff */
+            {14, 0x000339d2}, /* _TKFuBuff */
+            {14, 0x00033b9c}, /* _TKFuBufLen */
+            {14, 0x00046f44}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8c0}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cfe8}, /* _ldrpFileNameBuf */
+            {14, 0x00042824}, /* SecPathFromSFN */
         }
     },
     { /* 8263RU.SYM */
-        8263, 'R', TYPE_UNI, 14,
+        8263, KF_UNI, 14,
         {
             {13, 0x00009308}, /* _ldrRead */
@@ -472,11 +3027,232 @@
             {13, 0x0001d27e}, /* _VMGetOwner */
             {13, 0x0004321e}, /* g_tkExecPgm */
-            {9, 0x0000d7d4}, /* f_FuStrLenZ */
-            {9, 0x0000d78a}, /* f_FuStrLen */
-            {9, 0x0000d8c8}, /* f_FuBuff */
-        }
-    },
+            {13, 0x000401a3}, /* _tkStartProcess */
+            {9 , 0x0000d7d4}, /* f_FuStrLenZ */
+            {9 , 0x0000d78a}, /* f_FuStrLen */
+            {9 , 0x0000d8c8}, /* f_FuBuff */
+            {13, 0x0001c5e4}, /* _VMObjHandleInfo */
+            {13, 0x00043c14}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003ab57}, /* _ldrOpenPath */
+            {13, 0x000374d4}, /* _LDRClearSem */
+            {13, 0x0003f930}, /* _ldrFindModule */
+            {13, 0x0000a654}, /* _KSEMRequestMutex */
+            {13, 0x0000a6e7}, /* _KSEMReleaseMutex */
+            {13, 0x0000a712}, /* _KSEMQueryMutex */
+            {13, 0x0000a927}, /* _KSEMInit */
+            {8 , 0x0000c8ac}, /* _LdrSem */
+            {8 , 0x00009cf4}, /* _LDRLibPath */
+            {13, 0x00027f59}, /* _TKSuBuff */
+            {13, 0x00027b8f}, /* _TKFuBuff */
+            {13, 0x00027d19}, /* _TKFuBufLen */
+            {13, 0x00037510}, /* _ldrValidateMteHandle */
+            {8 , 0x000070ec}, /* _pTCBCur */
+            {8 , 0x000070e8}, /* _pPTDACur */
+            {2 , 0x0000f99c}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bc38}, /* _ldrpFileNameBuf */
+            {13, 0x00033b37}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8264AS.SYM */
+        8264, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d854}, /* _ldrRead */
+            {16, 0x0005c344}, /* _ldrOpen */
+            {16, 0x0005ce84}, /* _ldrClose */
+            {16, 0x0005ced4}, /* _LDRQAppType */
+            {16, 0x0005a5f0}, /* _ldrEnum32bitRelRecs */
+            {16, 0x0000632c}, /* _IOSftOpen */
+            {16, 0x00006814}, /* _IOSftClose */
+            {16, 0x000068cc}, /* _IOSftTransPath */
+            {16, 0x00006628}, /* _IOSftReadAt */
+            {16, 0x0000662f}, /* _IOSftWriteAt */
+            {16, 0x00006a04}, /* _SftFileSize */
+            {16, 0x00057950}, /* _VMAllocMem */
+            {16, 0x0002feb6}, /* _VMGetOwner */
+            {16, 0x000678cc}, /* g_tkExecPgm */
+            {16, 0x00063784}, /* _tkStartProcess */
+            {13, 0x0000a840}, /* f_FuStrLenZ */
+            {13, 0x0000a7c0}, /* f_FuStrLen */
+            {13, 0x0000aa08}, /* f_FuBuff */
+            {16, 0x0002e6d7}, /* _VMObjHandleInfo */
+            {16, 0x0006848c}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005c5fe}, /* _ldrOpenPath */
+            {16, 0x000585ec}, /* _LDRClearSem */
+            {16, 0x00062dbc}, /* _ldrFindModule */
+            {16, 0x0000f5cc}, /* _KSEMRequestMutex */
+            {16, 0x0000f6e0}, /* _KSEMReleaseMutex */
+            {16, 0x0000f740}, /* _KSEMQueryMutex */
+            {16, 0x0000fac4}, /* _KSEMInit */
+            {11, 0x0002c858}, /* _LdrSem */
+            {11, 0x0002a23c}, /* _LDRLibPath */
+            {16, 0x0003f274}, /* _TKSuBuff */
+            {16, 0x0003edc5}, /* _TKFuBuff */
+            {16, 0x0003efd1}, /* _TKFuBufLen */
+            {16, 0x00058684}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8b4}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c440}, /* _ldrpFileNameBuf */
+            {16, 0x00053650}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8264AU.SYM */
+        8264, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a3a8}, /* _ldrRead */
+            {15, 0x0004a5f0}, /* _ldrOpen */
+            {15, 0x0004af88}, /* _ldrClose */
+            {15, 0x0004afd8}, /* _LDRQAppType */
+            {15, 0x00048508}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004530}, /* _IOSftOpen */
+            {15, 0x000049a8}, /* _IOSftClose */
+            {15, 0x00004a40}, /* _IOSftTransPath */
+            {15, 0x000047f4}, /* _IOSftReadAt */
+            {15, 0x000047fb}, /* _IOSftWriteAt */
+            {15, 0x00004b68}, /* _SftFileSize */
+            {15, 0x00045e84}, /* _VMAllocMem */
+            {15, 0x000238ca}, /* _VMGetOwner */
+            {15, 0x000540d0}, /* g_tkExecPgm */
+            {15, 0x000507d4}, /* _tkStartProcess */
+            {11, 0x0000ea10}, /* f_FuStrLenZ */
+            {11, 0x0000e9c4}, /* f_FuStrLen */
+            {11, 0x0000eb28}, /* f_FuBuff */
+            {15, 0x00022814}, /* _VMObjHandleInfo */
+            {15, 0x00054b98}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a87b}, /* _ldrOpenPath */
+            {15, 0x00046938}, /* _LDRClearSem */
+            {15, 0x0004febf}, /* _ldrFindModule */
+            {15, 0x0000bcd4}, /* _KSEMRequestMutex */
+            {15, 0x0000bde8}, /* _KSEMReleaseMutex */
+            {15, 0x0000be48}, /* _KSEMQueryMutex */
+            {15, 0x0000c1cc}, /* _KSEMInit */
+            {10, 0x0002a384}, /* _LdrSem */
+            {10, 0x00026b58}, /* _LDRLibPath */
+            {15, 0x00031888}, /* _TKSuBuff */
+            {15, 0x00031478}, /* _TKFuBuff */
+            {15, 0x00031644}, /* _TKFuBufLen */
+            {15, 0x000469c0}, /* _ldrValidateMteHandle */
+            {10, 0x0000b868}, /* _pTCBCur */
+            {10, 0x0000b864}, /* _pPTDACur */
+            {4 , 0x0000f994}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x00029538}, /* _ldrpFileNameBuf */
+            {15, 0x000426a7}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8264HS.SYM */
+        8264, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000c360}, /* _ldrRead */
+            {16, 0x0004c7b0}, /* _ldrOpen */
+            {16, 0x0004d1d0}, /* _ldrClose */
+            {16, 0x0004d220}, /* _LDRQAppType */
+            {16, 0x0004aca8}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005484}, /* _IOSftOpen */
+            {16, 0x0000595d}, /* _IOSftClose */
+            {16, 0x00005a14}, /* _IOSftTransPath */
+            {16, 0x00005774}, /* _IOSftReadAt */
+            {16, 0x0000577b}, /* _IOSftWriteAt */
+            {16, 0x00005b3e}, /* _SftFileSize */
+            {16, 0x00048898}, /* _VMAllocMem */
+            {16, 0x00029210}, /* _VMGetOwner */
+            {16, 0x00056be2}, /* g_tkExecPgm */
+            {16, 0x00053359}, /* _tkStartProcess */
+            {13, 0x0000a178}, /* f_FuStrLenZ */
+            {13, 0x0000a0f8}, /* f_FuStrLen */
+            {13, 0x0000a321}, /* f_FuBuff */
+            {16, 0x00027e67}, /* _VMObjHandleInfo */
+            {16, 0x000576c4}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0004ca56}, /* _ldrOpenPath */
+            {16, 0x0004925c}, /* _LDRClearSem */
+            {16, 0x00052a35}, /* _ldrFindModule */
+            {16, 0x0000db54}, /* _KSEMRequestMutex */
+            {16, 0x0000dc2b}, /* _KSEMReleaseMutex */
+            {16, 0x0000dc56}, /* _KSEMQueryMutex */
+            {16, 0x0000def6}, /* _KSEMInit */
+            {11, 0x0001d7c8}, /* _LdrSem */
+            {11, 0x0001bd1c}, /* _LDRLibPath */
+            {16, 0x00035653}, /* _TKSuBuff */
+            {16, 0x000351e6}, /* _TKFuBuff */
+            {16, 0x000353b0}, /* _TKFuBufLen */
+            {16, 0x000492a8}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d588}, /* _ldrpFileNameBuf */
+            {16, 0x00044c58}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8264HU.SYM */
+        8264, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000093a0}, /* _ldrRead */
+            {15, 0x0003c204}, /* _ldrOpen */
+            {15, 0x0003ca88}, /* _ldrClose */
+            {15, 0x0003cad8}, /* _LDRQAppType */
+            {15, 0x0003a3f8}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a7c}, /* _IOSftOpen */
+            {15, 0x00003ee8}, /* _IOSftClose */
+            {15, 0x00003f7d}, /* _IOSftTransPath */
+            {15, 0x00003d36}, /* _IOSftReadAt */
+            {15, 0x00003d3d}, /* _IOSftWriteAt */
+            {15, 0x00004096}, /* _SftFileSize */
+            {15, 0x000386c4}, /* _VMAllocMem */
+            {15, 0x0001e20e}, /* _VMGetOwner */
+            {15, 0x00044c02}, /* g_tkExecPgm */
+            {15, 0x00041b67}, /* _tkStartProcess */
+            {11, 0x0000d7e0}, /* f_FuStrLenZ */
+            {11, 0x0000d796}, /* f_FuStrLen */
+            {11, 0x0000d8d4}, /* f_FuBuff */
+            {15, 0x0001d574}, /* _VMObjHandleInfo */
+            {15, 0x000455f8}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c47b}, /* _ldrOpenPath */
+            {15, 0x00038e0c}, /* _LDRClearSem */
+            {15, 0x000412f2}, /* _ldrFindModule */
+            {15, 0x0000a814}, /* _KSEMRequestMutex */
+            {15, 0x0000a8eb}, /* _KSEMReleaseMutex */
+            {15, 0x0000a916}, /* _KSEMQueryMutex */
+            {15, 0x0000abb6}, /* _KSEMInit */
+            {10, 0x0001ca70}, /* _LdrSem */
+            {10, 0x00019eb4}, /* _LDRLibPath */
+            {15, 0x00028f15}, /* _TKSuBuff */
+            {15, 0x00028b49}, /* _TKFuBuff */
+            {15, 0x00028cd3}, /* _TKFuBufLen */
+            {15, 0x00038e48}, /* _ldrValidateMteHandle */
+            {10, 0x000070ec}, /* _pTCBCur */
+            {10, 0x000070e8}, /* _pPTDACur */
+            {4 , 0x0000f99c}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bdfc}, /* _ldrpFileNameBuf */
+            {15, 0x0003553b}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8264RS.SYM */
-        8264, 'R', TYPE_SMP, 15,
+        8264, KF_SMP, 15,
         {
             {14, 0x0000c250}, /* _ldrRead */
@@ -494,11 +3270,36 @@
             {14, 0x000279f4}, /* _VMGetOwner */
             {14, 0x00054942}, /* g_tkExecPgm */
+            {14, 0x0005103d}, /* _tkStartProcess */
             {11, 0x0000a178}, /* f_FuStrLenZ */
             {11, 0x0000a0f8}, /* f_FuStrLen */
             {11, 0x0000a321}, /* f_FuBuff */
+            {14, 0x0002664b}, /* _VMObjHandleInfo */
+            {14, 0x00055424}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004a7ca}, /* _ldrOpenPath */
+            {14, 0x00046fd0}, /* _LDRClearSem */
+            {14, 0x00050719}, /* _ldrFindModule */
+            {14, 0x0000d914}, /* _KSEMRequestMutex */
+            {14, 0x0000d9a7}, /* _KSEMReleaseMutex */
+            {14, 0x0000d9d2}, /* _KSEMQueryMutex */
+            {14, 0x0000dbe7}, /* _KSEMInit */
+            {9 , 0x0000d238}, /* _LdrSem */
+            {9 , 0x0000b794}, /* _LDRLibPath */
+            {14, 0x00033e37}, /* _TKSuBuff */
+            {14, 0x000339ca}, /* _TKFuBuff */
+            {14, 0x00033b94}, /* _TKFuBufLen */
+            {14, 0x0004701c}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8c0}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cff8}, /* _ldrpFileNameBuf */
+            {14, 0x000429cc}, /* SecPathFromSFN */
         }
     },
     { /* 8264RU.SYM */
-        8264, 'R', TYPE_UNI, 14,
+        8264, KF_UNI, 14,
         {
             {13, 0x0000930c}, /* _ldrRead */
@@ -516,11 +3317,232 @@
             {13, 0x0001d3a6}, /* _VMGetOwner */
             {13, 0x00043432}, /* g_tkExecPgm */
-            {9, 0x0000d7e0}, /* f_FuStrLenZ */
-            {9, 0x0000d796}, /* f_FuStrLen */
-            {9, 0x0000d8d4}, /* f_FuBuff */
-        }
-    },
+            {13, 0x000403bb}, /* _tkStartProcess */
+            {9 , 0x0000d7e0}, /* f_FuStrLenZ */
+            {9 , 0x0000d796}, /* f_FuStrLen */
+            {9 , 0x0000d8d4}, /* f_FuBuff */
+            {13, 0x0001c70c}, /* _VMObjHandleInfo */
+            {13, 0x00043e28}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003ad0b}, /* _ldrOpenPath */
+            {13, 0x0003769c}, /* _LDRClearSem */
+            {13, 0x0003fb46}, /* _ldrFindModule */
+            {13, 0x0000a658}, /* _KSEMRequestMutex */
+            {13, 0x0000a6eb}, /* _KSEMReleaseMutex */
+            {13, 0x0000a716}, /* _KSEMQueryMutex */
+            {13, 0x0000a92b}, /* _KSEMInit */
+            {8 , 0x0000c8b4}, /* _LdrSem */
+            {8 , 0x00009cfc}, /* _LDRLibPath */
+            {13, 0x000280ad}, /* _TKSuBuff */
+            {13, 0x00027ce1}, /* _TKFuBuff */
+            {13, 0x00027e6b}, /* _TKFuBufLen */
+            {13, 0x000376d8}, /* _ldrValidateMteHandle */
+            {8 , 0x000070ec}, /* _pTCBCur */
+            {8 , 0x000070e8}, /* _pPTDACur */
+            {2 , 0x0000f99c}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bc40}, /* _ldrpFileNameBuf */
+            {13, 0x00033dcb}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 8265AS.SYM */
+        8265, KF_SMP | KF_ALLSTRICT, 17,
+        {
+            {16, 0x0000d854}, /* _ldrRead */
+            {16, 0x0005c394}, /* _ldrOpen */
+            {16, 0x0005ced4}, /* _ldrClose */
+            {16, 0x0005cf24}, /* _LDRQAppType */
+            {16, 0x0005a62c}, /* _ldrEnum32bitRelRecs */
+            {16, 0x0000632c}, /* _IOSftOpen */
+            {16, 0x00006814}, /* _IOSftClose */
+            {16, 0x000068cc}, /* _IOSftTransPath */
+            {16, 0x00006628}, /* _IOSftReadAt */
+            {16, 0x0000662f}, /* _IOSftWriteAt */
+            {16, 0x00006a04}, /* _SftFileSize */
+            {16, 0x0005798c}, /* _VMAllocMem */
+            {16, 0x0002fede}, /* _VMGetOwner */
+            {16, 0x0006791c}, /* g_tkExecPgm */
+            {16, 0x000637d4}, /* _tkStartProcess */
+            {13, 0x0000a840}, /* f_FuStrLenZ */
+            {13, 0x0000a7c0}, /* f_FuStrLen */
+            {13, 0x0000aa08}, /* f_FuBuff */
+            {16, 0x0002e6ff}, /* _VMObjHandleInfo */
+            {16, 0x000684dc}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0005c64e}, /* _ldrOpenPath */
+            {16, 0x00058628}, /* _LDRClearSem */
+            {16, 0x00062e0c}, /* _ldrFindModule */
+            {16, 0x0000f5b8}, /* _KSEMRequestMutex */
+            {16, 0x0000f6cc}, /* _KSEMReleaseMutex */
+            {16, 0x0000f72c}, /* _KSEMQueryMutex */
+            {16, 0x0000fab0}, /* _KSEMInit */
+            {11, 0x0002c834}, /* _LdrSem */
+            {11, 0x0002a218}, /* _LDRLibPath */
+            {16, 0x0003f29c}, /* _TKSuBuff */
+            {16, 0x0003eded}, /* _TKFuBuff */
+            {16, 0x0003eff9}, /* _TKFuBufLen */
+            {16, 0x000586c0}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8b4}, /* ptda_start */
+            {5 , 0x0000f9ce}, /* ptda_environ */
+            {5 , 0x0000fe88}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9d0}, /* ptda_pBeginLIBPATH */
+            {11, 0x0002c41c}, /* _ldrpFileNameBuf */
+            {16, 0x0005368c}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8265AU.SYM */
+        8265, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a3a8}, /* _ldrRead */
+            {15, 0x0004a658}, /* _ldrOpen */
+            {15, 0x0004aff0}, /* _ldrClose */
+            {15, 0x0004b040}, /* _LDRQAppType */
+            {15, 0x00048558}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004530}, /* _IOSftOpen */
+            {15, 0x000049a8}, /* _IOSftClose */
+            {15, 0x00004a40}, /* _IOSftTransPath */
+            {15, 0x000047f4}, /* _IOSftReadAt */
+            {15, 0x000047fb}, /* _IOSftWriteAt */
+            {15, 0x00004b68}, /* _SftFileSize */
+            {15, 0x00045ed4}, /* _VMAllocMem */
+            {15, 0x0002390e}, /* _VMGetOwner */
+            {15, 0x00054138}, /* g_tkExecPgm */
+            {15, 0x0005083c}, /* _tkStartProcess */
+            {11, 0x0000ea50}, /* f_FuStrLenZ */
+            {11, 0x0000ea04}, /* f_FuStrLen */
+            {11, 0x0000eb68}, /* f_FuBuff */
+            {15, 0x00022858}, /* _VMObjHandleInfo */
+            {15, 0x00054c00}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a8e3}, /* _ldrOpenPath */
+            {15, 0x00046988}, /* _LDRClearSem */
+            {15, 0x0004ff27}, /* _ldrFindModule */
+            {15, 0x0000bccc}, /* _KSEMRequestMutex */
+            {15, 0x0000bde0}, /* _KSEMReleaseMutex */
+            {15, 0x0000be40}, /* _KSEMQueryMutex */
+            {15, 0x0000c1c4}, /* _KSEMInit */
+            {10, 0x0002a360}, /* _LdrSem */
+            {10, 0x00026b34}, /* _LDRLibPath */
+            {15, 0x000318c8}, /* _TKSuBuff */
+            {15, 0x000314b8}, /* _TKFuBuff */
+            {15, 0x00031684}, /* _TKFuBufLen */
+            {15, 0x00046a10}, /* _ldrValidateMteHandle */
+            {10, 0x0000b868}, /* _pTCBCur */
+            {10, 0x0000b864}, /* _pPTDACur */
+            {4 , 0x0000f994}, /* ptda_start */
+            {4 , 0x0000fa46}, /* ptda_environ */
+            {4 , 0x0000fea0}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa48}, /* ptda_pBeginLIBPATH */
+            {10, 0x00029514}, /* _ldrpFileNameBuf */
+            {15, 0x000426f7}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8265HS.SYM */
+        8265, KF_SMP | KF_HALFSTRICT, 17,
+        {
+            {16, 0x0000c360}, /* _ldrRead */
+            {16, 0x0004c86c}, /* _ldrOpen */
+            {16, 0x0004d28c}, /* _ldrClose */
+            {16, 0x0004d2dc}, /* _LDRQAppType */
+            {16, 0x0004ad50}, /* _ldrEnum32bitRelRecs */
+            {16, 0x00005484}, /* _IOSftOpen */
+            {16, 0x0000595d}, /* _IOSftClose */
+            {16, 0x00005a14}, /* _IOSftTransPath */
+            {16, 0x00005774}, /* _IOSftReadAt */
+            {16, 0x0000577b}, /* _IOSftWriteAt */
+            {16, 0x00005b3e}, /* _SftFileSize */
+            {16, 0x00048940}, /* _VMAllocMem */
+            {16, 0x000292a4}, /* _VMGetOwner */
+            {16, 0x00056c8e}, /* g_tkExecPgm */
+            {16, 0x00053405}, /* _tkStartProcess */
+            {13, 0x0000a178}, /* f_FuStrLenZ */
+            {13, 0x0000a0f8}, /* f_FuStrLen */
+            {13, 0x0000a321}, /* f_FuBuff */
+            {16, 0x00027efb}, /* _VMObjHandleInfo */
+            {16, 0x00057770}, /* _ldrASMpMTEFromHandle */
+            {16, 0x0004cb12}, /* _ldrOpenPath */
+            {16, 0x00049304}, /* _LDRClearSem */
+            {16, 0x00052ae1}, /* _ldrFindModule */
+            {16, 0x0000db44}, /* _KSEMRequestMutex */
+            {16, 0x0000dc1b}, /* _KSEMReleaseMutex */
+            {16, 0x0000dc46}, /* _KSEMQueryMutex */
+            {16, 0x0000dee6}, /* _KSEMInit */
+            {11, 0x0001d7c8}, /* _LdrSem */
+            {11, 0x0001bd1c}, /* _LDRLibPath */
+            {16, 0x000356e7}, /* _TKSuBuff */
+            {16, 0x0003527a}, /* _TKFuBuff */
+            {16, 0x00035444}, /* _TKFuBufLen */
+            {16, 0x00049350}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {5 , 0x0000f8c0}, /* ptda_start */
+            {5 , 0x0000f9da}, /* ptda_environ */
+            {5 , 0x0000fe94}, /* ptda_ptdasem */
+            {5 , 0x0000ffa2}, /* ptda_module */
+            {5 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {11, 0x0001d588}, /* _ldrpFileNameBuf */
+            {16, 0x00044d00}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 8265HU.SYM */
+        8265, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000093a0}, /* _ldrRead */
+            {15, 0x0003c12c}, /* _ldrOpen */
+            {15, 0x0003c9b0}, /* _ldrClose */
+            {15, 0x0003ca00}, /* _LDRQAppType */
+            {15, 0x0003a30c}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a7c}, /* _IOSftOpen */
+            {15, 0x00003ee8}, /* _IOSftClose */
+            {15, 0x00003f7d}, /* _IOSftTransPath */
+            {15, 0x00003d36}, /* _IOSftReadAt */
+            {15, 0x00003d3d}, /* _IOSftWriteAt */
+            {15, 0x00004096}, /* _SftFileSize */
+            {15, 0x000385d8}, /* _VMAllocMem */
+            {15, 0x0001e116}, /* _VMGetOwner */
+            {15, 0x00044b2a}, /* g_tkExecPgm */
+            {15, 0x00041a8f}, /* _tkStartProcess */
+            {11, 0x0000d830}, /* f_FuStrLenZ */
+            {11, 0x0000d7e6}, /* f_FuStrLen */
+            {11, 0x0000d924}, /* f_FuBuff */
+            {15, 0x0001d47c}, /* _VMObjHandleInfo */
+            {15, 0x00045520}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c3a3}, /* _ldrOpenPath */
+            {15, 0x00038d20}, /* _LDRClearSem */
+            {15, 0x0004121a}, /* _ldrFindModule */
+            {15, 0x0000a808}, /* _KSEMRequestMutex */
+            {15, 0x0000a8df}, /* _KSEMReleaseMutex */
+            {15, 0x0000a90a}, /* _KSEMQueryMutex */
+            {15, 0x0000abaa}, /* _KSEMInit */
+            {10, 0x0001ca70}, /* _LdrSem */
+            {10, 0x00019eb4}, /* _LDRLibPath */
+            {15, 0x00028e1d}, /* _TKSuBuff */
+            {15, 0x00028a51}, /* _TKFuBuff */
+            {15, 0x00028bdb}, /* _TKFuBufLen */
+            {15, 0x00038d5c}, /* _ldrValidateMteHandle */
+            {10, 0x000070ec}, /* _pTCBCur */
+            {10, 0x000070e8}, /* _pPTDACur */
+            {4 , 0x0000f99c}, /* ptda_start */
+            {4 , 0x0000fa4e}, /* ptda_environ */
+            {4 , 0x0000fea8}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001bdfc}, /* _ldrpFileNameBuf */
+            {15, 0x00035453}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 8265RS.SYM */
-        8265, 'R', TYPE_SMP, 15,
+        8265, KF_SMP, 15,
         {
             {14, 0x0000c250}, /* _ldrRead */
@@ -538,11 +3560,36 @@
             {14, 0x00027a7c}, /* _VMGetOwner */
             {14, 0x000549e2}, /* g_tkExecPgm */
+            {14, 0x000510dd}, /* _tkStartProcess */
             {11, 0x0000a178}, /* f_FuStrLenZ */
             {11, 0x0000a0f8}, /* f_FuStrLen */
             {11, 0x0000a321}, /* f_FuBuff */
+            {14, 0x000266d3}, /* _VMObjHandleInfo */
+            {14, 0x000554c4}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004a87a}, /* _ldrOpenPath */
+            {14, 0x0004706c}, /* _LDRClearSem */
+            {14, 0x000507b9}, /* _ldrFindModule */
+            {14, 0x0000d914}, /* _KSEMRequestMutex */
+            {14, 0x0000d9a7}, /* _KSEMReleaseMutex */
+            {14, 0x0000d9d2}, /* _KSEMQueryMutex */
+            {14, 0x0000dbe7}, /* _KSEMInit */
+            {9 , 0x0000d238}, /* _LdrSem */
+            {9 , 0x0000b794}, /* _LDRLibPath */
+            {14, 0x00033ebf}, /* _TKSuBuff */
+            {14, 0x00033a52}, /* _TKFuBuff */
+            {14, 0x00033c1c}, /* _TKFuBufLen */
+            {14, 0x000470b8}, /* _ldrValidateMteHandle */
+            {0 , 0x00000b34}, /* _pTCBCur */
+            {0 , 0x00000b30}, /* _pPTDACur */
+            {3 , 0x0000f8c0}, /* ptda_start */
+            {3 , 0x0000f9da}, /* ptda_environ */
+            {3 , 0x0000fe94}, /* ptda_ptdasem */
+            {3 , 0x0000ffa2}, /* ptda_module */
+            {3 , 0x0000f9dc}, /* ptda_pBeginLIBPATH */
+            {9 , 0x0000cff8}, /* _ldrpFileNameBuf */
+            {14, 0x00042a68}, /* SecPathFromSFN */
         }
     },
     { /* 8265RU.SYM */
-        8265, 'R', TYPE_UNI, 14,
+        8265, KF_UNI, 14,
         {
             {13, 0x0000930c}, /* _ldrRead */
@@ -560,11 +3607,518 @@
             {13, 0x0001d2a6}, /* _VMGetOwner */
             {13, 0x00043352}, /* g_tkExecPgm */
-            {9, 0x0000d830}, /* f_FuStrLenZ */
-            {9, 0x0000d7e6}, /* f_FuStrLen */
-            {9, 0x0000d924}, /* f_FuBuff */
-        }
-    },
+            {13, 0x000402db}, /* _tkStartProcess */
+            {9 , 0x0000d830}, /* f_FuStrLenZ */
+            {9 , 0x0000d7e6}, /* f_FuStrLen */
+            {9 , 0x0000d924}, /* f_FuBuff */
+            {13, 0x0001c60c}, /* _VMObjHandleInfo */
+            {13, 0x00043d48}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003ac2b}, /* _ldrOpenPath */
+            {13, 0x000375a8}, /* _LDRClearSem */
+            {13, 0x0003fa66}, /* _ldrFindModule */
+            {13, 0x0000a65c}, /* _KSEMRequestMutex */
+            {13, 0x0000a6ef}, /* _KSEMReleaseMutex */
+            {13, 0x0000a71a}, /* _KSEMQueryMutex */
+            {13, 0x0000a92f}, /* _KSEMInit */
+            {8 , 0x0000c8b4}, /* _LdrSem */
+            {8 , 0x00009cfc}, /* _LDRLibPath */
+            {13, 0x00027fad}, /* _TKSuBuff */
+            {13, 0x00027be1}, /* _TKFuBuff */
+            {13, 0x00027d6b}, /* _TKFuBufLen */
+            {13, 0x000375e4}, /* _ldrValidateMteHandle */
+            {8 , 0x000070ec}, /* _pTCBCur */
+            {8 , 0x000070e8}, /* _pPTDACur */
+            {2 , 0x0000f99c}, /* ptda_start */
+            {2 , 0x0000fa4e}, /* ptda_environ */
+            {2 , 0x0000fea8}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000fa50}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bc40}, /* _ldrpFileNameBuf */
+            {13, 0x00033cdb}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9024AU.SYM */
+        9024, KF_UNI | KF_ALLSTRICT, 15,
+        {
+            {14, 0x00008c0c}, /* _ldrRead */
+            {14, 0x000463f4}, /* _ldrOpen */
+            {14, 0x00046d8c}, /* _ldrClose */
+            {14, 0x00046ddc}, /* _LDRQAppType */
+            {14, 0x000443ec}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00003da8}, /* _IOSftOpen */
+            {14, 0x0000425c}, /* _IOSftClose */
+            {14, 0x00004304}, /* _IOSftTransPath */
+            {14, 0x0000407c}, /* _IOSftReadAt */
+            {14, 0x00004083}, /* _IOSftWriteAt */
+            {14, 0x0000442c}, /* _SftFileSize */
+            {14, 0x00041db8}, /* _VMAllocMem */
+            {14, 0x0002165e}, /* _VMGetOwner */
+            {14, 0x0004f97c}, /* g_tkExecPgm */
+            {14, 0x0004c120}, /* _tkStartProcess */
+            {11, 0x0000f8d4}, /* f_FuStrLenZ */
+            {11, 0x0000f888}, /* f_FuStrLen */
+            {11, 0x0000f9ec}, /* f_FuBuff */
+            {14, 0x000205bc}, /* _VMObjHandleInfo */
+            {14, 0x00050404}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0004667f}, /* _ldrOpenPath */
+            {14, 0x00042864}, /* _LDRClearSem */
+            {14, 0x0004b812}, /* _ldrFindModule */
+            {14, 0x0000a5b4}, /* _KSEMRequestMutex */
+            {14, 0x0000a6c8}, /* _KSEMReleaseMutex */
+            {14, 0x0000a728}, /* _KSEMQueryMutex */
+            {14, 0x0000aaac}, /* _KSEMInit */
+            {10, 0x000159f0}, /* _LdrSem */
+            {10, 0x00015a7c}, /* _LDRLibPath */
+            {14, 0x0002ec48}, /* _TKSuBuff */
+            {14, 0x0002e83a}, /* _TKFuBuff */
+            {14, 0x0002ea06}, /* _TKFuBufLen */
+            {14, 0x000428ec}, /* _ldrValidateMteHandle */
+            {10, 0x0000b920}, /* _pTCBCur */
+            {10, 0x0000b91c}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x00017ebc}, /* _ldrpFileNameBuf */
+            {14, 0x0003e13e}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 9024RU.SYM */
+        9024, KF_UNI, 13,
+        {
+            {12, 0x00007d68}, /* _ldrRead */
+            {12, 0x00036c2c}, /* _ldrOpen */
+            {12, 0x000374b4}, /* _ldrClose */
+            {12, 0x00037504}, /* _LDRQAppType */
+            {12, 0x00034ef8}, /* _ldrEnum32bitRelRecs */
+            {12, 0x00003494}, /* _IOSftOpen */
+            {12, 0x0000393a}, /* _IOSftClose */
+            {12, 0x000039e1}, /* _IOSftTransPath */
+            {12, 0x0000375b}, /* _IOSftReadAt */
+            {12, 0x00003762}, /* _IOSftWriteAt */
+            {12, 0x00003afa}, /* _SftFileSize */
+            {12, 0x00033214}, /* _VMAllocMem */
+            {12, 0x0001b218}, /* _VMGetOwner */
+            {12, 0x0003f196}, /* g_tkExecPgm */
+            {12, 0x0003c177}, /* _tkStartProcess */
+            {9 , 0x0000e60c}, /* f_FuStrLenZ */
+            {9 , 0x0000e5c2}, /* f_FuStrLen */
+            {9 , 0x0000e700}, /* f_FuBuff */
+            {12, 0x0001a58c}, /* _VMObjHandleInfo */
+            {12, 0x0003fb4c}, /* _ldrASMpMTEFromHandle */
+            {12, 0x00036ea3}, /* _ldrOpenPath */
+            {12, 0x00033954}, /* _LDRClearSem */
+            {12, 0x0003b907}, /* _ldrFindModule */
+            {12, 0x000090ec}, /* _KSEMRequestMutex */
+            {12, 0x0000917f}, /* _KSEMReleaseMutex */
+            {12, 0x000091aa}, /* _KSEMQueryMutex */
+            {12, 0x000093bf}, /* _KSEMInit */
+            {8 , 0x0000a020}, /* _LdrSem */
+            {8 , 0x0000a0a0}, /* _LDRLibPath */
+            {12, 0x000256b5}, /* _TKSuBuff */
+            {12, 0x000252eb}, /* _TKFuBuff */
+            {12, 0x00025475}, /* _TKFuBufLen */
+            {12, 0x00033990}, /* _ldrValidateMteHandle */
+            {8 , 0x000072a8}, /* _pTCBCur */
+            {8 , 0x000072a4}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000ba4c}, /* _ldrpFileNameBuf */
+            {12, 0x0002fcea}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9026AU.SYM */
+        9026, KF_UNI | KF_ALLSTRICT, 15,
+        {
+            {14, 0x00008c8c}, /* _ldrRead */
+            {14, 0x0004653c}, /* _ldrOpen */
+            {14, 0x00046ed4}, /* _ldrClose */
+            {14, 0x00046f24}, /* _LDRQAppType */
+            {14, 0x00044534}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00003da8}, /* _IOSftOpen */
+            {14, 0x0000425c}, /* _IOSftClose */
+            {14, 0x00004304}, /* _IOSftTransPath */
+            {14, 0x0000407c}, /* _IOSftReadAt */
+            {14, 0x00004083}, /* _IOSftWriteAt */
+            {14, 0x0000442c}, /* _SftFileSize */
+            {14, 0x00041f00}, /* _VMAllocMem */
+            {14, 0x00021752}, /* _VMGetOwner */
+            {14, 0x0004fadc}, /* g_tkExecPgm */
+            {14, 0x0004c280}, /* _tkStartProcess */
+            {11, 0x0000f904}, /* f_FuStrLenZ */
+            {11, 0x0000f8b8}, /* f_FuStrLen */
+            {11, 0x0000fa1c}, /* f_FuBuff */
+            {14, 0x0002069c}, /* _VMObjHandleInfo */
+            {14, 0x00050560}, /* _ldrASMpMTEFromHandle */
+            {14, 0x000467c7}, /* _ldrOpenPath */
+            {14, 0x000429ac}, /* _LDRClearSem */
+            {14, 0x0004b95a}, /* _ldrFindModule */
+            {14, 0x0000a634}, /* _KSEMRequestMutex */
+            {14, 0x0000a748}, /* _KSEMReleaseMutex */
+            {14, 0x0000a7a8}, /* _KSEMQueryMutex */
+            {14, 0x0000ab2c}, /* _KSEMInit */
+            {10, 0x000159f8}, /* _LdrSem */
+            {10, 0x00015a84}, /* _LDRLibPath */
+            {14, 0x0002ed3c}, /* _TKSuBuff */
+            {14, 0x0002e92e}, /* _TKFuBuff */
+            {14, 0x0002eafa}, /* _TKFuBufLen */
+            {14, 0x00042a34}, /* _ldrValidateMteHandle */
+            {10, 0x0000b858}, /* _pTCBCur */
+            {10, 0x0000b854}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x00017ec4}, /* _ldrpFileNameBuf */
+            {14, 0x0003e27e}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 9026RU.SYM */
+        9026, KF_UNI, 13,
+        {
+            {12, 0x00007de0}, /* _ldrRead */
+            {12, 0x00036d3c}, /* _ldrOpen */
+            {12, 0x000375c4}, /* _ldrClose */
+            {12, 0x00037614}, /* _LDRQAppType */
+            {12, 0x00035008}, /* _ldrEnum32bitRelRecs */
+            {12, 0x00003494}, /* _IOSftOpen */
+            {12, 0x0000393a}, /* _IOSftClose */
+            {12, 0x000039e1}, /* _IOSftTransPath */
+            {12, 0x0000375b}, /* _IOSftReadAt */
+            {12, 0x00003762}, /* _IOSftWriteAt */
+            {12, 0x00003afa}, /* _SftFileSize */
+            {12, 0x00033324}, /* _VMAllocMem */
+            {12, 0x0001b2dc}, /* _VMGetOwner */
+            {12, 0x0003f2ba}, /* g_tkExecPgm */
+            {12, 0x0003c29b}, /* _tkStartProcess */
+            {9 , 0x0000e644}, /* f_FuStrLenZ */
+            {9 , 0x0000e5fa}, /* f_FuStrLen */
+            {9 , 0x0000e738}, /* f_FuBuff */
+            {12, 0x0001a63c}, /* _VMObjHandleInfo */
+            {12, 0x0003fc6c}, /* _ldrASMpMTEFromHandle */
+            {12, 0x00036fb3}, /* _ldrOpenPath */
+            {12, 0x00033a64}, /* _LDRClearSem */
+            {12, 0x0003ba17}, /* _ldrFindModule */
+            {12, 0x00009164}, /* _KSEMRequestMutex */
+            {12, 0x000091f7}, /* _KSEMReleaseMutex */
+            {12, 0x00009222}, /* _KSEMQueryMutex */
+            {12, 0x00009437}, /* _KSEMInit */
+            {8 , 0x0000a028}, /* _LdrSem */
+            {8 , 0x0000a0a8}, /* _LDRLibPath */
+            {12, 0x00025775}, /* _TKSuBuff */
+            {12, 0x000253ab}, /* _TKFuBuff */
+            {12, 0x00025535}, /* _TKFuBufLen */
+            {12, 0x00033aa0}, /* _ldrValidateMteHandle */
+            {8 , 0x000072ac}, /* _pTCBCur */
+            {8 , 0x000072a8}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000ba54}, /* _ldrpFileNameBuf */
+            {12, 0x0002fdf2}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9027AU.SYM */
+        9027, KF_UNI | KF_ALLSTRICT, 15,
+        {
+            {14, 0x0000a2f0}, /* _ldrRead */
+            {14, 0x00049ab4}, /* _ldrOpen */
+            {14, 0x0004a44c}, /* _ldrClose */
+            {14, 0x0004a49c}, /* _LDRQAppType */
+            {14, 0x00047a78}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00003e34}, /* _IOSftOpen */
+            {14, 0x000042e8}, /* _IOSftClose */
+            {14, 0x00004390}, /* _IOSftTransPath */
+            {14, 0x00004108}, /* _IOSftReadAt */
+            {14, 0x0000410f}, /* _IOSftWriteAt */
+            {14, 0x000044b8}, /* _SftFileSize */
+            {14, 0x00044be8}, /* _VMAllocMem */
+            {14, 0x00022bd2}, /* _VMGetOwner */
+            {14, 0x00052efc}, /* g_tkExecPgm */
+            {14, 0x0004f6b8}, /* _tkStartProcess */
+            {11, 0x0000f91c}, /* f_FuStrLenZ */
+            {11, 0x0000f8d0}, /* f_FuStrLen */
+            {11, 0x0000fa34}, /* f_FuBuff */
+            {14, 0x00021b1c}, /* _VMObjHandleInfo */
+            {14, 0x00053980}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00049d3f}, /* _ldrOpenPath */
+            {14, 0x00045694}, /* _LDRClearSem */
+            {14, 0x0004ed92}, /* _ldrFindModule */
+            {14, 0x0000bc9c}, /* _KSEMRequestMutex */
+            {14, 0x0000bdb0}, /* _KSEMReleaseMutex */
+            {14, 0x0000be10}, /* _KSEMQueryMutex */
+            {14, 0x0000c194}, /* _KSEMInit */
+            {10, 0x00016030}, /* _LdrSem */
+            {10, 0x000160bc}, /* _LDRLibPath */
+            {14, 0x00030668}, /* _TKSuBuff */
+            {14, 0x0003025a}, /* _TKFuBuff */
+            {14, 0x00030426}, /* _TKFuBufLen */
+            {14, 0x0004571c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b8c4}, /* _pTCBCur */
+            {10, 0x0000b8c0}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001862c}, /* _ldrpFileNameBuf */
+            {14, 0x00040f46}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 9027RU.SYM */
+        9027, KF_UNI, 13,
+        {
+            {12, 0x0000941c}, /* _ldrRead */
+            {12, 0x0003a044}, /* _ldrOpen */
+            {12, 0x0003a8cc}, /* _ldrClose */
+            {12, 0x0003a91c}, /* _LDRQAppType */
+            {12, 0x00038314}, /* _ldrEnum32bitRelRecs */
+            {12, 0x00003504}, /* _IOSftOpen */
+            {12, 0x000039aa}, /* _IOSftClose */
+            {12, 0x00003a51}, /* _IOSftTransPath */
+            {12, 0x000037cb}, /* _IOSftReadAt */
+            {12, 0x000037d2}, /* _IOSftWriteAt */
+            {12, 0x00003b6a}, /* _SftFileSize */
+            {12, 0x00035f98}, /* _VMAllocMem */
+            {12, 0x0001c924}, /* _VMGetOwner */
+            {12, 0x0004245e}, /* g_tkExecPgm */
+            {12, 0x0003f3e3}, /* _tkStartProcess */
+            {9 , 0x0000e660}, /* f_FuStrLenZ */
+            {9 , 0x0000e616}, /* f_FuStrLen */
+            {9 , 0x0000e754}, /* f_FuBuff */
+            {12, 0x0001bc84}, /* _VMObjHandleInfo */
+            {12, 0x00042e10}, /* _ldrASMpMTEFromHandle */
+            {12, 0x0003a2bb}, /* _ldrOpenPath */
+            {12, 0x000366d8}, /* _LDRClearSem */
+            {12, 0x0003eb5d}, /* _ldrFindModule */
+            {12, 0x0000a7a4}, /* _KSEMRequestMutex */
+            {12, 0x0000a837}, /* _KSEMReleaseMutex */
+            {12, 0x0000a862}, /* _KSEMQueryMutex */
+            {12, 0x0000aa77}, /* _KSEMInit */
+            {8 , 0x0000a3a0}, /* _LdrSem */
+            {8 , 0x0000a420}, /* _LDRLibPath */
+            {12, 0x0002728d}, /* _TKSuBuff */
+            {12, 0x00026ec1}, /* _TKFuBuff */
+            {12, 0x0002704b}, /* _TKFuBufLen */
+            {12, 0x00036714}, /* _ldrValidateMteHandle */
+            {8 , 0x000072b4}, /* _pTCBCur */
+            {8 , 0x000072b0}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bee4}, /* _ldrpFileNameBuf */
+            {12, 0x00032a46}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9028AU.SYM */
+        9028, KF_UNI | KF_ALLSTRICT, 15,
+        {
+            {14, 0x0000a2fc}, /* _ldrRead */
+            {14, 0x0004929c}, /* _ldrOpen */
+            {14, 0x00049c34}, /* _ldrClose */
+            {14, 0x00049c84}, /* _LDRQAppType */
+            {14, 0x00047294}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00003e40}, /* _IOSftOpen */
+            {14, 0x000042f4}, /* _IOSftClose */
+            {14, 0x0000439c}, /* _IOSftTransPath */
+            {14, 0x00004114}, /* _IOSftReadAt */
+            {14, 0x0000411b}, /* _IOSftWriteAt */
+            {14, 0x000044c4}, /* _SftFileSize */
+            {14, 0x00044c18}, /* _VMAllocMem */
+            {14, 0x00022bf6}, /* _VMGetOwner */
+            {14, 0x0005297c}, /* g_tkExecPgm */
+            {14, 0x0004f110}, /* _tkStartProcess */
+            {11, 0x0000f88c}, /* f_FuStrLenZ */
+            {11, 0x0000f840}, /* f_FuStrLen */
+            {11, 0x0000f9a4}, /* f_FuBuff */
+            {14, 0x00021b40}, /* _VMObjHandleInfo */
+            {14, 0x00053400}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00049527}, /* _ldrOpenPath */
+            {14, 0x000456c4}, /* _LDRClearSem */
+            {14, 0x0004e7ea}, /* _ldrFindModule */
+            {14, 0x0000bca8}, /* _KSEMRequestMutex */
+            {14, 0x0000bdbc}, /* _KSEMReleaseMutex */
+            {14, 0x0000be1c}, /* _KSEMQueryMutex */
+            {14, 0x0000c1a0}, /* _KSEMInit */
+            {10, 0x00015df4}, /* _LdrSem */
+            {10, 0x00015e80}, /* _LDRLibPath */
+            {14, 0x000306a4}, /* _TKSuBuff */
+            {14, 0x00030296}, /* _TKFuBuff */
+            {14, 0x00030462}, /* _TKFuBufLen */
+            {14, 0x0004574c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b8d0}, /* _pTCBCur */
+            {10, 0x0000b8cc}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x000183d4}, /* _ldrpFileNameBuf */
+            {14, 0x00040f46}, /* SecPathFromSFN */
+        }
+    },
+#endif
+    { /* 9028RU.SYM */
+        9028, KF_UNI, 13,
+        {
+            {12, 0x00009424}, /* _ldrRead */
+            {12, 0x000398cc}, /* _ldrOpen */
+            {12, 0x0003a154}, /* _ldrClose */
+            {12, 0x0003a1a4}, /* _LDRQAppType */
+            {12, 0x00037ba4}, /* _ldrEnum32bitRelRecs */
+            {12, 0x0000350c}, /* _IOSftOpen */
+            {12, 0x000039b2}, /* _IOSftClose */
+            {12, 0x00003a59}, /* _IOSftTransPath */
+            {12, 0x000037d3}, /* _IOSftReadAt */
+            {12, 0x000037da}, /* _IOSftWriteAt */
+            {12, 0x00003b72}, /* _SftFileSize */
+            {12, 0x00035e78}, /* _VMAllocMem */
+            {12, 0x0001c9b0}, /* _VMGetOwner */
+            {12, 0x00041e62}, /* g_tkExecPgm */
+            {12, 0x0003ee2f}, /* _tkStartProcess */
+            {9 , 0x0000e5bc}, /* f_FuStrLenZ */
+            {9 , 0x0000e572}, /* f_FuStrLen */
+            {9 , 0x0000e6b0}, /* f_FuBuff */
+            {12, 0x0001bd10}, /* _VMObjHandleInfo */
+            {12, 0x00042814}, /* _ldrASMpMTEFromHandle */
+            {12, 0x00039b43}, /* _ldrOpenPath */
+            {12, 0x000365b8}, /* _LDRClearSem */
+            {12, 0x0003e5a9}, /* _ldrFindModule */
+            {12, 0x0000a7ac}, /* _KSEMRequestMutex */
+            {12, 0x0000a83f}, /* _KSEMReleaseMutex */
+            {12, 0x0000a86a}, /* _KSEMQueryMutex */
+            {12, 0x0000aa7f}, /* _KSEMInit */
+            {8 , 0x0000a33c}, /* _LdrSem */
+            {8 , 0x0000a3bc}, /* _LDRLibPath */
+            {12, 0x0002731d}, /* _TKSuBuff */
+            {12, 0x00026f51}, /* _TKFuBuff */
+            {12, 0x000270db}, /* _TKFuBufLen */
+            {12, 0x000365f4}, /* _ldrValidateMteHandle */
+            {8 , 0x000072b8}, /* _pTCBCur */
+            {8 , 0x000072b4}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000be7c}, /* _ldrpFileNameBuf */
+            {12, 0x00032a37}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9029AU.SYM */
+        9029, KF_UNI | KF_ALLSTRICT, 15,
+        {
+            {14, 0x0000a2d4}, /* _ldrRead */
+            {14, 0x000493ac}, /* _ldrOpen */
+            {14, 0x00049d44}, /* _ldrClose */
+            {14, 0x00049d94}, /* _LDRQAppType */
+            {14, 0x000473a4}, /* _ldrEnum32bitRelRecs */
+            {14, 0x00003e18}, /* _IOSftOpen */
+            {14, 0x000042cc}, /* _IOSftClose */
+            {14, 0x00004374}, /* _IOSftTransPath */
+            {14, 0x000040ec}, /* _IOSftReadAt */
+            {14, 0x000040f3}, /* _IOSftWriteAt */
+            {14, 0x0000449c}, /* _SftFileSize */
+            {14, 0x00044d2c}, /* _VMAllocMem */
+            {14, 0x00022b9a}, /* _VMGetOwner */
+            {14, 0x00052ae0}, /* g_tkExecPgm */
+            {14, 0x0004f268}, /* _tkStartProcess */
+            {11, 0x0000f864}, /* f_FuStrLenZ */
+            {11, 0x0000f818}, /* f_FuStrLen */
+            {11, 0x0000f97c}, /* f_FuBuff */
+            {14, 0x00021ae4}, /* _VMObjHandleInfo */
+            {14, 0x00053564}, /* _ldrASMpMTEFromHandle */
+            {14, 0x00049637}, /* _ldrOpenPath */
+            {14, 0x000457d8}, /* _LDRClearSem */
+            {14, 0x0004e942}, /* _ldrFindModule */
+            {14, 0x0000bc80}, /* _KSEMRequestMutex */
+            {14, 0x0000bd94}, /* _KSEMReleaseMutex */
+            {14, 0x0000bdf4}, /* _KSEMQueryMutex */
+            {14, 0x0000c178}, /* _KSEMInit */
+            {10, 0x00015e48}, /* _LdrSem */
+            {10, 0x00015ed4}, /* _LDRLibPath */
+            {14, 0x00030640}, /* _TKSuBuff */
+            {14, 0x00030232}, /* _TKFuBuff */
+            {14, 0x000303fe}, /* _TKFuBufLen */
+            {14, 0x00045860}, /* _ldrValidateMteHandle */
+            {10, 0x0000b8bc}, /* _pTCBCur */
+            {10, 0x0000b8b8}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x00018428}, /* _ldrpFileNameBuf */
+            {14, 0x0004102a}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9029HU.SYM */
+        9029, KF_UNI | KF_HALFSTRICT, 15,
+        {
+            {14, 0x0000947c}, /* _ldrRead */
+            {14, 0x0003b03c}, /* _ldrOpen */
+            {14, 0x0003b8c4}, /* _ldrClose */
+            {14, 0x0003b914}, /* _LDRQAppType */
+            {14, 0x0003930c}, /* _ldrEnum32bitRelRecs */
+            {14, 0x0000355c}, /* _IOSftOpen */
+            {14, 0x00003a02}, /* _IOSftClose */
+            {14, 0x00003aa9}, /* _IOSftTransPath */
+            {14, 0x00003823}, /* _IOSftReadAt */
+            {14, 0x0000382a}, /* _IOSftWriteAt */
+            {14, 0x00003bc2}, /* _SftFileSize */
+            {14, 0x000375e0}, /* _VMAllocMem */
+            {14, 0x0001d618}, /* _VMGetOwner */
+            {14, 0x0004361a}, /* g_tkExecPgm */
+            {14, 0x000405bf}, /* _tkStartProcess */
+            {11, 0x0000e594}, /* f_FuStrLenZ */
+            {11, 0x0000e54a}, /* f_FuStrLen */
+            {11, 0x0000e688}, /* f_FuBuff */
+            {14, 0x0001c978}, /* _VMObjHandleInfo */
+            {14, 0x00043fcc}, /* _ldrASMpMTEFromHandle */
+            {14, 0x0003b2b3}, /* _ldrOpenPath */
+            {14, 0x00037d20}, /* _LDRClearSem */
+            {14, 0x0003fd39}, /* _ldrFindModule */
+            {14, 0x0000a92c}, /* _KSEMRequestMutex */
+            {14, 0x0000aa03}, /* _KSEMReleaseMutex */
+            {14, 0x0000aa2e}, /* _KSEMQueryMutex */
+            {14, 0x0000acce}, /* _KSEMInit */
+            {10, 0x0000a550}, /* _LdrSem */
+            {10, 0x0000a5d0}, /* _LDRLibPath */
+            {14, 0x00027f8d}, /* _TKSuBuff */
+            {14, 0x00027bc1}, /* _TKFuBuff */
+            {14, 0x00027d4b}, /* _TKFuBufLen */
+            {14, 0x00037d5c}, /* _ldrValidateMteHandle */
+            {10, 0x000072b4}, /* _pTCBCur */
+            {10, 0x000072b0}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0000c094}, /* _ldrpFileNameBuf */
+            {14, 0x0003419f}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9029RU.SYM */
-        9029, 'R', TYPE_UNI, 13,
+        9029, KF_UNI, 13,
         {
             {12, 0x00009404}, /* _ldrRead */
@@ -582,11 +4136,134 @@
             {12, 0x0001c8f0}, /* _VMGetOwner */
             {12, 0x00041eb6}, /* g_tkExecPgm */
-            {9, 0x0000e594}, /* f_FuStrLenZ */
-            {9, 0x0000e54a}, /* f_FuStrLen */
-            {9, 0x0000e688}, /* f_FuBuff */
-        }
-    },
+            {12, 0x0003ee7f}, /* _tkStartProcess */
+            {9 , 0x0000e594}, /* f_FuStrLenZ */
+            {9 , 0x0000e54a}, /* f_FuStrLen */
+            {9 , 0x0000e688}, /* f_FuBuff */
+            {12, 0x0001bc50}, /* _VMObjHandleInfo */
+            {12, 0x00042868}, /* _ldrASMpMTEFromHandle */
+            {12, 0x00039b77}, /* _ldrOpenPath */
+            {12, 0x000365e0}, /* _LDRClearSem */
+            {12, 0x0003e5f9}, /* _ldrFindModule */
+            {12, 0x0000a78c}, /* _KSEMRequestMutex */
+            {12, 0x0000a81f}, /* _KSEMReleaseMutex */
+            {12, 0x0000a84a}, /* _KSEMQueryMutex */
+            {12, 0x0000aa5f}, /* _KSEMInit */
+            {8 , 0x0000a398}, /* _LdrSem */
+            {8 , 0x0000a418}, /* _LDRLibPath */
+            {12, 0x00027265}, /* _TKSuBuff */
+            {12, 0x00026e99}, /* _TKFuBuff */
+            {12, 0x00027023}, /* _TKFuBufLen */
+            {12, 0x0003661c}, /* _ldrValidateMteHandle */
+            {8 , 0x000072b4}, /* _pTCBCur */
+            {8 , 0x000072b0}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bed8}, /* _ldrpFileNameBuf */
+            {12, 0x00032a5f}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9030AU.SYM */
+        9030, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a7b4}, /* _ldrRead */
+            {15, 0x00049c60}, /* _ldrOpen */
+            {15, 0x0004a5f8}, /* _ldrClose */
+            {15, 0x0004a648}, /* _LDRQAppType */
+            {15, 0x00047b7c}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004318}, /* _IOSftOpen */
+            {15, 0x000047cc}, /* _IOSftClose */
+            {15, 0x00004874}, /* _IOSftTransPath */
+            {15, 0x000045ec}, /* _IOSftReadAt */
+            {15, 0x000045f3}, /* _IOSftWriteAt */
+            {15, 0x0000499c}, /* _SftFileSize */
+            {15, 0x00045510}, /* _VMAllocMem */
+            {15, 0x00023390}, /* _VMGetOwner */
+            {15, 0x00053590}, /* g_tkExecPgm */
+            {15, 0x0004fcd8}, /* _tkStartProcess */
+            {11, 0x0000ecfc}, /* f_FuStrLenZ */
+            {11, 0x0000ecb0}, /* f_FuStrLen */
+            {11, 0x0000ee14}, /* f_FuBuff */
+            {15, 0x000222d8}, /* _VMObjHandleInfo */
+            {15, 0x00054014}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00049eeb}, /* _ldrOpenPath */
+            {15, 0x00045fc4}, /* _LDRClearSem */
+            {15, 0x0004f3b6}, /* _ldrFindModule */
+            {15, 0x0000c160}, /* _KSEMRequestMutex */
+            {15, 0x0000c274}, /* _KSEMReleaseMutex */
+            {15, 0x0000c2d4}, /* _KSEMQueryMutex */
+            {15, 0x0000c658}, /* _KSEMInit */
+            {10, 0x00016f2c}, /* _LdrSem */
+            {10, 0x00016fb8}, /* _LDRLibPath */
+            {15, 0x00030e98}, /* _TKSuBuff */
+            {15, 0x00030a88}, /* _TKFuBuff */
+            {15, 0x00030c54}, /* _TKFuBufLen */
+            {15, 0x0004604c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b8ac}, /* _pTCBCur */
+            {10, 0x0000b8a8}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001951c}, /* _ldrpFileNameBuf */
+            {15, 0x000418e2}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9030HU.SYM */
+        9030, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x0000980c}, /* _ldrRead */
+            {15, 0x0003b8c4}, /* _ldrOpen */
+            {15, 0x0003c14c}, /* _ldrClose */
+            {15, 0x0003c19c}, /* _LDRQAppType */
+            {15, 0x00039acc}, /* _ldrEnum32bitRelRecs */
+            {15, 0x0000390c}, /* _IOSftOpen */
+            {15, 0x00003db2}, /* _IOSftClose */
+            {15, 0x00003e59}, /* _IOSftTransPath */
+            {15, 0x00003bd3}, /* _IOSftReadAt */
+            {15, 0x00003bda}, /* _IOSftWriteAt */
+            {15, 0x00003f72}, /* _SftFileSize */
+            {15, 0x00037d98}, /* _VMAllocMem */
+            {15, 0x0001dd38}, /* _VMGetOwner */
+            {15, 0x0004406e}, /* g_tkExecPgm */
+            {15, 0x00040ffb}, /* _tkStartProcess */
+            {11, 0x0000db08}, /* f_FuStrLenZ */
+            {11, 0x0000dabe}, /* f_FuStrLen */
+            {11, 0x0000dbfc}, /* f_FuBuff */
+            {15, 0x0001d094}, /* _VMObjHandleInfo */
+            {15, 0x00044a20}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003bb3b}, /* _ldrOpenPath */
+            {15, 0x000384e0}, /* _LDRClearSem */
+            {15, 0x00040775}, /* _ldrFindModule */
+            {15, 0x0000acbc}, /* _KSEMRequestMutex */
+            {15, 0x0000ad93}, /* _KSEMReleaseMutex */
+            {15, 0x0000adbe}, /* _KSEMQueryMutex */
+            {15, 0x0000b05e}, /* _KSEMInit */
+            {10, 0x0000a56c}, /* _LdrSem */
+            {10, 0x0000a5ec}, /* _LDRLibPath */
+            {15, 0x000286d9}, /* _TKSuBuff */
+            {15, 0x0002830f}, /* _TKFuBuff */
+            {15, 0x00028499}, /* _TKFuBufLen */
+            {15, 0x0003851c}, /* _ldrValidateMteHandle */
+            {10, 0x000072b8}, /* _pTCBCur */
+            {10, 0x000072b4}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0000c0c0}, /* _ldrpFileNameBuf */
+            {15, 0x00034957}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9030RU.SYM */
-        9030, 'R', TYPE_UNI, 14,
+        9030, KF_UNI, 14,
         {
             {13, 0x00009784}, /* _ldrRead */
@@ -604,11 +4281,134 @@
             {13, 0x0001d000}, /* _VMGetOwner */
             {13, 0x0004288a}, /* g_tkExecPgm */
-            {9, 0x0000db08}, /* f_FuStrLenZ */
-            {9, 0x0000dabe}, /* f_FuStrLen */
-            {9, 0x0000dbfc}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0003f83b}, /* _tkStartProcess */
+            {9 , 0x0000db08}, /* f_FuStrLenZ */
+            {9 , 0x0000dabe}, /* f_FuStrLen */
+            {9 , 0x0000dbfc}, /* f_FuBuff */
+            {13, 0x0001c35c}, /* _VMObjHandleInfo */
+            {13, 0x0004323c}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a38b}, /* _ldrOpenPath */
+            {13, 0x00036d30}, /* _LDRClearSem */
+            {13, 0x0003efb5}, /* _ldrFindModule */
+            {13, 0x0000ab0c}, /* _KSEMRequestMutex */
+            {13, 0x0000ab9f}, /* _KSEMReleaseMutex */
+            {13, 0x0000abca}, /* _KSEMQueryMutex */
+            {13, 0x0000addf}, /* _KSEMInit */
+            {8 , 0x0000a3b4}, /* _LdrSem */
+            {8 , 0x0000a434}, /* _LDRLibPath */
+            {13, 0x000279a1}, /* _TKSuBuff */
+            {13, 0x000275d7}, /* _TKFuBuff */
+            {13, 0x00027761}, /* _TKFuBufLen */
+            {13, 0x00036d6c}, /* _ldrValidateMteHandle */
+            {8 , 0x000072b8}, /* _pTCBCur */
+            {8 , 0x000072b4}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bf04}, /* _ldrpFileNameBuf */
+            {13, 0x000331a7}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9031AU.SYM */
+        9031, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a84c}, /* _ldrRead */
+            {15, 0x0004979c}, /* _ldrOpen */
+            {15, 0x0004a138}, /* _ldrClose */
+            {15, 0x0004a188}, /* _LDRQAppType */
+            {15, 0x000476c4}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004318}, /* _IOSftOpen */
+            {15, 0x000047cc}, /* _IOSftClose */
+            {15, 0x00004874}, /* _IOSftTransPath */
+            {15, 0x000045ec}, /* _IOSftReadAt */
+            {15, 0x000045f3}, /* _IOSftWriteAt */
+            {15, 0x0000499c}, /* _SftFileSize */
+            {15, 0x00045188}, /* _VMAllocMem */
+            {15, 0x000234b0}, /* _VMGetOwner */
+            {15, 0x000530e4}, /* g_tkExecPgm */
+            {15, 0x0004f824}, /* _tkStartProcess */
+            {11, 0x0000ecfc}, /* f_FuStrLenZ */
+            {11, 0x0000ecb0}, /* f_FuStrLen */
+            {11, 0x0000ee14}, /* f_FuBuff */
+            {15, 0x000223f0}, /* _VMObjHandleInfo */
+            {15, 0x00053b68}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00049a27}, /* _ldrOpenPath */
+            {15, 0x00045b94}, /* _LDRClearSem */
+            {15, 0x0004ef01}, /* _ldrFindModule */
+            {15, 0x0000c1b4}, /* _KSEMRequestMutex */
+            {15, 0x0000c2c8}, /* _KSEMReleaseMutex */
+            {15, 0x0000c328}, /* _KSEMQueryMutex */
+            {15, 0x0000c6ac}, /* _KSEMInit */
+            {10, 0x00026f18}, /* _LdrSem */
+            {10, 0x00026fa4}, /* _LDRLibPath */
+            {15, 0x00030b94}, /* _TKSuBuff */
+            {15, 0x00030784}, /* _TKFuBuff */
+            {15, 0x00030950}, /* _TKFuBufLen */
+            {15, 0x00045c1c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b8a4}, /* _pTCBCur */
+            {10, 0x0000b8a0}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x00029508}, /* _ldrpFileNameBuf */
+            {15, 0x00041686}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9031HU.SYM */
+        9031, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x0000989c}, /* _ldrRead */
+            {15, 0x0003b7b8}, /* _ldrOpen */
+            {15, 0x0003c03c}, /* _ldrClose */
+            {15, 0x0003c08c}, /* _LDRQAppType */
+            {15, 0x000399b4}, /* _ldrEnum32bitRelRecs */
+            {15, 0x0000390c}, /* _IOSftOpen */
+            {15, 0x00003db2}, /* _IOSftClose */
+            {15, 0x00003e59}, /* _IOSftTransPath */
+            {15, 0x00003bd3}, /* _IOSftReadAt */
+            {15, 0x00003bda}, /* _IOSftWriteAt */
+            {15, 0x00003f72}, /* _SftFileSize */
+            {15, 0x00037d00}, /* _VMAllocMem */
+            {15, 0x0001dd60}, /* _VMGetOwner */
+            {15, 0x00044036}, /* g_tkExecPgm */
+            {15, 0x00040fa7}, /* _tkStartProcess */
+            {11, 0x0000db08}, /* f_FuStrLenZ */
+            {11, 0x0000dabe}, /* f_FuStrLen */
+            {11, 0x0000dbfc}, /* f_FuBuff */
+            {15, 0x0001d0bc}, /* _VMObjHandleInfo */
+            {15, 0x000449e8}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003ba2f}, /* _ldrOpenPath */
+            {15, 0x00038448}, /* _LDRClearSem */
+            {15, 0x00040724}, /* _ldrFindModule */
+            {15, 0x0000ad4c}, /* _KSEMRequestMutex */
+            {15, 0x0000ae23}, /* _KSEMReleaseMutex */
+            {15, 0x0000ae4e}, /* _KSEMQueryMutex */
+            {15, 0x0000b0ee}, /* _KSEMInit */
+            {10, 0x0001a574}, /* _LdrSem */
+            {10, 0x0001a5f4}, /* _LDRLibPath */
+            {15, 0x00028705}, /* _TKSuBuff */
+            {15, 0x0002833b}, /* _TKFuBuff */
+            {15, 0x000284c5}, /* _TKFuBufLen */
+            {15, 0x00038484}, /* _ldrValidateMteHandle */
+            {10, 0x000072b8}, /* _pTCBCur */
+            {10, 0x000072b4}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001c0c8}, /* _ldrpFileNameBuf */
+            {15, 0x0003499f}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9031RU.SYM */
-        9031, 'R', TYPE_UNI, 14,
+        9031, KF_UNI, 14,
         {
             {13, 0x00009814}, /* _ldrRead */
@@ -626,11 +4426,134 @@
             {13, 0x0001d09c}, /* _VMGetOwner */
             {13, 0x0004288a}, /* g_tkExecPgm */
-            {9, 0x0000db08}, /* f_FuStrLenZ */
-            {9, 0x0000dabe}, /* f_FuStrLen */
-            {9, 0x0000dbfc}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0003f81b}, /* _tkStartProcess */
+            {9 , 0x0000db08}, /* f_FuStrLenZ */
+            {9 , 0x0000dabe}, /* f_FuStrLen */
+            {9 , 0x0000dbfc}, /* f_FuBuff */
+            {13, 0x0001c3f8}, /* _VMObjHandleInfo */
+            {13, 0x0004323c}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a2a3}, /* _ldrOpenPath */
+            {13, 0x00036cbc}, /* _LDRClearSem */
+            {13, 0x0003ef98}, /* _ldrFindModule */
+            {13, 0x0000ab9c}, /* _KSEMRequestMutex */
+            {13, 0x0000ac2f}, /* _KSEMReleaseMutex */
+            {13, 0x0000ac5a}, /* _KSEMQueryMutex */
+            {13, 0x0000ae6f}, /* _KSEMInit */
+            {8 , 0x0000a3bc}, /* _LdrSem */
+            {8 , 0x0000a43c}, /* _LDRLibPath */
+            {13, 0x00027a41}, /* _TKSuBuff */
+            {13, 0x00027677}, /* _TKFuBuff */
+            {13, 0x00027801}, /* _TKFuBufLen */
+            {13, 0x00036cf8}, /* _ldrValidateMteHandle */
+            {8 , 0x000072b8}, /* _pTCBCur */
+            {8 , 0x000072b4}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bf0c}, /* _ldrpFileNameBuf */
+            {13, 0x00033213}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9032AU.SYM */
+        9032, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a84c}, /* _ldrRead */
+            {15, 0x000496c8}, /* _ldrOpen */
+            {15, 0x0004a060}, /* _ldrClose */
+            {15, 0x0004a0b0}, /* _LDRQAppType */
+            {15, 0x000475e4}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004318}, /* _IOSftOpen */
+            {15, 0x000047cc}, /* _IOSftClose */
+            {15, 0x00004874}, /* _IOSftTransPath */
+            {15, 0x000045ec}, /* _IOSftReadAt */
+            {15, 0x000045f3}, /* _IOSftWriteAt */
+            {15, 0x0000499c}, /* _SftFileSize */
+            {15, 0x000450a8}, /* _VMAllocMem */
+            {15, 0x000234a8}, /* _VMGetOwner */
+            {15, 0x000530d4}, /* g_tkExecPgm */
+            {15, 0x0004f828}, /* _tkStartProcess */
+            {11, 0x0000ecf8}, /* f_FuStrLenZ */
+            {11, 0x0000ecac}, /* f_FuStrLen */
+            {11, 0x0000ee10}, /* f_FuBuff */
+            {15, 0x000223e8}, /* _VMObjHandleInfo */
+            {15, 0x00053b58}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00049953}, /* _ldrOpenPath */
+            {15, 0x00045ab4}, /* _LDRClearSem */
+            {15, 0x0004ef05}, /* _ldrFindModule */
+            {15, 0x0000c1b4}, /* _KSEMRequestMutex */
+            {15, 0x0000c2c8}, /* _KSEMReleaseMutex */
+            {15, 0x0000c328}, /* _KSEMQueryMutex */
+            {15, 0x0000c6ac}, /* _KSEMInit */
+            {10, 0x00026f00}, /* _LdrSem */
+            {10, 0x00026f8c}, /* _LDRLibPath */
+            {15, 0x00030b60}, /* _TKSuBuff */
+            {15, 0x00030752}, /* _TKFuBuff */
+            {15, 0x0003091e}, /* _TKFuBufLen */
+            {15, 0x00045b3c}, /* _ldrValidateMteHandle */
+            {10, 0x0000b88c}, /* _pTCBCur */
+            {10, 0x0000b888}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x000294f0}, /* _ldrpFileNameBuf */
+            {15, 0x000415ff}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9032HU.SYM */
+        9032, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x0000989c}, /* _ldrRead */
+            {15, 0x0003b9cc}, /* _ldrOpen */
+            {15, 0x0003c250}, /* _ldrClose */
+            {15, 0x0003c2a0}, /* _LDRQAppType */
+            {15, 0x00039bc8}, /* _ldrEnum32bitRelRecs */
+            {15, 0x0000390c}, /* _IOSftOpen */
+            {15, 0x00003db2}, /* _IOSftClose */
+            {15, 0x00003e59}, /* _IOSftTransPath */
+            {15, 0x00003bd3}, /* _IOSftReadAt */
+            {15, 0x00003bda}, /* _IOSftWriteAt */
+            {15, 0x00003f72}, /* _SftFileSize */
+            {15, 0x00037f14}, /* _VMAllocMem */
+            {15, 0x0001dd5e}, /* _VMGetOwner */
+            {15, 0x0004421a}, /* g_tkExecPgm */
+            {15, 0x00041197}, /* _tkStartProcess */
+            {11, 0x0000db00}, /* f_FuStrLenZ */
+            {11, 0x0000dab6}, /* f_FuStrLen */
+            {11, 0x0000dbf4}, /* f_FuBuff */
+            {15, 0x0001d0bc}, /* _VMObjHandleInfo */
+            {15, 0x00044bcc}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003bc43}, /* _ldrOpenPath */
+            {15, 0x0003865c}, /* _LDRClearSem */
+            {15, 0x00040914}, /* _ldrFindModule */
+            {15, 0x0000ad4c}, /* _KSEMRequestMutex */
+            {15, 0x0000ae23}, /* _KSEMReleaseMutex */
+            {15, 0x0000ae4e}, /* _KSEMQueryMutex */
+            {15, 0x0000b0ee}, /* _KSEMInit */
+            {10, 0x0001a574}, /* _LdrSem */
+            {10, 0x0001a5f4}, /* _LDRLibPath */
+            {15, 0x00028711}, /* _TKSuBuff */
+            {15, 0x00028347}, /* _TKFuBuff */
+            {15, 0x000284d1}, /* _TKFuBufLen */
+            {15, 0x00038698}, /* _ldrValidateMteHandle */
+            {10, 0x000072b8}, /* _pTCBCur */
+            {10, 0x000072b4}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001c0c8}, /* _ldrpFileNameBuf */
+            {15, 0x00034a13}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9032RU.SYM */
-        9032, 'R', TYPE_UNI, 14,
+        9032, KF_UNI, 14,
         {
             {13, 0x00009814}, /* _ldrRead */
@@ -648,11 +4571,134 @@
             {13, 0x0001d09a}, /* _VMGetOwner */
             {13, 0x00042b3a}, /* g_tkExecPgm */
-            {9, 0x0000db00}, /* f_FuStrLenZ */
-            {9, 0x0000dab6}, /* f_FuStrLen */
-            {9, 0x0000dbf4}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0003fad3}, /* _tkStartProcess */
+            {9 , 0x0000db00}, /* f_FuStrLenZ */
+            {9 , 0x0000dab6}, /* f_FuStrLen */
+            {9 , 0x0000dbf4}, /* f_FuBuff */
+            {13, 0x0001c3f8}, /* _VMObjHandleInfo */
+            {13, 0x000434ec}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a4f3}, /* _ldrOpenPath */
+            {13, 0x00036f0c}, /* _LDRClearSem */
+            {13, 0x0003f250}, /* _ldrFindModule */
+            {13, 0x0000ab9c}, /* _KSEMRequestMutex */
+            {13, 0x0000ac2f}, /* _KSEMReleaseMutex */
+            {13, 0x0000ac5a}, /* _KSEMQueryMutex */
+            {13, 0x0000ae6f}, /* _KSEMInit */
+            {8 , 0x0000a3bc}, /* _LdrSem */
+            {8 , 0x0000a43c}, /* _LDRLibPath */
+            {13, 0x00027a4d}, /* _TKSuBuff */
+            {13, 0x00027683}, /* _TKFuBuff */
+            {13, 0x0002780d}, /* _TKFuBufLen */
+            {13, 0x00036f48}, /* _ldrValidateMteHandle */
+            {8 , 0x000072b8}, /* _pTCBCur */
+            {8 , 0x000072b4}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bf0c}, /* _ldrpFileNameBuf */
+            {13, 0x000332c3}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9033AU.SYM */
+        9033, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a850}, /* _ldrRead */
+            {15, 0x00049814}, /* _ldrOpen */
+            {15, 0x0004a1b4}, /* _ldrClose */
+            {15, 0x0004a204}, /* _LDRQAppType */
+            {15, 0x0004771c}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00004318}, /* _IOSftOpen */
+            {15, 0x000047cc}, /* _IOSftClose */
+            {15, 0x00004874}, /* _IOSftTransPath */
+            {15, 0x000045ec}, /* _IOSftReadAt */
+            {15, 0x000045f3}, /* _IOSftWriteAt */
+            {15, 0x0000499c}, /* _SftFileSize */
+            {15, 0x000451e0}, /* _VMAllocMem */
+            {15, 0x0002358c}, /* _VMGetOwner */
+            {15, 0x00053228}, /* g_tkExecPgm */
+            {15, 0x0004f97c}, /* _tkStartProcess */
+            {11, 0x0000ed2c}, /* f_FuStrLenZ */
+            {11, 0x0000ece0}, /* f_FuStrLen */
+            {11, 0x0000ee44}, /* f_FuBuff */
+            {15, 0x000224cc}, /* _VMObjHandleInfo */
+            {15, 0x00053cac}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00049a9f}, /* _ldrOpenPath */
+            {15, 0x00045bec}, /* _LDRClearSem */
+            {15, 0x0004f059}, /* _ldrFindModule */
+            {15, 0x0000c1c4}, /* _KSEMRequestMutex */
+            {15, 0x0000c2d8}, /* _KSEMReleaseMutex */
+            {15, 0x0000c338}, /* _KSEMQueryMutex */
+            {15, 0x0000c6bc}, /* _KSEMInit */
+            {10, 0x00026ecc}, /* _LdrSem */
+            {10, 0x00026f58}, /* _LDRLibPath */
+            {15, 0x00030c44}, /* _TKSuBuff */
+            {15, 0x00030836}, /* _TKFuBuff */
+            {15, 0x00030a02}, /* _TKFuBufLen */
+            {15, 0x00045c74}, /* _ldrValidateMteHandle */
+            {10, 0x0000b898}, /* _pTCBCur */
+            {10, 0x0000b894}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x000294bc}, /* _ldrpFileNameBuf */
+            {15, 0x000416f7}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9033HU.SYM */
+        9033, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000098ac}, /* _ldrRead */
+            {15, 0x0003bb24}, /* _ldrOpen */
+            {15, 0x0003c3b0}, /* _ldrClose */
+            {15, 0x0003c400}, /* _LDRQAppType */
+            {15, 0x00039d0c}, /* _ldrEnum32bitRelRecs */
+            {15, 0x0000390c}, /* _IOSftOpen */
+            {15, 0x00003db2}, /* _IOSftClose */
+            {15, 0x00003e59}, /* _IOSftTransPath */
+            {15, 0x00003bd3}, /* _IOSftReadAt */
+            {15, 0x00003bda}, /* _IOSftWriteAt */
+            {15, 0x00003f72}, /* _SftFileSize */
+            {15, 0x00038058}, /* _VMAllocMem */
+            {15, 0x0001de42}, /* _VMGetOwner */
+            {15, 0x0004437a}, /* g_tkExecPgm */
+            {15, 0x000412f7}, /* _tkStartProcess */
+            {11, 0x0000db30}, /* f_FuStrLenZ */
+            {11, 0x0000dae6}, /* f_FuStrLen */
+            {11, 0x0000dc24}, /* f_FuBuff */
+            {15, 0x0001d1a0}, /* _VMObjHandleInfo */
+            {15, 0x00044d2c}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003bd9b}, /* _ldrOpenPath */
+            {15, 0x000387a0}, /* _LDRClearSem */
+            {15, 0x00040a74}, /* _ldrFindModule */
+            {15, 0x0000ad68}, /* _KSEMRequestMutex */
+            {15, 0x0000ae3f}, /* _KSEMReleaseMutex */
+            {15, 0x0000ae6a}, /* _KSEMQueryMutex */
+            {15, 0x0000b10a}, /* _KSEMInit */
+            {10, 0x0001a578}, /* _LdrSem */
+            {10, 0x0001a5f8}, /* _LDRLibPath */
+            {15, 0x000287f5}, /* _TKSuBuff */
+            {15, 0x0002842b}, /* _TKFuBuff */
+            {15, 0x000285b5}, /* _TKFuBufLen */
+            {15, 0x000387dc}, /* _ldrValidateMteHandle */
+            {10, 0x000072bc}, /* _pTCBCur */
+            {10, 0x000072b8}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001c0cc}, /* _ldrpFileNameBuf */
+            {15, 0x00034b0b}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9033RU.SYM */
-        9033, 'R', TYPE_UNI, 14,
+        9033, KF_UNI, 14,
         {
             {13, 0x00009824}, /* _ldrRead */
@@ -670,11 +4716,134 @@
             {13, 0x0001d172}, /* _VMGetOwner */
             {13, 0x00042c8e}, /* g_tkExecPgm */
-            {9, 0x0000db30}, /* f_FuStrLenZ */
-            {9, 0x0000dae6}, /* f_FuStrLen */
-            {9, 0x0000dc24}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0003fc27}, /* _tkStartProcess */
+            {9 , 0x0000db30}, /* f_FuStrLenZ */
+            {9 , 0x0000dae6}, /* f_FuStrLen */
+            {9 , 0x0000dc24}, /* f_FuBuff */
+            {13, 0x0001c4d0}, /* _VMObjHandleInfo */
+            {13, 0x00043640}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a63f}, /* _ldrOpenPath */
+            {13, 0x00037044}, /* _LDRClearSem */
+            {13, 0x0003f3a4}, /* _ldrFindModule */
+            {13, 0x0000abb8}, /* _KSEMRequestMutex */
+            {13, 0x0000ac4b}, /* _KSEMReleaseMutex */
+            {13, 0x0000ac76}, /* _KSEMQueryMutex */
+            {13, 0x0000ae8b}, /* _KSEMInit */
+            {8 , 0x0000a3c0}, /* _LdrSem */
+            {8 , 0x0000a440}, /* _LDRLibPath */
+            {13, 0x00027b25}, /* _TKSuBuff */
+            {13, 0x0002775b}, /* _TKFuBuff */
+            {13, 0x000278e5}, /* _TKFuBufLen */
+            {13, 0x00037080}, /* _ldrValidateMteHandle */
+            {8 , 0x000072bc}, /* _pTCBCur */
+            {8 , 0x000072b8}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bf10}, /* _ldrpFileNameBuf */
+            {13, 0x000333af}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9034AU.SYM */
+        9034, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a3cc}, /* _ldrRead */
+            {15, 0x0004a144}, /* _ldrOpen */
+            {15, 0x0004aae8}, /* _ldrClose */
+            {15, 0x0004ab38}, /* _LDRQAppType */
+            {15, 0x00048048}, /* _ldrEnum32bitRelRecs */
+            {15, 0x000044b4}, /* _IOSftOpen */
+            {15, 0x00004968}, /* _IOSftClose */
+            {15, 0x00004a10}, /* _IOSftTransPath */
+            {15, 0x00004788}, /* _IOSftReadAt */
+            {15, 0x0000478f}, /* _IOSftWriteAt */
+            {15, 0x00004b38}, /* _SftFileSize */
+            {15, 0x00045b0c}, /* _VMAllocMem */
+            {15, 0x0002399c}, /* _VMGetOwner */
+            {15, 0x00053b44}, /* g_tkExecPgm */
+            {15, 0x00050264}, /* _tkStartProcess */
+            {11, 0x0000ed44}, /* f_FuStrLenZ */
+            {11, 0x0000ecf8}, /* f_FuStrLen */
+            {11, 0x0000ee5c}, /* f_FuBuff */
+            {15, 0x000228dc}, /* _VMObjHandleInfo */
+            {15, 0x000545dc}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a3cf}, /* _ldrOpenPath */
+            {15, 0x00046518}, /* _LDRClearSem */
+            {15, 0x0004f950}, /* _ldrFindModule */
+            {15, 0x0000bcfc}, /* _KSEMRequestMutex */
+            {15, 0x0000be10}, /* _KSEMReleaseMutex */
+            {15, 0x0000be70}, /* _KSEMQueryMutex */
+            {15, 0x0000c1f4}, /* _KSEMInit */
+            {10, 0x00027160}, /* _LdrSem */
+            {10, 0x000271ec}, /* _LDRLibPath */
+            {15, 0x00031014}, /* _TKSuBuff */
+            {15, 0x00030c04}, /* _TKFuBuff */
+            {15, 0x00030dd0}, /* _TKFuBufLen */
+            {15, 0x000465a0}, /* _ldrValidateMteHandle */
+            {10, 0x0000b9b0}, /* _pTCBCur */
+            {10, 0x0000b9ac}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x0002978c}, /* _ldrpFileNameBuf */
+            {15, 0x00041d7e}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9034HU.SYM */
+        9034, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000093fc}, /* _ldrRead */
+            {15, 0x0003be50}, /* _ldrOpen */
+            {15, 0x0003c6dc}, /* _ldrClose */
+            {15, 0x0003c72c}, /* _LDRQAppType */
+            {15, 0x0003a034}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a30}, /* _IOSftOpen */
+            {15, 0x00003ed6}, /* _IOSftClose */
+            {15, 0x00003f7d}, /* _IOSftTransPath */
+            {15, 0x00003cf7}, /* _IOSftReadAt */
+            {15, 0x00003cfe}, /* _IOSftWriteAt */
+            {15, 0x00004096}, /* _SftFileSize */
+            {15, 0x00038380}, /* _VMAllocMem */
+            {15, 0x0001e136}, /* _VMGetOwner */
+            {15, 0x0004476a}, /* g_tkExecPgm */
+            {15, 0x000416e7}, /* _tkStartProcess */
+            {11, 0x0000db44}, /* f_FuStrLenZ */
+            {11, 0x0000dafa}, /* f_FuStrLen */
+            {11, 0x0000dc38}, /* f_FuBuff */
+            {15, 0x0001d494}, /* _VMObjHandleInfo */
+            {15, 0x00045130}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c0c7}, /* _ldrOpenPath */
+            {15, 0x00038ac8}, /* _LDRClearSem */
+            {15, 0x00040e74}, /* _ldrFindModule */
+            {15, 0x0000a874}, /* _KSEMRequestMutex */
+            {15, 0x0000a94b}, /* _KSEMReleaseMutex */
+            {15, 0x0000a976}, /* _KSEMQueryMutex */
+            {15, 0x0000ac16}, /* _KSEMInit */
+            {10, 0x0001a5bc}, /* _LdrSem */
+            {10, 0x0001a63c}, /* _LDRLibPath */
+            {15, 0x00028aa1}, /* _TKSuBuff */
+            {15, 0x000286d7}, /* _TKFuBuff */
+            {15, 0x00028861}, /* _TKFuBufLen */
+            {15, 0x00038b04}, /* _ldrValidateMteHandle */
+            {10, 0x000072dc}, /* _pTCBCur */
+            {10, 0x000072d8}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001c148}, /* _ldrpFileNameBuf */
+            {15, 0x00034f09}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9034RU.SYM */
-        9034, 'R', TYPE_UNI, 14,
+        9034, KF_UNI, 14,
         {
             {13, 0x00009368}, /* _ldrRead */
@@ -692,11 +4861,134 @@
             {13, 0x0001d2fa}, /* _VMGetOwner */
             {13, 0x00042fda}, /* g_tkExecPgm */
-            {9, 0x0000db44}, /* f_FuStrLenZ */
-            {9, 0x0000dafa}, /* f_FuStrLen */
-            {9, 0x0000dc38}, /* f_FuBuff */
-        }
-    },
+            {13, 0x0003ff73}, /* _tkStartProcess */
+            {9 , 0x0000db44}, /* f_FuStrLenZ */
+            {9 , 0x0000dafa}, /* f_FuStrLen */
+            {9 , 0x0000dc38}, /* f_FuBuff */
+            {13, 0x0001c658}, /* _VMObjHandleInfo */
+            {13, 0x000439a0}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003a977}, /* _ldrOpenPath */
+            {13, 0x00037374}, /* _LDRClearSem */
+            {13, 0x0003f700}, /* _ldrFindModule */
+            {13, 0x0000a6b8}, /* _KSEMRequestMutex */
+            {13, 0x0000a74b}, /* _KSEMReleaseMutex */
+            {13, 0x0000a776}, /* _KSEMQueryMutex */
+            {13, 0x0000a98b}, /* _KSEMInit */
+            {8 , 0x0000a404}, /* _LdrSem */
+            {8 , 0x0000a484}, /* _LDRLibPath */
+            {13, 0x00027c65}, /* _TKSuBuff */
+            {13, 0x0002789b}, /* _TKFuBuff */
+            {13, 0x00027a25}, /* _TKFuBufLen */
+            {13, 0x000373b0}, /* _ldrValidateMteHandle */
+            {8 , 0x000072dc}, /* _pTCBCur */
+            {8 , 0x000072d8}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bf8c}, /* _ldrpFileNameBuf */
+            {13, 0x000337b5}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9035AU.SYM */
+        9035, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a3cc}, /* _ldrRead */
+            {15, 0x00049cf0}, /* _ldrOpen */
+            {15, 0x0004a68c}, /* _ldrClose */
+            {15, 0x0004a6dc}, /* _LDRQAppType */
+            {15, 0x00047c08}, /* _ldrEnum32bitRelRecs */
+            {15, 0x000044b4}, /* _IOSftOpen */
+            {15, 0x00004968}, /* _IOSftClose */
+            {15, 0x00004a10}, /* _IOSftTransPath */
+            {15, 0x00004788}, /* _IOSftReadAt */
+            {15, 0x0000478f}, /* _IOSftWriteAt */
+            {15, 0x00004b38}, /* _SftFileSize */
+            {15, 0x000456cc}, /* _VMAllocMem */
+            {15, 0x000237ac}, /* _VMGetOwner */
+            {15, 0x00053758}, /* g_tkExecPgm */
+            {15, 0x0004feb0}, /* _tkStartProcess */
+            {11, 0x0000ed44}, /* f_FuStrLenZ */
+            {11, 0x0000ecf8}, /* f_FuStrLen */
+            {11, 0x0000ee5c}, /* f_FuBuff */
+            {15, 0x000226ec}, /* _VMObjHandleInfo */
+            {15, 0x000541f0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x00049f7b}, /* _ldrOpenPath */
+            {15, 0x000460d8}, /* _LDRClearSem */
+            {15, 0x0004f59c}, /* _ldrFindModule */
+            {15, 0x0000bcfc}, /* _KSEMRequestMutex */
+            {15, 0x0000be10}, /* _KSEMReleaseMutex */
+            {15, 0x0000be70}, /* _KSEMQueryMutex */
+            {15, 0x0000c1f4}, /* _KSEMInit */
+            {10, 0x00027164}, /* _LdrSem */
+            {10, 0x000271f0}, /* _LDRLibPath */
+            {15, 0x00030e3c}, /* _TKSuBuff */
+            {15, 0x00030a2c}, /* _TKFuBuff */
+            {15, 0x00030bf8}, /* _TKFuBufLen */
+            {15, 0x00046160}, /* _ldrValidateMteHandle */
+            {10, 0x0000b9b0}, /* _pTCBCur */
+            {10, 0x0000b9ac}, /* _pPTDACur */
+            {4 , 0x0000f9f4}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x00029790}, /* _ldrpFileNameBuf */
+            {15, 0x00041af0}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9035HU.SYM */
+        9035, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x000093fc}, /* _ldrRead */
+            {15, 0x0003c0b4}, /* _ldrOpen */
+            {15, 0x0003c938}, /* _ldrClose */
+            {15, 0x0003c988}, /* _LDRQAppType */
+            {15, 0x0003a2ac}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a30}, /* _IOSftOpen */
+            {15, 0x00003ed6}, /* _IOSftClose */
+            {15, 0x00003f7d}, /* _IOSftTransPath */
+            {15, 0x00003cf7}, /* _IOSftReadAt */
+            {15, 0x00003cfe}, /* _IOSftWriteAt */
+            {15, 0x00004096}, /* _SftFileSize */
+            {15, 0x000385f8}, /* _VMAllocMem */
+            {15, 0x0001e272}, /* _VMGetOwner */
+            {15, 0x00044a1e}, /* g_tkExecPgm */
+            {15, 0x00041997}, /* _tkStartProcess */
+            {11, 0x0000db44}, /* f_FuStrLenZ */
+            {11, 0x0000dafa}, /* f_FuStrLen */
+            {11, 0x0000dc38}, /* f_FuBuff */
+            {15, 0x0001d5d0}, /* _VMObjHandleInfo */
+            {15, 0x000453e4}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c32b}, /* _ldrOpenPath */
+            {15, 0x00038d40}, /* _LDRClearSem */
+            {15, 0x00041124}, /* _ldrFindModule */
+            {15, 0x0000a874}, /* _KSEMRequestMutex */
+            {15, 0x0000a94b}, /* _KSEMReleaseMutex */
+            {15, 0x0000a976}, /* _KSEMQueryMutex */
+            {15, 0x0000ac16}, /* _KSEMInit */
+            {10, 0x0001a5bc}, /* _LdrSem */
+            {10, 0x0001a63c}, /* _LDRLibPath */
+            {15, 0x00028be9}, /* _TKSuBuff */
+            {15, 0x0002881f}, /* _TKFuBuff */
+            {15, 0x000289a9}, /* _TKFuBufLen */
+            {15, 0x00038d7c}, /* _ldrValidateMteHandle */
+            {10, 0x000072dc}, /* _pTCBCur */
+            {10, 0x000072d8}, /* _pPTDACur */
+            {4 , 0x0000f9fc}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001c148}, /* _ldrpFileNameBuf */
+            {15, 0x000350b6}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9035RU.SYM */
-        9035, 'R', TYPE_UNI, 14,
+        9035, KF_UNI, 14,
         {
             {13, 0x00009368}, /* _ldrRead */
@@ -714,11 +5006,134 @@
             {13, 0x0001d436}, /* _VMGetOwner */
             {13, 0x0004324e}, /* g_tkExecPgm */
-            {9, 0x0000db44}, /* f_FuStrLenZ */
-            {9, 0x0000dafa}, /* f_FuStrLen */
-            {9, 0x0000dc38}, /* f_FuBuff */
-        }
-    },
+            {13, 0x000401eb}, /* _tkStartProcess */
+            {9 , 0x0000db44}, /* f_FuStrLenZ */
+            {9 , 0x0000dafa}, /* f_FuStrLen */
+            {9 , 0x0000dc38}, /* f_FuBuff */
+            {13, 0x0001c794}, /* _VMObjHandleInfo */
+            {13, 0x00043c14}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003abdb}, /* _ldrOpenPath */
+            {13, 0x000375ec}, /* _LDRClearSem */
+            {13, 0x0003f977}, /* _ldrFindModule */
+            {13, 0x0000a6b8}, /* _KSEMRequestMutex */
+            {13, 0x0000a74b}, /* _KSEMReleaseMutex */
+            {13, 0x0000a776}, /* _KSEMQueryMutex */
+            {13, 0x0000a98b}, /* _KSEMInit */
+            {8 , 0x0000a404}, /* _LdrSem */
+            {8 , 0x0000a484}, /* _LDRLibPath */
+            {13, 0x00027dad}, /* _TKSuBuff */
+            {13, 0x000279e3}, /* _TKFuBuff */
+            {13, 0x00027b6d}, /* _TKFuBufLen */
+            {13, 0x00037628}, /* _ldrValidateMteHandle */
+            {8 , 0x000072dc}, /* _pTCBCur */
+            {8 , 0x000072d8}, /* _pPTDACur */
+            {2 , 0x0000f9fc}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bf8c}, /* _ldrpFileNameBuf */
+            {13, 0x00033962}, /* SecPathFromSFN */
+        }
+    },
+#ifdef ALLKERNELS
+    { /* 9036AU.SYM */
+        9036, KF_UNI | KF_ALLSTRICT, 16,
+        {
+            {15, 0x0000a444}, /* _ldrRead */
+            {15, 0x00049f78}, /* _ldrOpen */
+            {15, 0x0004a914}, /* _ldrClose */
+            {15, 0x0004a964}, /* _LDRQAppType */
+            {15, 0x00047e84}, /* _ldrEnum32bitRelRecs */
+            {15, 0x0000452c}, /* _IOSftOpen */
+            {15, 0x000049e0}, /* _IOSftClose */
+            {15, 0x00004a88}, /* _IOSftTransPath */
+            {15, 0x00004800}, /* _IOSftReadAt */
+            {15, 0x00004807}, /* _IOSftWriteAt */
+            {15, 0x00004bb0}, /* _SftFileSize */
+            {15, 0x00045948}, /* _VMAllocMem */
+            {15, 0x00023814}, /* _VMGetOwner */
+            {15, 0x00053a98}, /* g_tkExecPgm */
+            {15, 0x00050188}, /* _tkStartProcess */
+            {11, 0x0000ed84}, /* f_FuStrLenZ */
+            {11, 0x0000ed38}, /* f_FuStrLen */
+            {11, 0x0000ee9c}, /* f_FuBuff */
+            {15, 0x00022754}, /* _VMObjHandleInfo */
+            {15, 0x00054560}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0004a203}, /* _ldrOpenPath */
+            {15, 0x00046354}, /* _LDRClearSem */
+            {15, 0x0004f873}, /* _ldrFindModule */
+            {15, 0x0000bd6c}, /* _KSEMRequestMutex */
+            {15, 0x0000be80}, /* _KSEMReleaseMutex */
+            {15, 0x0000bee0}, /* _KSEMQueryMutex */
+            {15, 0x0000c264}, /* _KSEMInit */
+            {10, 0x000272f4}, /* _LdrSem */
+            {10, 0x00027380}, /* _LDRLibPath */
+            {15, 0x00030eb8}, /* _TKSuBuff */
+            {15, 0x00030aa8}, /* _TKFuBuff */
+            {15, 0x00030c74}, /* _TKFuBufLen */
+            {15, 0x000463dc}, /* _ldrValidateMteHandle */
+            {10, 0x0000bab8}, /* _pTCBCur */
+            {10, 0x0000bab4}, /* _pPTDACur */
+            {4 , 0x0000f9e8}, /* ptda_start */
+            {4 , 0x0000fa9a}, /* ptda_environ */
+            {4 , 0x0000fecc}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000fa9c}, /* ptda_pBeginLIBPATH */
+            {10, 0x00029920}, /* _ldrpFileNameBuf */
+            {15, 0x00041d19}, /* SecPathFromSFN */
+        }
+    },
+#endif
+#ifdef ALLKERNELS
+    { /* 9036HU.SYM */
+        9036, KF_UNI | KF_HALFSTRICT, 16,
+        {
+            {15, 0x00009448}, /* _ldrRead */
+            {15, 0x0003c2d4}, /* _ldrOpen */
+            {15, 0x0003cb58}, /* _ldrClose */
+            {15, 0x0003cba8}, /* _LDRQAppType */
+            {15, 0x0003a4b8}, /* _ldrEnum32bitRelRecs */
+            {15, 0x00003a7c}, /* _IOSftOpen */
+            {15, 0x00003f22}, /* _IOSftClose */
+            {15, 0x00003fc9}, /* _IOSftTransPath */
+            {15, 0x00003d43}, /* _IOSftReadAt */
+            {15, 0x00003d4a}, /* _IOSftWriteAt */
+            {15, 0x000040e2}, /* _SftFileSize */
+            {15, 0x00038804}, /* _VMAllocMem */
+            {15, 0x0001e31a}, /* _VMGetOwner */
+            {15, 0x00044cea}, /* g_tkExecPgm */
+            {15, 0x00041bf3}, /* _tkStartProcess */
+            {11, 0x0000db94}, /* f_FuStrLenZ */
+            {11, 0x0000db4a}, /* f_FuStrLen */
+            {11, 0x0000dc88}, /* f_FuBuff */
+            {15, 0x0001d678}, /* _VMObjHandleInfo */
+            {15, 0x000456e0}, /* _ldrASMpMTEFromHandle */
+            {15, 0x0003c54b}, /* _ldrOpenPath */
+            {15, 0x00038f4c}, /* _LDRClearSem */
+            {15, 0x0004137f}, /* _ldrFindModule */
+            {15, 0x0000a8b4}, /* _KSEMRequestMutex */
+            {15, 0x0000a98b}, /* _KSEMReleaseMutex */
+            {15, 0x0000a9b6}, /* _KSEMQueryMutex */
+            {15, 0x0000ac56}, /* _KSEMInit */
+            {10, 0x0001a5f0}, /* _LdrSem */
+            {10, 0x0001a670}, /* _LDRLibPath */
+            {15, 0x00028c99}, /* _TKSuBuff */
+            {15, 0x000288cf}, /* _TKFuBuff */
+            {15, 0x00028a59}, /* _TKFuBufLen */
+            {15, 0x00038f88}, /* _ldrValidateMteHandle */
+            {10, 0x000072fc}, /* _pTCBCur */
+            {10, 0x000072f8}, /* _pPTDACur */
+            {4 , 0x0000f9f0}, /* ptda_start */
+            {4 , 0x0000faa2}, /* ptda_environ */
+            {4 , 0x0000fed4}, /* ptda_ptdasem */
+            {4 , 0x0000ffaa}, /* ptda_module */
+            {4 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {10, 0x0001c17c}, /* _ldrpFileNameBuf */
+            {15, 0x00035319}, /* SecPathFromSFN */
+        }
+    },
+#endif
     { /* 9036RU.SYM */
-        9036, 'R', TYPE_UNI, 14,
+        9036, KF_UNI, 14,
         {
             {13, 0x000093b4}, /* _ldrRead */
@@ -736,11 +5151,36 @@
             {13, 0x0001d4ee}, /* _VMGetOwner */
             {13, 0x0004359e}, /* g_tkExecPgm */
-            {9, 0x0000db94}, /* f_FuStrLenZ */
-            {9, 0x0000db4a}, /* f_FuStrLen */
-            {9, 0x0000dc88}, /* f_FuBuff */
+            {13, 0x000404c7}, /* _tkStartProcess */
+            {9 , 0x0000db94}, /* f_FuStrLenZ */
+            {9 , 0x0000db4a}, /* f_FuStrLen */
+            {9 , 0x0000dc88}, /* f_FuBuff */
+            {13, 0x0001c84c}, /* _VMObjHandleInfo */
+            {13, 0x00043f94}, /* _ldrASMpMTEFromHandle */
+            {13, 0x0003ae03}, /* _ldrOpenPath */
+            {13, 0x00037800}, /* _LDRClearSem */
+            {13, 0x0003fc54}, /* _ldrFindModule */
+            {13, 0x0000a708}, /* _KSEMRequestMutex */
+            {13, 0x0000a79b}, /* _KSEMReleaseMutex */
+            {13, 0x0000a7c6}, /* _KSEMQueryMutex */
+            {13, 0x0000a9db}, /* _KSEMInit */
+            {8 , 0x0000a438}, /* _LdrSem */
+            {8 , 0x0000a4b8}, /* _LDRLibPath */
+            {13, 0x00027e6d}, /* _TKSuBuff */
+            {13, 0x00027aa3}, /* _TKFuBuff */
+            {13, 0x00027c2d}, /* _TKFuBufLen */
+            {13, 0x0003783c}, /* _ldrValidateMteHandle */
+            {8 , 0x000072fc}, /* _pTCBCur */
+            {8 , 0x000072f8}, /* _pPTDACur */
+            {2 , 0x0000f9f0}, /* ptda_start */
+            {2 , 0x0000faa2}, /* ptda_environ */
+            {2 , 0x0000fed4}, /* ptda_ptdasem */
+            {2 , 0x0000ffaa}, /* ptda_module */
+            {2 , 0x0000faa4}, /* ptda_pBeginLIBPATH */
+            {8 , 0x0000bfc0}, /* _ldrpFileNameBuf */
+            {13, 0x00033bcd}, /* SecPathFromSFN */
         }
     },
     { /* Terminating entry */
-        0,0,0,0,
+        0,0,0,
         {
             {0,0},
@@ -761,4 +5201,29 @@
             {0,0},
             {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
+            {0,0},
         }
     }
Index: trunk/src/win32k/dev16/d16globl.c
===================================================================
--- trunk/src/win32k/dev16/d16globl.c	(revision 4152)
+++ trunk/src/win32k/dev16/d16globl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: d16globl.c,v 1.1 2000-02-25 18:19:24 bird Exp $
+/* $Id: d16globl.c,v 1.2 2000-09-02 21:07:55 bird Exp $
  *
  * d16globals - global data (16-bit)
@@ -18,6 +18,8 @@
 *******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"
 #include "options.h"
 #include "log.h"
+
 
 /*******************************************************************************
@@ -27,11 +29,13 @@
 /* Note: All global variables must be initialized!  *
  *       Uninitialized variables ends up in DATA32. */
+PFN         Device_Help = NULL;
+ULONG       TKSSBase16  = 0;
+USHORT      R0FlatCS16  = 0;
+USHORT      R0FlatDS16  = 0;
+BOOL        fInitTime   = TRUE;
+struct options
+            DATA16_GLOBAL options = DEFAULT_OPTION_ASSIGMENTS;
 
-PFN     Device_Help = NULL;
-ULONG   TKSSBase16  = 0;
-USHORT  R0FlatCS16  = 0;
-USHORT  R0FlatDS16  = 0;
-BOOL    fInitTime   = TRUE;
+CHAR        szBuildDate[] = {__DATE__};
+CHAR        szBuildTime[] = {__TIME__};
 
-struct options  options = DEFAULT_OPTION_ASSIGMENTS;
-
Index: trunk/src/win32k/dev16/d16init.c
===================================================================
--- trunk/src/win32k/dev16/d16init.c	(revision 4152)
+++ trunk/src/win32k/dev16/d16init.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: d16init.c,v 1.6 2000-02-25 18:15:02 bird Exp $
+/* $Id: d16init.c,v 1.7 2000-09-02 21:07:55 bird Exp $
  *
  * d16init - init routines for both drivers.
@@ -6,5 +6,5 @@
  *            compleated. CodeEnd and DataEnd should not be set here.?
  *
- * Copyright (c) 1999 knut st. osmundsen
+ * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -36,7 +36,17 @@
 #include <memory.h>
 
+#include "devSegDf.h"
+#undef  DATA16_INIT
+#define DATA16_INIT
+#undef  CODE16_INIT
+#define CODE16_INIT
 #include "probkrnl.h"
 #include "dev1632.h"
 #include "dev16.h"
+#include "vprntf16.h"
+#include "log.h"
+#include "options.h"
+
+
 
 /**
@@ -51,9 +61,18 @@
 USHORT NEAR dev0Init(PRPINITIN pRpIn, PRPINITOUT pRpOut)
 {
+    APIRET  rc;
     Device_Help = pRpIn->DevHlpEP;
 
+    /*
+     * Does this work at Ring-3 (inittime)?
+     * If this work we could be saved from throuble!
+     */
+    rc = initGetDosTableData();
+    if (rc != NO_ERROR)
+        printf16("win32k - elf$: initGetDosTableData failed with rc=%d\n", rc);
+
     pRpOut->BPBArray = NULL;
-    pRpOut->CodeEnd  = (USHORT)&CODE16END;
-    pRpOut->DataEnd  = (USHORT)&DATA16END;
+    pRpOut->CodeEnd = (USHORT)&CODE16_INITSTART;
+    pRpOut->DataEnd = (USHORT)&DATA16_INITSTART;
     pRpOut->Unit     = 0;
     pRpOut->rph.Status = STATUS_DONE;
@@ -80,7 +99,14 @@
     NPSZ            npszErrMsg = NULL;
 
+    /*
+     * Probe kernel data.
+     */
     rc = ProbeKernel(pRpIn);
     if (rc == NO_ERROR)
     {
+        /*
+         * Open and send a Ring-0 init packet to elf$.
+         * If this succeeds win32k$ init succeeds.
+         */
         rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL,
                      OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
@@ -93,47 +119,44 @@
             if (rc == NO_ERROR)
             {
-                if (data.Status != STATUS_DONE)
-                    npszErrMsg = "Ring-0 initiation failed\n\r";
+                if ((rc = data.Status) == STATUS_DONE)
+                {
+                    if (!options.fQuiet)
+                        printf16("Win32k.sys succesfully initiated!\n");
+                    pRpOut->Status = pRpOut->rph.Status = data.Status;
+                }
                 else
-                {
-                    /* FIXME quiet test! */
-                    register NPSZ npsz = "Win32k.sys succesfully initiated!\n\r";
-                    DosPutMessage(1, strlen(npsz)+1, npsz);
-                    pRpOut->Status = data.Status;
-                }
+                    npszErrMsg = "Ring-0 initiation failed. rc=%d\n";
             }
             else
-            {
-                APIRET rc2 = rc;
-                NPSZ   npsz;
-                            /*0123456789012345678901234567890 1*/
-                npszErrMsg = "DosDevIOCtl failed. rc=       \n\r";
-
-                npsz  = &npszErrMsg[29];
-                do
-                {
-                    *npsz-- = (char)((rc2 % 10) + '0');
-                    rc2 = rc2/10;
-                } while (rc2 > 0);
-            }
-
+                npszErrMsg = "Ring-0 init: DosDevIOCtl failed. rc=%d\n";
             DosClose(hDev0);
         }
         else
-            npszErrMsg = "DosOpen failed.\n\r";
+            npszErrMsg = "Ring-0 init: DosOpen failed. rc=%d\n";
     }
     else
-        npszErrMsg = "ProbeKernel failed.\n\r";
-    pRpOut->BPBArray = NULL;
-    pRpOut->CodeEnd = (USHORT)&CODE16END;
-    pRpOut->DataEnd = (USHORT)&DATA16END;
+        npszErrMsg = ""; /* ProbeKrnl do its own complaining, but we need something here to indicate failure. */
+
+    /*
+     * Fill return data.
+     */
+    pRpOut->CodeEnd = (USHORT)&CODE16_INITSTART;
+    pRpOut->DataEnd = (USHORT)&DATA16_INITSTART;
+    pRpOut->BPBArray= NULL;
     pRpOut->Unit    = 0;
 
+    /*
+     * Any errors?, if so complain!
+     */
     if (npszErrMsg)
     {
-        DosPutMessage(1, strlen(npszErrMsg) + 1, npszErrMsg);
-        return pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
-    }
-
+        printf16(npszErrMsg, rc);
+        pRpOut->Status = pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
+    }
+
+    /* Init is completed. */
+    fInitTime = FALSE;
+
+    /* successful return */
     return pRpOut->rph.Status;
 }
@@ -142,10 +165,10 @@
 
 /**
- * R0 16-bit initiation function.
+ * R0 16-bit initiation.
  * This gets TKSSBase, thunks parameters and calls R0 32-bit initiation function.
  * @returns   Status word.
  * @param     pRp  Generic IO Control request packet.
  */
-USHORT NEAR R0Init16(PRP_GENIOCTL pRp)
+USHORT NEAR  R0Init16(PRP_GENIOCTL pRp)
 {
     USHORT usRc = STATUS_DONE;
@@ -162,4 +185,7 @@
         ULONG ulLinData;
 
+        /*
+         * Thunk the request packet and lock userdata.
+         */
         if (!DevHelp_VirtToLin(SELECTOROF(pRp->ParmPacket), OFFSETOF(pRp->ParmPacket), &ulLinParm)
             &&
@@ -175,6 +201,9 @@
                                 (LIN)~0UL, SSToDS_16(&hLockData[0]), &cPages)
                 )
-            {   /* data and param is locked (do we need to lock the request packet too ?). */
-                /* create new 32-bit packet */
+            {
+                /*
+                 * -data and param is locked (do we need to lock the request packet too ?).-
+                 * Create new 32-bit init packet - Parameter pointer is thunked.
+                 */
                 RP32INIT rp32init;
 
@@ -191,5 +220,7 @@
                 ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc;
 
-                /* finished - unlock data and parm */
+                /*
+                 * finished - unlock data and parm
+                 */
                 DevHelp_VMUnLock((LIN)SSToDS_16(&hLockParm[0]));
                 DevHelp_VMUnLock((LIN)SSToDS_16(&hLockData[0]));
@@ -204,21 +235,4 @@
         usRc |= ERROR_I24_GEN_FAILURE;
 
-
-    #if 0
-    rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE | VMDHL_VERIFY,
-                        &DATA32START,
-                        (ULONG)(&end) - (ULONG)&DATA32START),
-                        (void*)-1,
-                        &lock[0],
-                        &cPages);
-
-    rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_VERIFY,
-                        &CODE32START,
-                        (ULONG)(&CODE32END) - (ULONG)&CODE32START),
-                        (void*)-1,
-                        &lock[0],
-                        &cPages);
-    #endif
-
     return usRc;
 }
@@ -235,6 +249,7 @@
  *            After R0Init16 is called TKSSBase16 _is_ set.
  *            IMPORTANT! This function must _not_ be called after the initiation of the second device driver!!!
- */
-USHORT NEAR initGetDosTableData(void)
+ *                       (Since this is init code not present after init...)
+ */
+USHORT NEAR  initGetDosTableData(void)
 {
     APIRET     rc;
@@ -244,4 +259,9 @@
     if (TKSSBase16 != 0)
         return NO_ERROR;
+    /*
+    _asm {
+        int 3;
+    }
+    */
 
     /* First we're to get the DosTable2 stuff. */
Index: trunk/src/win32k/dev16/d16strat.c
===================================================================
--- trunk/src/win32k/dev16/d16strat.c	(revision 4152)
+++ trunk/src/win32k/dev16/d16strat.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: d16strat.c,v 1.8 2000-02-25 18:15:02 bird Exp $
+/* $Id: d16strat.c,v 1.9 2000-09-02 21:07:56 bird Exp $
  *
  * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr)
@@ -15,4 +15,6 @@
 #define INCL_DOSERRORS
 #define INCL_NOPMAPI
+
+#define NO_WIN32K_LIB_FUNCTIONS
 
 /*******************************************************************************
@@ -28,4 +30,5 @@
 /* Note that C-library function are only allowed during init! */
 
+#include "devSegDf.h"
 #include "dev1632.h"
 #include "dev16.h"
@@ -119,5 +122,5 @@
  * @param     pRp  Request packet.
  */
-USHORT dev0GenIOCtl(PRP_GENIOCTL pRp)
+USHORT NEAR dev0GenIOCtl(PRP_GENIOCTL pRp)
 {
     USHORT rc;
@@ -135,5 +138,4 @@
                 {
                     rc = R0Init16(pRp);
-                    fInitTime = FALSE;
                     return rc;
                 }
@@ -218,5 +220,5 @@
  * @param     pRp  Request packet.
  */
-USHORT dev1GenIOCtl(PRP_GENIOCTL pRp)
+USHORT NEAR dev1GenIOCtl(PRP_GENIOCTL pRp)
 {
     if (pRp->Category == IOCTL_W32K_K32 || pRp->Category == IOCTL_W32K_ELF)
Index: trunk/src/win32k/dev16/probkrnl.c
===================================================================
--- trunk/src/win32k/dev16/probkrnl.c	(revision 4152)
+++ trunk/src/win32k/dev16/probkrnl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: probkrnl.c,v 1.20 2000-04-17 01:56:48 bird Exp $
+/* $Id: probkrnl.c,v 1.21 2000-09-02 21:07:56 bird Exp $
  *
  * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
@@ -14,11 +14,12 @@
  *                How this works:
  *                1. parses the device-line parameters and collects some "SysInfo".
- *                2. gets the kernel object table. (elf$)
- *                3. finds the kernel image and scans it for a build number.
- *                4. locates and scans the symbol-file(s) for the entrypoints which are wanted.
+ *                2. gets the kernel object table and kernel info like build no. (elf$)
+ *                3. if non-debug kernel the symbol database is scanned to get the syms
+ *                4. if Syms not found THEN locates and scans the symbol-file(s) for the
+ *                   entrypoints which are wanted.
  *                5. the entry points are verified. (elf$)
  *                6. finished.
  *
- * Copyright (c) 1998-2000 knut st. osmundsen
+ * Copyright (c) 1998-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -51,5 +52,4 @@
 #define INCL_NOPMAPI
 
-
 /*******************************************************************************
 *   Header Files                                                               *
@@ -61,4 +61,9 @@
 #include <reqpkt.h>
 
+#include "devSegDf.h"
+#undef  DATA16_INIT
+#define DATA16_INIT
+#undef  CODE16_INIT
+#define CODE16_INIT
 #include "os2krnl.h"                    /* must be included before dev1632.h! */
 #include "sym.h"
@@ -68,5 +73,6 @@
 #include "vprntf16.h"
 #include "log.h"
-
+#include "options.h"
+#include "errors.h"
 
 /*******************************************************************************
@@ -74,15 +80,14 @@
 *   Note: must be inited or else we'll get BSS segment                         *
 *******************************************************************************/
-/*
- * kernel data - !only valid during init!
- */
+
 
 /*
  * aImportTab defines the imported and overloaded OS/2 kernel functions.
- * IMPORTANT: aImportTab has a sibling array in d32init.c, aulProc, which must
- *            match entry by entry. Adding/removing/shuffling aImportTab, aulProc
- *            has to be updated immediately!
- */
-IMPORTKRNLSYM aImportTab[NBR_OF_KRNLIMPORTS] =
+ * IMPORTANT: aImportTab has two sibling arrays, one in d32init.c, aulProc, and
+ *            the calltab.asm, which must match entry by entry.
+ *            When adding/removing/shuffling items in aImportTab, aulProc and
+ *            calltab.asm has to be updated immediately!
+ */
+IMPORTKRNLSYM DATA16_GLOBAL aImportTab[NBR_OF_KRNLIMPORTS] =
 {/* iFound     cchName                  offObject    usSel     fType    */
  /*      iObject      achName                 ulAddress  cProlog        */
@@ -101,16 +106,37 @@
     {FALSE, -1, 11, "_VMGetOwner",          -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 12 */
     {FALSE, -1, 11, "g_tkExecPgm",          -1,  -1,  -1,  -1, EPT_PROC32},        /* 13 */
-    {FALSE, -1, 11, "f_FuStrLenZ",          -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 14 */
-    {FALSE, -1, 10, "f_FuStrLen",           -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 15 */
-    {FALSE, -1,  8, "f_FuBuff",             -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 16 */
-    {FALSE, -1, 16, "_VMObjHandleInfo",     -1,  -1,  -1,  -1, EPT_PROCIMPORT}     /* 17 */
-/*    {FALSE, -1, 11, "",          -1,  -1, -1, EPT_PROCIMPORT16} */ /* 16 */
+    {FALSE, -1, 15, "_tkStartProcess",      -1,  -1,  -1,  -1, EPT_PROC32},        /* 14 */
+    {FALSE, -1, 11, "f_FuStrLenZ",          -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 15 */
+    {FALSE, -1, 10, "f_FuStrLen",           -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 16 */
+    {FALSE, -1,  8, "f_FuBuff",             -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 17 */
+    {FALSE, -1, 16, "_VMObjHandleInfo",     -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 18 */
+    {FALSE, -1, 21, "_ldrASMpMTEFromHandle",-1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 19 */
+    {FALSE, -1, 12, "_ldrOpenPath",         -1,  -1,  -1,  -1, EPT_PROC32},        /* 20 */
+    {FALSE, -1, 12, "_LDRClearSem",         -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 21 */
+    {FALSE, -1, 14, "_ldrFindModule",       -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 22 */
+    {FALSE, -1, 17, "_KSEMRequestMutex",    -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 23 */
+    {FALSE, -1, 17, "_KSEMReleaseMutex",    -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 24 */
+    {FALSE, -1, 15, "_KSEMQueryMutex",      -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 25 */
+    {FALSE, -1,  9, "_KSEMInit",            -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 26 */
+    {FALSE, -1,  7, "_LdrSem",              -1,  -1,  -1,  -1, EPT_VARIMPORT32},   /* 27 */
+    {FALSE, -1, 11, "_LDRLibPath",          -1,  -1,  -1,  -1, EPT_VARIMPORT32},   /* 28 */
+    {FALSE, -1,  9, "_TKSuBuff",            -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 29 */
+    {FALSE, -1,  9, "_TKFuBuff",            -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 30 */
+    {FALSE, -1, 11, "_TKFuBufLen",          -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 31 */
+    {FALSE, -1, 21, "_ldrValidateMteHandle",-1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 32 */
+    {FALSE, -1,  8, "_pTCBCur",             -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 33 */
+    {FALSE, -1,  9, "_pPTDACur",            -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 34 */
+    {FALSE, -1, 10, "ptda_start",           -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 35 */
+    {FALSE, -1, 12, "ptda_environ",         -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 36 */
+    {FALSE, -1, 12, "ptda_ptdasem",         -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 37 */
+    {FALSE, -1, 11, "ptda_module",          -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 38 */
+    {FALSE, -1, 18, "ptda_pBeginLIBPATH",   -1,  -1,  -1,  -1, EPT_VARIMPORT16},   /* 39 */
+    {FALSE, -1, 16, "_ldrpFileNameBuf",     -1,  -1,  -1,  -1, EPT_VARIMPORT32},   /* 40 */
+    {FALSE, -1, 14, "SecPathFromSFN",       -1,  -1,  -1,  -1, EPT_PROCIMPORTNR32},/* 41 */
+
 };
 
-unsigned short int  usBuild          = 0;
-unsigned short      usVerMajor       = 0;
-unsigned short      usVerMinor       = 0;
-unsigned char       fchType          = TYPE_UNI;        /* TYPE_SMP, TYPE_UNI, TYPE_W4 */
-unsigned char       fDebug           = FALSE;
+char DATA16_GLOBAL  szUsrSym[50] = {0};
+
 
 
@@ -118,10 +144,9 @@
  * privat data
  */
-static int          fQuiet           = 0;
-static char         szUsrOS2Krnl[50] = {0};
-static char         szOS2Krnl[]      = {"c:\\os2krnl"};
-
-static char         szUsrSym[50]     = {0};
-static char *       apszSym[]        =
+#if defined(DEBUGR3)
+static char     DATA16_INIT szUsrOS2Krnl[50] = {0};
+static char     DATA16_INIT szOS2Krnl[]      = {"c:\\os2krnl"};
+#endif
+static char *   DATA16_INIT apszSym[]        =
 {
     {"c:\\os2krnl.sym"},                              /* usual for debugkernel */
@@ -144,7 +169,67 @@
 
 /* Result from GetKernelInfo/ReadOS2Krnl. */
-static unsigned char  cObjects = 0;
-static POTE           paKrnlOTEs = NULL;
-
+static unsigned char DATA16_INIT  cObjects = 0;
+static POTE          DATA16_INIT  paKrnlOTEs = NULL;
+
+
+/*
+ *
+ */
+static struct
+{
+    short       sErr;
+    const char *pszMsg;
+} DATA16_INIT aErrorMsgs[] =
+{
+    {ERROR_PROB_KRNL_OPEN_FAILED,       "Krnl: Failed to open kernel file."},
+    {ERROR_PROB_KRNL_SEEK_SIZE,         "Krnl: Failed to seek to end to of file."},
+    {ERROR_PROB_KRNL_SEEK_FIRST,        "Krnl: Failed to start of file."},
+    {ERROR_PROB_KRNL_READ_FIRST,        "Krnl: Failed to read (first)."},
+    {ERROR_PROB_KRNL_READ_NEXT,         "Krnl: Failed to read."},
+    {ERROR_PROB_KRNL_TAG_NOT_FOUND,     "Krnl: Build level tag was not found."},
+    {ERROR_PROB_KRNL_INV_SIGANTURE,     "Krnl: Invalid build level signature."},
+    {ERROR_PROB_KRNL_INV_BUILD_NBR,     "Krnl: Invalid build level number."},
+    {ERROR_PROB_KRNL_BUILD_VERSION,     "Krnl: Invalid build level version."},
+    {ERROR_PROB_KRNL_MZ_SEEK,           "Krnl: Failed to seek to start of file. (MZ)"},
+    {ERROR_PROB_KRNL_MZ_READ,           "Krnl: Failed to read MZ header."},
+    {ERROR_PROB_KRNL_NEOFF_INVALID,     "Krnl: Invalid new-header offset in MZ header."},
+    {ERROR_PROB_KRNL_NEOFF_SEEK,        "Krnl: Failed to seek to new-header offset."},
+    {ERROR_PROB_KRNL_LX_READ,           "Krnl: Failed to read LX header."},
+    {ERROR_PROB_KRNL_LX_SIGNATURE,      "Krnl: Invalid LX header signature."},
+    {ERROR_PROB_KRNL_OBJECT_CNT,        "Krnl: Object count don't match the running kernel."},
+    {ERROR_PROB_KRNL_OBJECT_CNR_10,     "Krnl: Less than 10 objects - not a valid kernel file!"},
+    {ERROR_PROB_KRNL_OTE_SEEK,          "Krnl: Failed to seek to OTEs."},
+    {ERROR_PROB_KRNL_OTE_READ,          "Krnl: Failed to read OTEs."},
+    {ERROR_PROB_KRNL_OTE_SIZE_MIS,      "Krnl: Size of a OTE didn't match the running kernel."},
+
+    /*
+     * ProbeSymFile error messages
+     */
+    {ERROR_PROB_SYM_FILE_NOT_FOUND,     "Sym: Symbol file was not found."},
+    {ERROR_PROB_SYM_READERROR,          "Sym: Read failed."},
+    {ERROR_PROB_SYM_INVALID_MOD_NAME,   "Sym: Invalid module name (not OS2KRNL)."},
+    {ERROR_PROB_SYM_SEGS_NE_OBJS,       "Sym: Number of segments don't match the object count of the kernel."},
+    {ERROR_PROB_SYM_SEG_DEF_SEEK,       "Sym: Failed to seek to a segment definition."},
+    {ERROR_PROB_SYM_SEG_DEF_READ,       "Sym: Failed to read a segment definition."},
+    {ERROR_PROB_SYM_IMPORTS_NOTFOUND,   "Sym: All the imports wasn't found."},
+    {ERROR_PROB_SYM_V_PROC_NOT_FND,     "Sym: Verify failed: Procedure not found."},
+    {ERROR_PROB_SYM_V_OBJ_OR_ADDR,      "Sym: Verify failed: Invalid object or address."},
+    {ERROR_PROB_SYM_V_ADDRESS,          "Sym: Verify failed: Invalid address."},
+    {ERROR_PROB_SYM_V_PROLOG,           "Sym: Verify failed: Invalid prolog."},
+    {ERROR_PROB_SYM_V_NOT_IMPL,         "Sym: Verify failed: Not implemented."},
+
+    {ERROR_PROB_SYMDB_KRNL_NOT_FOUND,   "SymDB: Kernel was not found."}
+};
+
+/*
+ * Fake data for Ring-3 testing.
+ */
+#ifdef R3TST
+USHORT DATA16_INIT usFakeVerMajor = 0;
+USHORT DATA16_INIT usFakeVerMinor = 0;
+#ifdef R3TST
+static DATA16_INIT ach[11] =  {0}; /* works around compiler/linker bug */
+#endif
+#endif
 
 
@@ -157,7 +242,6 @@
 static int      fseek(HFILE hfile, signed long off, int iOrg);
 static unsigned long fsize(HFILE hFile);
-static void     puts(char *psz);
-
-/* C-library replacements. */
+
+/* C-library replacements and additions. */
 static void     kmemcpy(char *psz1, const char *psz2, int cch);
 static char *   kstrstr(const char *psz1, const char *psz2);
@@ -169,7 +253,8 @@
 static int      kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen);
 
+static const char * GetErrorMsg(short sErr);
+
 /* Workers */
-static int      LookupKrnlEntry(unsigned uBuild, unsigned char chType,
-                                unsigned char fchType, unsigned char cObjects);
+static int      LookupKrnlEntry(unsigned short usBuild, unsigned short fKernel, unsigned char cObjects);
 static int      VerifyPrologs(void);
 static int      ProbeSymFile(const char *pszFilename);
@@ -177,6 +262,4 @@
 
 /* Ouput */
-static void     ShowDecNumber(unsigned long ul);
-static void     ShowHexNumber(unsigned long ul);
 static void     ShowResult(int rc, int iSym);
 
@@ -187,4 +270,12 @@
 static int      processFile(const char *pszFilename);
 
+#if 0 /*ndef CODE16_INIT*/
+#pragma alloc_text(CODE16_INIT, fopen, fread, fseek, fsize)
+#pragma alloc_text(CODE16_INIT, kmemcpy, kstrstr, kstrcmp, kstrncmp, kstrnicmp, kstrlen, kstrcpy, kargncpy)
+#pragma alloc_text(CODE16_INIT, GetErrorMsg)
+#pragma alloc_text(CODE16_INIT, LookupKrnlEntry, VerifyPrologs, ProbeSymFile, GetKernelInfo)
+#pragma alloc_text(CODE16_INIT, ShowResult)
+#pragma alloc_text(CODE16_INIT, VerifyKernelVer, ReadOS2Krnl, ReadOS2Krnl2, processFile)
+#endif
 
 
@@ -277,13 +368,4 @@
 
 /**
- * puts lookalike
- */
-static void puts(char * psz)
-{
-    DosPutMessage(0, kstrlen(psz), psz);
-}
-
-
-/**
  * kmemcpy - memory copy - slow!
  * @param     psz1  target
@@ -421,5 +503,5 @@
     while (*pszSource != '\0')
         *psz++ = *pszSource++;
-
+    *psz = '\0';
     return pszTarget;
 }
@@ -478,4 +560,23 @@
 
     return i;
+}
+
+
+/**
+ * Get the message text for an error message.
+ * @returns Pointer to error text. NULL if not found.
+ * @param   sErr  Error code id.
+ * @status  completely implemented.
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+static const char * GetErrorMsg(short sErr)
+{
+    int i;
+    for (i = 0; i < sizeof(aErrorMsgs) / sizeof(aErrorMsgs[0]); i++)
+    {
+        if (aErrorMsgs[i].sErr == sErr)
+            return aErrorMsgs[i].pszMsg;
+    }
+    return NULL;
 }
 
@@ -493,9 +594,6 @@
  *            1 if not found.
  *            Error code on error.
- * @param     uBuild        Build level.
- * @param     fchBldType    'A' all strict
- *                          'H' half strict
- *                          'R' retail
- * @param     fchType       TYPE_SMP, TYPE_UNI, TYPE_W4
+ * @param     usBuild       Build level.
+ * @param     fKernel       Kernel (type) flags. (KF_* from options.h)
  * @param     cObjects      Count of object in the running kernel.
  * @sketch    Loop thru the table.
@@ -503,5 +601,5 @@
  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  */
-static int LookupKrnlEntry(unsigned uBuild, unsigned char fchBldType, unsigned char fchType, unsigned char cObjects)
+static int LookupKrnlEntry(unsigned short usBuild, unsigned short fKernel, unsigned char cObjects)
 {
     int i;
@@ -512,8 +610,7 @@
     for (i = 0; aKrnlSymDB[i].usBuild != 0; i++)
     {
-        if (aKrnlSymDB[i].usBuild       == uBuild
-            && aKrnlSymDB[i].fchBldType == fchBldType
-            && aKrnlSymDB[i].fchType    == fchType
-            && aKrnlSymDB[i].cObjects   == cObjects)
+        if (   aKrnlSymDB[i].usBuild  == usBuild
+            && aKrnlSymDB[i].fKernel  == fKernel
+            && aKrnlSymDB[i].cObjects == cObjects)
         {   /* found matching entry! */
             int j;
@@ -533,5 +630,5 @@
                                            + pEntry->aSyms[j].offObject;
                 aImportTab[j].usSel      = paKrnlOTEs[pEntry->aSyms[j].iObject].ote_sel;
-                aImportTab[j].fFound     = TRUE;
+                aImportTab[j].fFound     = (char)((aImportTab[j].offObject != 0xFFFFFFFFUL) ? 1 : 0);
                 dprintf(("  %-3d addr=0x%08lx off=0x%08lx  %s\n",
                          j, aImportTab[j].ulAddress, aImportTab[j].offObject,
@@ -550,7 +647,8 @@
 
     /* not found */
-    return 1;
+    return ERROR_PROB_SYMDB_KRNL_NOT_FOUND;
 }
 #endif /* !EXTRACT */
+
 
 /**
@@ -574,4 +672,15 @@
         rc = DosDevIOCtl("", "", D16_IOCTL_VERIFYIMPORTTAB, D16_IOCTL_CAT, hDev0);
         DosClose(hDev0);
+        if (rc != NO_ERROR)
+        {
+            register APIRET rc2 = rc & STECODE;
+            if (rc2 >= ERROR_D32_VERIFYIMPORTTAB_FIRST && rc2 <= ERROR_D32_VERIFYIMPORTTAB_LAST)
+                rc = rc2 + ERROR_PROB_SYM_VERIFY_FIRST - ERROR_D32_VERIFYIMPORTTAB_FIRST;
+        }
+    }
+    else
+    {
+        dprintf(("DosOpen Failed with rc=%d\n", rc));
+        DosSleep(2000);
     }
 
@@ -616,5 +725,5 @@
     {
         dprintf(("Error opening file %s\n", pszFilename));
-        return -50;
+        return ERROR_PROB_SYM_FILE_NOT_FOUND;
     }
     dprintf(("\nSuccessfully opened symbolfile: %s\n", pszFilename));
@@ -629,5 +738,5 @@
     {   /* oops! read failed, close file and fail. */
         fclose(hSym);
-        return -51;
+        return ERROR_PROB_SYM_READERROR;
     }
     achBuffer[0] = MapDef.achModName[0];
@@ -646,5 +755,5 @@
         dprintf(("Modulename verify failed\n"));
         fclose(hSym);
-        return -51;
+        return ERROR_PROB_SYM_INVALID_MOD_NAME;
     }
 
@@ -658,5 +767,5 @@
         dprintf(("Segment No. verify failed\n"));
         fclose(hSym);
-        return -52;
+        return ERROR_PROB_SYM_SEGS_NE_OBJS;
     }
     #endif /* !EXTRACT */
@@ -701,5 +810,5 @@
         {   /* Failed to seek to the segment definition, fail! */
             fclose(hSym);
-            return -53;
+            return ERROR_PROB_SYM_SEG_DEF_SEEK;
         }
         rc = fread(&SegDef, sizeof(SEGDEF), 1, hSym);
@@ -707,5 +816,5 @@
         {   /* Failed to read the segment definition, fail! */
             fclose(hSym);
-            return -53;
+            return ERROR_PROB_SYM_SEG_DEF_READ;
         }
 
@@ -731,5 +840,7 @@
         for (iSym = 0; iSym < SegDef.cSymbols && cLeftToFind; iSym++)
         {
+            IMPORTKRNLSYM * pImport;
             unsigned cchName;
+
             /*
              * Fileoffset of the current symbol.
@@ -784,33 +895,32 @@
              * Search proctable.
              */
-            for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
+            for (i = 0, pImport = &aImportTab[0]; i < NBR_OF_KRNLIMPORTS; i++, pImport++)
             {
-                if (!aImportTab[i].fFound                                     /* Not allready found */
-                    && (aImportTab[i].fType & EPT_BIT_MASK) == fSegEPTBitType /* Equal bittype */
-                    && (fCode || (aImportTab[i].fType & EPT_VARIMPORT))       /* Don't look for code in a data segment and vice versa */
-                    && aImportTab[i].cchName == cchName                       /* Equal name length */
-                    && kstrncmp(aImportTab[i].achName, achBuffer, cchName) == 0  /* Equal name */
+                if (!pImport->fFound                                       /* Not allready found */
+                    && (pImport->fType & EPT_VARIMPORT ? !fCode : fCode)   /* Don't look for code in a data segment */
+                    && pImport->cchName == cchName                         /* Equal name length */
+                    && kstrncmp(pImport->achName, achBuffer, cchName) == 0 /* Equal name */
                     )
                 {   /* Symbol was found */
-                    aImportTab[i].offObject = (SegDef.bFlags & 0x01 ? SymDef32.wSymVal : SymDef16.wSymVal);
-                    aImportTab[i].ulAddress = aImportTab[i].offObject + paKrnlOTEs[iSeg].ote_base;
-                    aImportTab[i].iObject   = (unsigned char)iSeg;
-                    aImportTab[i].usSel     = paKrnlOTEs[iSeg].ote_sel;
+                    pImport->offObject = (SegDef.bFlags & 0x01 ? SymDef32.wSymVal : SymDef16.wSymVal);
+                    pImport->ulAddress = pImport->offObject + paKrnlOTEs[iSeg].ote_base;
+                    pImport->iObject   = (unsigned char)iSeg;
+                    pImport->usSel     = paKrnlOTEs[iSeg].ote_sel;
                     dprintf(("debug: base=%lx, size=%lx iSeg=%d\n", paKrnlOTEs[iSeg].ote_base, paKrnlOTEs[iSeg].ote_size, iSeg));
 
                     /* Paranoia test! */
                     #ifndef EXTRACT
-                    if (aImportTab[i].offObject < paKrnlOTEs[iSeg].ote_size)
+                    if (pImport->offObject < paKrnlOTEs[iSeg].ote_size)
                     {
-                        aImportTab[i].fFound = TRUE;
+                        pImport->fFound = TRUE;
                         cLeftToFind--;
                         dprintf(("Found: %s at off 0x%lx addr 0x%lx, sel=0x%x\n",
-                                 aImportTab[i].achName, aImportTab[i].offObject,
-                                 aImportTab[i].ulAddress, aImportTab[i].usSel));
+                                 pImport->achName, pImport->offObject,
+                                 pImport->ulAddress, pImport->usSel));
                     }
                     else/* test failed, continue on next symbol*/
-                        dprintf(("Error: Paranoia test failed for %s\n", aImportTab[i].achName));;
+                        dprintf(("Error: Paranoia test failed for %s\n", pImport->achName));;
                     #else
-                    aImportTab[i].fFound = TRUE;
+                    pImport->fFound = TRUE;
                     cLeftToFind--;
                     #endif /* !EXTRACT */
@@ -832,6 +942,7 @@
      * If not all procedures were found fail.
      */
-    if (cLeftToFind != 0)
-        return -57;
+    for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
+        if (!aImportTab[i].fFound && !(aImportTab[i].fType & EPT_NOT_REQ))
+            return ERROR_PROB_SYM_IMPORTS_NOTFOUND;
 
     /*
@@ -843,15 +954,20 @@
 
 /**
- * Gets the os/2 kernel OTE's (object table entries).
- * @returns   0 on success. Not 0 on error.
+ * Get kernelinformation (OTEs (object table entries), build, type, debug...)
+ * @returns 0 on success.
+ *              options.ulBuild, fchType, fDebug, cObjects and paKrnlOTEs is set on successful return.
+ *          Not 0 on error.
  */
 static int   GetKernelInfo(void)
 {
-#if !defined(DEBUGR3) && !defined(EXTRACT) /* IOCtl not available after inittime! */
-    static KRNLINFO KrnlInfo = {0};
+#if !defined(DEBUGR3) && !defined(EXTRACT) /* This IOCtl is not available after inittime! */
+    static KRNLINFO DATA16_INIT KrnlInfo = {0};
     APIRET          rc;
     HFILE           hDev0 = 0;
     USHORT          usAction = 0;
 
+    /*
+     * Issue an IOCtl to elf$ to query kernel information.
+     */
     rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL,
                  OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
@@ -863,14 +979,22 @@
         if (rc == NO_ERROR)
         {
-            int i;
-
-            /* Set the exported parameters */
-            usBuild  = KrnlInfo.usBuild;
-            fchType  = KrnlInfo.fchType;
-            fDebug   = KrnlInfo.fDebug;
-            cObjects = KrnlInfo.cObjects;
-            paKrnlOTEs = &KrnlInfo.aObjects[0];
             #ifdef DEBUG
-            for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
+            unsigned i;
+            #endif
+
+            /*
+             * Set the exported parameters
+             */
+            options.ulBuild = KrnlInfo.ulBuild;
+            options.fKernel = KrnlInfo.fKernel;
+            cObjects        = KrnlInfo.cObjects;
+            paKrnlOTEs      = &KrnlInfo.aObjects[0];
+
+            /*
+             * If debugging probkrnl dump kernel OTEs.
+             */
+            #ifdef DEBUG
+            dprintf(("debug: kernel OTE:\n"));
+            for (i = 0; i < cObjects; i++)
                 dprintf(("debug: no.%2d base=%lx size=%lx sel=%x\n",
                          i,
@@ -879,5 +1003,4 @@
                          paKrnlOTEs[i].ote_sel));
             #endif
-
         }
         DosClose(hDev0);
@@ -885,5 +1008,5 @@
 
     if (rc != NO_ERROR)
-        printf16("Failed to get kernel OTEs\r\n");
+        printf16("Failed to get kernel OTEs. rc=%d\n", rc);
 
     return rc;
@@ -899,7 +1022,7 @@
         {
             rc = ReadOS2Krnl(szUsrOS2Krnl);
-            if (rc != 0)
+            if (rc != NO_ERROR)
             {
-                puts("Warning: Invalid kernel file specified. Tries defaults.\n\r");
+                printf16("Warning: Invalid kernel file specified. Tries defaults.\n");
                 szUsrOS2Krnl[0] = '\0';
                 rc = ReadOS2Krnl(szOS2Krnl);
@@ -918,6 +1041,6 @@
 /**
  * Shows result of kernelprobing if not quiet or on error.
- * @param     rc          Return code.
- * @param     iSym        index of .sym-file into static struct.
+ * @param   rc      Return code.
+ * @param   iSym    index of .sym-file into static struct.
  */
 #ifndef EXTRACT
@@ -929,5 +1052,5 @@
      * Complain even if quiet on error
      */
-    if (!fQuiet || rc != 0)
+    if (!options.fQuiet || rc != NO_ERROR)
     {
         printf16("Win32k - Odin32 support driver.\n");
@@ -936,36 +1059,53 @@
          * kernel stuff
          */
-        if (rc <= -50 || rc == 0)
+        if (rc == NO_ERROR || rc > ERROR_PROB_KRNL_LAST)
         {
             #ifdef DEBUGR3
             printf16("    Found kernel:     %s\n", szOS2Krnl);
             #endif
-            printf16("    Build:            %d - v%d.%d\n",
-                     usBuild, usVerMajor, usVerMinor);
-        }
+            printf16("    Build:            %ld - v%d.%d\n",
+                     options.ulBuild, options.usVerMajor, options.usVerMinor);
+        }
+        else if (rc >= ERROR_PROB_KRNL_FIRST)
+            printf16("    Kernel probing failed with rc=%d.\n", rc);
         else
-            printf16("    Kernel probing failed with rc=%d.\n", rc);
+            printf16("    Failed before probing kernel.\n");
 
         /*
          * symbol-file
          */
-        if (rc == 0)
+        if (rc == NO_ERROR || (rc > ERROR_PROB_SYM_LAST && (szUsrSym[0] != '\0' || apszSym[iSym] != NULL)))
             printf16("    Found symbolfile: %s\n",
                      szUsrSym[0] == '\0' ? apszSym[iSym] : szUsrSym);
+        else if (rc >= ERROR_PROB_SYM_FIRST)
+            printf16("    Failed to find symbolfile!\n");
         else
-            printf16("    Failed to find symbolfile! rc=%d\n", rc);
+            printf16("    Failed before searching for symbolfile.\n");
 
         /*
          * function listing
          */
-        for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
-        {
-            printf16("  %-20s at ",aImportTab[i].achName);
-            if (aImportTab[i].fFound)
-                printf16("0x%08lx%s", aImportTab[i].ulAddress, (i % 2) == 0 ? "" : "\n");
-            else
-                printf16("failed!%s", (i % 2) == 0 ? "" : "\n");
-        }
-        if (i % 2) printf16("\n");
+        if (options.fLogging || rc != NO_ERROR)
+        {
+            for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
+            {
+                printf16("  %-21s at ", aImportTab[i].achName);
+                if (aImportTab[i].fFound)
+                    printf16("0x%08lx%s", aImportTab[i].ulAddress, (i % 2) == 0 ? "" : "\n");
+                else
+                    printf16("not found!%s", (i % 2) == 0 ? "" : "\n");
+            }
+            if (i % 2) printf16("\n");
+        }
+
+        /*
+         * Display error code.
+         */
+        if (rc != NO_ERROR)
+        {
+            const char *psz = GetErrorMsg(rc);
+            printf16("ProbeKernel failed with rc=%d.\n", rc);
+            if (psz) printf16("%s\n", psz);
+        }
     }
 }
@@ -1003,4 +1143,5 @@
                 switch (pReqPack->InitArgs[i])
                 {
+                    #if defined(DEBUGR3)
                     case 'k':
                     case 'K': /* Kernel file */
@@ -1008,12 +1149,14 @@
                         i += kargncpy(szUsrOS2Krnl, &pReqPack->InitArgs[i], sizeof(szUsrOS2Krnl));
                         break;
+                    #endif
 
                     case 'n':
                     case 'N': /* NoLoader */
+                        options.fNoLoader = TRUE;
                         return 0;
 
                     case 'q':
                     case 'Q': /* Quiet */
-                        fQuiet = 1;
+                        options.fQuiet = TRUE;
                         break;
 
@@ -1021,5 +1164,7 @@
                     case 'S': /* Symbol file */
                         i++;
-                        if (pReqPack->InitArgs[i] == 'Y' || pReqPack->InitArgs[i] == 'y')
+                        if (   pReqPack->InitArgs[i] != 'c' && pReqPack->InitArgs[i] != 'C'
+                            && pReqPack->InitArgs[i] != 'm' && pReqPack->InitArgs[i] != 'M'
+                            ) /* -script and -smp is ignored */
                             i += kargncpy(szUsrSym, &pReqPack->InitArgs[i], sizeof(szUsrSym));
                         break;
@@ -1027,5 +1172,5 @@
                     case 'v':
                     case 'V': /* Verbose */
-                        fQuiet = 0;
+                        options.fQuiet = FALSE;
                         break;
                 }
@@ -1044,11 +1189,23 @@
     pGIS = MAKEPGINFOSEG(selGIS);
     usBootDrive = pGIS->bootdrive;
-    usVerMajor  = pGIS->uchMajorVersion;
-    usVerMinor  = pGIS->uchMinorVersion;
+#ifndef R3TST
+    options.usVerMajor  = pGIS->uchMajorVersion;
+    options.usVerMinor  = pGIS->uchMinorVersion;
+#else
+    if (usFakeVerMajor == 0)
+    {
+        usFakeVerMajor = pGIS->uchMajorVersion;
+        usFakeVerMinor = pGIS->uchMinorVersion;
+    }
+    options.usVerMajor  = usFakeVerMajor;
+    options.usVerMinor  = usFakeVerMinor;
+#endif
     dprintf(("BootDrive: %d\n", usBootDrive));
 
     /* set driveletter in constants strings */
     usBootDrive = (char)usBootDrive + (char)'a' - 1;
+    #if defined(DEBUGR3)
     szOS2Krnl[0] = (char)usBootDrive;
+    #endif
     for (i = 0; apszSym[i] != NULL; i++)
         apszSym[i][0] = (char)usBootDrive;
@@ -1058,6 +1215,4 @@
     /*-----------------*/
     rc = GetKernelInfo();
-    if (rc != NO_ERROR)
-        return rc;
 
     /*--------------*/
@@ -1072,23 +1227,38 @@
             if (rc)
             {
-                puts("Warning: Invalid symbol file specified. Tries defaults.\n\r");
+                printf16("Warning: Invalid symbol file specified. Tries defaults.\n");
                 szUsrSym[0] = '\0';
             }
         }
-        if (rc != 0) /* if user sym failed or don't exists. */
+        if (rc != NO_ERROR) /* if user sym failed or don't exists. */
         {
             /*
              * Check database - only if not a debug kernel!
              * You usually have a .sym-file when using a debug kernel.
-             * (Currently I am not able to distinguish between half and all strict kernels...)
+             * (This is because I am unable to distinguish between half and
+             *  all strict kernels...)
              */
-            if (fDebug ||
-                (rc = LookupKrnlEntry((unsigned short)usBuild, 'R', fchType, cObjects)) != 0
+            if ((options.fKernel & KF_DEBUG) ||
+                (rc = LookupKrnlEntry((unsigned short)options.ulBuild,
+                                      (unsigned short)options.fKernel,
+                                      cObjects)
+                 ) != NO_ERROR
                 )
             {
+                #if 1 /* ndef R3TST */
+                APIRET rc2;
                 /* search on disk */
                 i = 0;
-                while (apszSym[i] != NULL && (rc = ProbeSymFile(apszSym[i])) != 0)
+                while (apszSym[i] != NULL
+                       && (rc2 = ProbeSymFile(apszSym[i])) != NO_ERROR
+                       )
+                {
                     i++;
+                    if (rc2 >= ERROR_PROB_SYM_VERIFY_FIRST)
+                        rc = rc2;
+                }
+                if (rc == 1 || rc2 == NO_ERROR)
+                    rc = rc2;
+                #endif
             }
         }
@@ -1099,4 +1269,8 @@
     ShowResult(rc, i);
 
+    /* Copy the symbol file name to szUsrSym. */
+    if (szUsrSym[0] == '\0' && apszSym[i] != NULL)
+        kstrcpy(szUsrSym, apszSym[i]);
+
     return rc;
 }
@@ -1113,9 +1287,9 @@
     int VerMinor, VerMajor;
 
-    VerMajor = usBuild < 20000 ? 20 : 30/*?*/;
-    VerMinor = usBuild <  6600 ? 10 :  usBuild <  8000 ? 11 : usBuild < 9000 ? 30 :
-               usBuild < 10000 ? 40 :  usBuild < 15000 ? 45 : 50;
-
-    return VerMajor - (int)usVerMajor | VerMinor - (int)usVerMinor;
+    VerMajor = options.ulBuild < 20000 ? 20 : 30/*?*/;
+    VerMinor = options.ulBuild <  6600 ? 10 :  options.ulBuild <  8000 ? 11 : options.ulBuild < 9000 ? 30 :
+               options.ulBuild < 10000 ? 40 :  options.ulBuild < 15000 ? 45 : 50;
+
+    return VerMajor - (int)options.usVerMajor | VerMinor - (int)options.usVerMinor;
 }
 
@@ -1123,7 +1297,8 @@
 /**
  * Reads and verifies OS/2 kernel.
- * @returns   0 on success, not 0 on failure.
- * @param     filename   Filename of the OS/2 kernel.
- * @result    usBuild is set.
+ * @returns   0 on success.
+ *            One of the ERROR_PROB_KRNL_* defines on error.
+ * @param     pszFilename   Filename of the OS/2 kernel.
+ * @result    options.ulBuild is set.
  * @remark    This step will be eliminated by searching thru the DOSGROUP datasegment
  *            in the kernel memory. This segment have a string "Internal revision 9.034[smp|uni]"
@@ -1140,9 +1315,17 @@
     if (hKrnl != 0)
     {
+        /*
+         * Get size of kernel file.
+         */
         cbKrnl = fsize(hKrnl);
         if (!fseek(hKrnl, 0, SEEK_SET))
+        {
+            /*
+             * Call worker with filehandle and size.
+             */
             rc = ReadOS2Krnl2(hKrnl, cbKrnl);
+        }
         else
-            rc = -2;
+            rc = ERROR_PROB_KRNL_SEEK_SIZE;
         fclose(hKrnl);
     }
@@ -1150,5 +1333,5 @@
     {
         dprintf(("Could not open file\n"));
-        rc = -1;
+        rc = ERROR_PROB_KRNL_OPEN_FAILED;
     }
     return rc;
@@ -1159,5 +1342,5 @@
  * Worker function for ReadOS2Krnl
  * @returns   0 on success.
- *            errorcodes on failure. (-1 >= rc >= -14)
+ *            One of the ERROR_PROB_KRNL_* defines on error.
  * @param     hKrnl   Handle to the kernel file.
  * @param     cbKrnl  Size of the kernel file.
@@ -1167,5 +1350,5 @@
 {
     #if defined(DEBUGR3) || !defined(EXTRACT)
-    static KRNLINFO KrnlInfo = {0};
+    static KRNLINFO DATA16_INIT KrnlInfo = {0};
     #endif
     int            i, j;
@@ -1176,10 +1359,13 @@
 
 
-    /* find bldlevel string - "@#IBM:14.020#@  IBM OS/2 Kernel - 14.020F" */
+    /*
+     * Find bldlevel string - for example: "@#IBM:14.020#@  IBM OS/2 Kernel - 14.020F"
+     * Searching the entire file lineary from the start.
+     */
     if (fseek(hKrnl, 0, SEEK_SET))
-        return -2;
+        return ERROR_PROB_KRNL_SEEK_FIRST;
 
     if (!fread(&achBuffer[KERNEL_ID_STRING_LENGTH], 1, KERNEL_READ_SIZE, hKrnl))
-        return -3;
+        return ERROR_PROB_KRNL_READ_FIRST;
 
     i = KERNEL_ID_STRING_LENGTH;
@@ -1191,5 +1377,5 @@
             kmemcpy(achBuffer, &achBuffer[KERNEL_READ_SIZE], KERNEL_ID_STRING_LENGTH);
             if (!fread(&achBuffer[KERNEL_ID_STRING_LENGTH], 1, cbKrnl > KERNEL_READ_SIZE ? KERNEL_READ_SIZE : (int)cbKrnl, hKrnl))
-                return -3;
+                return ERROR_PROB_KRNL_READ_NEXT;
 
             i = 0;
@@ -1204,9 +1390,15 @@
     }
 
+    /* found it? */
     if (cbKrnl == 0)
     {
         fclose(hKrnl);
-        return -4;
-    }
+        return ERROR_PROB_KRNL_TAG_NOT_FOUND;
+    }
+
+
+    /*
+     * We've found the @#IBM: tag. So now we'll try read it.
+     */
 
     /* displacement */
@@ -1217,19 +1409,21 @@
     /* verify signature */
     if (kstrncmp(&achBuffer[i+10+j], "#@  IBM OS/2 Kernel", 19) != 0)
-        return -5;
-
-    /* read usBuild */
-    usBuild  = (char)(achBuffer[i+6] - '0') * 1000;
+        return ERROR_PROB_KRNL_INV_SIGANTURE;
+
+    /*
+     * read options.ulBuild
+     */
+    options.ulBuild  = (char)(achBuffer[i+6] - '0') * 1000;
     if (achBuffer[i+7] != '.')
     {
         /* this code is for Warp5 */
-        usBuild *= 10;
-        usBuild += (char)(achBuffer[i+7] - '0') * 1000;
+        options.ulBuild *= 10;
+        options.ulBuild += (char)(achBuffer[i+7] - '0') * 1000;
         i++;
         j--;
         if (achBuffer[i+7] != '.')
         {
-            usBuild = usBuild * 10;
-            usBuild = usBuild + (unsigned short)(achBuffer[i+7] - '0') * 1000;
+            options.ulBuild *= 10;
+            options.ulBuild += (unsigned long)(achBuffer[i+7] - '0') * 1000;
             i++;
             j--;
@@ -1239,42 +1433,46 @@
     if (j == 0)
     {
-        usBuild += (achBuffer[i+ 8] - '0') * 10;
-        usBuild += (achBuffer[i+ 9] - '0') * 1;
+        options.ulBuild += (achBuffer[i+ 8] - '0') * 10;
+        options.ulBuild += (achBuffer[i+ 9] - '0') * 1;
     }
     else
     {
         if (j == 3)
-            return -9;
-        usBuild += (achBuffer[i+ 8] - '0') * 100;
-        usBuild += (achBuffer[i+ 9] - '0') * 10;
-        usBuild += (achBuffer[i+10] - '0');
-    }
-
+            return ERROR_PROB_KRNL_INV_BUILD_NBR;
+        options.ulBuild += (achBuffer[i+ 8] - '0') * 100;
+        options.ulBuild += (achBuffer[i+ 9] - '0') * 10;
+        options.ulBuild += (achBuffer[i+10] - '0');
+    }
+
+    /*
+     * We've read the build number. Let's check that it matches the OS/2
+     * version reported by DosGetInfoSeg.
+     */
     if (VerifyKernelVer())
-        return -9;
-    dprintf(("usBuild: %d\n", usBuild));
+        return ERROR_PROB_KRNL_BUILD_VERSION;
+    dprintf(("options.ulBuild: %d\n", options.ulBuild));
 
     /* get segment number */
     /* read-MZheader */
     if (fseek(hKrnl,0,SEEK_SET))
-        return -2;
+        return ERROR_PROB_KRNL_MZ_SEEK;
 
     if (!fread(achBuffer, 1, 0x40, hKrnl))
-        return -3;
+        return ERROR_PROB_KRNL_MZ_READ;
 
     offLXHdr = *(unsigned long int *)&achBuffer[0x3c];
 
     if (offLXHdr > 0x2000 && offLXHdr < 0x80) /* just to detect garbage */
-        return -6;
+        return ERROR_PROB_KRNL_NEOFF_INVALID;
 
     if (fseek(hKrnl, offLXHdr, SEEK_SET))
-        return -2;
+        return ERROR_PROB_KRNL_NEOFF_SEEK;
 
     if (!fread(achBuffer, 1, sizeof(struct e32_exe), hKrnl))
-        return -3;
+        return ERROR_PROB_KRNL_LX_READ;
 
     /* check LX-magic */
     if (achBuffer[0] != 'L' || achBuffer[1] != 'X')
-        return -7;
+        return ERROR_PROB_KRNL_LX_SIGNATURE;
 
 #if !defined(DEBUGR3) && !defined(EXTRACT)
@@ -1282,10 +1480,10 @@
     pLXHdr = (struct e32_exe *)achBuffer;
     if ((UCHAR)pLXHdr->e32_objcnt != cObjects)
-        return -8;
+        return ERROR_PROB_KRNL_OBJECT_CNT;
 
     if (pLXHdr->e32_objcnt < 10)
-        return -9;
-
-    /* check objects (sizes and flags(?)) */
+        return ERROR_PROB_KRNL_OBJECT_CNR_10;
+
+    /* check objects sizes. */
     if (!fseek(hKrnl, (LONG)offLXHdr + (LONG)pLXHdr->e32_objtab, SEEK_SET))
     {
@@ -1294,16 +1492,11 @@
         {
             if (!fread(achBuffer, 1, sizeof(OTE), hKrnl))
-                return -11;
+                return ERROR_PROB_KRNL_OTE_READ;
             if (pObj->o32_size < paKrnlOTEs[i].ote_size)
-                return -12;
-
-            #if 0 /* don't work! */
-            if ((pObj->o32_flags & 0xffffUL) != (paKrnlOTEs[i].ote_flags & 0xffffUL))
-                return -14;
-            #endif
+                return ERROR_PROB_KRNL_OTE_SIZE_MIS;
         }
     }
     else
-        return -10;
+        return ERROR_PROB_KRNL_OTE_SEEK;
 #else
     /* Since we can't get the OTEs from the kernel when debugging in RING-3,
@@ -1322,11 +1515,11 @@
         for (i = 0; i < (int)cObjects; i++)
             if (!fread(&paKrnlOTEs[i], 1, sizeof(struct o32_obj), hKrnl))
-                return -11;
+                return ERROR_PROB_KRNL_OTE_READ;
     }
     else
-        return -10;
+        return ERROR_PROB_KRNL_OTE_SEEK;
 #endif
 
-    return 0;
+    return NO_ERROR;
 }
 
@@ -1370,5 +1563,5 @@
  * Where: n - are the build number 4 or 5 digits.
  *        t - kernel type. R = retail, H = half strict, A = all strict.
- *        m - UNI or SMP.  U = UNI processor kernel. S = SMP processor kernel.
+ *        m - UNI or SMP.  U = UNI processor kernel. S = SMP processor kernel. 4 = Warp 4 FP13+
  * @returns   NO_ERROR on success. Untracable error code on error.
  * @param     pszFilename  Pointer to read only filename of the .sym-file.
@@ -1381,4 +1574,7 @@
     APIRET   rc;
     int      cch = kstrlen(pszFilename);
+
+    DosWrite(2, (char*)pszFilename, cch, &rc);
+    DosWrite(2, "\r\n", 2, &rc);
 
     /* Filename check */
@@ -1397,13 +1593,4 @@
     }
 
-    /** @remark
-     * All a/h-strict files are currently ignored.
-     * When a debug kernel is used we'll have to use the
-     * .sym-file for it. This is so because I can't distinguish
-     * between a all-strick and a half-strick kernel (yet).
-     */
-    if (pszFilename[cch-6] != 'R')
-        return 0;
-
     /*
      * Probe kernelfile
@@ -1419,12 +1606,31 @@
         int i;
 
+        /** @remark
+         * Currently information for retail kernels are usable, but we'll
+         * generate it for the debug kernels too, but this information
+         * is enclaved within an "#ifdef ALLKERNELS ... #endif".
+         */
+        if (pszFilename[cch-6] != 'R')
+            printf16("#ifdef ALLKERNELS\n");
+
         printf16("    { /* %s */\n"
-                 "        %.*s, \'%c\', %s, %d,\n"
+                 "        %.*s, ",
+                 pszFilename,
+                 cch - 6, &pszFilename[0]              /* build number */
+                 );
+
+        switch (pszFilename[cch - 5])
+        {
+            case 'S':   printf16("KF_SMP"); break;
+            case '4':   printf16("KF_UNI | KF_W4"); break;
+            case 'U':   printf16("KF_UNI"); break;
+        }
+        switch (pszFilename[cch - 6])
+        {
+            case 'A':   printf16(" | KF_ALLSTRICT"); break;
+            case 'H':   printf16(" | KF_HALFSTRICT"); break;
+        }
+        printf16(", %d,\n"
                  "        {\n",
-                 pszFilename,
-                 cch - 6, &pszFilename[0],              /* build number */
-                 pszFilename[cch - 6],                  /* Type, A=astrict, H=halfstrict, R=Retail */
-                 pszFilename[cch - 5] == 'S' ?          /* UNI: TYPE_UNI  SMP: TYPE_SMP  W4: TYPE_W4 */
-                    "TYPE_SMP" :  pszFilename[cch - 5] == '4' ? "TYPE_W4" : "TYPE_UNI",
                  aImportTab[0].iObject + 1); /* ASSUMES that DOSCODE32 is the last object. */
 
@@ -1432,7 +1638,7 @@
         {
             char *psz = aImportTab[i].achName;
-            printf16("            {%2d, 0x%08lx}, /* %s */\n",
+            printf16("            {%-2d, 0x%08lx}, /* %s */\n",
                      aImportTab[i].iObject,
-                     aImportTab[i].offObject,
+                     aImportTab[i].fFound ? aImportTab[i].offObject : 0xFFFFFFFFUL,
                      (char *)&aImportTab[i].achName[0]
                      );
@@ -1440,4 +1646,12 @@
         printf16("        }\n"
                  "    },\n");
+
+        /** @remark
+         * Currently information for retail kernels are usable, but we'll
+         * generate it for the debug kernels too, but this information
+         * is enclaved within an "#ifdef ALLKERNELS ... #endif".
+         */
+        if (pszFilename[cch-6] != 'R')
+            printf16("#endif\n");
     }
     else
@@ -1460,10 +1674,10 @@
 {
     APIRET  rc;
-
+    const char *  psz;
 
     /*
      * Set paKrnlOTEs to point to an zeroed array of OTEs.
      */
-    static KRNLINFO KrnlInfo = {0};
+    static KRNLINFO DATA16_INIT  KrnlInfo = {0};
     paKrnlOTEs = &KrnlInfo.aObjects[0];
 
@@ -1474,5 +1688,5 @@
          */
         int i;
-        for (i = 0; i < argc; i++)
+        for (i = 1; i < argc; i++)
         {
             rc = processFile(argv[i]);
@@ -1480,5 +1694,7 @@
             {
                 printf16("processFile failed with rc=%d for file %s\n",
-                          rc, argv[i]);
+                         rc, argv[i]);
+                if (psz = GetErrorMsg(rc))
+                    printf16("%s\n", psz);
                 return rc;
             }
@@ -1498,5 +1714,5 @@
         int         i;
 
-        printf16("/* $Id: probkrnl.c,v 1.20 2000-04-17 01:56:48 bird Exp $\n"
+        printf16("/* $Id: probkrnl.c,v 1.21 2000-09-02 21:07:56 bird Exp $\n"
                  "*\n"
                  "* Autogenerated kernel symbol database.\n"
@@ -1512,8 +1728,10 @@
                  "#define INCL_NOBASEAPI\n"
                  "#include <os2.h>\n"
+                 "#include \"DevSegDf.h\"\n"
                  "#include \"probkrnl.h\"\n"
+                 "#include \"options.h\"\n"
                  "\n");
 
-        printf16("KRNLDBENTRY aKrnlSymDB[] = \n"
+        printf16("KRNLDBENTRY DATA16_INIT aKrnlSymDB[] = \n"
                  "{\n");
 
@@ -1528,4 +1746,6 @@
                 printf16("processFile failed with rc=%d for file %s\n",
                          rc, &ffb.achName[0]);
+                if (psz = GetErrorMsg(rc))
+                    printf16("%s\n", psz);
                 return rc;
             }
@@ -1537,5 +1757,5 @@
 
         printf16("    { /* Terminating entry */\n"
-                 "        0,0,0,0,\n"
+                 "        0,0,0,\n"
                  "        {\n");
         for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
Index: trunk/src/win32k/dev16/vprntf16.c
===================================================================
--- trunk/src/win32k/dev16/vprntf16.c	(revision 4152)
+++ trunk/src/win32k/dev16/vprntf16.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: vprntf16.c,v 1.2 2000-02-26 17:49:28 bird Exp $
+/* $Id: vprntf16.c,v 1.3 2000-09-02 21:07:56 bird Exp $
  *
  * vprintf and printf - 16-bit.
@@ -36,4 +36,6 @@
 #include <os2.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+#include "dev16.h"
 #include "vprntf16.h"
 #ifdef RING0
@@ -41,11 +43,11 @@
 #include "conio.h"
 #endif
-#include "dev16.h"
 
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
+static char chReturn  = '\r';
 static char chNewLine = '\n';
-static char chReturn  = '\r';
+static char chReturnWithNewLine[2] = "\r\n";
 
 /*******************************************************************************
@@ -217,5 +219,5 @@
  * @param     args        Argument list.
  */
-int vprintf16(const char *pszFormat, va_list args)
+int FAR vprintf16(const char *pszFormat, va_list args)
 {
     int cch = 0;
@@ -327,5 +329,5 @@
                         char *pszStr = va_arg(args, char*);
 
-                        if (pszStr < (char*)0x10000)
+                        if (pszStr == NULL)
                             pszStr = "<NULL>";
                         cchStr = _strnlen(pszStr, (unsigned)cchPrecision);
@@ -391,5 +393,5 @@
  * @param     ...        Optional parameters.
  */
-int printf16(const char *pszFormat, ...)
+int FAR printf16(const char *pszFormat, ...)
 {
     int     cch;
@@ -413,15 +415,11 @@
 static void choutconsole(int ch)
 {
-    USHORT usWrote;
-
     if (ch != '\r')
     {
+        USHORT  usWrote;                /* Bytes written (ignored). */
         if (ch == '\n')
-        {
-            usWrote = 1;
-            DosWrite(1, (PVOID)&chReturn, 1, &usWrote);
-        }
-        usWrote = 1;
-        DosWrite(1, (PVOID)&ch, 1, &usWrote);
+            DosWrite(1, (PVOID)&chReturnWithNewLine, 2, &usWrote);
+        else
+            DosWrite(1, (PVOID)&ch, 1, &usWrote);
     }
 }
@@ -438,29 +436,28 @@
  *            At runtime the text is only sendt to com-port.
  */
-static char *stroutconsole(char *psz, signed cchMax)
-{
+static char *stroutconsole(register char *psz, signed cchMax)
+{
+    register CHAR   ch;
+
     while (cchMax > 0 && *psz != '\0')
     {
-        USHORT cch = 0;
-        USHORT us;
-
-        while (cchMax - cch > 0 && psz[cch] != '\0' && psz[cch] != '\r' && psz[cch] != '\n')
+        register signed cch = 0;
+        USHORT          us;             /* Bytes written (ignored). */
+
+        while (cchMax > cch && (ch = psz[cch]) != '\0' && ch != '\r' && ch != '\n')
             cch++;
 
         /* write string part */
-        us = cch;
         DosWrite(1, (PVOID)psz, cch, &us);
 
-        /* cr and lf check + skip */
-        if (psz[cch] == '\n' || psz[cch] == '\r')
-        {
-            if (psz[cch] == '\n')
-            {
-                DosWrite(1, (PVOID)&chReturn, 1, &us);
-                DosWrite(1, (PVOID)&chNewLine, 1, &us);
-            }
-
-            while (cchMax - cch > 0 && (psz[cch] == '\r' || psz[cch] == '\n'))
-                cch++;
+        /* cr and lf: expand lf to cr+lf and ignore cr. */
+        while (cchMax > cch)
+        {
+            if ((ch = psz[cch]) == '\n')
+                DosWrite(1, (PVOID)&chReturnWithNewLine, 2, &us);
+            else
+                if (ch != '\r')
+                    break;
+            cch++;
         }
 
@@ -481,5 +478,5 @@
 static void chout(int ch)
 {
-    #ifdef RING0
+    #if defined(RING0) && !defined(R3TST)
         if (fInitTime)
             choutconsole(ch);
@@ -514,5 +511,5 @@
 static char *strout(char *psz, signed cchMax)
 {
-    #ifdef RING0
+    #if defined(RING0) && !defined(R3TST)
         int cchYield = 0;
 
@@ -539,5 +536,5 @@
 
             /* cr and lf check + skip */
-            if (psz[cch] == '\n' || psz[cch] == '\r')
+            if (cch < cchMax && (psz[cch] == '\n' || psz[cch] == '\r'))
             {
                 if (psz[cch] == '\n')
Index: trunk/src/win32k/dev32/d32ElfIOCtl.c
===================================================================
--- trunk/src/win32k/dev32/d32ElfIOCtl.c	(revision 4152)
+++ trunk/src/win32k/dev32/d32ElfIOCtl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: d32ElfIOCtl.c,v 1.1 2000-02-15 23:39:18 bird Exp $
+/* $Id: d32ElfIOCtl.c,v 1.2 2000-09-02 21:07:57 bird Exp $
  *
  * Elf driver IOCtl handler function.
@@ -20,4 +20,5 @@
 #include <os2.h>
 
+#include "devSegDf.h"
 #include "dev1632.h"
 #include "dev32.h"
Index: trunk/src/win32k/dev32/d32Win32kIOCtl.c
===================================================================
--- trunk/src/win32k/dev32/d32Win32kIOCtl.c	(revision 4152)
+++ trunk/src/win32k/dev32/d32Win32kIOCtl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: d32Win32kIOCtl.c,v 1.1 2000-02-15 23:39:19 bird Exp $
+/* $Id: d32Win32kIOCtl.c,v 1.2 2000-09-02 21:07:57 bird Exp $
  *
  * Win32k driver IOCtl handler function.
@@ -14,4 +14,6 @@
 #define INCL_NOPMAPI
 
+#define NO_WIN32K_LIB_FUNCTIONS
+
 
 /*******************************************************************************
@@ -20,6 +22,8 @@
 #include <os2.h>
 
+#include "devSegDf.h"
 #include "dev1632.h"
 #include "dev32.h"
+#include "OS2Krnl.h"
 #include "Win32k.h"
 #include "k32.h"
@@ -49,4 +53,32 @@
                     return STATUS_DONE;
                 }
+
+                case K32_QUERYOTES:
+                {
+                    PK32QUERYOTES pParm = (PK32QUERYOTES)pRpIOCtl->ParmPacket;
+                    if (pParm == NULL)
+                        return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
+                    pParm->rc = k32QueryOTEs((HMTE)pParm->hMTE, pParm->pQOte, pParm->cbQOte);
+                    return STATUS_DONE;
+                }
+
+                case K32_QUERYOPTIONSSTATUS:
+                {
+                    PK32QUERYOPTIONSSTATUS pParm = (PK32QUERYOPTIONSSTATUS)pRpIOCtl->ParmPacket;
+                    if (pParm == NULL)
+                        return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
+                    pParm->rc = k32QueryOptionsStatus(pParm->pOptions, pParm->pStatus);
+                    return STATUS_DONE;
+                }
+
+                case K32_SETOPTIONS:
+                {
+                    PK32SETOPTIONS pParm = (PK32SETOPTIONS)pRpIOCtl->ParmPacket;
+                    if (pParm == NULL)
+                        return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
+                    pParm->rc = k32SetOptions(pParm->pOptions);
+                    return STATUS_DONE;
+                }
+
             }
             break;
Index: trunk/src/win32k/dev32/d32hlp.asm
===================================================================
--- trunk/src/win32k/dev32/d32hlp.asm	(revision 4152)
+++ trunk/src/win32k/dev32/d32hlp.asm	(revision 4164)
@@ -1,3 +1,3 @@
-; $Id: d32hlp.asm,v 1.3 1999-10-31 23:57:02 bird Exp $
+; $Id: d32hlp.asm,v 1.4 2000-09-02 21:07:57 bird Exp $
 ;
 ; d32hlp - 32-bit Device Driver Helper Function.
@@ -34,12 +34,13 @@
 ; extrns
 ;
-extrn _Device_Help:dword
+    extrn _Device_Help:dword
 
 ;CODE32 segment
-CODE32 segment dword public 'CODE' use32
+CODE32 segment
     assume cs:CODE32, ds:flat, ss:nothing, es:nothing
     .386p
 
 ;PVOID  D32HLPCALL D32Hlp_VirtToLin(ULONG  ulPtr16); /* eax */
+; Sideeffect: edx holds the error code on error.
 D32Hlp_VirtToLin proc near
     push    esi
@@ -51,4 +52,5 @@
 Thunk32_VirtToLin::
     jnc     Finished
+    mov     edx, eax
     xor     eax, eax
 
@@ -61,4 +63,5 @@
 ;PVOID  D32HLPCALL D32Hlp_VirtToLin2(USHORT usSelector, /*  ax */
 ;                                    ULONG  ulOffset);  /* edx */
+; Sideeffect: edx holds the error code on error.
 D32Hlp_VirtToLin2 proc near
     push    esi
@@ -69,4 +72,5 @@
 Thunk32_VirtToLin2::
     jnc     Finished
+    mov     edx, eax
     xor     eax, eax
 
@@ -106,5 +110,5 @@
 Thunk32_GetDOSVar::
     jc  Error
-    shl     ebx, 16
+    shl     eax, 16
     mov     bx, ax
     xchg    eax, ebx
@@ -277,5 +281,5 @@
 
 ;CODE16 segment
-CODE16 segment word public 'CODE' use16
+CODE16 segment
     assume cs:CODE16, ds:FLAT
 
Index: trunk/src/win32k/dev32/d32init.c
===================================================================
--- trunk/src/win32k/dev32/d32init.c	(revision 4152)
+++ trunk/src/win32k/dev32/d32init.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: d32init.c,v 1.19 2000-05-03 10:46:06 bird Exp $
+/* $Id: d32init.c,v 1.20 2000-09-02 21:07:57 bird Exp $
  *
  * d32init.c - 32-bits init routines.
@@ -14,5 +14,4 @@
 #define MAXSIZE_PROLOG 0x18             /* Note that this must be synced with */
                                         /* the one used in calltab.asm.       */
-#define static                          /* just to make all symbols visible in the kernel debugger.  */
 #if  0                                  /* Enable this to have extra debug logging. */
     #define kprintf2(a) kprintf
@@ -24,4 +23,5 @@
 #define INCL_NOPMAPI
 #define LDR_INCL_INITONLY
+#define INCL_OS2KRNL_ALL
 
 /*******************************************************************************
@@ -32,4 +32,5 @@
 #include <string.h>
 
+#include "devSegDf.h"
 #include "OS2Krnl.h"
 #include "options.h"
@@ -44,4 +45,9 @@
 #include "ldrCalls.h"
 #include "macros.h"
+#include "errors.h"
+
+#ifdef R3TST
+    #include "test.h"
+#endif
 
 
@@ -53,7 +59,7 @@
 static char * apszInfoLevel[] = {"INFOLEVEL_QUIET", "INFOLEVEL_ERROR", "INFOLEVEL_WARNING", "INFOLEVEL_INFO", "INFOLEVEL_INFOALL", "!invalid!"};
 #endif
-static PMTE    pKrnlMTE = NULL;
-static PSMTE   pKrnlSMTE = NULL;
-static POTE    pKrnlOTE = NULL;
+PMTE    pKrnlMTE = NULL;
+PSMTE   pKrnlSMTE = NULL;
+POTE    pKrnlOTE = NULL;
 
 
@@ -61,9 +67,16 @@
 *   Internal Functions                                                         *
 *******************************************************************************/
-static ULONG        readnum(const char *pszNum);
-_Inline int         ModR_M_32bit(char bModRM);
-static int          interpretFunctionProlog32(char *pach, BOOL fOverload);
-static int          interpretFunctionProlog16(char *pach, BOOL fOverload);
-static int          ImportTabInit(void);
+ ULONG          readnum(const char *pszNum);
+_Inline int     ModR_M_32bit(char bModRM);
+_Inline int     ModR_M_16bit(char bModRM);
+int             interpretFunctionProlog32(char *pach, BOOL fOverload);
+int             interpretFunctionProlog16(char *pach, BOOL fOverload);
+int             importTabInit(void);
+#ifdef R3TST
+PMTE            GetOS2KrnlMTETst(void);
+void            R3TstFixImportTab(void);
+#endif
+PSZ SECCALL     nopSecPathFromSFN(SFN hFile);
+
 
 
@@ -78,7 +91,7 @@
 /* extern(s) located in mytkExecPgm.asm  */
 extern char     mytkExecPgm;
-
-
-#ifndef DEBUGR3
+extern char     mytkStartProcess;
+
+
 /**
  * Ring-0, 32-bit, init function.
@@ -118,15 +131,11 @@
         {
             case 'c':
-            case 'C': /* -C[1|2] - com-port no, def:-C2 */
-                switch (pszTmp[1])
-                {
-                    case '1':
-                        options.usCom = OUTPUT_COM1;
-                        break;
-
-                    case '2':
-                    default:
-                        options.usCom = OUTPUT_COM2;
-                }
+            case 'C': /* -C[1|2] or -Com:[1|2]  -  com-port no, def:-C2 */
+                pszTmp2 = strpbrk(pszTmp, ":=/- ");
+                if (pszTmp2 != NULL && (*pszTmp2 == ':' || *pszTmp2 == '='))
+                    pszTmp2++;
+                else
+                    pszTmp2 = pszTmp + 1;
+                options.usCom = (USHORT)(*pszTmp2 == '1' ? OUTPUT_COM1 : OUTPUT_COM2);
                 break;
 
@@ -134,5 +143,5 @@
             case 'E':/* ELF */
                 pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
+                if (pszTmp2 != NULL
                     && (pszTmp2[1] == 'N' ||pszTmp2[1] == 'n' || pszTmp2[1] == 'D' || pszTmp2[1] == 'd')
                     )
@@ -145,6 +154,5 @@
             case 'H': /* Heap options */
                 pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
-                    && (*pszTmp2 == ':' || *pszTmp2 == '='))
+                if (pszTmp2 != NULL && (*pszTmp2 == ':' || *pszTmp2 == '='))
                 {
                     ul = readnum(pszTmp2 + 1);
@@ -159,13 +167,23 @@
                 break;
 
+            case 'j':
+            case 'J': /* -Java:<Yes|No> */
+                pszTmp2 = strpbrk(pszTmp, ":=/- ");
+                options.fJava =
+                    pszTmp2 != NULL
+                    && (int)(pszTmp2-pszTmp) < cch-1
+                    && (*pszTmp2 == ':' || *pszTmp2 == '=')
+                    && (pszTmp2[1] == 'Y' || pszTmp2[1] == 'y');
+                break;
+
             case 'l':
             case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */
                 pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
-                    && (pszTmp2[1] == 'N' ||pszTmp2[1] == 'n' || pszTmp2[1] == 'D' || pszTmp2[1] == 'd')
+                if (pszTmp2 != NULL
+                    && (pszTmp2[1] == 'Y' ||pszTmp2[1] == 'y' || pszTmp2[1] == 'E' || pszTmp2[1] == 'e')
                     )
+                    options.fLogging = TRUE;
+                else
                     options.fLogging = FALSE;
-                else
-                    options.fLogging = TRUE;
                 break;
 
@@ -178,15 +196,14 @@
             case 'P': /* PE */
                 pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
-                    && (*pszTmp2 == ':' || *pszTmp2 == '='))
+                if (pszTmp2 != NULL && (*pszTmp2 == ':' || *pszTmp2 == '='))
                 {
-                    pszTmp++;
-                    if (strnicmp(pszTmp, "pe2lx", 5) == 0)
+                    pszTmp2++;
+                    if (strnicmp(pszTmp2, "pe2lx", 5) == 0)
                         options.fPE = FLAGS_PE_PE2LX;
-                    else if (strnicmp(pszTmp, "pe", 2) == 0)
+                    else if (strnicmp(pszTmp2, "pe", 2) == 0)
                         options.fPE = FLAGS_PE_PE;
-                    else if (strnicmp(pszTmp, "mixed", 2) == 0)
+                    else if (strnicmp(pszTmp2, "mixed", 2) == 0)
                         options.fPE = FLAGS_PE_MIXED;
-                    else if (strnicmp(pszTmp, "not", 2) == 0)
+                    else if (strnicmp(pszTmp2, "not", 2) == 0)
                         options.fPE = FLAGS_PE_NOT;
                     else
@@ -203,16 +220,27 @@
 
             case 'r':
-            case 'R': /* ResHeap options */
+            case 'R': /* ResHeap options or REXX option */
                 pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
-                    && (*pszTmp2 == ':' || *pszTmp2 == '='))
-                {
-                    ul = readnum(pszTmp2 + 1);
-                    if (ul > 0x1000UL && ul < 0x700000UL) /* 4KB < ul < 7MB */
+                if (   (pszTmp[1] == 'E' || pszTmp[1] == 'e')
+                    && (pszTmp[2] == 'X' || pszTmp[2] == 'x'))
+                {   /* REXX */
+                    options.fREXXScript =
+                        pszTmp2 != NULL
+                        && (int)(pszTmp2-pszTmp) < cch-1
+                        && (*pszTmp2 == ':' || *pszTmp2 == '=')
+                        && (pszTmp2[1] == 'Y' || pszTmp2[1] == 'y');
+                }
+                else
+                {   /* ResHeap options */
+                    if (pszTmp2 != NULL && (*pszTmp2 == ':' || *pszTmp2 == '='))
                     {
-                        if (strnicmp(pszTmp, "resheapm", 8) == 0)
-                            options.cbResHeapMax = ul;
-                        else
-                            options.cbResHeapInit = ul;
+                        ul = readnum(pszTmp2 + 1);
+                        if (ul > 0x1000UL && ul < 0x700000UL) /* 4KB < ul < 7MB */
+                        {
+                            if (strnicmp(pszTmp, "resheapm", 8) == 0)
+                                options.cbResHeapMax = ul;
+                            else
+                                options.cbResHeapInit = ul;
+                        }
                     }
                 }
@@ -222,21 +250,13 @@
             case 'S': /* Sym:<filename> or Script:<Yes|No> or Smp */
                 /* SMP kernel */
-                if (pszTmp[1] == 'm' || pszTmp[1] == 'M')
-                    options.fKernel = KF_SMP;
-                else
+                pszTmp2 = strpbrk(pszTmp, ":=/- ");
+                if (pszTmp[1] == 'c' || pszTmp[1] == 'C')
                 {
-                    if (pszTmp[1] == 'c' || pszTmp[1] == 'C')
-                    {
-                        pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                        options.fScript = pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
-                            && (*pszTmp2 == ':' || *pszTmp2 == '=')
-                            && (pszTmp2[1] == 'Y' || pszTmp2[1] == 'y');
-                    }
-                }
-                break;
-
-            case 'u':
-            case 'U': /* UNI kernel */
-                options.fKernel = KF_UNI;
+                    options.fUNIXScript =
+                        pszTmp2 != NULL
+                        && (int)(pszTmp2-pszTmp) < cch-1
+                        && (*pszTmp2 == ':' || *pszTmp2 == '=')
+                        && (pszTmp2[1] == 'Y' || pszTmp2[1] == 'y');
+                }
                 break;
 
@@ -247,5 +267,5 @@
 
             case 'w':
-            case 'W':
+            case 'W': /* ModuleBase info level; -W<n> or -Warning:<n> */
                 if (pszTmp[1] >= '0' && pszTmp[1] <= '4')
                     options.ulInfoLevel = pszTmp[1] - '0';
@@ -253,9 +273,11 @@
                 {
                     pszTmp2 = strpbrk(pszTmp, ":=/- ");
-                    if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
-                        && (*pszTmp2 == ':' || *pszTmp2 == '=')
-                        && pszTmp2[1] >= '0' && pszTmp2[1] <= '4'
-                        )
-                        options.ulInfoLevel = pszTmp2[1] - '0';
+                    if (pszTmp2 != NULL && (*pszTmp2 == ':' || *pszTmp2 == '='))
+                        pszTmp2++;
+                    else
+                        pszTmp2 = pszTmp + 1;
+
+                    if (*pszTmp2 >= '0' && *pszTmp2 <= '4')
+                        options.ulInfoLevel = *pszTmp2 - '0';
                 }
                 break;
@@ -270,9 +292,4 @@
     if (options.cbResHeapInit > options.cbResHeapMax)
         options.cbResHeapMax = options.cbResHeapInit;
-
-    /* Transfer version and build number from 16-bit probkrnl.c */
-    options.ulBuild    = _usBuild;
-    options.usVerMajor = _usVerMajor;
-    options.usVerMinor = _usVerMinor;
 
     /* Log option summary */
@@ -288,21 +305,32 @@
     else
         kprintf(("\tlogging disabled\n"));
-    kprintf(("\tCom port no.%d\n", options.usCom));
-
-    kprintf(("\tKernel: ver%d.%d  build %d  type %s\n",
+    kprintf(("\tCom port no.%03xh\n", options.usCom));
+
+    kprintf(("\tKernel: v%d.%d  build %d  type ",
                 options.usVerMajor,
                 options.usVerMinor,
-                options.ulBuild,
-                (options.fKernel & KF_SMP) ? "SMP" : "UNI"
-              ));
-    kprintf(("\tfPE=%d (%s)\n", options.fPE, apszPE[MIN(options.fPE, 5)]));
+                options.ulBuild));
+    if (options.fKernel & KF_SMP)
+        kprintf(("SMP "));
+    else if (options.fKernel & KF_W4)
+        kprintf(("W4 "));
+    else
+        kprintf(("UNI "));
+    if (options.fKernel & KF_DEBUG)
+        kprintf(("DEBUG\n"));
+    else
+        kprintf(("\n"));
+
+    kprintf(("\tfPE=%d (%s)\n",     options.fPE, apszPE[MIN(options.fPE, 5)]));
     kprintf(("\tulInfoLevel=%d (%s)\n", options.ulInfoLevel, apszInfoLevel[MIN(options.ulInfoLevel, 5)]));
-    kprintf(("\tfElf=%d\n", options.fElf));
-    kprintf(("\tfScript=%d\n", options.fScript));
-    kprintf(("\tfNoLoader=%d\n", options.fNoLoader));
+    kprintf(("\tfElf=%d\n",         options.fElf));
+    kprintf(("\tfUNIXScript=%d\n",  options.fUNIXScript));
+    kprintf(("\tfREXXScript=%d\n",  options.fREXXScript));
+    kprintf(("\tfJAVA=%d\n",        options.fJava));
+    kprintf(("\tfNoLoader=%d\n",    options.fNoLoader));
     kprintf(("\tcbSwpHeapInit=0x%08x  cbSwpHeapMax=0x%08x\n",
              options.cbSwpHeapInit, options.cbSwpHeapMax));
     kprintf(("\tcbResHeapInit=0x%08x  cbResHeapMax=0x%08x\n",
-             options.cbSwpHeapInit, options.cbSwpHeapMax));
+             options.cbResHeapInit, options.cbResHeapMax));
     kprintf(("Options - Summary - End\n"));
     #endif /* debug */
@@ -325,5 +353,5 @@
     /* functionoverrides */
     if (!options.fNoLoader)
-        if (ImportTabInit() != NO_ERROR)
+        if (importTabInit() != NO_ERROR)
             return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
 
@@ -369,5 +397,5 @@
  * @author    knut st. osmundsen
  */
-static ULONG    readnum(const char *pszNum)
+ULONG    readnum(const char *pszNum)
 {
     ULONG ulRet = 0;
@@ -428,5 +456,9 @@
 
     /* Find the kernel OTE table */
+#ifndef R3TST
     pKrnlMTE = GetOS2KrnlMTE();
+#else
+    pKrnlMTE = GetOS2KrnlMTETst();
+#endif
     if (pKrnlMTE != NULL)
     {
@@ -461,16 +493,16 @@
                      * Search for internal revision stuff in the two first objects.
                      */
-                    pKrnlInfo->usBuild = 0;
-                    for (i = 0; i < 2 && pKrnlInfo->usBuild == 0; i++)
+                    pKrnlInfo->ulBuild = 0;
+                    for (i = 0; i < 2 && pKrnlInfo->ulBuild == 0; i++)
                     {
                         const char *psz = (const char*)pKrnlOTE[i].ote_base;
-                        const char *pszEnd = psz + pKrnlOTE[i].ote_size;
-
-                        while (psz + 100 < pszEnd)
+                        const char *pszEnd = psz + pKrnlOTE[i].ote_size - 50; /* Last possible search position. */
+
+                        while (psz < pszEnd)
                         {
                             if (strncmp(psz, "Internal revision ", 18) == 0 && (psz[18] >= '0' && psz[18] <= '9'))
                             {
                                 int j;
-                                kprintf2(("GetOTEs32: found internal revision: '%s'\n", psz));
+                                kprintf2(("GetKernelInfo32: found internal revision: '%s'\n", psz));
 
                                 /* skip to end of "Internal revision " string. */
@@ -481,16 +513,17 @@
                                 {
                                     if (*psz != '.')
-                                        pKrnlInfo->usBuild = (unsigned short)(pKrnlInfo->usBuild * 10 + (*psz - '0'));
+                                        pKrnlInfo->ulBuild = (unsigned short)(pKrnlInfo->ulBuild * 10 + (*psz - '0'));
                                     psz++;
                                 }
 
                                 /* Check if build number seems valid. */
-                                if (   !(pKrnlInfo->usBuild >=  8254 && pKrnlInfo->usBuild <  8383) /* Warp 3 fp 32 -> fp 60 */
-                                    && !(pKrnlInfo->usBuild >=  9023 && pKrnlInfo->usBuild <= 9036) /* Warp 4 GA -> fp 12 */
-                                    && !(pKrnlInfo->usBuild >= 14039 && pKrnlInfo->usBuild < 14080) /* Warp 4.5 GA -> fp 40 */
+                                if (   !(pKrnlInfo->ulBuild >=  8254 && pKrnlInfo->ulBuild <  8383) /* Warp 3 fp 32 -> fp 60 */
+                                    && !(pKrnlInfo->ulBuild >=  9023 && pKrnlInfo->ulBuild <= 9036) /* Warp 4 GA -> fp 12 */
+                                    && !(pKrnlInfo->ulBuild >= 14039 && pKrnlInfo->ulBuild < 14080) /* Warp 4.5 GA -> fp 40 */
+                                    && !(pKrnlInfo->ulBuild >=  6600 && pKrnlInfo->ulBuild <= 6678) /* Warp 2.1x fix?? (just for fun!) */
                                       )
                                 {
-                                    kprintf(("GetOTEs32: info summary: Build %d is invalid - invalid fixpack?\n", pKrnlInfo->usBuild));
-                                    usRc = 6;
+                                    kprintf(("GetKernelInfo32: info summary: Build %d is invalid - invalid fixpack?\n", pKrnlInfo->ulBuild));
+                                    usRc = ERROR_D32_INVALID_BUILD;
                                     break;
                                 }
@@ -500,14 +533,20 @@
                                     || (psz[0] == '_' && (psz[1] == 'S' || psz[1] == 's'))  /* _SMP  */
                                     )
-                                    pKrnlInfo->fchType = TYPE_SMP;
-                                else if (psz[0] == '_' && psz[1] == 'W' && psz[2] == '4')    /* _W4  */
-                                    pKrnlInfo->fchType = TYPE_W4;
+                                    pKrnlInfo->fKernel = KF_SMP;
                                 else
-                                    pKrnlInfo->fchType = TYPE_UNI;
+                                    if (*psz != ','
+                                        && (   (psz[0] == '_' && psz[1] == 'W' && psz[2] == '4')  /* _W4 */
+                                            || (psz[1] == '_' && psz[2] == 'W' && psz[3] == '4')  /* A_W4 */
+                                            || (psz[0] == '_' && psz[1] == 'U' && psz[2] == 'N' && psz[3] == 'I' && psz[4] == '4')  /* _UNI4 */
+                                            || (psz[1] == '_' && psz[2] == 'U' && psz[3] == 'N' && psz[4] == 'I' && psz[5] == '4')  /* A_UNI4 */
+                                            )
+                                        )
+                                    pKrnlInfo->fKernel = KF_W4 | KF_UNI;
+                                else
+                                    pKrnlInfo->fKernel = KF_UNI;
 
 
                                 /* Check if its a debug kernel (look for DEBUG at start of object 3-5) */
                                 j = 3;
-                                pKrnlInfo->fDebug = FALSE;
                                 while (j < 5)
                                 {
@@ -520,5 +559,5 @@
                                         && strncmp((char*)pKrnlOTE[j].ote_base, "DEBUG", 5) == 0)
                                     {
-                                        pKrnlInfo->fDebug = TRUE;
+                                        pKrnlInfo->fKernel |= KF_DEBUG;
                                         break;
                                     }
@@ -527,6 +566,6 @@
 
                                 /* Display info */
-                                kprintf(("GetOTEs32: info summary: Build %d, fchType=%d, fDebug=%d\n",
-                                         pKrnlInfo->usBuild, pKrnlInfo->fchType, pKrnlInfo->fDebug));
+                                kprintf(("GetKernelInfo32: info summary: Build %d, fKernel=%d\n",
+                                         pKrnlInfo->ulBuild, pKrnlInfo->fKernel));
 
                                 /* Break out */
@@ -540,29 +579,27 @@
 
                     /* Set error code if not found */
-                    if (pKrnlInfo->usBuild == 0)
+                    if (pKrnlInfo->ulBuild == 0)
                     {
-                        usRc = 5;
-                        kprintf(("GetOTEs32: Internal revision was not found!\n"));
+                        usRc = ERROR_D32_BUILD_INFO_NOT_FOUND;
+                        kprintf(("GetKernelInfo32: Internal revision was not found!\n"));
                     }
                 }
                 else
-                    usRc = 4;
+                    usRc = ERROR_D32_NO_OBJECT_TABLE;
             }
             else
-                usRc = 3;
+                usRc = ERROR_D32_TOO_MANY_OBJECTS;
         }
         else
-            usRc = 2;
+            usRc = ERROR_D32_NO_SWAPMTE;
     }
     else
-        usRc = 1;
-
-
-    if (usRc != 0)
-        kprintf(("GetOTEs32: failed. usRc = %d\n", usRc));
+        usRc = ERROR_D32_GETOS2KRNL_FAILED;
+
+    if (usRc != NO_ERROR)
+        kprintf(("GetKernelInfo32: failed. usRc = %d\n", usRc));
 
     return (USHORT)(usRc | (usRc != NO_ERROR ? STATUS_DONE | STERR : STATUS_DONE));
 }
-#endif /* !DEBUGR3*/
 
 
@@ -575,10 +612,33 @@
  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  */
-_Inline int ModR_M_32bit(char bModRM)
+int ModR_M_32bit(char bModRM)
 {
     if ((bModRM & 0xc0) == 0x80  /* ex. mov ax,[ebp+11145543h] */
         || ((bModRM & 0xc0) == 0 && (bModRM & 0x07) == 5)) /* ex. mov ebp,[0ff231234h] */
     {   /* 32-bit displacement */
-        return 5;
+        return 5 + ((bModRM & 0x7) == 0x4); // + SIB
+    }
+    else if ((bModRM & 0xc0) == 0x40) /* ex. mov ecx,[esi]+4fh */
+    {   /* 8-bit displacement */
+        return 2 + ((bModRM & 0x7) == 0x4); // + SIB
+    }
+    /* no displacement (only /r byte) */
+    return 1;
+}
+
+
+/**
+ * Functions which cacluates the instructionsize given a ModR/M byte.
+ * @returns   Number of bytes to add to cb and pach.
+ * @param     bModRM  ModR/M byte.
+ * @status    completely implemented.
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+int ModR_M_16bit(char bModRM)
+{
+    if ((bModRM & 0xc0) == 0x80  /* ex. mov ax,[ebp+11145543h] */
+        || ((bModRM & 0xc0) == 0 && (bModRM & 0x07) == 5)) /* ex. mov ebp,[0ff231234h] */
+    {   /* 16-bit displacement */
+        return 4;
     }
     else if ((bModRM & 0xc0) == 0x40) /* ex. mov ecx,[esi]+4fh */
@@ -603,8 +663,7 @@
  *                       FALSE: Function is to be imported.
  */
-static int interpretFunctionProlog32(char *pach, BOOL fOverload)
+int interpretFunctionProlog32(char *pach, BOOL fOverload)
 {
     int cb = -3;
-
     kprintf2(("interpretFunctionProlog32(0x%08x, %d):\n"
               "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n"
@@ -630,19 +689,51 @@
      *     push ebp
      *  or
+     *     mov ecx, r/m32
+     *  or
+     *     jmp dword
+     *  or
+     *     sub esp, imm8
+     *  or
+     *     call ptr16:32
+     *  or
+     *     enter imm16, imm8    (2.1x)
+     *  or
+     *     mov eax, imm32       (2.1x)
+     *     <anything>
+     *  or
+     *     xor r32, r/m32
+     *  or
      *     mov eax, msoff32
      *
      */
-    if ((pach[0] == 0x55 && (pach[1] == 0x8b || pach[1] == 0xa1)) /* two first prologs */
+    if ((pach[0] == 0x55 && (pach[1] == 0x8b || pach[1] == 0xa1)) /* the two first prologs */
         ||
-        (pach[0] == 0xB8 && (pach[5] == 0xEB || pach[5] == 0x55 ) && !fOverload) /* two next prologs */
+        (pach[0] == 0xB8 && (pach[5] == 0xEB || pach[5] == 0x55) && !fOverload) /* the two next prologs */
+        ||
+        (pach[0] == 0x8B && !fOverload) /* the next prolog */
+        ||
+        (pach[0] == 0xFF && !fOverload) /* the next prolog */
+        ||
+        (pach[0] == 0x83 && !fOverload) /* the next prolog */
+        ||
+        (pach[0] == 0x9a && !fOverload) /* the next prolog */
+        ||
+        (pach[0] == 0xc8)               /* the next prolog */
+        ||
+        (pach[0] == 0xB8 && !fOverload) /* the next prolog */
+        ||
+        (pach[0] == 0x33 && !fOverload) /* the next prolog */
         ||
         (pach[0] == 0xa1 && !fOverload) /* last prolog */
         )
     {
-        BOOL fForce;
+        BOOL fForce = FALSE;
+        int  cbWord = 4;
         cb = 0;
         while (cb < 5 || fForce)                  /* 5 is the size of a jump instruction. */
         {
             int cb2;
+            if (!fForce && cbWord != 4)
+                cbWord = 4;
             fForce = FALSE;
             switch (*pach)
@@ -656,4 +747,9 @@
                 case 0x65:              /* gs segment override */
                     fForce = TRUE;
+                    break;
+
+                case 0x66:              /* 16 bit */
+                    fForce = TRUE;
+                    cbWord = 2;
                     break;
 
@@ -703,6 +799,6 @@
                 case 0xa1:              /* mov eax, moffs16 */
                 case 0xa3:              /* mov moffs16, eax */
-                    pach += 4;
-                    cb += 4;
+                    pach += cbWord;
+                    cb += cbWord;
                     break;
 
@@ -722,6 +818,4 @@
                 case 0x8b:              /* mov /r */
                 case 0x8d:              /* lea /r */
-                    if ((pach[1] & 0x7) == 4 && (pach[1] & 0xc0) != 0xc0) /* invalid instruction!?! */
-                        return -1;
                     cb += cb2 = ModR_M_32bit(pach[1]);
                     pach += cb2;
@@ -751,5 +845,5 @@
                         )
                     {
-                        cb += cb2 = 4 + ModR_M_32bit(pach[1]); /* 4 is the size of the imm32 */
+                        cb += cb2 = cbWord + ModR_M_32bit(pach[1]); /* cbWord is the size of the imm32/imm16 */
                         pach += cb2;
                     }
@@ -759,4 +853,22 @@
                         return -2;
                     }
+                    break;
+
+                case 0x9a:              /* call ptr16:32 */
+                    cb += cb2 = 6;
+                    pach += cb2;
+                    break;
+
+                case 0xc8:              /* enter imm16, imm8 */
+                    cb += cb = 3;
+                    pach += cb2;
+                    break;
+
+                /*
+                 * jmp /digit
+                 */
+                case 0xff:
+                    cb += cb2 = cbWord + ModR_M_32bit(pach[1]); /* cbWord is the size of the imm32/imm16 */
+                    pach += cb2;
                     break;
 
@@ -771,5 +883,6 @@
     else
     {
-        kprintf(("interpretFunctionProlog32: unknown prolog start. 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2]));
+        kprintf(("interpretFunctionProlog32: unknown prolog start. 0x%x 0x%x 0x%x 0x%x 0x%x\n",
+                 pach[0], pach[1], pach[2], pach[3], pach[4]));
         cb = 0;
     }
@@ -787,5 +900,5 @@
  *                       FALSE: Function is to be imported.
  */
-static int interpretFunctionProlog16(char *pach, BOOL fOverload)
+int interpretFunctionProlog16(char *pach, BOOL fOverload)
 {
     int cb = -7;
@@ -809,7 +922,14 @@
         while (cb < 8 || fForce)        /* 8 is the size of a 66h prefixed far jump instruction. */
         {
+            int cb2;
             fForce = FALSE;
             switch (*pach)
             {
+                case 0x06:              /* push es */
+                case 0x0e:              /* push cs */
+                case 0x1e:              /* push ds */
+                case 0x16:              /* push ss */
+                    break;
+
                 case 0x0f:              /* push gs and push fs */
                     if (pach[1] != 0xA0 && pach[1] != 0xA8)
@@ -888,4 +1008,22 @@
                     break;
 
+                /* complex sized instruction - "/5 ib" */
+                case 0x80:              /* 5: sub r/m8, imm8  7: cmp r/m8, imm8 */
+                case 0x83:              /* 5: sub r/m16, imm8 7: cmp r/m16, imm8 */
+                    if ((pach[1] & 0x38) == (5<<3)
+                        || (pach[1] & 0x38) == (7<<3)
+                        )
+                    {
+                        cb += cb2 = 1 + ModR_M_16bit(pach[1]); /* 1 is the size of the imm8 */
+                        pach += cb2;
+                    }
+                    else
+                    {
+                        kprintf(("interpretFunctionProlog16: unknown instruction (-3) 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2]));
+                        return -3;
+                    }
+                    break;
+
+
                 default:
                     kprintf(("interpretFunctionProlog16: unknown instruction 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2]));
@@ -904,5 +1042,4 @@
 
 
-#ifndef DEBUGR3
 /**
  * Verifies the aImportTab.
@@ -913,7 +1050,8 @@
 USHORT _loadds _Far32 _Pascal VerifyImportTab32(void)
 {
-    int i;
-    int cb;
-    int cbmin;
+    USHORT  usRc;
+    int     i;
+    int     cb;
+    int     cbmin;
 
     /* VerifyImporTab32 is called before the initroutine! */
@@ -921,6 +1059,7 @@
 
     /* Check that pKrnlOTE is set */
-    if (GetKernelInfo32(NULL) != NO_ERROR)
-        return STATUS_DONE | STERR | 1;
+    usRc = GetKernelInfo32(NULL);
+    if (usRc != NO_ERROR)
+        return (USHORT)(STATUS_DONE | STERR | (usRc & STECODE));
 
     /*
@@ -933,40 +1072,46 @@
          */
         kprintf2(("VerifyImportTab32: procedure no.%d is being checked: %s addr=0x%08x iObj=%d offObj=%d\n",
-                  i, &_aImportTab[i].achName[0], _aImportTab[i].ulAddress,
-                  _aImportTab[i].iObject, _aImportTab[i].offObject));
+                  i, &aImportTab[i].achName[0], aImportTab[i].ulAddress,
+                  aImportTab[i].iObject, aImportTab[i].offObject));
 
         /* Verify that it is found */
-        if (!_aImportTab[i].fFound)
-        {
-            kprintf(("VerifyImportTab32: procedure no.%d was not fFound!\n", i));
-            return STATUS_DONE | STERR | 2;
+        if (!aImportTab[i].fFound)
+        {
+            if (aImportTab[i].fType & EPT_NOT_REQ)
+                continue;
+            else
+            {
+                kprintf(("VerifyImportTab32: procedure no.%d was not fFound!\n", i));
+                return STATUS_DONE | STERR | ERROR_D32_PROC_NOT_FOUND;
+            }
         }
 
         /* Verify read/writeable. */
-        if (_aImportTab[i].iObject >= pKrnlSMTE->smte_objcnt                                /* object index valid? */
-            || _aImportTab[i].ulAddress < pKrnlOTE[_aImportTab[i].iObject].ote_base         /* address valid? */
-            || _aImportTab[i].ulAddress + 16 > (pKrnlOTE[_aImportTab[i].iObject].ote_base +
-                                                pKrnlOTE[_aImportTab[i].iObject].ote_size)  /* address valid? */
-            || _aImportTab[i].ulAddress - _aImportTab[i].offObject
-               != pKrnlOTE[_aImportTab[i].iObject].ote_base                                 /* offObject ok?  */
+        if (aImportTab[i].iObject >= pKrnlSMTE->smte_objcnt                                /* object index valid? */
+            || aImportTab[i].ulAddress < pKrnlOTE[aImportTab[i].iObject].ote_base          /* address valid? */
+            || aImportTab[i].ulAddress + 16 > (pKrnlOTE[aImportTab[i].iObject].ote_base +
+                                                pKrnlOTE[aImportTab[i].iObject].ote_size)  /* address valid? */
+            || aImportTab[i].ulAddress - aImportTab[i].offObject
+               != pKrnlOTE[aImportTab[i].iObject].ote_base                                 /* offObject ok?  */
             )
         {
             kprintf(("VerifyImportTab32: procedure no.%d has an invalid address or object number.!\n"
                      "                   %s  addr=0x%08x iObj=%d offObj=%d\n",
-                     i, &_aImportTab[i].achName[0], _aImportTab[i].ulAddress,
-                     _aImportTab[i].iObject, _aImportTab[i].offObject));
-            return STATUS_DONE | STERR | 3;
+                     i, &aImportTab[i].achName[0], aImportTab[i].ulAddress,
+                     aImportTab[i].iObject, aImportTab[i].offObject));
+            return STATUS_DONE | STERR | ERROR_D32_INVALID_OBJ_OR_ADDR;
         }
 
 
-
-        if (_aImportTab[i].ulAddress < 0xffe00000UL)
+        #ifndef R3TST
+        if (aImportTab[i].ulAddress < 0xff400000UL)
         {
             kprintf(("VerifyImportTab32: procedure no.%d has an invalid address, %#08x!\n",
-                     i, _aImportTab[i].ulAddress));
-            return STATUS_DONE | STERR | 4;
+                     i, aImportTab[i].ulAddress));
+            return STATUS_DONE | STERR | ERROR_D32_INVALID_ADDRESS;
         }
-
-        switch (_aImportTab[i].fType & ~EPT_BIT_MASK)
+        #endif
+
+        switch (aImportTab[i].fType & ~(EPT_BIT_MASK | EPT_NOT_REQ))
         {
             case EPT_PROC:
@@ -975,14 +1120,14 @@
                  * Verify known function prolog.
                  */
-                if (EPT32BitEntry(_aImportTab[i]))
+                if (EPT32BitEntry(aImportTab[i]))
                 {
-                    cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress,
-                                                   _aImportTab[i].fType == EPT_PROC32);
+                    cb = interpretFunctionProlog32((char*)aImportTab[i].ulAddress,
+                                                   aImportTab[i].fType == EPT_PROC32);
                     cbmin = 5; /* Size of the jump instruction */
                 }
                 else
                 {
-                    cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress,
-                                                   _aImportTab[i].fType == EPT_PROC16);
+                    cb = interpretFunctionProlog16((char*)aImportTab[i].ulAddress,
+                                                   aImportTab[i].fType == EPT_PROC16);
                     cbmin = 7; /* Size of the far jump instruction */
                 }
@@ -991,8 +1136,8 @@
                  * Check result of the function prolog interpretations.
                  */
-                if (cb <= 0 && cb + cbmin >= MAXSIZE_PROLOG)
+                if (cb <= 0 || cb + cbmin >= MAXSIZE_PROLOG)
                 {   /* failed, too small or too large. */
-                    kprintf(("VerifyImportTab32: verify failed for procedure no.%d (cd=%d)\n", i, cb));
-                    return STATUS_DONE | STERR | 5;
+                    kprintf(("VerifyImportTab32: verify failed for procedure no.%d (cb=%d)\n", i, cb));
+                    return STATUS_DONE | STERR | ERROR_D32_TOO_INVALID_PROLOG;
                 }
                 break;
@@ -1003,7 +1148,7 @@
 
             default:
-                kprintf(("VerifyImportTab32: only EPT_PROC is implemented\n",i));
+                kprintf(("VerifyImportTab32: invalid type/type not implemented\n",i));
                 Int3(); /* temporary fix! */
-                return STATUS_DONE | STERR | 6;
+                return STATUS_DONE | STERR | ERROR_D32_NOT_IMPLEMENTED;
         }
     }
@@ -1017,32 +1162,62 @@
  * @returns   NO_ERROR on success. !0 on error.
  */
-static int importTabInit(void)
+int importTabInit(void)
 {
-    /* This table must be updated with the overloading functions. */
+    /* This table must be updated with the overloading functions.
+     * It should also hold NOP functions for functions which are of the
+     * not required type.
+     */
     static unsigned auFuncs[NBR_OF_KRNLIMPORTS] =
     {
-        (unsigned)myldrRead,
-        (unsigned)myldrOpen,
-        (unsigned)myldrClose,
-        (unsigned)myLDRQAppType,
-        (unsigned)myldrEnum32bitRelRecs,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        (unsigned)&mytkExecPgm,
-        0,
-        0,
-        0,
-        0
+        (unsigned)myldrRead,            /* 0 */
+        (unsigned)myldrOpen,            /* 1 */
+        (unsigned)myldrClose,           /* 2 */
+        (unsigned)myLDRQAppType,        /* 3 */
+        (unsigned)myldrEnum32bitRelRecs,/* 4 */
+        0,                              /* 5 */
+        0,                              /* 6 */
+        0,                              /* 7 */
+        0,                              /* 8 */
+        0,                              /* 9 */
+        0,                              /* 10 */
+        0,                              /* 11 */
+        0,                              /* 12 */
+        (unsigned)&mytkExecPgm,         /* 13 */
+        (unsigned)&mytkStartProcess,    /* 14 */
+        0,                              /* 15 */
+        0,                              /* 16 */
+        0,                              /* 17 */
+        0,                              /* 18 */
+        0,                              /* 19 */
+        (unsigned)myldrOpenPath,        /* 20 */
+        0,                              /* 21 */
+        0,                              /* 22 */
+        0,                              /* 23 */
+        0,                              /* 24 */
+        0,                              /* 25 */
+        0,                              /* 26 */
+        0,                              /* 27 */
+        0,                              /* 28 */
+        0,                              /* 29 */
+        0,                              /* 30 */
+        0,                              /* 31 */
+        0,                              /* 32 */
+        0,                              /* 33 */
+        0,                              /* 34 */
+        0,                              /* 35 */
+        0,                              /* 36 */
+        0,                              /* 37 */
+        0,                              /* 38 */
+        0,                              /* 39 */
+        0,                              /* 40 */
+        (unsigned)nopSecPathFromSFN,    /* 41 */
     };
-
     int i;
     int cb;
     int cbmin;
+
+#ifdef R3TST
+    R3TstFixImportTab();
+#endif
 
     /*
@@ -1052,15 +1227,21 @@
     {
         /* EPT_VARIMPORTs are skipped */
-        if ((_aImportTab[i].fType & ~EPT_BIT_MASK) == EPT_VARIMPORT)
+        if ((aImportTab[i].fType & ~EPT_BIT_MASK) == EPT_VARIMPORT)
             continue;
-
-        if (EPT32BitEntry(_aImportTab[i]))
-        {
-            cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC32);
+        /* EPT_NOT_REQ which is not found are set pointing to the nop function provided. */
+        if (!aImportTab[i].fFound && (aImportTab[i].fType & EPT_NOT_REQ))
+        {
+            aImportTab[i].ulAddress = auFuncs[i];
+            continue;
+        }
+
+        if (EPT32BitEntry(aImportTab[i]))
+        {
+            cb = interpretFunctionProlog32((char*)aImportTab[i].ulAddress, aImportTab[i].fType == EPT_PROC32);
             cbmin = 5; /* Size of the jump instruction */
         }
         else
         {
-            cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC16);
+            cb = interpretFunctionProlog16((char*)aImportTab[i].ulAddress, aImportTab[i].fType == EPT_PROC16);
             cbmin = 7; /* Size of the far jump instruction */
         }
@@ -1068,5 +1249,5 @@
         {
             kprintf(("ImportTabInit: Verify failed for procedure no.%d, cb=%d\n", i, cb));
-            return 1;
+            return ERROR_D32_VERIFY_FAILED;
         }
     }
@@ -1077,5 +1258,5 @@
     for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
     {
-        switch (_aImportTab[i].fType)
+        switch (aImportTab[i].fType & ~EPT_NOT_REQ)
         {
             /*
@@ -1087,6 +1268,6 @@
             case EPT_PROC32:
             {
-                cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, TRUE);
-                _aImportTab[i].cbProlog = (char)cb;
+                cb = interpretFunctionProlog32((char*)aImportTab[i].ulAddress, TRUE);
+                aImportTab[i].cbProlog = (char)cb;
                 if (cb >= 5 && cb + 5 < MAXSIZE_PROLOG) /* 5(1st): size of jump instruction in the function prolog which jumps to my overloading function */
                 {                                       /* 5(2nd): size of jump instruction which jumps back to the original function after executing the prolog copied to the callTab entry for this function. */
@@ -1094,5 +1275,5 @@
                      * Copy function prolog which will be overwritten by the jmp to calltabl.
                      */
-                    memcpy(callTab[i], (void*)_aImportTab[i].ulAddress, (size_t)cb);
+                    memcpy(callTab[i], (void*)aImportTab[i].ulAddress, (size_t)cb);
 
                     /*
@@ -1102,17 +1283,17 @@
                      */
                     callTab[i][cb] = 0xE9; /* jmp */
-                    *(unsigned long*)(void*)&callTab[i][cb+1] = _aImportTab[i].ulAddress + cb - (unsigned long)&callTab[i][cb+5];
+                    *(unsigned long*)(void*)&callTab[i][cb+1] = aImportTab[i].ulAddress + cb - (unsigned long)&callTab[i][cb+5];
 
                     /*
                      * Jump from original function to my function - an cli(?) could be needed here
                      */
-                    *(char*)_aImportTab[i].ulAddress = 0xE9; /* jmp */
-                    *(unsigned long*)(_aImportTab[i].ulAddress + 1) = auFuncs[i] - (_aImportTab[i].ulAddress + 5);
+                    *(char*)aImportTab[i].ulAddress = 0xE9; /* jmp */
+                    *(unsigned long*)(aImportTab[i].ulAddress + 1) = auFuncs[i] - (aImportTab[i].ulAddress + 5);
                 }
                 else
                 {   /* !fatal! - this could never happen really... */
-                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n",i));
+                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n", i));
                     Int3(); /* ipe - later! */
-                    return 1;
+                    return ERROR_D32_VERIFY_FAILED;
                 }
                 break;
@@ -1129,6 +1310,6 @@
                 Int3();
 
-                cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, TRUE);
-                _aImportTab[i].cbProlog = (char)cb;
+                cb = interpretFunctionProlog16((char*)aImportTab[i].ulAddress, TRUE);
+                aImportTab[i].cbProlog = (char)cb;
                 if (cb >= 8 && cb + 7 < MAXSIZE_PROLOG) /* 8: size of a 16:32 jump which jumps to my overloading function (prefixed with 66h in a 16-bit segment) */
                 {                                       /* 7: size of a 16:32 jump which is added to the call tab */
@@ -1136,5 +1317,5 @@
                      * Copy function prolog which is to be overwritten.
                      */
-                    memcpy(callTab[i], (void*)_aImportTab[i].ulAddress, (size_t)cb);
+                    memcpy(callTab[i], (void*)aImportTab[i].ulAddress, (size_t)cb);
 
                     /*
@@ -1143,6 +1324,6 @@
                      */
                     callTab[i][cb] = 0xEA; /* jmp far ptr */
-                    *(unsigned long*)(void*)&callTab[i][cb+1] = _aImportTab[i].offObject;
-                    *(unsigned short*)(void*)&callTab[i][cb+5] = _aImportTab[i].usSel;
+                    *(unsigned long*)(void*)&callTab[i][cb+1] = aImportTab[i].offObject;
+                    *(unsigned short*)(void*)&callTab[i][cb+5] = aImportTab[i].usSel;
 
                     /*
@@ -1150,14 +1331,14 @@
                      * 0x66 0xEA <four byte target address> <two byte target selector>
                      */
-                    *(char*)(_aImportTab[i].ulAddress    ) = 0x66;    /* operandsize prefix */
-                    *(char*)(_aImportTab[i].ulAddress + 1) = 0xEA;    /* jmp far ptr */
-                    *(unsigned long*)(_aImportTab[i].ulAddress + 2) = auFuncs[i];   /* FIXME? */
-                    *(unsigned short*)(_aImportTab[i].ulAddress + 6) = _R0FlatCS16; /* FIXME */
+                    *(char*)(aImportTab[i].ulAddress    ) = 0x66;    /* operandsize prefix */
+                    *(char*)(aImportTab[i].ulAddress + 1) = 0xEA;    /* jmp far ptr */
+                    *(unsigned long*)(aImportTab[i].ulAddress + 2) = auFuncs[i];   /* FIXME? */
+                    *(unsigned short*)(aImportTab[i].ulAddress + 6) = _R0FlatCS16; /* FIXME */
                 }
                 else
                 {   /* !fatal! - this could never happen really... */
-                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n",i));
+                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n", i));
                     Int3(); /* ipe - later! */
-                    return 1;
+                    return ERROR_D32_VERIFY_FAILED;
                 }
                 break;
@@ -1171,6 +1352,6 @@
             case EPT_PROCIMPORT32:
             {
-                cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, FALSE);
-                _aImportTab[i].cbProlog = (char)cb;
+                cb = interpretFunctionProlog32((char*)aImportTab[i].ulAddress, FALSE);
+                aImportTab[i].cbProlog = (char)cb;
                 if (cb > 0) /* Since no prolog part is copied to the function table, it's ok as long as the prolog has been recognzied. */
                 {
@@ -1181,11 +1362,11 @@
                      */
                     callTab[i][0] = 0xE9; /* jmp */
-                    *(unsigned*)(void*)&callTab[i][1] = _aImportTab[i].ulAddress - (unsigned)&callTab[i][5];
+                    *(unsigned*)(void*)&callTab[i][1] = aImportTab[i].ulAddress - (unsigned)&callTab[i][5];
                 }
                 else
                 {   /* !fatal! - this should never really happen... */
-                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n",i));
+                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n", i));
                     Int3(); /* ipe - later! */
-                    return 1;
+                    return ERROR_D32_VERIFY_FAILED;
                 }
                 break;
@@ -1199,6 +1380,6 @@
             case EPT_PROCIMPORT16:
             {
-                cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, FALSE);
-                _aImportTab[i].cbProlog = (char)cb;
+                cb = interpretFunctionProlog16((char*)aImportTab[i].ulAddress, FALSE);
+                aImportTab[i].cbProlog = (char)cb;
                 if (cb > 0) /* Since no prolog part is copied to the function table, it's ok as long as the prolog has been recognzied. */
                 {
@@ -1208,12 +1389,12 @@
                      */
                     callTab[i][0] = 0xEA; /* jmp far ptr */
-                    *(unsigned long*)(void*)&callTab[i][1] = _aImportTab[i].offObject;
-                    *(unsigned short*)(void*)&callTab[i][5] = _aImportTab[i].usSel;
+                    *(unsigned long*)(void*)&callTab[i][1] = aImportTab[i].offObject;
+                    *(unsigned short*)(void*)&callTab[i][5] = aImportTab[i].usSel;
                 }
                 else
                 {   /* !fatal! - this should never really happen... */
-                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n",i));
+                    kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n", i));
                     Int3(); /* ipe - later! */
-                    return 1;
+                    return ERROR_D32_VERIFY_FAILED;
                 }
                 break;
@@ -1231,10 +1412,10 @@
             case EPT_VARIMPORT32:
             case EPT_VARIMPORT16:
-                _aImportTab[i].cbProlog = (char)0;
-                *(unsigned long*)(void*)&callTab[i][0] = _aImportTab[i].ulAddress;
-                *(unsigned long*)(void*)&callTab[i][4] = _aImportTab[i].offObject;
-                *(unsigned short*)(void*)&callTab[i][8] = _aImportTab[i].usSel;
-                *(unsigned short*)(void*)&callTab[i][0xa] = (unsigned short)_aImportTab[i].offObject;
-                *(unsigned short*)(void*)&callTab[i][0xc] = _aImportTab[i].usSel;
+                aImportTab[i].cbProlog = (char)0;
+                *(unsigned long*)(void*)&callTab[i][0] = aImportTab[i].ulAddress;
+                *(unsigned long*)(void*)&callTab[i][4] = aImportTab[i].offObject;
+                *(unsigned short*)(void*)&callTab[i][8] = aImportTab[i].usSel;
+                *(unsigned short*)(void*)&callTab[i][0xa] = (unsigned short)aImportTab[i].offObject;
+                *(unsigned short*)(void*)&callTab[i][0xc] = aImportTab[i].usSel;
                 break;
 
@@ -1242,5 +1423,5 @@
                 kprintf(("ImportTabInit: unsupported type. (procedure no.%d, cb=%d)\n", i, cb));
                 Int3(); /* ipe - later! */
-                return 1;
+                return ERROR_D32_VERIFY_FAILED;
         } /* switch - type */
     }   /* for */
@@ -1248,161 +1429,143 @@
     return NO_ERROR;
 }
-#endif /* !DEBUGR3 */
-
-
-
-
-/*******************************************************************************
-*   Ring-3 Debug Stuff
-*******************************************************************************/
-#ifdef DEBUGR3
-#include <stdio.h>
-
-void main(void)
+
+
+#ifdef R3TST
+/**
+ * Creates a fake kernel MTE, SMTE and OTE for use while testing in Ring3.
+ * @returns Pointer to the fake kernel MTE.
+ * @status  completely implemented.
+ * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+PMTE GetOS2KrnlMTETst(void)
 {
-    char ach_ldrRead[] = {
-        0x55, 0x8b, 0xec, 0x8d, 0x65, 0xf8, 0x53, 0x56,
-        0x57, 0x33, 0xd2, 0x42, 0x89, 0x55, 0xf8, 0x38,
-        0x35, 0xce, 0x70, 0x00, 0x00, 0x75, 0x4d, 0x8b,
-        0x55, 0x08, 0x66, 0x83, 0xfa, 0xff, 0x74, 0x62
-    };
-    char ach_ldrOpen[] = {
-        0x55, 0x8b, 0xec, 0x33, 0xc0, 0x38, 0x05, 0xce,
-        0x70, 0x00, 0x00, 0x75, 0x4b, 0x50, 0xff, 0x75,
-        0x08, 0x6a, 0x01, 0x68, 0xa3, 0x00, 0x00, 0x00,
-        0xff, 0x75, 0x0c, 0xff, 0x15, 0xc4, 0xc1, 0x0d
-    };
-    char ach_ldrClose[] = {
-        0x55, 0x8b, 0xec, 0x33, 0xc0, 0x38, 0x05, 0xce,
-        0x70, 0x00, 0x00, 0x75, 0x13, 0x8b, 0x55, 0x08,
-        0x0f, 0xb7, 0xd2, 0x66, 0x83, 0xfa, 0xff, 0x74,
-        0x07, 0x52, 0xff, 0x15, 0xcc, 0xc1, 0x0d, 0x00
-    };
-    char ach_LDRQAppType[] = {
-        0x55, 0x8b, 0x0d, 0xa0, 0x0a, 0x00, 0x00, 0x8b,
-        0xec, 0x83, 0xec, 0x3c, 0x53, 0x81, 0xc1, 0x24,
-        0x06, 0x00, 0x00, 0x57, 0x56, 0x6a, 0xff, 0x66,
-        0xc7, 0x45, 0xc6, 0x00, 0x00, 0x51, 0xe8, 0x38
-    };
-    char ach_ldrEnum32bitRelRecs[] = {
-        0x55, 0xa1, 0xe8, 0xcf, 0x0d, 0x00, 0x8b, 0xec,
-        0x83, 0xec, 0x5c, 0x53, 0x8b, 0x55, 0x08, 0x57,
-        0x56, 0x8b, 0x52, 0x04, 0xf6, 0x40, 0x04, 0x80,
-        0x89, 0x55, 0xfc, 0x0f, 0x84, 0x10, 0x01, 0x00
-    };
-    char ach_IOSftOpen[] = {
-        0x55, 0x8b, 0xec, 0x8d, 0xa5, 0xa0, 0xfe, 0xff,
-        0xff, 0xf6, 0x05, 0x95, 0x2d, 0x00, 0x00, 0x80,
-        0x74, 0x13, 0x66, 0x68, 0x50, 0x30, 0xff, 0x75,
-        0x08, 0x6a, 0x3c, 0x6a, 0x06, 0xe8, 0x5a, 0x03
-    };
-    char ach_IOSftClose[] = {
-        0x55, 0x8b, 0xec, 0x8d, 0xa5, 0x28, 0xff, 0xff,
-        0xff, 0xf6, 0x05, 0x95, 0x2d, 0x00, 0x00, 0x80,
-        0x74, 0x16, 0x50, 0x66, 0x68, 0x51, 0x30, 0x8b,
-        0x45, 0x08, 0x50, 0x6a, 0x0c, 0x6a, 0x06, 0xe8
-    };
-    char ach_IOSftTransPath[] = {
-        0x55, 0x8b, 0xec, 0x8d, 0xa5, 0xd8, 0xfd, 0xff,
-        0xff, 0x53, 0x56, 0x57, 0x1e, 0x06, 0xa1, 0xa4,
-        0x0a, 0x00, 0x00, 0x66, 0x8d, 0x9d, 0xe2, 0xfe,
-        0xff, 0xff, 0x66, 0x89, 0x98, 0xf6, 0x01, 0x00
-    };
-    char ach_IOSftReadAt[] = {
-        0xb8, 0xc4, 0x68, 0x14, 0x00, 0xeb, 0x05, 0xb8,
-        0xcc, 0x68, 0x14, 0x00, 0x55, 0x8b, 0xec, 0x8d,
-        0xa5, 0x20, 0xff, 0xff, 0xff, 0xf6, 0x05, 0x95,
-        0x2d, 0x00, 0x00, 0x80, 0x74, 0x28, 0x50, 0x66
-    };
-    char ach_IOSftWriteAt[] = {
-        0xb8, 0xcc, 0x68, 0x14, 0x00, 0x55, 0x8b, 0xec,
-        0x8d, 0xa5, 0x20, 0xff, 0xff, 0xff, 0xf6, 0x05,
-        0x95, 0x2d, 0x00, 0x00, 0x80, 0x74, 0x28, 0x50,
-        0x66, 0x68, 0x52, 0x30, 0x8b, 0x45, 0x08, 0x25
-    };
-    char ach_SftFileSize[] = {
-        0x55, 0x8b, 0xec, 0x8d, 0xa5, 0x28, 0xff, 0xff,
-        0xff, 0x57, 0x56, 0x53, 0xc6, 0x85, 0x2b, 0xff,
-        0xff, 0xff, 0x00, 0x8b, 0x35, 0xa4, 0x0a, 0x00,
-        0x00, 0xf6, 0x46, 0x04, 0x01, 0x74, 0x0a, 0x80
-    };
-    char ach_VMAllocMem[] = {
-        0xa1, 0xe8, 0xcf, 0x0d, 0x00, 0x55, 0x8b, 0xec,
-        0x83, 0xec, 0x44, 0x53, 0x57, 0xf6, 0x40, 0x04,
-        0x80, 0x56, 0x0f, 0x84, 0x34, 0x01, 0x00, 0x00,
-        0xf6, 0x00, 0x40, 0x74, 0x44, 0xa1, 0xcc, 0x02
-    };
-    char ach_VMGetOwner[] = {
-        0x55, 0x8b, 0xec, 0x83, 0xec, 0x30, 0x57, 0x66,
-        0x8b, 0x4d, 0x08, 0x66, 0x89, 0x4d, 0xd8, 0xf6,
-        0xc1, 0x04, 0x75, 0x39, 0x80, 0x3d, 0x40, 0x8c,
-        0x00, 0x00, 0x00, 0x74, 0x07, 0xa1, 0xac, 0x0a
-    };
-    char achg_tkExecPgm[] = {
-        0x55, 0x8b, 0xec, 0x8d, 0x65, 0xa4, 0x66, 0x89,
-        0x5d, 0xf4, 0x66, 0x8c, 0x45, 0xf6, 0x66, 0x89,
-        0x55, 0xfc, 0x66, 0x8c, 0x5d, 0xfe, 0x66, 0x89,
-        0x75, 0xf0, 0x66, 0x89, 0x7d, 0xf2, 0xc7, 0x45
-    };
-    char achf_FuStrLenZ[] = {
-        0x6a, 0x02, 0x52, 0x66, 0x55, 0x0f, 0xa8, 0x68,
-        0x0c, 0x00, 0x0f, 0xa9, 0x65, 0x67, 0x66, 0x8b,
-        0x2d, 0xa8, 0x0a, 0x00, 0x00, 0x65, 0x67, 0xff,
-        0xb5, 0xb4, 0x1f, 0x00, 0x00, 0x65, 0x67, 0x66
-    };
-    char achf_FuStrLen[] = {
-        0x6a, 0x02, 0x52, 0x66, 0x55, 0x0f, 0xa8, 0x68,
-        0x0c, 0x00, 0x0f, 0xa9, 0x65, 0x67, 0x66, 0x8b,
-        0x2d, 0xa8, 0x0a, 0x00, 0x00, 0x65, 0x67, 0xff,
-        0xb5, 0xb4, 0x1f, 0x00, 0x00, 0x65, 0x67, 0x66
-    };
-    char achf_FuBuff[] = {
-        0x6a, 0x02, 0x52, 0x66, 0x55, 0x0f, 0xa8, 0x68,
-        0x0c, 0x00, 0x0f, 0xa9, 0x65, 0x67, 0x66, 0x8b,
-        0x2d, 0xa8, 0x0a, 0x00, 0x00, 0x65, 0x67, 0xff,
-        0xb5, 0xb4, 0x1f, 0x00, 0x00, 0x65, 0x67, 0x66
-    };
-    char achf_VMObjHandleInfo[] =  {
-        0x55, 0x8B, 0x0D, 0x9C, 0xBF, 0x0D, 0x00, 0x8B,
-        0xEC, 0x83, 0xEC, 0x0C, 0x53, 0x57, 0x8D, 0x55,
-        0xF8
-    };
-
-
-    char *aProcs[] =
+    static MTE    KrnlMTE;
+    static SMTE   KrnlSMTE;
+
+    KrnlMTE.mte_swapmte = &KrnlSMTE;
+    KrnlSMTE.smte_objtab = &aKrnlOTE[0];
+    KrnlSMTE.smte_objcnt = cObjectsFake;
+
+    return &KrnlMTE;
+}
+
+/**
+ * -Ring-3 testing-
+ * Changes the entries in aImportTab to point to their fake equivalents.
+ * @returns void
+ * @param   void
+ * @status  completely implemented.
+ * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ * @remark  Called before the aImportTab array is used/verified.
+ */
+VOID R3TstFixImportTab(VOID)
+{
+    struct _TstFaker
     {
-        ach_ldrRead            ,
-        ach_ldrOpen            ,
-        ach_ldrClose           ,
-        ach_LDRQAppType        ,
-        ach_ldrEnum32bitRelRecs,
-        ach_IOSftOpen          ,
-        ach_IOSftClose         ,
-        ach_IOSftTransPath     ,
-        ach_IOSftReadAt        ,
-        ach_IOSftWriteAt       ,
-        ach_SftFileSize        ,
-        ach_VMAllocMem         ,
-        ach_VMGetOwner         ,
-        achg_tkExecPgm         ,
-        achf_FuStrLenZ         ,
-        achf_FuStrLen          ,
-        achf_FuBuff            ,
-        achf_VMObjHandleInfo   ,
-        NULL
+        unsigned   uAddress;
+        int        fObj;                   /* 1 = CODE32, 2 = CODE16, 3 = DATA32, 4 = DATA16 */
+    }
+    aTstFakers[NBR_OF_KRNLIMPORTS] =
+    {
+        {(unsigned)fakeldrRead,             1},
+        {(unsigned)fakeldrOpen,             1},
+        {(unsigned)fakeldrClose,            1},
+        {(unsigned)fakeLDRQAppType,         1},
+        {(unsigned)fakeldrEnum32bitRelRecs, 1},
+        {(unsigned)fakeIOSftOpen,           1},
+        {(unsigned)fakeIOSftClose,          1},
+        {(unsigned)fakeIOSftTransPath,      1},
+        {(unsigned)fakeIOSftReadAt,         1},
+        {(unsigned)fakeIOSftWriteAt,        1},
+        {(unsigned)fakeSftFileSize,         1},
+        {(unsigned)fakeVMAllocMem,          1},
+        {(unsigned)fakeVMGetOwner,          1},
+        {(unsigned)fakeg_tkExecPgm,         1},
+        {(unsigned)fake_tkStartProcess,     1},
+        {(unsigned)fakef_FuStrLenZ,         2},
+        {(unsigned)fakef_FuStrLen,          2},
+        {(unsigned)fakef_FuBuff,            2},
+        {(unsigned)fakeVMObjHandleInfo,     1},
+        {(unsigned)fakeldrASMpMTEFromHandle,1},
+        {(unsigned)fakeldrOpenPath,         1},
+        {(unsigned)fakeLDRClearSem,         1},
+        {(unsigned)fakeldrFindModule,       1},
+        {(unsigned)fakeKSEMRequestMutex,    1},
+        {(unsigned)fakeKSEMReleaseMutex,    1},
+        {(unsigned)fakeKSEMQueryMutex,      1},
+        {(unsigned)fakeKSEMInit,            1},
+        {(unsigned)&fakeLDRSem,             3},
+        {(unsigned)&fakeLDRLibPath,         3},
+        {(unsigned)fakeTKSuBuff,            1},
+        {(unsigned)fakeTKFuBuff,            1},
+        {(unsigned)fakeTKFuBufLen,          1},
+        {(unsigned)fakeldrValidateMteHandle,1},
+        {(unsigned)&fakepTCBCur,            4},
+        {(unsigned)&fakepPTDACur,           4},
+        {(unsigned)&fakeptda_start,         4},
+        {(unsigned)&fakeptda_environ,       4},
+        {(unsigned)&fakeptda_ptdasem,       4},
+        {(unsigned)&fakeptda_module,        4},
+        {(unsigned)&fakeptda_pBeginLIBPATH, 4},
+        {(unsigned)&fakeldrpFileNameBuf,    3},
+        {(unsigned)&fakeSecPathFromSFN,     3}
     };
     int i;
 
-    /* loop thru procs */
-    for (i = 0; aProcs[i] != NULL; i++)
+    for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
     {
-        unsigned cb;
-        printf("Proc.no.%i\n", i);
-        if (i < 14 || i > 16)
-            cb = interpretFunctionProlog32(aProcs[i], i < 5 || i == 13);
-        else
-            cb = interpretFunctionProlog16(aProcs[i], FALSE);
-        printf(" cb=%d\n\n", cb);
-    }
+        switch (aImportTab[i].fType)
+        {
+            case EPT_PROC32:
+                if (aTstFakers[i].fObj != 1)
+                    kprintf(("R3TstFixImportTab: invalid segment config for entry %i. (PROC32)\n", i));
+                break;
+            case EPT_PROCIMPORT32:
+                if (aTstFakers[i].fObj != 1)
+                    kprintf(("R3TstFixImportTab: invalid segment config for entry %i. (PROCIMPORT32)\n", i));
+                break;
+            case EPT_PROCIMPORT16:
+                if (aTstFakers[i].fObj != 2)
+                    kprintf(("R3TstFixImportTab: invalid segment config for entry %i. (PROCIMPORT16)\n", i));
+                break;
+            case EPT_VARIMPORT32:
+            case EPT_VARIMPORT16:
+                if (aTstFakers[i].fObj != 3 && aTstFakers[i].fObj != 4)
+                    kprintf(("R3TstFixImportTab: invalid segment config for entry %i. (VARIMPORT32/16)\n", i));
+                break;
+        } /* switch - type */
+
+        aImportTab[i].ulAddress = aTstFakers[i].uAddress;
+        switch (aTstFakers[i].fObj)
+        {
+            case 1:
+                aImportTab[i].usSel = GetSelectorCODE32();
+                aImportTab[i].offObject = aTstFakers[i].uAddress - (unsigned)&CODE32START;
+                break;
+            case 2:
+                aImportTab[i].usSel = GetSelectorCODE16();
+                aImportTab[i].offObject = aTstFakers[i].uAddress - (unsigned)&CODE16START;
+                break;
+            case 3:
+                aImportTab[i].usSel = GetSelectorDATA32();
+                aImportTab[i].offObject = aTstFakers[i].uAddress - (unsigned)&DATA32START;
+                break;
+            case 4:
+                aImportTab[i].usSel = GetSelectorDATA16();
+                aImportTab[i].offObject = aTstFakers[i].uAddress - (unsigned)&DATA16START;
+                break;
+            default:
+                kprintf(("R3TstFixImportTab: invalid segment config for entry %i.\n", i));
+        }
+    } /* for */
 }
 #endif
+
+/**
+ * Dummy nop function if SecPathFromSFN isn't found.
+ */
+PSZ SECCALL nopSecPathFromSFN(SFN hFile)
+{
+    NOREF(hFile);
+    return NULL;
+}
Index: trunk/src/win32k/dev32/devfirst.asm
===================================================================
--- trunk/src/win32k/dev32/devfirst.asm	(revision 4152)
+++ trunk/src/win32k/dev32/devfirst.asm	(revision 4164)
@@ -1,3 +1,3 @@
-; $Id: devfirst.asm,v 1.5 2000-02-25 18:15:03 bird Exp $
+; $Id: devfirst.asm,v 1.6 2000-09-02 21:07:58 bird Exp $
 ;
 ; DevFirst - entrypoint and segment definitions
@@ -19,8 +19,10 @@
 ;
     public CODE16START
+    public CODE16_INITSTART
     public DATA16START
     public DATA16START
     public DATA16_BSSSTART
     public DATA16_CONSTSTART
+    public DATA16_INITSTART
     public CODE16START
     public CODE32START
@@ -60,4 +62,5 @@
 ;$win32ki entry point
 _strategyAsm0:
+;    int 3
     push    0
     jmp     _strategyAsm
@@ -65,4 +68,5 @@
 ;$win32k entry point
 _strategyAsm1:
+;    int 3
     push    1
     jmp     _strategyAsm
@@ -101,5 +105,5 @@
     call    far ptr FLAT:GETKERNELINFO32
     pop     ds
-    retn
+    ret
 _CallGetKernelInfo32 ENDP
 
@@ -155,5 +159,5 @@
 ; @author    knut st. osmundsen
 ; @remark    es is cs, not ds!
-_SSToDS_16a proc near
+_SSToDS_16a proc NEAR
     assume CS:CODE16, DS:DATA16, ES:NOTHING
     mov     edx, ds:_TKSSBase16         ; get pointer held by _TKSSBase16 (pointer to stack base)
@@ -168,5 +172,5 @@
     mov     edx, eax
     shr     edx, 16                     ; dx high 16-bit of 32-bit stack pointer.
-    ret
+    retn
 _SSToDS_16a endp
 
@@ -218,4 +222,7 @@
 CODE32 ends
 
+CODE16_INIT segment
+CODE16_INITSTART label byte
+CODE16_INIT ends
 
 DATA16 segment
@@ -231,4 +238,8 @@
 DATA16_CONST ends
 
+DATA16_INIT segment
+DATA16_INITSTART label byte
+DATA16_INIT ends
+
 DATA32 segment
 DATA32START label byte
Index: trunk/src/win32k/dev32/devlast.asm
===================================================================
--- trunk/src/win32k/dev32/devlast.asm	(revision 4152)
+++ trunk/src/win32k/dev32/devlast.asm	(revision 4164)
@@ -1,3 +1,3 @@
-; $Id: devlast.asm,v 1.5 2000-02-25 18:15:03 bird Exp $
+; $Id: devlast.asm,v 1.6 2000-09-02 21:07:58 bird Exp $
 ;
 ; DevLast - the object file termintating the resident part of the objects.
@@ -21,9 +21,12 @@
 ; Exported symbols
 ;
-    public CODE16END
     public DATA16END
     public DATA16_BSSEND
     public DATA16_CONSTEND
+    public DATA16_INITEND
+    public DATA16_INIT_BSSEND
+    public DATA16_INIT_CONSTEND
     public CODE16END
+    public CODE16_INITEND
     public CODE32END
     public DATA32END
@@ -32,4 +35,5 @@
     public _VFTEND
     public EH_DATAEND
+
     public _CallR0Init32
     public _CallVerifyImportTab32
@@ -52,11 +56,24 @@
 DATA16_CONST ends
 
+DATA16_INIT segment
+DATA16_INITEND db ?
+DATA16_INIT ends
+
+DATA16_INIT_BSS segment
+DATA16_INIT_BSSEND db ?
+DATA16_INIT_BSS ends
+
+DATA16_INIT_CONST segment
+DATA16_INIT_CONSTEND db ?
+DATA16_INIT_CONST ends
+
+CODE16 segment
+CODE16END db ?
+CODE16 ends
 
 extrn R0INIT32:FAR
 extrn VERIFYIMPORTTAB32:FAR
 
-CODE16 segment
-CODE16END db ?
-
+CODE16_INIT segment
 ;;
 ; Thunk procedure for R0Init32.
@@ -67,5 +84,5 @@
 ; @author    knut st. osmundsen
 _CallR0Init32 PROC NEAR
-    ASSUME CS:CODE16
+    ASSUME CS:CODE16_INIT
     push    ds
     push    word ptr [esp+6]            ; push high word.
@@ -73,5 +90,5 @@
     call    far ptr FLAT:R0INIT32
     pop     ds
-    retn
+    ret
 _CallR0Init32 ENDP
 
@@ -84,12 +101,13 @@
 ; @author    knut st. osmundsen
 _CallVerifyImportTab32 PROC NEAR
-    ASSUME CS:CODE16
+    ASSUME CS:CODE16_INIT
     push    ds
     call    far ptr FLAT:VERIFYIMPORTTAB32
     pop     ds
-    retn
+    ret
 _CallVerifyImportTab32 ENDP
 
-CODE16 ends
+CODE16_INITEND LABEL BYTE
+CODE16_INIT ends
 
 
@@ -118,4 +136,5 @@
 EH_DATA ends
 
+
 END
 
Index: trunk/src/win32k/elf2lx/elf2lx.cpp
===================================================================
--- trunk/src/win32k/elf2lx/elf2lx.cpp	(revision 4152)
+++ trunk/src/win32k/elf2lx/elf2lx.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: elf2lx.cpp,v 1.3 2000-02-27 02:13:19 bird Exp $
+/* $Id: elf2lx.cpp,v 1.4 2000-09-02 21:07:58 bird Exp $
  *
  * Elf2Lx - implementation.
@@ -28,4 +28,6 @@
 #include <newexe.h>                     /* OS/2 NE structs and definitions. */
 #include <exe386.h>                     /* OS/2 LX structs and definitions. */
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 
 #include "malloc.h"                     /* win32k malloc (resident). Not C library! */
Index: trunk/src/win32k/include/LdrCalls.h
===================================================================
--- trunk/src/win32k/include/LdrCalls.h	(revision 4152)
+++ trunk/src/win32k/include/LdrCalls.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: LdrCalls.h,v 1.3 2000-01-22 18:21:00 bird Exp $
+/* $Id: LdrCalls.h,v 1.4 2000-09-02 21:08:02 bird Exp $
  *
  * Prototypes for the loader overrided function.
@@ -35,10 +35,10 @@
  */
 extern ULONG LDRCALL ldrOpen(   /* retd  0x0c */
-    PSFN p1,                    /* ebp + 0x08 */
-    PCHAR p2,                   /* ebp + 0x0c */
-    ULONG p3                    /* ebp + 0x10 */
-    );
-
-ULONG LDRCALL myldrOpen(PSFN,PCHAR,ULONG);
+    PSFN    p1,                 /* ebp + 0x08 */
+    PCHAR   p2,                 /* ebp + 0x0c */
+    PULONG  p3                  /* ebp + 0x10 */
+    );
+
+ULONG LDRCALL myldrOpen(PSFN phFile, PSZ pszFilename, PULONG pfl);
 
 
@@ -47,19 +47,19 @@
  */
 extern ULONG LDRCALL ldrRead(   /* retd  0x18 */
-    SFN p1,                     /* ebp + 0x08 */
-    ULONG p2,                   /* ebp + 0x0c */
-    PVOID p3,                   /* ebp + 0x10 */
-    ULONG p4,                   /* ebp + 0x14 */
-    ULONG p5,                   /* ebp + 0x18 */
-    PMTE p6                     /* ebp + 0x1c */
+    SFN     hFile,              /* ebp + 0x08 */
+    ULONG   ulOffset,           /* ebp + 0x0c */
+    PVOID   pvBuffer,           /* ebp + 0x10 */
+    ULONG   fpBuffer,           /* ebp + 0x14 */
+    ULONG   cbToRead,           /* ebp + 0x18 */
+    PMTE    pMTE                /* ebp + 0x1c */
     );
 
 ULONG LDRCALL myldrRead(
-    SFN   hFile,
-    ULONG ulOffset,
-    PVOID pBuffer,
-    ULONG ulFlags ,
-    ULONG ulBytesToRead,
-    PMTE  pMTE
+    SFN     hFile,
+    ULONG   ulOffset,
+    PVOID   pvBuffer,
+    ULONG   fpBuffer,
+    ULONG   cbToRead,
+    PMTE    pMTE
     );
 
@@ -99,72 +99,136 @@
 
 
-#if 0
-/****************************************/
-/* _LDRLoadExe                          */
-/****************************************/
-extern int LDRCALL _LDRLoadExe(     /* retd  0x08 */
-        PCHAR pExeName,             /* ebp + 0x08 */
-        PULONG param2               /* ebp + 0x0c */
-    );
-
-int LDRCALL myLDRLoadExe(PCHAR,PULONG);
-
-
-
-/****************************************/
-/* _ldrGetResource                      */
-/****************************************/
-extern int LDRCALL _ldrGetResource( /* retd 0x14 - 20d */
-        USHORT idType,              /* ebp + 0x08 */
-        ULONG  idName,              /* ebp + 0x0c */
-        USHORT hMod,                /* ebp + 0x10 */
-        PPVOID ppRes,               /* ebp + 0x14 */
-        ULONG ulP5                  /* ebp + 0x18 */
-    );
-
-int LDRCALL myldrGetResource(USHORT,ULONG,USHORT,PPVOID,ULONG);
-
-
-
-/****************************************/
-/* _ldrOpenNewExe                       */
-/****************************************/
-extern int LDRCALL _ldrOpenNewExe(  /* retd 0x10 - 16d */
-        PCHAR  pszName,             /* ebp + 0x08 */
-        USHORT lenName,             /* ebp + 0x0c */
-        ULONG  ulP3,                /* ebp + 0x10 */
-        ULONG  ulP4                 /* ebp + 0x14 */
-    );
-
-int LDRCALL myldrOpenNewExe(PCHAR,USHORT,ULONG,ULONG);
-
-
-
-/****************************************/
-/* _ldrCreateMte                        */
-/****************************************/
-extern int LDRCALL  _ldrCreateMte(  /* retd  0x08 */
-        ULONG p1,                   /* ebp + 0x08 */
-        ULONG p2                    /* ebp + 0x0c */
-    );
-
-int LDRCALL myldrCreateMte(ULONG,ULONG);
-
-
-
-/****************************************/
-/* _ldrGetMte                           */
-/****************************************/
-extern int LDRCALL  _ldrGetMte(     /* retd 0x14 - 20d */
-        ULONG  p1,                  /* ebp + 0x08 */
-        ULONG  p2,                  /* ebp + 0x0c */
-        ULONG  p3,                  /* ebp + 0x10 */
-        ULONG  p4,                  /* ebp + 0x14 */
-        ULONG  p5                   /* ebp + 0x18 */
-    );
-
-int LDRCALL myldrGetMte(ULONG,ULONG,ULONG,ULONG,ULONG);
-
-#endif
+
+/**
+ * Loader local variables from KERNEL.SDF.
+ */
+typedef struct ldrlv_s /* #memb 12 size 39 (0x027) */
+{
+    PMTE        lv_pmte;                /* Pointer to mte. (ldrCreateMte/ldrXXX) */
+    ULONG       lv_lbufaddr;
+    ULONG       lv_sbufaddr;
+    ULONG       lv_lrecbufaddr;
+    ULONG       lv_srecbufaddr;
+    ULONG       lv_new_exe_off;
+    USHORT      lv_sfn;                 /* Handle to the module being loaded */
+    USHORT      lv_hobmte;
+    ULONG       lv_objnum;
+    ULONG       lv_csmte;               /* size of the swappable mte heap block. (ldrCreateMte) */
+    USHORT      lv_class;               /* Object class CLASS_* defines in OS2Krnl (mteflags1) it seems. */
+                                        /* CLASS_PROGRAM    Program class. */
+                                        /* CLASS_GLOBAL     Global class. */
+                                        /* CLASS_SPECIFIC   Specific class, as against global. */
+                                        /* CLASS_ALL (0)    Nonspecific class  all modules. */
+                                        /* CLASS_MASK       Class mask. */
+    UCHAR       lv_type;                /* Type of executable image expected loaded. */
+} ldrlv_t;
+
+
+/*
+ * Values of the lv_type byte. (Qualified guesses.)
+ */
+#define LVTYPE_EXE      0               /* Executable program. */
+#define LVTYPE_DLL      1               /* Dynamic Link Library. */
+#define LVTYPE_DD       2               /* Device Driver. */
+#define LVTYPE_IFS      3               /* Installable Filesystem. */
+#define LVTYPE_VDD      4               /* Virtual Device Driver (for VDMs). */
+
+
+
+/**
+ * ldrOpenPath
+ * @returns   OS2 return code.
+ *            pLdrLv->lv_sfn  is set to filename handle.
+ * @param     pachModname   Pointer to modulename. Not zero terminated!
+ * @param     cchModname    Modulename length.
+ * @param     pLdrLv        Loader local variables? (Struct from KERNEL.SDF)
+ * @param     pfl           Pointer to flags which are passed on to ldrOpen.
+ * @sketch
+ *  if !CLASS_GLOBAL or miniifs then
+ *      ldrOpen(pachModName)
+ *  else
+ *      loop until no more libpath elements
+ *          get next libpath element and add it to the modname.
+ *          try open the modname
+ *          if successfull then break the loop.
+ *      endloop
+ *  endif
+ */
+extern ULONG LDRCALL ldrOpenPath(   /* retd  0x10 */
+    PCHAR       pachFilename,       /* ebp + 0x08 */
+    USHORT      cchFilename,        /* ebp + 0x0c */
+    ldrlv_t *   plv,                /* ebp + 0x10 */
+    PULONG      pful                /* ebp + 0x14 */
+    );
+
+ULONG LDRCALL myldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful);
+
+
+/**
+ * Finds a module if it's loaded.
+ * @returns     NO_ERROR on success.
+ *              OS/2 errorcode on error.
+ * @param       pachFilename    Pointer to module filename.
+ * @param       cchFilename     Length of modulefilename.
+ * @param       usClass         Module class. (CLASS_*)
+ * @param       ppMTE           Pointer to pMTE found.
+ * @sketch
+ */
+ULONG LDRCALL ldrFindModule(PCHAR pachFilename, USHORT cchFilename, USHORT usClass, PPMTE ppMTE);
+
+
+/**
+ * LDRClearSem - Clears the loader semaphore.
+ * (It does some garbage collection on release.)
+ * @returns   NO_ERROR on success.
+ *            OS/2 error on failure. (ERROR_INTERRUPT?)
+ */
+extern ULONG LDRCALL LDRClearSem(void);
+
+
+/**
+ * LDRRequestSem - Requests the loader semaphore..
+ * @returns   NO_ERROR if succesfully.
+ *            OS2 errorcode on failure. (ERROR_INTERRUPT?)
+ */
+#define LDRRequestSem()   KSEMRequestMutex(pLdrSem, (ULONG)-1)
+
+
+/*
+ * Pointer to the loader semaphore.
+ */
+#ifdef _OS2KSEM_h_
+extern PKSEMMTX    pLdrSem;
+#endif
+
+
+/**
+ * Validates an hMTE and gets the MTE pointer.
+ * @returns   Pointer to MTE on success.
+ *            NULL on error.
+ * @param     hMTE  MTE handle.
+ * @remark    If you wan't to this faster:
+ *              Use the hMTE as a HOB and get the HOB address (by using VMGetHandleInfo).
+ */
+extern PMTE LDRCALL ldrValidateMteHandle(HMTE hMTE);
+
+
+/**
+ * Gets the pMTE from a hMTE. No checks.
+ * @returns     Pointer to the pMTE for a given hMTE.
+ * @param       hMTE    Module handle.
+ * @sketch
+ */
+extern PMTE KRNLCALL ldrASMpMTEFromHandle(HMTE  hMTE);
+
+
+/**
+ * Pointer to the loader filename buffer.
+ * Upon return from ldrOpen (and ldrOpenPath which calls ldrOpen) this is
+ * set to the fully qualified filename of the file last opened (successfully).
+ */
+extern PSZ *pldrpFileNameBuf;
+#define ldrpFileNameBuf (*pldrpFileNameBuf)
+
 
 #ifdef __cplusplus
Index: trunk/src/win32k/include/ModuleBase.h
===================================================================
--- trunk/src/win32k/include/ModuleBase.h	(revision 4152)
+++ trunk/src/win32k/include/ModuleBase.h	(revision 4164)
@@ -1,13 +1,13 @@
-/* $Id: ModuleBase.h,v 1.3 2000-02-27 02:16:43 bird Exp $
+/* $Id: ModuleBase.h,v 1.4 2000-09-02 21:07:59 bird Exp $
  *
  * ModuleBase - Declaration of the Basic module class.
  *
- * Copyright (c) 1999 knut st. osmundsen
+ * Copyright (c) 1999-2000 knut st. osmundsen
  *
  * Project Odin Software License can be found in LICENSE.TXT
  *
  */
-#ifndef _MODULEBASE_H_
-#define _MODULEBASE_H_
+#ifndef _modulebase_h_
+#define _modulebase_h_
 
 
@@ -73,6 +73,6 @@
  *           RING0: Map this to ldrRead with 0UL as flFlags.
  *           RING3: Implementes this function as a static function, ReadAt.
- *  ReadAtF: Same as ReadAt but two extra parameters; an additional flag and a pointer to an MTE.
- *           Used in the read method.
+ *  ReadAtF: Same as ReadAt but two extra parameters; an additional far pointer to the buffer and
+ *           a MTE pointer. Used in the read method.
  *           RING0: Map directly to ldrRead.
  *           RING3: Map to ReadAt, ignoring the two extra parameters.
@@ -81,8 +81,8 @@
     #define ReadAt(hFile, ulOffset, pvBuffer, cbToRead) \
         ldrRead(hFile, ulOffset, pvBuffer, 0UL, cbToRead, NULL)
-    #define ReadAtF(hFile, ulOffset, pvBuffer, cbToRead, flFlags, pMTE) \
-        ldrRead(hFile, ulOffset, pvBuffer, flFlags, cbToRead, pMTE)
+    #define ReadAtF(hFile, ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE) \
+        ldrRead(hFile, ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE)
 #else
-    #define ReadAtF(hFile, ulOffset, pvBuffer, cbToRead, flFlags, pMTE) \
+    #define ReadAtF(hFile, ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE) \
         ReadAt(hFile, ulOffset, pvBuffer, cbToRead)
 #endif
@@ -96,5 +96,10 @@
 #endif
 
-
+/*
+ * Make sure that pLdrLv is defined.
+ */
+#if !defined(RING0) && !defined(_ldrCalls_h_)
+typedef struct ldrlv_s  ldrlv_t;
+#endif
 
 /**
@@ -111,15 +116,18 @@
 
     /** @cat Public Main methods */
-    virtual ULONG  init(PCSZ pszFilename);
-    virtual ULONG  read(ULONG offLXFile, PVOID pvBuffer, ULONG cbToRead, ULONG flFlags, PMTE pMTE) = 0;
-    virtual ULONG  applyFixups(PMTE pMTE, ULONG iObject, ULONG iPageTable, PVOID pvPage,
-                               ULONG ulPageAddress, PVOID pvPTDA); /*(ldrEnum32bitRelRecs)*/
+    virtual ULONG   init(PCSZ pszFilename);
+    virtual ULONG   read(ULONG offLXFile, PVOID pvBuffer, ULONG fpBuffer, ULONG cbToRead, PMTE pMTE) = 0;
+    virtual ULONG   applyFixups(PMTE pMTE, ULONG iObject, ULONG iPageTable, PVOID pvPage,
+                                ULONG ulPageAddress, PVOID pvPTDA); /*(ldrEnum32bitRelRecs)*/
+    virtual ULONG   openPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *pLdrLv, PULONG pful); /* (ldrOpenPath) */
     #ifndef RING0
-    virtual ULONG  writeFile(PCSZ pszLXFilename);
+    virtual ULONG   writeFile(PCSZ pszLXFilename);
     #endif
 
     /** @cat public Helper methods */
-    virtual VOID   dumpVirtualLxFile() = 0;
-    BOOL           queryIsModuleName(PCSZ pszFilename);
+    virtual VOID    dumpVirtualLxFile() = 0;
+    BOOL            queryIsModuleName(PCSZ pszFilename);
+    PCSZ            getFilename();
+    PCSZ            getModuleName();
 
     /** @cat static print method */
@@ -133,5 +141,5 @@
     SFN         hFile;                  /* filehandle */
     PSZ         pszFilename;            /* fullpath */
-    PSZ         pszModuleName;          /* filename without extention. */
+    PSZ         pszModuleName;          /* filename without path and extention. */
 
     /** @cat public static data. */
Index: trunk/src/win32k/include/OS2KPTDA.h
===================================================================
--- trunk/src/win32k/include/OS2KPTDA.h	(revision 4152)
+++ trunk/src/win32k/include/OS2KPTDA.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2KPTDA.h,v 1.1 2000-07-16 22:21:19 bird Exp $
+/* $Id: OS2KPTDA.h,v 1.2 2000-09-02 21:07:59 bird Exp $
  *
  * PTDA access functions.
@@ -54,6 +54,7 @@
 
 
-USHORT  ptdaGet_ptda_environ(PPTDA pPTDA);
-
+USHORT      ptdaGet_ptda_environ(PPTDA pPTDA);
+USHORT      ptdaGet_ptda_module(PPTDA pPTDA);
+HKSEMMTX    ptda_ptda_ptdasem(PPTDA pPTDA);
 
 #ifdef __cplusplus
Index: trunk/src/win32k/include/OS2KSEC.h
===================================================================
--- trunk/src/win32k/include/OS2KSEC.h	(revision 4164)
+++ trunk/src/win32k/include/OS2KSEC.h	(revision 4164)
@@ -0,0 +1,22 @@
+/* $Id: OS2KSEC.h,v 1.2 2000-09-02 21:07:59 bird Exp $
+ *
+ * OS/2 Kernel Security helpers : prototypes, typedefs and macros.
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+#ifndef _OS2KSEC_h_
+#define _OS2KSEC_h_
+
+
+/**
+ * Gets the path (name with fully qualified path) from a SFN.
+ * @returns     Pointer to the path of hFile.
+ * @param       hFile   SFN filehandle.
+ */
+PSZ SECCALL SecPathFromSFN(SFN hFile);
+
+
+#endif
+
Index: trunk/src/win32k/include/OS2KSEM.h
===================================================================
--- trunk/src/win32k/include/OS2KSEM.h	(revision 4152)
+++ trunk/src/win32k/include/OS2KSEM.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2KSEM.h,v 1.1 2000-07-16 22:21:19 bird Exp $
+/* $Id: OS2KSEM.h,v 1.2 2000-09-02 21:07:59 bird Exp $
  *
  * OS/2 kernel Semaphore functions.
@@ -16,6 +16,22 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-#define KSEM_INDEFINITE_WAIT     -1L
-#define KSEM_IMMEDIATE_RETURN     0L
+#define KSEM_INDEFINITE_WAIT       -1UL
+#define KSEM_IMMEDIATE_RETURN       0UL
+
+/*
+ * Semaphore type. ( Used with the generic KSEM routines. )
+ */
+#define KSEM_EVENT                  0
+#define KSEM_MUTEX                  1
+#define KSEM_SHARED                 2
+
+/*
+ * Sempahore flags. (according to SG24-4640-00)
+ */
+#define KSEM_DEFAULT                0
+#define KSEM_NOINTERRUPT            1
+#define KSEM_WRITE                  2
+#define KSEM_DISPLAYID              4
+#define KSEM_NOBLOCKED              8
 
 
@@ -23,8 +39,112 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
-typedef ULONG  HKSEM;                   /* Handle to kernel semaphore. */
-typedef HKSEM  PHKSEM;                  /* Pointer to kernel semaphore handle. */
-typedef HKSEM  HKMTX;                   /* Handle to kernel mutex semaphore. */
-typedef HKSEM  HKEV;                    /* Handle to kernel event semaphore. */
+/* (This is according to SG24-4640-00.) */
+
+typedef struct _KSEMSHR
+{
+    /**
+     * Astrict 16 is byte while retail 12 is bytes.
+     * We'll reserve 20 bytes just to be sure!.
+     */
+    char achDummy[20];
+
+    struct
+    {
+        char            ks_achSignature[4];
+        char            ks_bFlags;
+        char            ks_bType;
+        unsigned short  ks_Owner;
+        unsigned short  ks_cusPendingWriters;
+        unsigned short  ks_cusNest;
+        unsigned short  ks_cusReaders;
+        unsigned short  ks_cusPendingReaders;
+    } debug;
+
+    struct
+    {
+        char            ks_bFlags;
+        char            ks_bType;
+        unsigned short  ks_Owner;
+        unsigned short  ks_cusPendingWriters;
+        unsigned short  ks_cusNest;
+        unsigned short  ks_cusReaders;
+        unsigned short  ks_cusPendingReaders;
+    } release;
+
+}   KSEMSHR,
+   *PKSEMSHR,
+   *HKSEMSHR;                           /* Handle to kernel shared semphore. */
+typedef HKSEMSHR * PHKSEMSHR;
+
+
+typedef union _KSEMMTX
+{
+    /**
+     * Astrict is 12 byte while retail is 8 bytes.
+     * We'll reserve 20 bytes just to be sure!
+     */
+    char achDummy[20];
+
+    struct
+    {
+        char            ksem_achSignature[4];
+        char            ksem_bFlags;
+        char            ksem_bType;
+        unsigned short  ksem_Owner;
+        unsigned short  ksem_cusPendingWriters;
+        unsigned short  ksem_cusNest;
+    }debug;
+    struct
+    {
+        char            ksem_bFlags;
+        char            ksem_bType;
+        unsigned short  ksem_Owner;
+        unsigned short  ksem_cusPendingWriters;
+        unsigned short  ksem_cusNest;
+    } release;
+}   KSEMMTX,
+   *PKSEMMTX,
+   *HKSEMMTX;                           /* Handle to kernel mutex semaphore. */
+typedef HKSEMMTX * PHKSEMMTX;
+
+
+typedef struct _KSEMEVT
+{
+    /**
+     * Astrict is 16 byte while retail is 12 bytes.
+     * We'll reserve 20 bytes just to be sure!
+     */
+    char achDummy[20];
+
+    struct
+    {
+        char            kse_achSignature[4];
+        char            kse_bFlags;
+        char            kse_bType;
+        unsigned short  kse_Owner;
+        unsigned short  kse_cusPendingWriters;
+    } debug;
+
+    struct
+    {
+        char            kse_bFlags;
+        char            kse_bType;
+        unsigned short  kse_Owner;
+        unsigned short  kse_cusPendingWriters;
+    } release;
+
+}   KSEMEVT,
+   *PKSEMEVT,
+   *HKSEMEVT;                           /* Handle to kernel event sempahore. */
+typedef HKSEMEVT * PHKSEMEVT;
+
+
+typedef union _KSEM
+{
+    KSEMSHR shr;
+    KSEMMTX mtx;
+    KSEMEVT evt;
+} KSEM, *PKSEM, *HKSEM;                 /* Generic kernel semaphore handle. */
+typedef HKSEM * PHKSEM;
 
 
@@ -34,9 +154,8 @@
 /*
  * Mutex semaphores.
- * NOTE! Only is KSEMRequestMutex currently is imported!
  */
-extern ULONG KRNLCALL KSEMRequestMutex(HKMTX hkmtx, ULONG ulTimeout);
-extern VOID  KRNLCALL KSEMReleaseMutex(HKMTX hkmtx);
-extern ULONG KRNLCALL KSEMQueryMutex(HKMTX hkmtx, PUSHORT pus);
+extern ULONG KRNLCALL KSEMRequestMutex(HKSEMMTX hkmtx, ULONG ulTimeout);
+extern VOID  KRNLCALL KSEMReleaseMutex(HKSEMMTX hkmtx);
+extern ULONG KRNLCALL KSEMQueryMutex(HKSEMMTX hkmtx, PUSHORT pcusNest);
 
 
@@ -48,8 +167,10 @@
 extern VOID  KRNLCALL KSEMPostEvent(HKEV hkevent);
 extern ULONG KRNLCALL KSEMWaitEvent(HKEV hkevent);
+#endif
 
 /*
  * Some other KSEM prefixed functions - parameters's not that obvious...
  */
+#if 0
 extern ULONG KRNLCALL KSEMAlloc(PHKSEM phksem, ULONG p1, ULONG p2);
 extern ULONG KRNLCALL KSEMCreate(PHKSEM phksem, ULONG type);
@@ -57,5 +178,7 @@
 extern ULONG KRNLCALL KSEMRequestShared(HKSEM hksem, ULONG);
 extern VOID  KRNLCALL KSEMDestroy(HKSEM hksem);
-extern VOID  KRNLCALL KSEMInit(HKSEM hksem, ULONG p1, ULONG p2);
+#endif
+extern VOID  KRNLCALL KSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags);
+#if 0
 extern VOID  KRNLCALL KSEMQuery(HKSEM hksem, ULONG p2)
 extern VOID  KRNLCALL KSEMRelease(HKSEM hksem);
Index: trunk/src/win32k/include/OS2KTK.h
===================================================================
--- trunk/src/win32k/include/OS2KTK.h	(revision 4152)
+++ trunk/src/win32k/include/OS2KTK.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2KTK.h,v 1.1 2000-07-16 22:21:18 bird Exp $
+/* $Id: OS2KTK.h,v 1.2 2000-09-02 21:08:00 bird Exp $
  *
  * OS2KTK - OS/2 Kernel Task.
@@ -21,34 +21,34 @@
 
 #define TKFuChar(pch, pchUsr) \
-            TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_FATAL);
+            TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_FATAL)
 #define TKSuChar(pchUsr, pch) \
-            TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_FATAL);
+            TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_FATAL)
 
 #define TKFuCharNF(pch, pchUsr) \
-            TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_NONFATAL);
+            TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_NONFATAL)
 #define TKSuCharNF(pchUsr, pch) \
-            TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_NONFATAL);
+            TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_NONFATAL)
 
 
 #define TKFuUShort(pus, pusUsr) \
-            TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_FATAL);
+            TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_FATAL)
 #define TKSuUShort(pusUsr, pus) \
-            TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_FATAL);
+            TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_FATAL)
 
 #define TKFuUShortNF(pus, pusUsr) \
-            TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_NONFATAL);
+            TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_NONFATAL)
 #define TKSuUShortNF(pusUsr, pus) \
-            TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_NONFATAL);
+            TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_NONFATAL)
 
 
 #define TKFuULong(pul, pulUsr) \
-            TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_FATAL);
+            TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_FATAL)
 #define TKSuULong(pulUsr, pul) \
-            TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_FATAL);
+            TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_FATAL)
 
 #define TKFuULongNF(pul, pulUsr) \
-            TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_NONFATAL);
+            TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_NONFATAL)
 #define TKSuULongNF(pulUsr, pul) \
-            TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_NONFATAL);
+            TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_NONFATAL)
 
 
Index: trunk/src/win32k/include/OS2KVM.h
===================================================================
--- trunk/src/win32k/include/OS2KVM.h	(revision 4152)
+++ trunk/src/win32k/include/OS2KVM.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2KVM.h,v 1.4 2000-04-17 01:56:49 bird Exp $
+/* $Id: OS2KVM.h,v 1.5 2000-09-02 21:08:00 bird Exp $
  *
  * OS/2 kernel VM functions.
@@ -82,7 +82,4 @@
 
 
-typedef USHORT HMTE, *PHMTE;
-typedef USHORT HPTDA, *PHPTDA;
-
 /*******************************************************************************
 *   Exported Functions                                                         *
@@ -108,3 +105,5 @@
     PUSHORT pushPTDA);
 
+PMTE KRNLCALL VMPseudoHandleMap(
+    HMTE    hMTE);
 #endif
Index: trunk/src/win32k/include/OS2Krnl.h
===================================================================
--- trunk/src/win32k/include/OS2Krnl.h	(revision 4152)
+++ trunk/src/win32k/include/OS2Krnl.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2Krnl.h,v 1.7 2000-02-15 23:39:19 bird Exp $
+/* $Id: OS2Krnl.h,v 1.8 2000-09-02 21:08:00 bird Exp $
  *
  * OS/2 kernel structures, typedefs and macros.
@@ -153,4 +153,6 @@
 } MTE,*PMTE,**PPMTE;
 
+typedef USHORT HMTE, *PHMTE;
+typedef USHORT HPTDA, *PHPTDA;
 
 
@@ -228,4 +230,9 @@
 
 /*
+ * Calling convention for Security Helpers.
+ */
+#define SECCALL  _System
+
+/*
  *
  * Other Kernel Parts
@@ -235,4 +242,13 @@
     #define INCL_OS2KRNL_IO
     #define INCL_OS2KRNL_VM
+    #define INCL_OS2KRNL_SEM
+    #define INCL_OS2KRNL_TK
+    #define INCL_OS2KRNL_PTDA
+    #define INCL_OS2KRNL_TCB
+    #define INCL_OS2KRNL_SEC
+#endif
+
+#if defined(INCL_OS2KRNL_PTDA) && !defined(INCL_OS2KRNL_SEM)
+    #define INCL_OS2KRNL_SEM
 #endif
 
@@ -245,3 +261,23 @@
 #endif
 
-#endif
+#ifdef INCL_OS2KRNL_SEM
+    #include <OS2KSEM.h>
+#endif
+
+#ifdef INCL_OS2KRNL_TK
+    #include <OS2KTK.h>
+#endif
+
+#ifdef INCL_OS2KRNL_PTDA
+    #include <OS2KPTDA.h>
+#endif
+
+#ifdef INCL_OS2KRNL_TCB
+    #include <OS2KTCB.h>
+#endif
+
+#ifdef INCL_OS2KRNL_SEC
+    #include <OS2KSEC.h>
+#endif
+
+#endif
Index: trunk/src/win32k/include/dev16.h
===================================================================
--- trunk/src/win32k/include/dev16.h	(revision 4152)
+++ trunk/src/win32k/include/dev16.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: dev16.h,v 1.8 2000-02-25 18:15:04 bird Exp $
+/* $Id: dev16.h,v 1.9 2000-09-02 21:08:00 bird Exp $
  * dev16 - 16-bit specific. Should not be used in 32-bit C/C++.
  *
@@ -113,5 +113,7 @@
 USHORT NEAR R0Init16(PRP_GENIOCTL pRp);
 USHORT NEAR initGetDosTableData(void);
-
+#if 0 /*ndef CODE16_INIT*/
+#pragma alloc_text(CODE16_INIT, dev0Init, dev1Init, R0Init16, initGetDosTableData)
+#endif
 
 /*
@@ -123,4 +125,7 @@
 USHORT NEAR CallElfIOCtl(LIN pRpIOCtl);
 USHORT NEAR CallWin32kIOCtl(LIN pRpIOCtl);
+#if 0 /*ndef CODE16_INIT*/
+#pragma alloc_text(CODE16_INIT, CallR0Init32, CallVerifyImportTab32, CallGetKernelInfo32)
+#endif
 
 
@@ -148,15 +153,17 @@
 #define SSToDS_16(pStackVar) (SSToDS_16a((void NEAR *)pStackVar))
 
-extern LIN   SSToDS_16a(void NEAR *pStackVar);
+extern LIN NEAR SSToDS_16a(void NEAR *pStackVar);
 
 /*
  * START and END labels. NOTE: these are not bytes only assembly labels.
  */
-extern char PASCAL CODE16START      ;
-extern char PASCAL DATA16START      ;
 extern char PASCAL DATA16START      ;
 extern char PASCAL DATA16_BSSSTART  ;
 extern char PASCAL DATA16_CONSTSTART;
+extern char PASCAL DATA16_INITSTART      ;
+extern char PASCAL DATA16_INIT_BSSSTART  ;
+extern char PASCAL DATA16_INIT_CONSTSTART;
 extern char PASCAL CODE16START      ;
+extern char PASCAL CODE16_INITSTART      ;
 extern char PASCAL CODE32START      ;
 extern char PASCAL DATA32START      ;
@@ -168,8 +175,11 @@
 extern char PASCAL CODE16END      ;
 extern char PASCAL DATA16END      ;
-extern char PASCAL DATA16END      ;
 extern char PASCAL DATA16_BSSEND  ;
 extern char PASCAL DATA16_CONSTEND;
+extern char PASCAL DATA16_INITEND      ;
+extern char PASCAL DATA16_INIT_BSSEND  ;
+extern char PASCAL DATA16_INIT_CONSTEND;
 extern char PASCAL CODE16END      ;
+extern char PASCAL CODE16_INITEND      ;
 extern char PASCAL CODE32END      ;
 extern char PASCAL DATA32END      ;
@@ -180,5 +190,3 @@
 
 
-
-
 #endif
Index: trunk/src/win32k/include/dev1632.h
===================================================================
--- trunk/src/win32k/include/dev1632.h	(revision 4152)
+++ trunk/src/win32k/include/dev1632.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: dev1632.h,v 1.5 2000-04-05 18:40:41 bird Exp $
+/* $Id: dev1632.h,v 1.6 2000-09-02 21:08:00 bird Exp $
  * dev1632.h - Common header file for 16-bit and 32-bit C
  *
@@ -50,8 +50,8 @@
 typedef struct _KRNLINFO
 {
+    unsigned long   ulBuild;
+    unsigned short  fKernel;
     unsigned char   cObjects;
-    unsigned char   fDebug;
-    unsigned char   fchType;             /* TYPE_SMP, TYPE_UNI, TYPE_W4 */
-    unsigned short  usBuild;
+    unsigned char   chPadding;
     OTE             aObjects[MAXKRNLOBJECTS];
 } KRNLINFO, FAR * PKRNLINFO;
@@ -64,3 +64,15 @@
 
 #pragma pack()
+
+
+/*
+ * Global data...
+ */
+extern CHAR DATA16_GLOBAL   szBuildDate[];
+extern CHAR DATA16_GLOBAL   szBuildTime[];
+#if defined(__IBMC__) || defined(__IBMCPP__)
+    #pragma map( szBuildDate , "_szBuildDate" )
+    #pragma map( szBuildTime , "_szBuildTime" )
 #endif
+
+#endif
Index: trunk/src/win32k/include/dev32.h
===================================================================
--- trunk/src/win32k/include/dev32.h	(revision 4152)
+++ trunk/src/win32k/include/dev32.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: dev32.h,v 1.8 2000-02-25 18:15:04 bird Exp $
+/* $Id: dev32.h,v 1.9 2000-09-02 21:08:00 bird Exp $
  *
  * dev32 - header file for 32-bit part of the driver.
@@ -100,10 +100,12 @@
  * START and END labels. NOTE: these are not bytes only assembly labels.
  */
-extern char CODE16START      ;
-extern char DATA16START      ;
 extern char DATA16START      ;
 extern char DATA16_BSSSTART  ;
 extern char DATA16_CONSTSTART;
+extern char DATA16_INITSTART      ;
+extern char DATA16_INIT_BSSSTART  ;
+extern char DATA16_INIT_CONSTSTART;
 extern char CODE16START      ;
+extern char CODE16_INITSTART      ;
 extern char CODE32START      ;
 extern char DATA32START      ;
@@ -115,8 +117,11 @@
 extern char CODE16END      ;
 extern char DATA16END      ;
-extern char DATA16END      ;
 extern char DATA16_BSSEND  ;
 extern char DATA16_CONSTEND;
+extern char DATA16_INITEND      ;
+extern char DATA16_INIT_BSSEND  ;
+extern char DATA16_INIT_CONSTEND;
 extern char CODE16END      ;
+extern char CODE16_INITEND      ;
 extern char CODE32END      ;
 extern char DATA32END      ;
@@ -126,6 +131,3 @@
 extern char EH_DATAEND     ;
 
-
-
-
 #endif
Index: trunk/src/win32k/include/devSegDf.h
===================================================================
--- trunk/src/win32k/include/devSegDf.h	(revision 4164)
+++ trunk/src/win32k/include/devSegDf.h	(revision 4164)
@@ -0,0 +1,38 @@
+/* $Id: devSegDf.h,v 1.2 2000-09-02 21:08:01 bird Exp $
+ *
+ * Segment stuff used in 16 and 32 bits C/C++.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+#ifndef _devSegDf_h
+#define _devSegDf_h
+
+#ifdef INCL_16
+
+/*
+ * More segment stuff
+ */
+#define DATA16_INIT     _based(_segname("DATA16_INIT"))
+#define DATA16_GLOBAL   _based(_segname("DATA16_GLOBAL"))
+#define DATA16          _based(_segname("DATA16"))
+
+#else
+
+/*
+ * More segment stuff
+ */
+#define DATA16_INIT
+#define DATA16_GLOBAL
+#define DATA16
+
+#endif
+
+
+#endif
+
+
Index: trunk/src/win32k/include/devSegDf.inc
===================================================================
--- trunk/src/win32k/include/devSegDf.inc	(revision 4152)
+++ trunk/src/win32k/include/devSegDf.inc	(revision 4164)
@@ -1,3 +1,3 @@
-; $Id: devSegDf.inc,v 1.5 2000-02-21 09:24:00 bird Exp $
+; $Id: devSegDf.inc,v 1.6 2000-09-02 21:08:01 bird Exp $
 ;
 ; Segment definitions for win32k.sys.
@@ -18,9 +18,34 @@
 DATA16_CONST ends
 
-DATA16_GROUP    group DATA16, DATA16_CONST, DATA16_BSS
+DATA16_GLOBAL segment word public 'FAR_DATA' use16
+DATA16_GLOBAL ends
+
+;DATA16_GROUP    group DATA16, DATA16_CONST, DATA16_BSS, DATA16_GLOBAL
+
+
+DATA16_INIT segment word public 'FAR_DATA' use16
+DATA16_INIT ends
+
+DATA16_INIT_CONST segment word public 'FAR_DATA' use16
+DATA16_INIT_CONST ends
+
+DATA16_INIT_BSS segment word public 'FAR_DATA' use16
+DATA16_INIT_BSS ends
+
+;DATA16_INIT_GROUP   group DATA16_INIT, DATA16_INIT_CONST, DATA16_INIT_BSS
+;
+;A bad trick to make all the 16-bit data segments one
+;
+DATA16_GROUP    group DATA16, DATA16_CONST, DATA16_BSS, DATA16_GLOBAL, DATA16_INIT, DATA16_INIT_CONST, DATA16_INIT_BSS
 
 
 CODE16 segment word public 'CODE' use16
 CODE16 ends
+
+CODE16_INIT segment word public 'CODE' use16
+CODE16_INIT ends
+
+CODE16_IOSEG segment word public 'CODE' use16
+CODE16_IOSEG ends
 
 
@@ -33,5 +58,5 @@
 
 ;DGROUP group BSS32, DATA32
-DGROUP group BSS32, DATA32, CONST32_RO, _VFT, EH_DATA
+DGROUP group CALLTAB, BSS32, DATA32, CONST32_RO, _VFT, c_common, DDE4_DATA32, CTOR_DTOR1, CTOR_DTOR2, CTOR_DTOR3, EH_DATA
 
 DATA32  segment dword public 'DATA' use32
@@ -41,7 +66,18 @@
 c_common ends
 
+DDE4_DATA32  segment dword public 'DATA' use32
+DDE4_DATA32 ends
+
 BSS32 segment dword public 'BSS' use32
 BSS32 ends
 
+CTOR_DTOR1 segment dword public 'DATA' use32
+CTOR_DTOR1 ends
+
+CTOR_DTOR2 segment dword public 'DATA' use32
+CTOR_DTOR2 ends
+
+CTOR_DTOR3 segment dword public 'DATA' use32
+CTOR_DTOR3 ends
 
 ;CONSTGROUP group CONST32_RO, _VFT, EH_DATA
Index: trunk/src/win32k/include/env.h
===================================================================
--- trunk/src/win32k/include/env.h	(revision 4152)
+++ trunk/src/win32k/include/env.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: env.h,v 1.2 2000-04-17 02:26:04 bird Exp $
+/* $Id: env.h,v 1.3 2000-09-02 21:08:01 bird Exp $
  *
  * Environment access functions
@@ -21,5 +21,5 @@
 *******************************************************************************/
 const char *ScanEnv(const char *paszEnv, const char *pszVar);
-const char *GetEnv(void);
+const char *GetEnv(BOOL fExecChild);
 
 
Index: trunk/src/win32k/include/errors.h
===================================================================
--- trunk/src/win32k/include/errors.h	(revision 4164)
+++ trunk/src/win32k/include/errors.h	(revision 4164)
@@ -0,0 +1,95 @@
+/* $Id: errors.h,v 1.2 2000-09-02 21:08:01 bird Exp $
+ *
+ * Error definitions for Win32k.sys
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+#ifndef _errors_h_
+#define _errors_h_
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+
+/*
+ * Probkrnl error codes. (They all begin with ERROR_PROB_.)
+ *
+ * NOTE! ERROR_PROB_KRNL_*  <  ERROR_PROB_SYM_*  <  ERROR_PROB_SYMDB_*
+ */
+#define ERROR_PROB_BASE                             10000
+#define ERROR_PROB_KRNL_FIRST                       ERROR_PROB_KRNL_OPEN_FAILED
+#define ERROR_PROB_KRNL_LAST                        ERROR_PROB_KRNL_OTE_READ
+#define ERROR_PROB_KRNL_OPEN_FAILED                 (ERROR_PROB_BASE + 0)
+#define ERROR_PROB_KRNL_SEEK_SIZE                   (ERROR_PROB_BASE + 2)
+#define ERROR_PROB_KRNL_SEEK_FIRST                  (ERROR_PROB_BASE + 3)
+#define ERROR_PROB_KRNL_READ_FIRST                  (ERROR_PROB_BASE + 4)
+#define ERROR_PROB_KRNL_READ_NEXT                   (ERROR_PROB_BASE + 5)
+#define ERROR_PROB_KRNL_TAG_NOT_FOUND               (ERROR_PROB_BASE + 6)
+#define ERROR_PROB_KRNL_INV_SIGANTURE               (ERROR_PROB_BASE + 7)
+#define ERROR_PROB_KRNL_INV_BUILD_NBR               (ERROR_PROB_BASE + 8)
+#define ERROR_PROB_KRNL_BUILD_VERSION               (ERROR_PROB_BASE + 9)
+#define ERROR_PROB_KRNL_MZ_SEEK                     (ERROR_PROB_BASE + 10)
+#define ERROR_PROB_KRNL_MZ_READ                     (ERROR_PROB_BASE + 11)
+#define ERROR_PROB_KRNL_NEOFF_INVALID               (ERROR_PROB_BASE + 12)
+#define ERROR_PROB_KRNL_NEOFF_SEEK                  (ERROR_PROB_BASE + 13)
+#define ERROR_PROB_KRNL_LX_READ                     (ERROR_PROB_BASE + 14)
+#define ERROR_PROB_KRNL_LX_SIGNATURE                (ERROR_PROB_BASE + 15)
+#define ERROR_PROB_KRNL_OBJECT_CNT                  (ERROR_PROB_BASE + 16)
+#define ERROR_PROB_KRNL_OBJECT_CNR_10               (ERROR_PROB_BASE + 17)
+#define ERROR_PROB_KRNL_OTE_SEEK                    (ERROR_PROB_BASE + 18)
+#define ERROR_PROB_KRNL_OTE_READ                    (ERROR_PROB_BASE + 19)
+#define ERROR_PROB_KRNL_OTE_SIZE_MIS                (ERROR_PROB_BASE + 20)
+
+#define ERROR_PROB_SYM_FIRST                        ERROR_PROB_SYM_FILE_NOT_FOUND
+#define ERROR_PROB_SYM_LAST                         ERROR_PROB_SYMDB_KRNL_NOT_FOUND
+#define ERROR_PROB_SYM_FILE_NOT_FOUND               (ERROR_PROB_BASE + 30)
+#define ERROR_PROB_SYM_READERROR                    (ERROR_PROB_BASE + 31)
+#define ERROR_PROB_SYM_INVALID_MOD_NAME             (ERROR_PROB_BASE + 32)
+#define ERROR_PROB_SYM_SEGS_NE_OBJS                 (ERROR_PROB_BASE + 33)
+#define ERROR_PROB_SYM_SEG_DEF_SEEK                 (ERROR_PROB_BASE + 34)
+#define ERROR_PROB_SYM_SEG_DEF_READ                 (ERROR_PROB_BASE + 35)
+#define ERROR_PROB_SYM_VERIFY_FIRST                 (ERROR_PROB_BASE + 36)
+#define ERROR_PROB_SYM_V_PROC_NOT_FND               (ERROR_PROB_SYM_VERIFY_FIRST + ERROR_D32_PROC_NOT_FOUND      - ERROR_D32_VERIFYIMPORTTAB_FIRST)
+#define ERROR_PROB_SYM_V_OBJ_OR_ADDR                (ERROR_PROB_SYM_VERIFY_FIRST + ERROR_D32_INVALID_OBJ_OR_ADDR - ERROR_D32_VERIFYIMPORTTAB_FIRST)
+#define ERROR_PROB_SYM_V_ADDRESS                    (ERROR_PROB_SYM_VERIFY_FIRST + ERROR_D32_INVALID_ADDRESS     - ERROR_D32_VERIFYIMPORTTAB_FIRST)
+#define ERROR_PROB_SYM_V_PROLOG                     (ERROR_PROB_SYM_VERIFY_FIRST + ERROR_D32_TOO_INVALID_PROLOG  - ERROR_D32_VERIFYIMPORTTAB_FIRST)
+#define ERROR_PROB_SYM_V_NOT_IMPL                   (ERROR_PROB_SYM_VERIFY_FIRST + ERROR_D32_NOT_IMPLEMENTED     - ERROR_D32_VERIFYIMPORTTAB_FIRST)
+/* - reserved for future errors - *
+#define ERROR_PROB_SYM_                             (ERROR_PROB_BASE + 41)
+#define ERROR_PROB_SYM_                             (ERROR_PROB_BASE + 42) */
+#define ERROR_PROB_SYM_IMPORTS_NOTFOUND             (ERROR_PROB_BASE + 43)
+#define ERROR_PROB_SYMDB_KRNL_NOT_FOUND             (ERROR_PROB_BASE + 44)
+
+
+
+/*
+ * D32init Errors
+ */
+#define ERROR_D32_GETOS2KRNL_FAILED                 0x01
+#define ERROR_D32_NO_SWAPMTE                        0x02
+#define ERROR_D32_TOO_MANY_OBJECTS                  0x03
+#define ERROR_D32_NO_OBJECT_TABLE                   0x04
+#define ERROR_D32_BUILD_INFO_NOT_FOUND              0x05
+#define ERROR_D32_INVALID_BUILD                     0x06
+
+#define ERROR_D32_VERIFYIMPORTTAB_FIRST             0x10
+#define ERROR_D32_PROC_NOT_FOUND                    (ERROR_D32_VERIFYIMPORTTAB_FIRST + 0)
+#define ERROR_D32_INVALID_OBJ_OR_ADDR               (ERROR_D32_VERIFYIMPORTTAB_FIRST + 1)
+#define ERROR_D32_INVALID_ADDRESS                   (ERROR_D32_VERIFYIMPORTTAB_FIRST + 2)
+#define ERROR_D32_TOO_INVALID_PROLOG                (ERROR_D32_VERIFYIMPORTTAB_FIRST + 3)
+#define ERROR_D32_NOT_IMPLEMENTED                   (ERROR_D32_VERIFYIMPORTTAB_FIRST + 4)
+#define ERROR_D32_VERIFYIMPORTTAB_LAST              0x1F
+
+#define ERROR_D32_VERIFY_FAILED                     0x20
+
+
+#endif
+
+
+
+
Index: trunk/src/win32k/include/k32.h
===================================================================
--- trunk/src/win32k/include/k32.h	(revision 4152)
+++ trunk/src/win32k/include/k32.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: k32.h,v 1.2 2000-02-15 23:39:19 bird Exp $
+/* $Id: k32.h,v 1.3 2000-09-02 21:08:02 bird Exp $
  *
  * k32 - definitions.
@@ -20,4 +20,7 @@
 *******************************************************************************/
 APIRET k32AllocMemEx(PPVOID ppb, ULONG cb, ULONG flag, ULONG ulCS, ULONG ulEIP);
+APIRET k32QueryOTEs(HMTE hMTE, PQOTEBUFFER pQOte, ULONG cbOte);
+APIRET k32QueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus);
+APIRET k32SetOptions(PK32OPTIONS pOptions);
 
 
Index: trunk/src/win32k/include/ldr.h
===================================================================
--- trunk/src/win32k/include/ldr.h	(revision 4152)
+++ trunk/src/win32k/include/ldr.h	(revision 4164)
@@ -1,7 +1,7 @@
-/* $Id: ldr.h,v 1.5 2000-01-22 18:20:59 bird Exp $
- *
- * ldr - loader header file.
- *
- * Copyright (c)  1999 knut  St.  osmundsen
+/* $Id: ldr.h,v 1.6 2000-09-02 21:08:02 bird Exp $
+ *
+ * ldr - Our loader "subsystem" public header file.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -12,89 +12,229 @@
 #ifndef _ldr_h_
 #define _ldr_h_
-    #ifndef LDR_INCL_INITONLY
-        /* state variable */
-        extern BOOL fQAppType;
-
-        /*
-         * handle state - Array of handle states. Eight state per byte!
-         */
-        #define MAX_FILE_HANDLES 0x10000
-
-        extern unsigned char achHandleStates[MAX_FILE_HANDLES/8];
-
-        #define HSTATE_UNUSED       0x00    /* Handle not used (or OS/2). */
-        #define HSTATE_OS2          0x00    /* OS/2 module filehandle. */
-        #define HSTATE_OUR          0x01    /* Our module filehandle. */
-        #define HSTATE_MASK         0xFE
-        #define HSTATE_UMASK        0x01
-
-        #define GetState(a)         (HSTATE_UMASK & (achHandleStates[(a)/8] >> ((a)%8)))
-        #define SetState(a,b)       (achHandleStates[(a)/8] = (achHandleStates[(a)/8] & (HSTATE_MASK << ((a)%8) | HSTATE_MASK >> 8-((a)%8)) | ((b) & 0x1) << ((a)%8)))
-
-
-        /*
-         * Module struct.
-         */
-        typedef struct _Module
-        {
-            AVLNODECORE     coreKey;    /* Key is hFile. */
-            AVLNODECORE     coreMTE;    /* Key is pMTE. */
-
-            SFN             hFile;      /* System file number or file handle if you prefer that. */
-            PMTE            pMTE;       /* Pointer to MTE if we got one - NULL is allowed. */
-
-            ULONG           fFlags;     /* Flags. Flags if coreMte is in use and what Data contains. */
-            union
-            {
-                ModuleBase *pModule;    /* Pointer to a Pe2Lx object. (Win32 executables) */
-                #if defined(_PE2LX_H_)
-                Pe2Lx *     pPe2Lx;     /* Pointer to a Pe2Lx object. (Win32 executables) */
-                #endif
-                #if defined(_ELF2LX_H_)
-                Elf2Lx *    pElf2Lx;    /* Pointer to a Elf2Lx object. (ELF executables) */
-                #endif
-                #if defined(_SCRIPT_H_)
-                Script *    pScript;    /* Pointer to a Script object. (Shell scripts) */
-                #endif
-                #if defined(_PE_H_)
-                Pe *        pPe;        /* Pointer to a Pe object. (Ring3 loader) */
-                #endif
-            } Data;                     /* Pointer to data. Currently it's allways a Pe2Lx object! */
-        } MODULE, *PMODULE;
-
-        #define MOD_FLAGS_IN_MTETREE    0x00000010UL /* The node is present in the MTE-tree. */
-        #define MOD_TYPE_MASK           0x0000000FUL /* Type mask. */
-        #define MOD_TYPE_PE2LX          0x00000001UL /* Pe2Lx module. */
-        #define MOD_TYPE_ELF2LX         0x00000002UL /* Elf2Lx module. */
-        #define MOD_TYPE_SCRIPT         0x00000003UL /* Script module. */
-        #define MOD_TYPE_PE             0x00000004UL /* Pe module. */
-
-
-        /*
-         * Modules operations.
-         */
-        PMODULE     getModuleBySFN(SFN hFile);
-        PMODULE     getModuleByMTE(PMTE pMTE);
-        PMODULE     getModuleByFilename(PCSZ pszFilename);
-
-        ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, ModuleBase *pModObj);
-        ULONG       removeModule(SFN hFile);
-
-    #endif
-
-    /*************/
-    /* functions */
-    /*************/
-    #ifdef __cplusplus
-    extern "C" {
-    #endif
-
-    ULONG ldrInit(void);
-
-    #ifdef __cplusplus
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifndef LDR_INCL_INITONLY
+
+/*
+ * Fail if dependent header files is missing
+ */
+#ifndef _AVL_H_
+#error "You'll have to include avl.h before ldr.h!"
+#endif
+
+
+/** @design Loader State.
+ *
+ * Used to determin behaviour in different cases.
+ * Use the isLdrState<State> macros to query current state.
+ * IMPORTANT! Don't change this variable if you don't really mean it!
+ *            And only change it thru the setLdrState* macros!
+ *
+ * The state is changing as follows:
+ *    1) Load a new program
+ *      mytkExecPgm will set the state to LDRSTATE_TKEXECPGM on successful overloading.
+ *          myldrOpenPath will set the type part of the loaderbits. (EXE,DLL or UNSUPPORTED)
+ *          (NB! myldrOpenPath is called several times. First for the EXE then for imported modules.)
+ *              IF executable THEN myLdrOpen might set the LDRSTATE_OUR flag.
+ *          myldrOpenPath will reset the type part of the loaderbits upon return.
+ *      mytkExecPgm resets the state to LDRSTATE_UNKNOWN upon return.
+ *
+ *    2) Query program type.
+ *      myLDRQAppType will set the state to LDRSTATE_LDRQAPPTYPE on entry.
+ *          myldrOpenPath will set the type part of the loaderbits. (EXE,DLL or UNSUPPORTED)
+ *          (NB! myldrOpenPath may be called several times.)
+ *              IF executable THEN myLdrOpen might set the LDRSTATE_OUR flag.
+ *          myldrOpenPath will reset the type part of the loaderbits upon return.
+ *      myLDRQAppType resets the state to LDRSTATE_UNKNOWN upon return.
+ *
+ *    3) Unknown invocation - probably DosLoadModule. Base state is LDRSTATE_UNKNOWN.
+ *          myldrOpenPath will set the type part of the loaderbits. (EXE,DLL or UNSUPPORTED)
+ *          (NB! myldrOpenPath is probably called several times. Import modules.)
+ *          myldrOpenPath will reset the type part of the loaderbits upon return.
+ *
+ */
+extern ULONG    ulLdrState;
+
+#define LDRSTATE_UNKNOWN        0       /* Default state - undertermined. */
+#define LDRSTATE_TKEXECPGM      1       /* A program is being loaded. */
+#define LDRSTATE_LDRQAPPTYPE    2       /* Loader called from LDRQAPPTYPE */
+/*#define LDRSTATE_LOADMODULE     3 */  /* A module is being loaded by DosLoadModule. Not implemented! */
+#define LDRSTATE_MASK           0x00FF  /* State mask. */
+
+/*
+ * The following flags are only valid when myldrOpenPath is on the stack!, ie. in ldrOpen.
+ * These flags is the "loading-bits".
+ */
+#define LDRSTATE_EXE            0x0100  /* Flags telling that an executable is being opened. */
+#define LDRSTATE_DLL            0x0200  /* Flags telling that an dll is being opened. */
+#define LDRSTATE_UNSUPPORTED    0x0300  /* Flags telling to not override this open call. */
+#define LDRSTATE_TYPE_MASK      0x0f00  /* Load Type Mask. */
+/* The following flag will tell us if the executable which is loading is ours or not. */
+#define LDRSTATE_OUREXE         0x1000
+#define LDRSTATE_LOADERBITS     0xff00  /* Mask */
+
+
+/*
+ * Query macros.
+ */
+#define isLdrStateUnknown()             ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_UNKNOWN)
+#define isLdrStateExecPgm()             ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_TKEXECPGM)
+#define isLdrStateQAppType()            ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_LDRQAPPTYPE)
+/*#define isLdrStateLoadModule()        ((ulLdrState & LDRSTATE_MASK) == LDRSTATE_LOADMODULE)*/
+
+#define isLdrStateLoadingEXE()          ((ulLdrState & LDRSTATE_TYPE_MASK) == LDRSTATE_EXE)
+#define isLdrStateLoadingDLL()          ((ulLdrState & LDRSTATE_TYPE_MASK) == LDRSTATE_DLL)
+#define isLdrStateLoadingUnsupported()  ((ulLdrState & LDRSTATE_TYPE_MASK) == LDRSTATE_UNSUPPORTED)
+
+#define isLdrStateLoadingOurEXE()       (ulLdrState & LDRSTATE_OUREXE)
+
+
+/*
+ * Set macros.
+ */
+#define setLdrStateQAppType()           ulLdrState = LDRSTATE_LDRQAPPTYPE
+#define setLdrStateUnknown()            ulLdrState = LDRSTATE_UNKNOWN
+/*      setLdrStateExecPgm() isn't needed as this is in assembly source! */
+/*#define setLdrStateLoadModule()         ulLdrState = LDRSTATE_LOADMODULE */
+
+#define setLdrStateLoadingEXE()         ulLdrState = (ulLdrState & (ULONG)(~LDRSTATE_TYPE_MASK)) | LDRSTATE_EXE
+#define setLdrStateLoadingDLL()         ulLdrState = (ulLdrState & (ULONG)(~LDRSTATE_TYPE_MASK)) | LDRSTATE_DLL
+#define setLdrStateLoadingUnsupported() ulLdrState = (ulLdrState & (ULONG)(~LDRSTATE_TYPE_MASK)) | LDRSTATE_UNSUPPORTED
+#define setLdrStateClearLoadingType()   ulLdrState &= (ULONG)(~LDRSTATE_TYPE_MASK)
+
+#define setLdrStateLoadingOurEXE()      ulLdrState |= LDRSTATE_OUREXE
+
+
+/*
+ * Loader State assert macros.
+ */
+#define ASSERT_LdrStateUnknown(fn)      ASSERT_LdrState(fn, LDRSTATE_UNKNOWN)
+#define ASSERT_LdrStateExecPgm(fn)      ASSERT_LdrState(fn, LDRSTATE_TKEXECPGM)
+#define ASSERT_LdrStateQAppType(fn)     ASSERT_LdrState(fn, LDRSTATE_LDRQAPPTYPE)
+
+#define ASSERT_LdrState(fn, state) \
+    {                              \
+        if ((ulLdrState & LDRSTATE_MASK) != (state)) \
+        {                          \
+            kprintf((fn ": assertion incorrect loader state. ulLdrState (%d) != " #state "(%d)", \
+                     ulLdrState, state)); \
+        }                          \
     }
-    #endif
-
-    #pragma pack()
-
-#endif
+
+
+/*
+ * handle state - Array of handle states. Eight state per byte!
+ */
+#define MAX_FILE_HANDLES 0x10000
+
+extern unsigned char achHandleStates[MAX_FILE_HANDLES/8];
+
+#define HSTATE_UNUSED       0x00    /* Handle not used (or OS/2). */
+#define HSTATE_OS2          0x00    /* OS/2 module filehandle. */
+#define HSTATE_OUR          0x01    /* Our module filehandle. */
+#define HSTATE_MASK         0xFE
+#define HSTATE_UMASK        0x01
+
+#define GetState(a)         (HSTATE_UMASK & (achHandleStates[(a)/8] >> ((a)%8)))
+#define SetState(a,b)       (achHandleStates[(a)/8] = (achHandleStates[(a)/8] & (HSTATE_MASK << ((a)%8) | HSTATE_MASK >> 8-((a)%8)) | ((b) & 0x1) << ((a)%8)))
+
+
+/*
+ * Declare the module classes used below in case they aren't declared yet.
+ */
+#ifdef __cplusplus
+class ModuleBase;
+class Pe2Lx;
+class Elf2Lx;
+#else
+typedef char ModuleBase;
+typedef char Pe2Lx;
+typedef char Elf2Lx;
+#endif
+
+
+/*
+ * Module struct.
+ */
+typedef struct _Module
+{
+    AVLNODECORE     coreKey;    /* Key is hFile. */
+    AVLNODECORE     coreMTE;    /* Key is pMTE. */
+
+    SFN             hFile;      /* System file number or file handle if you prefer that. */
+    PMTE            pMTE;       /* Pointer to MTE if we got one - NULL is allowed. */
+
+    ULONG           fFlags;     /* Flags. Flags if coreMte is in use and what Data contains. */
+    union
+    {
+        ModuleBase *pModule;    /* Pointer to base module. */
+        Pe2Lx *     pPe2Lx;     /* Pointer to a Pe2Lx object. (Win32 executables) */
+        Elf2Lx *    pElf2Lx;    /* Pointer to a Elf2Lx object. (ELF executables) */
+        #if 0
+        Script *    pScript;    /* Pointer to a Script object. (Shell scripts) */
+        Pe *        pPe;        /* Pointer to a Pe object. (Ring3 loader) */
+        #endif
+    } Data;                     /* Pointer to data. Currently it's allways a Pe2Lx object! */
+} MODULE, *PMODULE;
+
+#define MOD_FLAGS_IN_MTETREE    0x00000010UL /* The node is present in the MTE-tree. */
+#define MOD_TYPE_MASK           0x0000000FUL /* Type mask. */
+#define MOD_TYPE_PE2LX          0x00000001UL /* Pe2Lx module. */
+#define MOD_TYPE_ELF2LX         0x00000002UL /* Elf2Lx module. */
+#define MOD_TYPE_SCRIPT         0x00000003UL /* Script module. */
+#define MOD_TYPE_PE             0x00000004UL /* Pe module. */
+
+
+/*
+ * Pointer to the currently loading executable module.
+ * Available at tkExecPgm time when loading a converted module.
+ */
+extern PMODULE pExeModule;
+
+
+/*
+ * Modules operations.
+ */
+PMODULE     getModuleBySFN(SFN hFile);
+PMODULE     getModuleByMTE(PMTE pMTE);
+PMODULE     getModuleByhMTE(HMTE hMTE);
+PMODULE     getModuleByFilename(PCSZ pszFilename);
+
+ULONG       addModule(SFN hFile, PMTE pMTE, ULONG fFlags, ModuleBase *pModObj);
+ULONG       removeModule(SFN hFile);
+
+
+
+/*
+ * mytkExecPgm variables and functions
+ *
+ * (See ldr\mytkExecPgm.asm for further info on these variabels and functions.)
+ */
+#define CCHFILENAME     261             /* This is defined in mytkExecPgm.asm too. */
+#define CCHARGUMENTS   1536             /* This is defined in mytkExecPgm.asm too. */
+extern const char   fTkExecPgm;
+extern char         achTkExecPgmFilename[CCHFILENAME];
+extern char         achTkExecPgmArguments[CCHARGUMENTS];
+#endif
+ULONG _Optlink  tkExecPgmEnvLength(void);
+ULONG _Optlink  tkExecPgmCopyEnv(char *pachBuffer, unsigned cchBuffer);
+
+
+
+/*
+ * functions
+ */
+PSZ         ldrGetExePath(PSZ pszPath, BOOL fExecChild);
+ULONG       ldrInit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#pragma pack()
+
+#endif
Index: trunk/src/win32k/include/log.h
===================================================================
--- trunk/src/win32k/include/log.h	(revision 4152)
+++ trunk/src/win32k/include/log.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: log.h,v 1.4 2000-02-25 18:15:04 bird Exp $
+/* $Id: log.h,v 1.5 2000-09-02 21:08:02 bird Exp $
  *
  * log - C-style logging - kprintf.
@@ -25,4 +25,6 @@
 #define OUTPUT_COM1 0x3f8
 #define OUTPUT_COM2 0x2f8
+#define OUTPUT_COM3 0x3e8
+#define OUTPUT_COM4 0x2e8
 
 
@@ -32,16 +34,17 @@
 #define dprintf kprintf
 #if defined(DEBUG) && !defined(NOLOGGING)
-    #ifndef INCL_16
+    #ifdef INCL_16
+        /* 16-bit */
+        #include "vprntf16.h"
+        #define kprintf(a)          printf16 a
+        #define printf this function is not used in 16-bit code! Use printf16!
+    #else
         /* 32-bit */
         #include <stdarg.h>
         #include "vprintf.h"
         #define kprintf(a)          printf a
-    #else
-        /* 16-bit */
-        #include "vprntf16.h"
-        #define kprintf(a)          printf16 a
     #endif
 #else
-    #define kprintf(a)              (void)0
+    #define kprintf(a)              ((void)0)
 #endif
 
Index: trunk/src/win32k/include/macros.h
===================================================================
--- trunk/src/win32k/include/macros.h	(revision 4152)
+++ trunk/src/win32k/include/macros.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: macros.h,v 1.2 2000-05-03 10:46:07 bird Exp $
+/* $Id: macros.h,v 1.3 2000-09-02 21:08:02 bird Exp $
  *
  * Common macros for Win32k/Elf.
@@ -24,4 +24,8 @@
 #define ALIGN(a, alignment) (((a) + (alignment - 1UL)) & ~(alignment - 1UL))
 
+/*
+ * Not referenced parameter warning fix.
+ */
+#define NOREF(a) (a=a)
 
 /*
Index: trunk/src/win32k/include/myExecPgm.h
===================================================================
--- trunk/src/win32k/include/myExecPgm.h	(revision 4152)
+++ trunk/src/win32k/include/myExecPgm.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: myExecPgm.h,v 1.1 2000-02-19 08:41:10 bird Exp $
+/* $Id: myExecPgm.h,v 1.2 2000-09-02 21:08:03 bird Exp $
  *
  * Desclarations for buffer.asm and mytkExecPgm.
@@ -12,27 +12,5 @@
 #define _myExecPgm_h_
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-#define CB_BUFFER   1536                /* This is to be updated in the files buffer.asm and tkExecPgm too! */
-#define CCH_FILENAME 261                /* This is to be updated in the files buffer.asm and tkExecPgm too! */
-
-
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
-#pragma pack(1)
-typedef struct _EXECPGMBUFFER
-{
-    char szFilename[CCH_FILENAME];          /* Executable filename. */
-    char achArgs[CB_BUFFER - CCH_FILENAME]; /* collection of ASCIIZ which ends with an empty string */
-} EXECPGMBUFFER, *PEXECPGMBUFFER;
-#pragma pack()
-
-
-/*******************************************************************************
-*   Functions Prototypes                                                       *
-*******************************************************************************/
-PEXECPGMBUFFER _Optlink QueryBufferPointerFromFilename(const char *pszFilename);
+/* obsolete */
 
 #endif
Index: trunk/src/win32k/include/omf.h
===================================================================
--- trunk/src/win32k/include/omf.h	(revision 4152)
+++ trunk/src/win32k/include/omf.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: omf.h,v 1.2 1999-11-10 01:45:33 bird Exp $ */
+/* $Id: omf.h,v 1.3 2000-09-02 21:08:03 bird Exp $ */
 /*
  * OMF stuff
@@ -16,12 +16,17 @@
 #define LIBEND      0xF1
 #define THEADR      0x80
-
 #define MODEND      0x8a
 #define MODEND2     0x8b
-
 #define COMENT      0x88
 #define     IMPDEF  0x01
-
+#define PUBDEF      0x90
 #define LNAMES      0x96
+#define SEGDEF      0x98
+#define SEGDEF2     0x99
+#define GRPDEF      0x9A
+#define FIXUPP      0x9C
+#define FIXUPP2     0x9D
+#define LEDATA      0xA0
+#define LEDATA2     0xA1
 
 #endif
Index: trunk/src/win32k/include/options.h
===================================================================
--- trunk/src/win32k/include/options.h	(revision 4152)
+++ trunk/src/win32k/include/options.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: options.h,v 1.10 2000-02-25 18:15:06 bird Exp $
+/* $Id: options.h,v 1.11 2000-09-02 21:08:03 bird Exp $
  *
  * Options.
@@ -16,6 +16,11 @@
 *******************************************************************************/
 /* fKernel */
-#define KF_UNI              0x00000000UL
-#define KF_SMP              0x00000001UL
+#define KF_UNI              0x0000
+#define KF_SMP              0x0001
+#define KF_W4               0x0002
+#define KF_DEBUG            0x1000
+#define KF_HAS_DEBUGTYPE    0x2000
+#define KF_ALLSTRICT        0x3000
+#define KF_HALFSTRICT       0x7000
 
 /* fPE */
@@ -33,8 +38,8 @@
 
 /* default heapsizes */
-#define CB_SWP_INIT         (1024*512)      /* 512KB */
-#define CB_SWP_MAX          (1024*1024*16)  /*  16MB  */
-#define CB_RES_INIT         (1024*256)      /* 256KB */
-#define CB_RES_MAX          (1024*1024*10)  /*  10MB  */
+#define CB_SWP_INIT         ((unsigned long)1024*512)      /* 512KB */
+#define CB_SWP_MAX          ((unsigned long)1024*1024*16)  /*  16MB  */
+#define CB_RES_INIT         ((unsigned long)1024*256)      /* 256KB */
+#define CB_RES_MAX          ((unsigned long)1024*1024*10)  /*  10MB  */
 
 /* default assignments */
@@ -47,8 +52,10 @@
             (unsigned short)~0,     /* usVerMajor    */     \
             (unsigned short)~0,     /* usVerMinor    */     \
-            FLAGS_PE_PE2LX,         /* fPE           */     \
+            FLAGS_PE_MIXED,         /* fPE           */     \
             INFOLEVEL_QUIET,        /* ulInfoLevel   */     \
             FALSE,                  /* fElf          */     \
-            TRUE,                   /* fScript       */     \
+            TRUE,                   /* fUNIXScript   */     \
+            TRUE,                   /* fREXXScript   */     \
+            TRUE,                   /* fJava         */     \
             FALSE,                  /* fNoLoader     */     \
             CB_SWP_INIT,            /* cbSwpHeapInit */     \
@@ -57,4 +64,22 @@
             CB_RES_MAX}             /* cbResHeapMax  */
 
+#define isAnyLoaderEnabled()        (!options.fNoLoader && \
+                                    (isPELoaderEnabled() || isELFEnabled() || isUNIXScriptEnabled() || isREXXScriptEnabled() || isJAVAEnabled()))
+#define isPELoaderEnabled()         (options.fPE != FLAGS_PE_NOT)
+#define isPELoaderDisabled()        (options.fPE == FLAGS_PE_NOT)
+#define isPe2LxLoaderEnabled()      (options.fPE == FLAGS_PE_PE2LX)
+#define isMixedPeLoaderEnabled()    (options.fPE == FLAGS_PE_MIXED)
+
+#define isELFDisabled()             (!options.fElf)
+#define isELFEnabled()              (options.fElf)
+#define isUNIXScriptDisabled()      (!options.fUNIXScript)
+#define isUNIXScriptEnabled()       (options.fUNIXScript)
+#define isREXXScriptDisabled()      (!options.fREXXScript)
+#define isREXXScriptEnabled()       (options.fREXXScript)
+#define isJAVADisabled()            (!options.fJava)
+#define isJAVAEnabled()             (options.fJava)
+
+#define isSMPKernel()               (options.fKernel & KF_SMP)
+#define isUNIKernel()               !(options.fKernel & KF_SMP)
 
 
@@ -86,9 +111,15 @@
     ULONG       fElf;                   /* Elf flags. */
 
-    /** @cat Options affecting the script executables */
-    ULONG       fScript;                /* Script flags. */
+    /** @cat Options affecting the UNIX script executables */
+    ULONG       fUNIXScript;            /* UNIX script flags. */
 
-    /** @cat Options affecting the script executables */
-    ULONG       fNoLoader;              /* No loader stuff. */
+    /** @cat Options affecting the REXX script executables */
+    ULONG       fREXXScript;            /* REXX script flags. */
+
+    /** @cat Options affecting the JAVA executables */
+    ULONG       fJava;                  /* Java flags. */
+
+    /** @cat Options affecting the  executables */
+    ULONG       fNoLoader;              /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
 
     /** @cat Options affecting the heap. */
@@ -100,9 +131,8 @@
 #pragma pack()
 
-
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
-extern struct options options;      /* defined in d32globals.c */
+extern struct options DATA16_GLOBAL options;    /* defined in d16globals.c */
 #if defined(__IBMC__) || defined(__IBMCPP__)
     #pragma map( options , "_options"  )
Index: trunk/src/win32k/include/pe2lx.h
===================================================================
--- trunk/src/win32k/include/pe2lx.h	(revision 4152)
+++ trunk/src/win32k/include/pe2lx.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: pe2lx.h,v 1.9 2000-02-27 02:16:43 bird Exp $
+/* $Id: pe2lx.h,v 1.10 2000-09-02 21:08:03 bird Exp $
  *
  * Pe2Lx class declarations. Ring 0 and Ring 3
@@ -66,8 +66,18 @@
     ULONG  applyFixups(PMTE pMTE, ULONG iObject, ULONG iPageTable, PVOID pvPage,
                        ULONG ulPageAddress, PVOID pvPTDA); /*(ldrEnum32bitRelRecs)*/
+    ULONG  openPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *pLdrLv, PULONG pful); /* (ldrOpenPath) */
+    static ULONG  openPath2(PCHAR pachFilename, ULONG cchFilename, ldrlv_t *pLdrLv, PULONG pful, BOOL fOdin32PathValid);
     #ifndef RING0
     ULONG  testApplyFixups();
     ULONG  writeFile(PCSZ pszLXFilename);
     #endif
+
+    /** @cat public query methods */
+    BOOL    isExe();
+    BOOL    isDll();
+    static SFN  getKernel32SFN()        {   return sfnKernel32;   }
+    static VOID setKernel32SFN(SFN sfn) {   sfnKernel32 = sfn;    }
+    static VOID invalidateOdin32Path();
+    static LONG getLoadedModuleCount()  {   return cLoadedModules;}
 
     /** @cat public Helper methods */
@@ -120,4 +130,6 @@
     /** @cat static helpers */
     static PCSZ queryOdin32ModuleName(PCSZ pszWin32ModuleName);
+    static BOOL initOdin32Path();
+    static BOOL setOdin32Path(const char *psz);
 
     /** @cat static dump methods */
@@ -195,4 +207,9 @@
         ULONG flFlags;                      /* equivalent object flags */
     } paSecChars2Flags[];
+
+    static LONG             cLoadedModules; /* Count of existing objects. Updated by constructor and destructor. */
+    static const char *     pszOdin32Path;  /* Odin32 base path (include a slash). */
+    static ULONG            cchOdin32Path;  /* Odin32 base path length. */
+    static SFN              sfnKernel32;    /* Odin32 Kernel32 filehandle. */
 };
 
Index: trunk/src/win32k/include/probkrnl.h
===================================================================
--- trunk/src/win32k/include/probkrnl.h	(revision 4152)
+++ trunk/src/win32k/include/probkrnl.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: probkrnl.h,v 1.13 2000-04-17 01:56:49 bird Exp $
+/* $Id: probkrnl.h,v 1.14 2000-09-02 21:08:04 bird Exp $
  *
  * Include file for ProbKrnl.
@@ -16,7 +16,9 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-#define NBR_OF_KRNLIMPORTS      18      /* When this is changed make sure to   */
+#define NBR_OF_KRNLIMPORTS      42      /* When this is changed make sure to   */
                                         /* update the arrays in d32init.c and  */
-                                        /* probkrnl.c */
+                                        /* probkrnl.c, make test faker in      */
+                                        /* test.h and the appropriate fake.c   */
+                                        /* fakea.asm.                          */
 #define MAX_LENGTH_NAME         32      /* Max length for the function. */
 
@@ -24,7 +26,8 @@
 #define EPT_PROC                0x00    /* procedure - overload procedure*/
 #define EPT_PROCIMPORT          0x01    /* procedure 32bit - import only */
-#define EPT_VARIMPORT           0x02    /* variable/non-procedure 32bit - not implemented yet */
-#define EPT_32BIT               0x00    /* 16 bit entry-point  */
-#define EPT_16BIT               0x80    /* 32 bit entry-point */
+#define EPT_VARIMPORT           0x02    /* variable/non-procedure 32bit */
+#define EPT_NOT_REQ             0x04    /* Not required flag. */
+#define EPT_32BIT               0x00    /* 32 bit entry-point  */
+#define EPT_16BIT               0x80    /* 16 bit entry-point */
 #define EPT_BIT_MASK            0x80    /* Mask bit entry-point */
 #define EPT16BitEntry(a)    (((a).fType & EPT_BIT_MASK) == EPT_16BIT)
@@ -34,4 +37,5 @@
 #define EPT_PROC32              (EPT_PROC | EPT_32BIT)
 #define EPT_PROCIMPORT32        (EPT_PROCIMPORT | EPT_32BIT)
+#define EPT_PROCIMPORTNR32      (EPT_PROCIMPORT | EPT_32BIT | EPT_NOT_REQ)
 #define EPT_VARIMPORT32         (EPT_VARIMPORT | EPT_32BIT)
 
@@ -41,8 +45,11 @@
 #define EPT_VARIMPORT16         (EPT_VARIMPORT | EPT_16BIT)
 
-/* Kernel type: SMP/UNI/W4 */
-#define TYPE_UNI                0       /* Any UNI processor kernel except Warp 4 fp13 and above. */
-#define TYPE_SMP                1       /* SMP Warp3 Adv. or Warp 4.5 SMP */
-#define TYPE_W4                 2       /* Warp4 fp13 and above. */
+
+/* Kernel type: SMP/UNI/W4 (flags matches KF_* in options.h)  */
+#if 0
+#define TYPE_UNI                0x00     /* Any UNI processor kernel except Warp 4 fp13 and above. */
+#define TYPE_SMP                0x01     /* SMP Warp3 Adv. or Warp 4.5 SMP */
+#define TYPE_W4                 0x02     /* Warp4 fp13 and above. */
+#endif
 
 
@@ -73,6 +80,5 @@
 {
     unsigned short usBuild;             /* Build number */
-    unsigned char  fchBldType;          /* R, H, A */
-    unsigned char  fchType;             /* TYPE_SMP, TYPE_UNI, TYPE_W4 */
+    unsigned short fKernel;             /* Kernel flag (KF_* defines in options.h). */
     unsigned char  cObjects;            /* Count of objects */
     struct
@@ -91,16 +97,23 @@
 *   NOTE! These are only available at init time!                               *
 *******************************************************************************/
-extern IMPORTKRNLSYM _aImportTab[NBR_OF_KRNLIMPORTS]; /* 'aImportTab' in PrbKrnl.c */
-extern unsigned short int _usBuild;     /* 'ulBuild'         in PrbKrnl.c */
-extern unsigned short int _usVerMajor;  /* 'usVerMajor'      in PrbKrnl.c */
-extern unsigned short int _usVerMinor;  /* 'usVerMinor'      in PrbKrnl.c */
-extern KRNLDBENTRY aKrnlSymDB[];        /* defined in symdb.c (for 16-bit usage) */
-extern KRNLDBENTRY _aKrnlSymDB[];       /* defined in symdb.c (for 32-bit usage) */
+extern IMPORTKRNLSYM DATA16_GLOBAL  aImportTab[NBR_OF_KRNLIMPORTS]; /* Defined in ProbKrnl.c */
+extern char          DATA16_GLOBAL  szUsrSym[50];                   /* Defined in ProbKrnl.c */
+extern KRNLDBENTRY   DATA16_INIT    aKrnlSymDB[];                   /* Defined in symdb.c (for 16-bit usage) */
 
+#if defined(__IBMC__) || defined(__IBMCPP__)
+    #pragma map( aImportTab , "_aImportTab" )
+    #pragma map( szUsrSym   , "_szUsrSym"   )
+    #pragma map( aKrnlSymDB , "_aKrnlSymDB" )
+#endif
 
 #if defined(INCL_16) && defined(MAX_DISKDD_CMD) /* 16-bit only */
 int ProbeKernel(PRPINITIN pReqPack);
+
+#if 0 /*ndef CODE16_INIT*/
+#pragma alloc_text(CODE16_INIT, ProbeKernel)
 #endif
 
 #endif
 
+#endif
+
Index: trunk/src/win32k/include/rmalloc.h
===================================================================
--- trunk/src/win32k/include/rmalloc.h	(revision 4152)
+++ trunk/src/win32k/include/rmalloc.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: rmalloc.h,v 1.2 2000-01-24 01:44:08 bird Exp $
+/* $Id: rmalloc.h,v 1.3 2000-09-02 21:08:04 bird Exp $
  *
  * Resident Heap.
@@ -20,4 +20,16 @@
 #endif
 /* XLATON */
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct HeapState_s  /* note: this is used by both swappable and resident heaps */
+{
+    ULONG       cbHeapSize;          /* Amount of memory used by the heap free and used++. */
+    ULONG       cbHeapFree;          /* Amount of used space. */
+    ULONG       cbHeapUsed;          /* Amount of free space reserved. */
+    ULONG       cBlocksUsed;         /* Count of used blocks. */
+    ULONG       cBlocksFree;         /* Count of free blocks. */
+} HEAPSTATE, *PHEAPSTATE;
+
 
 /*******************************************************************************
@@ -33,8 +45,13 @@
 int         _res_validptr2(void *, unsigned);
 unsigned    _res_memfree(void);
+unsigned    _res_memused(void);
+int         _res_state(PHEAPSTATE);
 int         _res_heap_check(void);
 void        _res_heapmin(void);
 void        _res_dump_subheaps(void);
 void        _res_dump_allocated(unsigned);
+
+extern unsigned cbResHeapMax;           /* Maximum amount of memory used by the heap. */
+
 
 /* XLATOFF */
Index: trunk/src/win32k/include/smalloc.h
===================================================================
--- trunk/src/win32k/include/smalloc.h	(revision 4152)
+++ trunk/src/win32k/include/smalloc.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: smalloc.h,v 1.1 2000-01-24 01:44:08 bird Exp $
+/* $Id: smalloc.h,v 1.2 2000-09-02 21:08:04 bird Exp $
  *
  * Swappable Heap.
@@ -21,4 +21,6 @@
 /* XLATON */
 
+struct HeapState_s;
+
 /*******************************************************************************
 *   Exported Functions and Variables                                           *
@@ -33,8 +35,12 @@
 int         _swp_validptr2(void *, unsigned);
 unsigned    _swp_memfree(void);
+unsigned    _swp_memused(void);
+int         _swp_state(struct HeapState_s *);
 int         _swp_heap_check(void);
 void        _swp_heapmin(void);
 void        _swp_dump_subheaps(void);
 void        _swp_dump_allocated(unsigned);
+
+extern unsigned cbSwpHeapMax;   /* Maximum amount of memory used by the heap. */
 
 /* XLATOFF */
Index: trunk/src/win32k/include/test.h
===================================================================
--- trunk/src/win32k/include/test.h	(revision 4152)
+++ trunk/src/win32k/include/test.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: test.h,v 1.1 2000-07-16 22:17:13 bird Exp $
+/* $Id: test.h,v 1.2 2000-09-02 21:08:04 bird Exp $
  *
  * Definitions and declarations for test moduls.
@@ -93,32 +93,48 @@
     PULONG  pulAddr,
     PUSHORT pushPTDA);
-ULONG LDRCALL fakeldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful);
-ULONG LDRCALL fakeLDRClearSem(void);
-ULONG KRNLCALL fakeKSEMRequestMutex(HKMTX hkmtx, ULONG ulTimeout);
-extern HKMTX        fakeLDRSem;
-ULONG KRNLCALL   fakeTKFuBuff(PVOID pv, PVOID pvUsr, ULONG cb, ULONG fl);
-ULONG KRNLCALL   fakeTKSuBuff(PVOID pvUsr, PVOID pv, ULONG cb, ULONG fl);
-ULONG KRNLCALL   fakeTKFuBufLen(PLONG pcch, PVOID pvUsr, ULONG cchMax, ULONG fl, BOOL fDblNULL);
-PMTE LDRCALL  fakeldrValidateMteHandle(HMTE hMTE);
-void _Optlink fakeg_tkExecPgm(void);    /* Not callable! (fakea.asm) */
-void _Optlink fakef_FuStrLenZ(void);    /* Not callable! (fakea.asm) */
-void _Optlink fakef_FuStrLen(void);     /* Not callable! (fakea.asm) */
-void _Optlink fakef_FuBuff(void);       /* Not callable! (fakea.asm) */
+PMTE KRNLCALL fakeldrASMpMTEFromHandle(
+    HMTE  hMTE);
+ULONG LDRCALL   fakeldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful);
+ULONG LDRCALL   fakeLDRClearSem(void);
+ULONG LDRCALL   fakeldrFindModule(PCHAR pachFilename, USHORT cchFilename, USHORT usClass, PPMTE ppMTE);
+ULONG KRNLCALL  fakeKSEMRequestMutex(HKSEMMTX hkmtx, ULONG ulTimeout);
+ULONG KRNLCALL  fakeKSEMReleaseMutex(HKSEMMTX hkmtx);
+BOOL  KRNLCALL  fakeKSEMQueryMutex(HKSEMMTX hkmtx, PUSHORT pcusNest);
+VOID  KRNLCALL  fakeKSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags);
+extern KSEMMTX  fakeLDRSem;
+extern char *   fakeLDRLibPath;
+ULONG KRNLCALL  fakeTKFuBuff(PVOID pv, PVOID pvUsr, ULONG cb, ULONG fl);
+ULONG KRNLCALL  fakeTKSuBuff(PVOID pvUsr, PVOID pv, ULONG cb, ULONG fl);
+ULONG KRNLCALL  fakeTKFuBufLen(PLONG pcch, PVOID pvUsr, ULONG cchMax, ULONG fl, BOOL fDblNULL);
+PMTE LDRCALL    fakeldrValidateMteHandle(HMTE hMTE);
+PSZ  SECCALL    fakeSecPathFromSFN(SFN hFile);
+void _Optlink   fakeg_tkExecPgm(void);    /* Not callable! (fakea.asm) */
+void _Optlink   fake_tkStartProcess(void);/* Not callable! (fakea.asm) */
+void _Optlink   fakef_FuStrLenZ(void);    /* Not callable! (fakea.asm) */
+void _Optlink   fakef_FuStrLen(void);     /* Not callable! (fakea.asm) */
+void _Optlink   fakef_FuBuff(void);       /* Not callable! (fakea.asm) */
 extern PTCB     fakepTCBCur;
 extern PPTDA    fakepPTDACur;
 extern char     fakeptda_start;
 extern USHORT   fakeptda_environ;
+extern KSEMMTX  fakeptda_ptdasem;
+extern HMTE     fakeptda_module;
+extern PSZ      fakeptda_pBeginLIBPATH;
+extern PSZ      fakeldrpFileNameBuf;
 
 #endif /* INCL_NO_FAKE */
 
 #ifdef INCL_16
-extern USHORT  usFakeVerMajor;          /* define in probkrnl.c */
-extern USHORT  usFakeVerMinor;          /* define in probkrnl.c */
+extern USHORT   usFakeVerMajor;         /* define in probkrnl.c */
+extern USHORT   usFakeVerMinor;         /* define in probkrnl.c */
 #else
-extern USHORT  _usFakeVerMajor;
-extern USHORT  _usFakeVerMinor;
+extern USHORT   _usFakeVerMajor;
+extern USHORT   _usFakeVerMinor;
 #endif
 
-extern const char *pszInternalRevision; /* defined in win32ktst.c */
+#ifdef _OS2Krnl_h_
+extern int      cObjectsFake;           /* defined in win32ktst.c */
+extern OTE      aKrnlOTE[24];           /* defined in win32ktst.c */
+#endif
 
 #ifdef __cplusplus
Index: trunk/src/win32k/include/vprntf16.h
===================================================================
--- trunk/src/win32k/include/vprntf16.h	(revision 4152)
+++ trunk/src/win32k/include/vprntf16.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: vprntf16.h,v 1.1 2000-02-25 18:15:06 bird Exp $
+/* $Id: vprntf16.h,v 1.2 2000-09-02 21:08:04 bird Exp $
  *
  * printf/vprintf header file - 16bit.
@@ -30,6 +30,8 @@
  * Function prototypes
  */
-int printf16(const char *pszFormat, ...);
-int vprintf16(const char *pszFormat, va_list args);
+int FAR printf16(const char *pszFormat, ...);
+int FAR vprintf16(const char *pszFormat, va_list args);
+
+/*#pragma alloc_text(CODE16, printf16, vprintf16)*/
 
 
Index: trunk/src/win32k/include/win32k.h
===================================================================
--- trunk/src/win32k/include/win32k.h	(revision 4152)
+++ trunk/src/win32k/include/win32k.h	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: win32k.h,v 1.4 2000-02-26 20:21:42 bird Exp $
+/* $Id: win32k.h,v 1.5 2000-09-02 21:08:00 bird Exp $
  *
  * Top level make file for the Win32k library.
@@ -25,5 +25,7 @@
  */
 #define K32_ALLOCMEMEX          0x01
-
+#define K32_QUERYOTES           0x02
+#define K32_QUERYOPTIONSSTATUS  0x03
+#define K32_SETOPTIONS          0x04
 
 /*
@@ -36,4 +38,114 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
+#pragma pack(1)
+
+/*
+ * Object Table Entry buffer.
+ */
+typedef struct _QueryOTE
+{
+    ULONG   ote_size;                   /* Object virtual size */
+    ULONG   ote_base;                   /* Object base virtual address */
+    ULONG   ote_flags;                  /* Attribute flags */
+    ULONG   ote_pagemap;                /* Object page map index */
+    ULONG   ote_mapsize;                /* Num of entries in obj page map */
+  /*ULONG   ote_reserved;*/
+    USHORT  ote_sel;                    /* Object Selector */
+    USHORT  ote_hob;                    /* Object Handle */
+} QOTE, *PQOTE;
+
+typedef struct _QueryOTEBuffer
+{
+    ULONG   cOTEs;                      /* Number of entries in aOTE. */
+    QOTE    aOTE[1];                    /* Array of OTEs. */
+} QOTEBUFFER, *PQOTEBUFFER;
+
+
+/*
+ * Options struct.
+ *
+ * (The function of these members are described in options.h in
+ *  the src\win32k\include directory.)
+ * All members of this struct (except cb ofcourse) is changable.
+ */
+typedef struct _K32Options
+{
+    ULONG   cb;
+
+    /** @cat logging options */
+    USHORT      usCom;                  /* Output port no. */
+    ULONG       fLogging;               /* Logging. */
+
+    /** @cat Options affecting the generated LX executables */
+    ULONG       fPE;                    /* Flags set the type of conversion. */
+    ULONG       ulInfoLevel;            /* Pe2Lx InfoLevel. */
+
+    /** @cat Options affecting the generated ELF executables */
+    ULONG       fElf;                   /* Elf flags. */
+
+    /** @cat Options affecting the UNIX script executables */
+    ULONG       fUNIXScript;            /* UNIX script flags. */
+
+    /** @cat Options affecting the REXX script executables */
+    ULONG       fREXXScript;            /* REXX script flags. */
+
+    /** @cat Options affecting the JAVA executables */
+    ULONG       fJava;                  /* Java flags. */
+
+    /** @cat Options affecting the  executables */
+    ULONG       fNoLoader;              /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
+
+    /** @cat Options affecting the heap. */
+    ULONG       cbSwpHeapMax;           /* Maximum heapsize. */
+    ULONG       cbResHeapMax;           /* Maxiumem residentheapsize. */
+} K32OPTIONS, *PK32OPTIONS;
+
+
+/*
+ * Status struct.
+ *
+ */
+typedef struct _K32Status
+{
+    ULONG   cb;
+
+    /** @cat Options status. */
+    ULONG       fQuiet;                 /* Quiet initialization. */
+
+    /** @cat Kernel status. */
+    ULONG       fKernel;                /* Smp or uni kernel. */
+    ULONG       ulBuild;                /* Kernel build. */
+    USHORT      usVerMajor;             /* OS/2 major ver - 20 */
+    USHORT      usVerMinor;             /* OS/2 minor ver - 30,40 */
+
+    /** @cat Heap status. */
+    ULONG       cbSwpHeapInit;          /* Initial heapsize. */
+    ULONG       cbSwpHeapFree;          /* Amount of used space. */
+    ULONG       cbSwpHeapUsed;          /* Amount of free space reserved. */
+    ULONG       cbSwpHeapSize;          /* Amount of memory used by the heap free and used++. */
+    ULONG       cSwpBlocksUsed;         /* Count of used blocks. */
+    ULONG       cSwpBlocksFree;         /* Count of free blocks. */
+
+    ULONG       cbResHeapInit;          /* Initial heapsize. */
+    ULONG       cbResHeapFree;          /* Amount of free space reserved. */
+    ULONG       cbResHeapUsed;          /* Amount of used space. */
+    ULONG       cbResHeapSize;          /* Amount of memory used by the heap free and used++. */
+    ULONG       cResBlocksUsed;         /* Count of used blocks. */
+    ULONG       cResBlocksFree;         /* Count of free blocks. */
+
+    /** @cat Win32k build, version and init stuff */
+    CHAR        szBuildDate[12];        /* Date of the win32k build. (Sep 02 2000) */
+    CHAR        szBuildTime[9];         /* Time of the win32k build. (11:44:21) */
+    ULONG       ulVersion;              /* Win32k version */
+    CHAR        szSymFile[CCHMAXPATH];  /* The name of the symbol file or sym database. */
+
+    /** @cat Statistics */
+    ULONG       cPe2LxModules;          /* Number of Pe2Lx modules currently loaded. */
+    ULONG       cElf2LxModules;         /* Number of Elf2Lx modules currently loaded. */
+    /*...*/
+} K32STATUS, *PK32STATUS;
+
+
+
 /*
  * K32 category parameter structs
@@ -51,15 +163,45 @@
 } K32ALLOCMEMEX, *PK32ALLOCMEMEX;
 
-
-
-
-#ifdef INCL_WIN32K_LIB
+typedef struct _k32QueryOTEs
+{
+    HMODULE     hMTE;                   /* Module handle. */
+    PQOTEBUFFER pQOte;                  /* Pointer to output buffer. */
+    ULONG       cbQOte;                 /* Size of the buffer pointed to by pQOte  */
+    ULONG       rc;                     /* Return code. */
+} K32QUERYOTES, *PK32QUERYOTES;
+
+typedef struct _k32QueryOptionsStatus
+{
+    PK32OPTIONS     pOptions;           /* Pointer to option struct. (NULL allowed) */
+    PK32STATUS      pStatus;            /* Pointer to status struct. (NULL allowed) */
+    ULONG           rc;                 /* Return code. */
+} K32QUERYOPTIONSSTATUS, *PK32QUERYOPTIONSSTATUS;
+
+typedef struct _k32SetOptions
+{
+    PK32OPTIONS     pOptions;           /* Pointer to option struct. (NULL allowed) */
+    ULONG           rc;                 /* Return code. */
+} K32SETOPTIONS, *PK32SETOPTIONS;
+
+
+#pragma pack()
+
+#ifndef NO_WIN32K_LIB_FUNCTIONS
 /*******************************************************************************
 *   External Functions                                                         *
 *******************************************************************************/
+/* Win32k APIs */
 APIRET APIENTRY  libWin32kInit(void);
 APIRET APIENTRY  libWin32kTerm(void);
+BOOL   APIENTRY  libWin32kInstalled(void);
+APIRET APIENTRY  libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus);
+APIRET APIENTRY  libWin32kSetOptions(PK32OPTIONS pOptions);
+
+/* "Extra OS2 APIs" */
+APIRET APIENTRY  DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag);
+APIRET APIENTRY  W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte);
+
+/* Helper function */
 USHORT APIENTRY  libHelperGetCS(void);
-APIRET APIENTRY  DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag);
 
 
Index: trunk/src/win32k/k32/k32AllocMemEx.cpp
===================================================================
--- trunk/src/win32k/k32/k32AllocMemEx.cpp	(revision 4152)
+++ trunk/src/win32k/k32/k32AllocMemEx.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: k32AllocMemEx.cpp,v 1.2 2000-02-18 19:27:30 bird Exp $
+/* $Id: k32AllocMemEx.cpp,v 1.3 2000-09-02 21:08:05 bird Exp $
  *
  * k32AllocMemEx - Equivalent to DosAllocMem, but this one
@@ -18,4 +18,6 @@
 #define INCL_OS2KRNL_VM
 
+#define NO_WIN32K_LIB_FUNCTIONS
+
 #ifndef OBJ_SELMAPALL
 #define OBJ_SELMAPALL   0x00000800UL
@@ -27,9 +29,12 @@
 *******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "OS2Krnl.h"
+#include "win32k.h"
 #include "k32.h"
 #include "options.h"
 #include "dev32.h"
 #include "log.h"
+#include "macros.h"
 
 
@@ -95,4 +100,5 @@
 APIRET k32AllocMemEx(PPVOID ppv, ULONG cb, ULONG flag, ULONG ulCS, ULONG ulEIP)
 {
+    #if 0
     APIRET  rc;
     ULONG   flFlags2;
@@ -133,4 +139,12 @@
 
     return rc;
+    #else
+    NOREF(ppv);
+    NOREF(cb);
+    NOREF(flag);
+    NOREF(ulCS);
+    NOREF(ulEIP);
+    return ERROR_NOT_SUPPORTED;
+    #endif
 }
 
Index: trunk/src/win32k/k32/k32QueryOTEs.cpp
===================================================================
--- trunk/src/win32k/k32/k32QueryOTEs.cpp	(revision 4164)
+++ trunk/src/win32k/k32/k32QueryOTEs.cpp	(revision 4164)
@@ -0,0 +1,118 @@
+/* $Id: k32QueryOTEs.cpp,v 1.2 2000-09-02 21:08:05 bird Exp $
+ *
+ * k32QueryOTEs  -  Get's the object table entries (OTEs) for a given
+ *                  module (given by a module handle).
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define INCL_DOSMEMMGR
+#define INCL_DOSERRORS
+
+#define INCL_OS2KRNL_TK
+#define INCL_OS2KRNL_SEM
+
+#define NO_WIN32K_LIB_FUNCTIONS
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+#include "OS2Krnl.h"
+#include "ldrCalls.h"
+#include "win32k.h"
+#include "k32.h"
+#include "options.h"
+#include "dev32.h"
+#include "log.h"
+
+
+/**
+ * Gets the object table entries for a module.
+ * @returns     OS2 returncode.
+ * @param       hMTE    Module handle (HMTE) of the module.
+ * @param       pQOte   Pointer to output buffer.
+ * @param       cbQOte  Size (in bytes) of the output buffer.
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark
+ */
+APIRET k32QueryOTEs(HMTE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte)
+{
+    APIRET  rc;
+    PMTE    pMTE;
+
+    /*
+     * Validate parameters.
+     *  Ensure that the buffer pointer is sensible.
+     *  Ensure that the buffer not less than minimum size.
+     */
+    if ((ULONG)pQOte < 0x10000 || cbQOte < sizeof(QOTEBUFFER))
+        return ERROR_INVALID_PARAMETER;
+
+    /*
+     * Take loader semaphore. (We are accessing LDR structures.)
+     */
+    rc = LDRRequestSem();
+    if (rc != NO_ERROR)
+    {
+        kprintf(("k32QueryOTEs: LDRRequestSem failed with rc = %d\n", rc));
+        return rc;
+    }
+
+    /*
+     * Validate and get the MTE pointer.
+     */
+    pMTE = ldrValidateMteHandle(hMTE);
+    if (pMTE != NULL && pMTE->mte_swapmte != NULL)
+    {
+        /*
+         * Copy data to the output buffer.
+         * 1) First we'll copy the object number.
+         *    If this failes or no object we'll bailout/return.
+         * 2) Then we'll check if the buffer is large enough to hold the
+         *    object info.
+         * 3) Check if LX executable and copy the OTEs to the output buffer.
+         *    If not LX fail.
+         */
+        rc = TKSuULongNF(&pQOte->cOTEs, &pMTE->mte_swapmte->smte_objcnt);
+        if (rc != NO_ERROR || pQOte->cOTEs == 0)
+            goto bailout;
+
+        if ((pMTE->mte_swapmte->smte_objcnt * sizeof(QOTE)) + (sizeof(QOTEBUFFER) - sizeof(QOTE))
+            > cbQOte)
+        {
+            rc = ERROR_BUFFER_OVERFLOW;
+            goto bailout;
+        }
+
+        if (pMTE->mte_flags2 & MTEFORMATLX)
+        {
+            rc = TKSuBuff(pQOte->aOTE,
+                          pMTE->mte_swapmte->smte_objtab,
+                          pMTE->mte_swapmte->smte_objcnt * sizeof(OTE),
+                          TK_FUSU_NONFATAL);
+        }
+        else
+            rc = ERROR_BAD_EXE_FORMAT;
+    }
+    else
+        rc = ERROR_INVALID_HANDLE;
+
+bailout:
+    /*
+     * Felease loader semaphore and return
+     */
+    LDRClearSem();
+
+    return rc;
+}
+
Index: trunk/src/win32k/k32/k32QueryOptionsStatus.cpp
===================================================================
--- trunk/src/win32k/k32/k32QueryOptionsStatus.cpp	(revision 4164)
+++ trunk/src/win32k/k32/k32QueryOptionsStatus.cpp	(revision 4164)
@@ -0,0 +1,208 @@
+/* $Id: k32QueryOptionsStatus.cpp,v 1.2 2000-09-02 21:08:06 bird Exp $
+ *
+ * k32QueryOptionsStatus  - Queries the options and/or the status of
+ *                          Win32k.sys driver.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define FOR_EXEHDR 1                    /* To make all object flags OBJ???. */
+#define INCL_DOSMEMMGR
+#define INCL_DOSERRORS
+
+#define INCL_OS2KRNL_TK
+#define INCL_OS2KRNL_SEM
+
+#define NO_WIN32K_LIB_FUNCTIONS
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <os2.h>                        /* OS/2 header file. */
+#include <peexe.h>                      /* Wine PE structs and definitions. */
+#include <neexe.h>                      /* Wine NE structs and definitions. */
+#include <newexe.h>                     /* OS/2 NE structs and definitions. */
+#include <exe386.h>                     /* OS/2 LX structs and definitions. */
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+
+#include "malloc.h"                     /* win32k malloc (resident). Not C library! */
+#include "smalloc.h"                    /* win32k swappable heap. */
+#include "rmalloc.h"                    /* win32k resident heap. */
+
+#include <string.h>                     /* C library string.h. */
+#include <stdlib.h>                     /* C library stdlib.h. */
+#include <stddef.h>                     /* C library stddef.h. */
+#include <stdarg.h>                     /* C library stdarg.h. */
+
+#include "vprintf.h"                    /* win32k printf and vprintf. Not C library! */
+#include "dev1632.h"                    /* Common 16- and 32-bit parts */
+#include "dev32.h"                      /* 32-Bit part of the device driver. (SSToDS) */
+#include "OS2Krnl.h"                    /* kernel structs.  (SFN) */
+#include "ldrCalls.h"                   /* ldr* calls. (ldrRead) */
+#include "log.h"                        /* Logging. */
+#include "avl.h"                        /* AVL tree. (ldr.h need it) */
+#include "ldr.h"                        /* ldr helpers. (ldrGetExePath) */
+#include "env.h"                        /* Environment helpers. */
+#include "modulebase.h"                 /* ModuleBase class definitions, ++. */
+#include "pe2lx.h"                      /* Pe2Lx class definitions, ++. */
+#include <versionos2.h>                 /* Pe2Lx version. */
+#include "options.h"                    /* Win32k options. */
+
+#include "ProbKrnl.h"                   /* ProbKrnl variables and definitions. */
+#include "win32k.h"                     /* Win32k API structures.  */
+#include "k32.h"                        /* Internal Win32k API structures.  */
+
+
+/**
+ * Queries the options and/or the status of Win32k.sys driver.
+ * @returns     OS2 returncode.
+ * @param       pOptions    Pointer to options structure. (NULL is allowed)
+ * @param       pStatus     Pointer to status structure. (NULL is allowed)
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark      One of the pointer may be NULL.
+ */
+APIRET k32QueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus)
+{
+    APIRET  rc;
+    ULONG   cb;
+
+    /*
+     * Validate parameters.
+     *  Ensure that the buffer pointer is sensible.
+     *  Ensure that the structure sizes are correct.
+     */
+    if (((ULONG)pOptions < 0x10000 && pOptions != NULL)
+        ||
+        ((ULONG)pStatus  < 0x10000 && pStatus  != NULL)
+        ||
+        (pOptions == NULL && pStatus == NULL)
+        )
+        rc = ERROR_INVALID_PARAMETER;
+
+    if (pOptions != NULL)
+    {
+        rc = TKFuULongNF(SSToDS(&cb), &pOptions->cb);
+        if (rc)
+            return rc;
+        if (cb != sizeof(K32OPTIONS))
+            return ERROR_INVALID_PARAMETER;
+    }
+
+    if (pStatus != NULL)
+    {
+        rc = TKFuULongNF(SSToDS(&cb), &pStatus->cb);
+        if (rc)
+            return rc;
+        if (cb != sizeof(K32STATUS))
+            return ERROR_INVALID_PARAMETER;
+    }
+
+
+    /*
+     * Take loader semaphore. (We might accessing LDR structures.)
+     */
+    rc = LDRRequestSem();
+    if (rc != NO_ERROR)
+    {
+        kprintf(("k32QueryOptionsStatus: LDRRequestSem failed with rc = %d\n", rc));
+        return rc;
+    }
+
+    /*
+     * Get options.
+     */
+    if (pOptions)
+    {
+        K32OPTIONS  TmpOptions;
+
+        TmpOptions.cb           = sizeof(K32OPTIONS);
+        TmpOptions.usCom        = options.usCom;
+        TmpOptions.fLogging     = options.fLogging;
+        TmpOptions.fPE          = options.fPE;
+        TmpOptions.ulInfoLevel  = options.ulInfoLevel;
+        TmpOptions.fElf         = options.fElf;
+        TmpOptions.fUNIXScript  = options.fUNIXScript;
+        TmpOptions.fREXXScript  = options.fREXXScript;
+        TmpOptions.fJava        = options.fJava;
+        TmpOptions.fNoLoader    = options.fNoLoader;
+        TmpOptions.cbSwpHeapMax = options.cbSwpHeapMax;
+        TmpOptions.cbResHeapMax = options.cbResHeapMax;
+
+        rc = TKSuBuff(pOptions, SSToDS(&TmpOptions), sizeof(K32OPTIONS), TK_FUSU_NONFATAL);
+        if (rc != NO_ERROR) /* retry once if we fail. (For some reason it seems to work.) */
+            rc = TKSuBuff(pOptions, SSToDS(&TmpOptions), sizeof(K32OPTIONS), TK_FUSU_NONFATAL);
+    }
+
+    /*
+     * Get status.
+     */
+    if (rc == NO_ERROR && pStatus)
+    {
+        K32STATUS TmpStatus;
+        HEAPSTATE HeapState;
+
+        /* initate the temporary structure */
+        memset(&TmpStatus, 0, sizeof(K32STATUS));
+        TmpStatus.cb = sizeof(K32STATUS);
+
+        /* options */
+        TmpStatus.fQuiet            = options.fQuiet;
+        TmpStatus.fKernel           = options.fKernel;              /* Smp or uni kernel. */
+        TmpStatus.ulBuild           = options.ulBuild;              /* Kernel build. */
+        TmpStatus.usVerMajor        = options.usVerMajor;           /* OS/2 major ver - 20 */
+        TmpStatus.usVerMinor        = options.usVerMinor;           /* OS/2 minor ver - 30,40 */
+
+        /* swappable heap */
+        if (_swp_state((PHEAPSTATE)SSToDS(&HeapState)) == 0)
+        {
+            TmpStatus.cbSwpHeapInit  = options.cbSwpHeapInit;       /* Initial heapsize. */
+            TmpStatus.cbSwpHeapFree  = HeapState.cbHeapFree;        /* Amount of used space. */
+            TmpStatus.cbSwpHeapUsed  = HeapState.cbHeapUsed;        /* Amount of free space reserved. */
+            TmpStatus.cbSwpHeapSize  = HeapState.cbHeapSize;        /* Amount of memory used by the heap free and used++. */
+            TmpStatus.cSwpBlocksUsed = HeapState.cBlocksUsed;       /* Count of used blocks. */
+            TmpStatus.cSwpBlocksFree = HeapState.cBlocksFree;       /* Count of free blocks. */
+        }
+
+        /* resident heap */
+        if (_res_state((PHEAPSTATE)SSToDS(&HeapState)) == 0)
+        {
+            TmpStatus.cbResHeapInit  = options.cbResHeapInit;       /* Initial heapsize. */
+            TmpStatus.cbResHeapFree  = HeapState.cbHeapFree;        /* Amount of used space. */
+            TmpStatus.cbResHeapUsed  = HeapState.cbHeapUsed;        /* Amount of free space reserved. */
+            TmpStatus.cbResHeapSize  = HeapState.cbHeapSize;        /* Amount of memory used by the heap free and used++. */
+            TmpStatus.cResBlocksUsed = HeapState.cBlocksUsed;       /* Count of used blocks. */
+            TmpStatus.cResBlocksFree = HeapState.cBlocksFree;       /* Count of free blocks. */
+        }
+
+        /* Win32k Build and version; and symfile name or SymDB. */
+        strcpy(TmpStatus.szBuildDate, szBuildDate);                 /* Date of the win32k build. */
+        strcpy(TmpStatus.szBuildTime, szBuildTime);                 /* Time of the win32k build. */
+        TmpStatus.ulVersion         = PE2LX_VERSION;                /* Win32k version */
+        strcpy(TmpStatus.szSymFile, szUsrSym);  /* The name of the symbol file or sym database. */
+
+        /* Module counts */
+        TmpStatus.cPe2LxModules     = Pe2Lx::getLoadedModuleCount();/* Number of Pe2Lx modules currently loaded. */
+        TmpStatus.cElf2LxModules    = /*Elf2Lx::getLoadedModuleCount()*/ 0; /* Number of Elf2Lx modules currently loaded. */
+
+        rc = TKSuBuff(pStatus, SSToDS(&TmpStatus), sizeof(K32STATUS), TK_FUSU_NONFATAL);
+        if (rc != NO_ERROR) /* retry once if we fail. (For some reason it seems to work.) */
+            rc = TKSuBuff(pStatus, SSToDS(&TmpStatus), sizeof(K32STATUS), TK_FUSU_NONFATAL);
+    }
+
+    /*
+     * Release loader semaphore and return.
+     */
+    LDRClearSem();
+
+    return rc;
+}
+
Index: trunk/src/win32k/k32/k32SetOptions.cpp
===================================================================
--- trunk/src/win32k/k32/k32SetOptions.cpp	(revision 4164)
+++ trunk/src/win32k/k32/k32SetOptions.cpp	(revision 4164)
@@ -0,0 +1,171 @@
+/* $Id: k32SetOptions.cpp,v 1.2 2000-09-02 21:08:06 bird Exp $
+ *
+ * k32SetOptions - Sets the changable options of win32k.sys the options.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define FOR_EXEHDR 1                    /* To make all object flags OBJ???. */
+#define INCL_DOSMEMMGR
+#define INCL_DOSERRORS
+
+#define INCL_OS2KRNL_TK
+#define INCL_OS2KRNL_SEM
+
+#define NO_WIN32K_LIB_FUNCTIONS
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <os2.h>                        /* OS/2 header file. */
+#include <peexe.h>                      /* Wine PE structs and definitions. */
+#include <neexe.h>                      /* Wine NE structs and definitions. */
+#include <newexe.h>                     /* OS/2 NE structs and definitions. */
+#include <exe386.h>                     /* OS/2 LX structs and definitions. */
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+
+#include "malloc.h"                     /* win32k malloc (resident). Not C library! */
+#include "smalloc.h"                    /* win32k swappable heap. */
+#include "rmalloc.h"                    /* win32k resident heap. */
+
+#include <string.h>                     /* C library string.h. */
+#include <stdlib.h>                     /* C library stdlib.h. */
+#include <stddef.h>                     /* C library stddef.h. */
+#include <stdarg.h>                     /* C library stdarg.h. */
+
+#include "vprintf.h"                    /* win32k printf and vprintf. Not C library! */
+#include "dev1632.h"                    /* Common 16- and 32-bit parts */
+#include "dev32.h"                      /* 32-Bit part of the device driver. (SSToDS) */
+#include "OS2Krnl.h"                    /* kernel structs.  (SFN) */
+#include "ldrCalls.h"                   /* ldr* calls. (ldrRead) */
+#include "log.h"                        /* Logging. */
+#include "avl.h"                        /* AVL tree. (ldr.h need it) */
+#include "ldr.h"                        /* ldr helpers. (ldrGetExePath) */
+#include "env.h"                        /* Environment helpers. */
+#include "modulebase.h"                 /* ModuleBase class definitions, ++. */
+#include "pe2lx.h"                      /* Pe2Lx class definitions, ++. */
+#include <versionos2.h>                 /* Pe2Lx version. */
+#include "options.h"                    /* Win32k options. */
+
+#include "ProbKrnl.h"                   /* ProbKrnl variables and definitions. */
+#include "win32k.h"                     /* Win32k API structures.  */
+#include "k32.h"                        /* Internal Win32k API structures.  */
+
+
+/**
+ * Sets the changable options of win32k.sys the options.
+ * @returns     OS2 returncode.
+ * @param       pOptions    Pointer to options structure. (NULL is allowed)
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark      One of the pointer may be NULL.
+ */
+APIRET k32SetOptions(PK32OPTIONS pOptions)
+{
+    APIRET  rc;
+    ULONG   cb;
+
+    /*
+     * Validate parameters.
+     *  Ensure that the buffer pointer is sensible.
+     *  Ensure that the structure sizes are correct.
+     */
+    if ((ULONG)pOptions < 0x10000)
+        rc = ERROR_INVALID_PARAMETER;
+
+    if (pOptions != NULL)
+    {
+        rc = TKFuULongNF(SSToDS(&cb), &pOptions->cb);
+        if (rc)
+            return rc;
+        if (cb != sizeof(K32OPTIONS))
+            return ERROR_INVALID_PARAMETER;
+    }
+
+
+    /*
+     * Get options.
+     */
+    K32OPTIONS  TmpOptions;
+
+    rc = TKFuBuff(SSToDS(&TmpOptions), pOptions, sizeof(K32OPTIONS), TK_FUSU_NONFATAL);
+    if (rc == NO_ERROR)
+    {
+        /*
+         * Validate contents.
+         */
+        if (    TmpOptions.usCom != OUTPUT_COM1
+            &&  TmpOptions.usCom != OUTPUT_COM2
+            &&  TmpOptions.usCom != OUTPUT_COM3
+            &&  TmpOptions.usCom != OUTPUT_COM4)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fLogging > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fPE > 4)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.ulInfoLevel > 4)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fElf > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fUNIXScript > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fREXXScript > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fJava > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fNoLoader > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.fREXXScript > 1)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.cbSwpHeapMax > (32768*1024) || TmpOptions.cbSwpHeapMax < options.cbSwpHeapInit)
+            return ERROR_INVALID_PARAMETER;
+        if (TmpOptions.cbResHeapMax > (32768*1024) || TmpOptions.cbResHeapMax < options.cbResHeapInit)
+            return ERROR_INVALID_PARAMETER;
+
+        /*
+         * Take loader semaphore. (We might accessing LDR structures.)
+         */
+        rc = LDRRequestSem();
+        if (rc != NO_ERROR)
+        {
+            kprintf(("k32QueryOptionsStatus: LDRRequestSem failed with rc = %d\n", rc));
+            return rc;
+        }
+
+
+        /*
+         * Apply changes
+         */
+        options.usCom       = TmpOptions.usCom;         /* Output port no. */
+        options.fLogging    = TmpOptions.fLogging;      /* Logging. */
+        options.fPE         = TmpOptions.fPE;           /* Flags set the type of conversion. */
+        options.ulInfoLevel = TmpOptions.ulInfoLevel;   /* Pe2Lx InfoLevel. */
+        options.fElf        = TmpOptions.fElf;          /* Elf flags. */
+        options.fUNIXScript = TmpOptions.fUNIXScript;   /* UNIX script flags. */
+        options.fREXXScript = TmpOptions.fREXXScript;   /* REXX script flags. */
+        options.fJava       = TmpOptions.fJava;         /* Java flags. */
+        options.fNoLoader   = TmpOptions.fNoLoader;     /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
+
+        options.cbSwpHeapMax = TmpOptions.cbSwpHeapMax; /* Maximum heapsize. */
+        cbSwpHeapMax = (unsigned)options.cbSwpHeapMax;
+        options.cbResHeapMax = TmpOptions.cbResHeapMax; /* Maxiumem residentheapsize. */
+        cbResHeapMax = (unsigned)options.cbResHeapMax;
+
+        /*
+         * Release loader semaphore and return
+         */
+        LDRClearSem();
+
+    }
+
+    return rc;
+}
+
Index: trunk/src/win32k/ldr/ModuleBase.cpp
===================================================================
--- trunk/src/win32k/ldr/ModuleBase.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/ModuleBase.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: ModuleBase.cpp,v 1.3 2000-02-27 02:17:06 bird Exp $
+/* $Id: ModuleBase.cpp,v 1.4 2000-09-02 21:08:06 bird Exp $
  *
  * ModuleBase - Implementetation.
@@ -12,9 +12,9 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-#define INCL_DOSERRORS                      /* DOS Error codes. */
+#define INCL_DOSERRORS                  /* DOS Error codes. */
 #ifdef RING0
-    #define INCL_NOAPI                      /* RING0: No apis. */
+    #define INCL_NOAPI                  /* RING0: No apis. */
 #else /*RING3*/
-    #define INCL_DOSFILEMGR                 /* RING3: DOS File api. */
+    #define INCL_DOSFILEMGR             /* RING3: DOS File api. */
 #endif
 
@@ -23,15 +23,17 @@
 *   Header Files                                                               *
 *******************************************************************************/
-#include <os2.h>                            /* OS/2 header file. */
-
-#include "malloc.h"                         /* win32k malloc. Not C library! */
-
-#include <string.h>                         /* C library string.h. */
-#include <stdarg.h>                         /* C library stdarg.h. */
-
-#include "vprintf.h"                        /* win32k printf and vprintf. Not C library! */
-#include "dev32.h"                          /* 32-Bit part of the device driver. (SSToDS) */
-#include "OS2Krnl.h"                        /* kernel structs.  (SFN) */
-#include "modulebase.h"                     /* ModuleBase class definitions, ++. */
+#include <os2.h>                        /* OS/2 header file. */
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+#include "malloc.h"                     /* Win32k malloc. Not C library! */
+
+#include <string.h>                     /* C library string.h. */
+#include <stdarg.h>                     /* C library stdarg.h. */
+
+#include "vprintf.h"                    /* win32k printf and vprintf. Not C library! */
+#include "dev32.h"                      /* 32-Bit part of the device driver. (SSToDS) */
+#include "OS2Krnl.h"                    /* kernel structs.  (SFN) */
+#include "ldrCalls.h"                   /* ldrOpenPath and ldrlv_t. */
+#include "modulebase.h"                 /* ModuleBase class definitions, ++. */
 
 
@@ -159,4 +161,42 @@
 }
 
+
+/**
+ * openPath - opens file eventually searching loader specific paths.
+ *
+ * This base implementation simply calls ldrOpenPath.
+ * This method is only called for DLLs. DosLoadModule and Imports.
+ *
+ * @returns   OS2 return code.
+ *            pLdrLv->lv_sfn  is set to filename handle.
+ * @param     pachFilename  Pointer to filename. Not zero terminated!
+ * @param     cchFilename   Filename length.
+ * @param     pLdrLv        Loader local variables? (Struct from KERNEL.SDF)
+ * @param     pful          Pointer to flags which are passed on to ldrOpen.
+ * @sketch
+ * This is roughly what the original ldrOpenPath does:
+ *      if !CLASS_GLOBAL or miniifs then
+ *          ldrOpen(pachModName)
+ *      else
+ *          loop until no more libpath elements
+ *              get next libpath element and add it to the modname.
+ *              try open the modname
+ *              if successfull then break the loop.
+ *          endloop
+ *      endif
+ */
+ULONG  ModuleBase::openPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *pLdrLv, PULONG pful) /* (ldrOpenPath) */
+{
+    #ifdef RING0
+    printf("ModuleBase::openPath:\n");
+    return ldrOpenPath(pachFilename, cchFilename, pLdrLv, pful);
+    #else
+    NOREF(pachFilename);
+    NOREF(cchFilename);
+    NOREF(pLdrLv);
+    NOREF(pful);
+    return ERROR_NOT_SUPPORTED;
+    #endif
+}
 
 
@@ -232,4 +272,27 @@
 
 /**
+ * Gets the fullpath filename.
+ * @returns     Const ("Readonly") pointer to the filename.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ */
+PCSZ ModuleBase::getFilename()
+{
+    return pszFilename;
+}
+
+
+/**
+ * Gets the modulename.
+ * @returns     Const ("Readonly") pointer to the module name.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ * @remark      Modulename is filename without path and extention.
+ */
+PCSZ ModuleBase::getModuleName()
+{
+    return pszModuleName;
+}
+
+
+/**
  * Output function for Modules.
  * @param     pszFormat    Pointer to format string.
@@ -273,5 +336,5 @@
         rc = DosRead(hFile, pvBuffer, cbToRead, &cbRead);
     else
-        printErr(("DosSetFilePtr(hfile, %#8x(%d),..) failed with rc = %d.",
+        printErr(("DosSetFilePtr(hfile, %#8x(%d),..) failed with rc = %d.\n",
                   ulOffset, ulOffset, rc));
 
Index: trunk/src/win32k/ldr/calltab.asm
===================================================================
--- trunk/src/win32k/ldr/calltab.asm	(revision 4152)
+++ trunk/src/win32k/ldr/calltab.asm	(revision 4164)
@@ -1,8 +1,10 @@
-; $Id: calltab.asm,v 1.12 2000-04-17 01:56:49 bird Exp $
-;
-; callTab - Call back again table - table with entry for each function which is overrided.
-;           It holds the part of the prolog which was replaced by a jmp instruction.
-;
-; Copyright (c) 1998-1999 knut st. osmundsen
+; $Id: calltab.asm,v 1.13 2000-09-02 21:08:06 bird Exp $
+;
+; callTab - Call back again table - table with entry for each function or
+;           variable which is overrided.
+;           It holds the part of the prolog which was replaced by the jmp
+;           instruction (overridden functions).
+;
+; Copyright (c) 1998-2000 knut st. osmundsen
 ;
 ; Project Odin Software License can be found in LICENSE.TXT
@@ -35,7 +37,75 @@
     public _VMGetOwner@8
     public _g_tkExecPgm
+    public _tkStartProcess
     public _f_FuStrLenZ
     public _f_FuBuff
 
+    public _VMObjHandleInfo@12
+    public _ldrASMpMTEFromHandle@4
+    public _ldrOpenPath@16
+    public _LDRClearSem@0
+    public _ldrFindModule@16
+    public _KSEMRequestMutex@8
+    public _KSEMReleaseMutex@4
+    public _KSEMQueryMutex@8
+    public _KSEMInit@12
+
+    public pLDRSem
+    public LDRSem_offObject
+    public _fpLDRSem
+    public LDRSem_sel
+
+    public pLDRLibPath
+    public LDRLibPath_offObject
+    public _fpLDRLibPath
+    public LDRLibPath_sel
+
+    public _TKSuBuff@16
+    public _TKFuBuff@16
+    public _TKFuBufLen@20
+    public _ldrValidateMteHandle@4
+
+    public ppTCBCur
+    public pTCBCur_offObject
+    public _fppTCBCur
+    public pTCBCur_sel
+
+    public ppPTDACur
+    public pPTDACur_offObject
+    public _fppPTDACur
+    public pPTDACur_sel
+
+    public pptda_start
+    public ptda_start_offObject
+    public _fpptda_start
+    public ptda_start_sel
+
+    public pptda_environ
+    public ptda_environ_offObject
+    public _fpptda_environ
+    public ptda_environ_sel
+
+    public pptda_ptdasem
+    public ptda_ptdasem_offObject
+    public _fpptda_ptdasem
+    public ptda_ptdasem_sel
+
+    public pptda_module
+    public ptda_module_offObject
+    public _fpptda_module
+    public ptda_module_sel
+
+    public pptda_pBeginLIBPATH
+    public ptda_pBeginLIBPATH_offObject
+    public _fpptda_pBeginLIBPATH
+    public pptda_pBeginLIBPATH_sel
+
+    public pldrpFileNameBuf
+    public pldrpFileNameBuf_offObject
+    public _fpldrpFileNameBuf
+    public pldrpFileNameBuf_sel
+
+    public SecPathFromSFN
+
 
 ;
@@ -47,5 +117,6 @@
 
 CALLTAB segment
-    assume cs:CALLTAB, ds:flat, ss:nothing
+    ;assume cs:CALLTAB, ds:flat, ss:nothing
+    assume ds:flat, ss:nothing
 ;
 ; callTab is an array of evt. function prologs with a jump to the real function.
@@ -56,79 +127,237 @@
 ;
 callTab:
+
+; 0
 _ldrRead@24 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _ldrRead@24 ENDP
 
+; 1
 _ldrOpen@12 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _ldrOpen@12 ENDP
 
+; 2
 _ldrClose@4 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _ldrClose@4 ENDP
 
+; 3
 _LDRQAppType@8 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _LDRQAppType@8 ENDP
 
+; 4
 _ldrEnum32bitRelRecs@24 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _ldrEnum32bitRelRecs@24 ENDP
 
-
+; 5
 _IOSftOpen@20 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _IOSftOpen@20 ENDP
 
+; 6
 _IOSftClose@4 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _IOSftClose@4 ENDP
 
+; 7
 _IOSftTransPath@4 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _IOSftTransPath@4 ENDP
 
+; 8
 _IOSftReadAt@20 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _IOSftReadAt@20 ENDP
 
+; 9
 _IOSftWriteAt@20 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _IOSftWriteAt@20 ENDP
 
+; 10
 _SftFileSize@8 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _SftFileSize@8 ENDP
 
-
+; 11
 _VMAllocMem@36 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _VMAllocMem@36 ENDP
 
+; 12
 _VMGetOwner@8 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _VMGetOwner@8 ENDP
 
+; 13
 _g_tkExecPgm PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _g_tkExecPgm ENDP
 
-
+; 14
+_tkStartProcess PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_tkStartProcess ENDP
+
+; 15
 _f_FuStrLenZ PROC FAR
     db MAXSIZE_PROLOG dup(0cch)
 _f_FuStrLenZ ENDP
 
+; 16
 _f_FuStrLen PROC FAR
     db MAXSIZE_PROLOG dup(0cch)
 _f_FuStrLen ENDP
 
+; 17
 _f_FuBuff PROC FAR
     db MAXSIZE_PROLOG dup(0cch)
 _f_FuBuff ENDP
 
+; 18
 _VMObjHandleInfo@12 PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
 _VMObjHandleInfo@12 ENDP
 
+; 19
+_ldrASMpMTEFromHandle@4 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_ldrASMpMTEFromHandle@4 ENDP
+
+; 20
+_ldrOpenPath@16 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_ldrOpenPath@16 ENDP
+
+; 21
+_LDRClearSem@0 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_LDRClearSem@0 ENDP
+
+; 22
+_ldrFindModule@16 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_ldrFindModule@16 ENDP
+
+; 23
+_KSEMRequestMutex@8 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_KSEMRequestMutex@8 ENDP
+
+; 24
+_KSEMReleaseMutex@4 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_KSEMReleaseMutex@4 ENDP
+
+; 25
+_KSEMQueryMutex@8 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_KSEMQueryMutex@8 ENDP
+
+; 26
+_KSEMInit@12 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_KSEMInit@12 ENDP
+
+; 27
+pLDRSem          dd  0
+LDRSem_offObject dd  0
+_fpLDRSem        dd  0
+LDRSem_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+
+; 28
+pLDRLibPath          dd  0
+LDRLibPath_offObject dd  0
+_fpLDRLibPath        dd  0
+LDRLibPath_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 29
+_TKSuBuff@16 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_TKSuBuff@16 ENDP
+
+; 30
+_TKFuBuff@16 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_TKFuBuff@16 ENDP
+
+; 31
+_TKFuBufLen@20 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_TKFuBufLen@20 ENDP
+
+; 32
+_ldrValidateMteHandle@4 PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+_ldrValidateMteHandle@4 ENDP
+
+; 33
+ppTCBCur           dd  0
+pTCBCur_offObject  dd  0
+_fppTCBCur         dd  0
+pTCBCur_sel        dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 34
+ppPTDACur          dd  0
+pPTDACur_offObject dd  0
+_fppPTDACur        dd  0
+pPTDACur_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 35
+pptda_start          dd  0
+ptda_start_offObject dd  0
+_fpptda_start        dd  0
+ptda_start_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 36
+pptda_environ          dd  0
+ptda_environ_offObject dd  0
+_fpptda_environ        dd  0
+ptda_environ_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 37
+pptda_ptdasem          dd  0
+ptda_ptdasem_offObject dd  0
+_fpptda_ptdasem        dd  0
+ptda_ptdasem_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 38
+pptda_module          dd  0
+ptda_module_offObject dd  0
+_fpptda_module        dd  0
+ptda_module_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 39
+pptda_pBeginLIBPATH           dd  0
+ptda_pBeginLIBPATH_offObject  dd  0
+_fpptda_pBeginLIBPATH         dd  0
+pptda_pBeginLIBPATH_sel       dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 40
+pldrpFileNameBuf              dd  0
+pldrpFileNameBuf_offObject    dd  0
+_fpldrpFileNameBuf            dd  0
+pldrpFileNameBuf_sel          dw  0
+    db (MAXSIZE_PROLOG - 14) dup(0cch)
+
+; 41
+SecPathFromSFN PROC NEAR
+    db MAXSIZE_PROLOG dup(0cch)
+SecPathFromSFN ENDP
+
+
 CALLTAB ENDS
 
Index: trunk/src/win32k/ldr/ldr.cpp
===================================================================
--- trunk/src/win32k/ldr/ldr.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/ldr.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: ldr.cpp,v 1.7 2000-01-22 18:21:01 bird Exp $
+/* $Id: ldr.cpp,v 1.8 2000-09-02 21:08:06 bird Exp $
  *
  * ldr.cpp - Loader helpers.
@@ -14,5 +14,6 @@
 #define INCL_DOSERRORS
 #define INCL_NOPMAPI
-
+#define INCL_OS2KRNL_SEM
+#define INCL_OS2KRNL_PTDA
 
 /*******************************************************************************
@@ -21,4 +22,5 @@
 #include <os2.h>
 
+#include "devSegDf.h"
 #include "malloc.h"
 #include "new.h"
@@ -26,13 +28,15 @@
 #include <stdlib.h>
 #include <stddef.h>
+#include <string.h>
 
 #include "log.h"
+#include "avl.h"
 #include <peexe.h>
 #include <exe386.h>
 #include "OS2Krnl.h"
+#include "ldr.h"
+#include "ldrCalls.h"
 #include "ModuleBase.h"
 #include "pe2lx.h"
-#include "avl.h"
-#include "ldr.h"
 #include "options.h"
 
@@ -41,8 +45,28 @@
 *   Global Variables                                                           *
 *******************************************************************************/
-PAVLNODECORE    pSFNRoot = NULL;
-PAVLNODECORE    pMTERoot = NULL;
-
+static PAVLNODECORE    pSFNRoot = NULL;
+static PAVLNODECORE    pMTERoot = NULL;
+
+
+/*
+ * Loader State. (See ldr.h for more info.)
+ */
+ULONG          ulLdrState = LDRSTATE_UNKNOWN;
+
+
+/*
+ * Pointer to the executable module being loaded.
+ * This pointer is set by ldrOpen and cleared by tkExecPgm.
+ * It's hence only valid at tkExecPgm time. (isLdrStateExecPgm() == TRUE).
+ */
+PMODULE         pExeModule = NULL;
+
+
+/*
+ * Filehandle bitmap.
+ */
 unsigned char   achHandleStates[MAX_FILE_HANDLES/8];
+
+
 
 
@@ -64,5 +88,5 @@
  * Gets a module by the MTE.
  * @returns   Pointer to module node. If not found NULL.
- * @param     pMTE  Pointer an Module Table Entry.
+ * @param     pMTE  Pointer a Module Table Entry.
  * @sketch    Try find it in the MTE tree.
  *            IF not found THEN
@@ -124,4 +148,25 @@
 
 /**
+ * Gets a module by the hMTE.
+ * @returns   Pointer to module node. If not found NULL.
+ * @param     hMTE  Handle to a Module Table Entry.
+ * @sketch    Convert hMte to an pMTE (pointer to MTE).
+ *            Call getModuleByMTE with MTE pointer.
+ * @status    completely implemented.
+ * @author    knut st. osmundsen
+ */
+PMODULE     getModuleByhMTE(HMTE hMTE)
+{
+    PMTE pMTE;
+
+    pMTE = ldrValidateMteHandle(hMTE);
+    if (pMTE != NULL)
+        return getModuleByMTE(pMTE);
+
+    return NULL;
+}
+
+
+/**
  * Get a module by filename.
  * @returns   Pointer to module node. If not found NULL.
@@ -236,10 +281,12 @@
             delete pMod->Data.pPe2Lx;
             break;
-
+/*
         case MOD_TYPE_ELF2LX:
-        case MOD_TYPE_SCRIPT:
-        case MOD_TYPE_PE:
+            break;
+*/
+#ifdef DEBUG
         default:
             kprintf(("removeModule: Unknown type, %#x\n", pMod->fFlags & MOD_TYPE_MASK));
+#endif
     }
 
@@ -248,4 +295,119 @@
 
     return NO_ERROR;
+}
+
+
+/**
+ * Gets the path of the executable being executed.
+ * @returns     Pointer to pszPath on success. Path has _NOT_ a trailing slash.
+ *              NULL pointer on error.
+ * @param       pszPath     Pointer to path buffer. Expects CCHMAXPATH length.
+ * @param       fExecChild  Use hMTE of the PTDAExecChild if present.
+ * @sketch
+ * @status      completely implemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark      The path from the pExeModule might not be fully qualified.
+ */
+PSZ ldrGetExePath(PSZ pszPath, BOOL fExecChild)
+{
+    PCSZ    pszFilename;
+    PCSZ    psz;
+
+    #if 0 /* getFilename not implemented */
+    if (pExeModule != NULL)
+        /*
+         * We have the executable object pointer. Let's use it!
+         */
+        pszFilename = pExeModule->Data.pModule->getFilename();
+    else
+    #endif
+    {
+        /*
+         * Get the hMTE for the executable using the pPTDAExecChild
+         * Then get the pMTE, and access the smte_path to get a pointer to the executable path.
+         */
+        PPTDA   pPTDACur;               /* Pointer to the current (system context) PTDA */
+        PPTDA   pPTDA;                  /* PTDA in question. */
+        HMTE    hMTE = NULLHANDLE;      /* Modulehandle of the executable module. */
+        PMTE    pMTE;                   /* Pointer to ModuleTableEntry of the executable module. */
+
+        /*
+         *  Get the current PTDA. (Fail if this call failes.)
+         *  IF pPTDAExecChild isn't NULL THEN get hMTE for that.
+         *  IF no pPTDAExecChild THEN  get hMte for the current PTDA.
+         */
+        pPTDACur = ptdaGetCur();
+        if (pPTDACur != NULL)
+        {
+            pPTDA = ptdaGet_pPTDAExecChild(pPTDACur);
+            if (pPTDA != NULL && fExecChild)
+                hMTE = ptdaGet_ptda_module(pPTDA);
+            if (hMTE == NULLHANDLE)
+                hMTE = ptdaGet_ptda_module(pPTDACur);
+        }
+        else
+        {   /* Not called at task time? No current task! */
+            kprintf(("ldrGetExePath: Failed to get current PTDA.\n"));
+            return NULL;
+        }
+
+        /* fail if hMTE is NULLHANDLE ie. not found / invalid */
+        if (hMTE == NULLHANDLE)
+        {
+            kprintf(("ldrGetExePath: Failed to get hMTE from the PTDAs.\n"));
+            return NULL;
+        }
+
+        /* get the pMTE for this hMTE */
+        pMTE = ldrASMpMTEFromHandle(hMTE);
+        if (pMTE == NULL)
+        {
+            kprintf(("ldrGetExePath: ldrASMpMTEFromHandle failed for hMTE=0x%04.\n", hMTE));
+            return NULL;
+        }
+        if (pMTE->mte_swapmte == NULL) /* paranoia */
+        {
+            kprintf(("ldrGetExePath: mte_swapmte is NULL.\n"));
+            return NULL;
+        }
+
+        /* take the filename from the swappable MTE */
+        pszFilename = pMTE->mte_swapmte->smte_path;
+        if (pszFilename == NULL)
+        {
+            kprintf(("ldrGetExePath: smte_path is NULL.\n"));
+            return NULL;
+        }
+    }
+
+    /* paranoia... */
+    if (*pszFilename == '\0')
+    {
+        kprintf(("ldrGetExePath: pszFilename is empty!\n"));
+        return NULL;
+    }
+
+    /*
+     * Skip back over the filename. (stops pointing at the slash or ':')
+     */
+    psz = pszFilename + strlen(pszFilename)-1;
+    while (psz >= pszFilename && *psz != '\\' && *psz != '/' && *psz != ':')
+        psz--;
+
+    /*
+     * If no path the fail.
+     */
+    if (psz <= pszFilename)
+    {
+        kprintf(("ldrGetExePath: Exepath is empty.\n"));
+        return NULL;
+    }
+
+    /*
+     * Copy path and return.
+     */
+    memcpy(pszPath, pszFilename, psz - pszFilename);
+    pszPath[psz - pszFilename] = '\0';
+    return pszPath;
 }
 
Index: trunk/src/win32k/ldr/myLDRLoadExe.cpp
===================================================================
--- trunk/src/win32k/ldr/myLDRLoadExe.cpp	(revision 4152)
+++ 	(revision )
@@ -1,18 +1,0 @@
-/* $Id: myLDRLoadExe.cpp,v 1.2 2000-01-28 15:28:42 bird Exp $
- *
- * Obsolete
- *
- * Copyright (c) 1998 knut st. osmundsen
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#include <ldr.h>
-
-int LDRCALL myLDRLoadExe(PCHAR pExeName,PULONG pPTDA) /* ? */
-{
-    //kernel_printf(("_LDRLoadExe: %s - param2:0x%x", pExeName, p2));
-    return _LDRLoadExe(pExeName,p2);
-}
-
-
Index: trunk/src/win32k/ldr/myLDRQAppType.cpp
===================================================================
--- trunk/src/win32k/ldr/myLDRQAppType.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/myLDRQAppType.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: myLDRQAppType.cpp,v 1.3 2000-01-22 18:21:02 bird Exp $
+/* $Id: myLDRQAppType.cpp,v 1.4 2000-09-02 21:08:07 bird Exp $
  *
  * _myLDRQAppType - _LDRQAppType overload.
@@ -15,4 +15,7 @@
 #define INCL_NOPMAPI
 
+#define INCL_OS2KRNL_PTDA
+#define INCL_OS2KRNL_SEM
+
 /*******************************************************************************
 *   Header Files                                                               *
@@ -20,14 +23,20 @@
 #include <os2.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "OS2Krnl.h"
+#include "avl.h"
+#include "ldr.h"
 #include "ldrCalls.h"
 #include "log.h"
 
-BOOL fQAppType = FALSE;
 
 /**
- * LDRQAppType - Loader Query Application Type.
- * We set a flag while we're executing this function. Just to speed up processing.
- * If a PE file is queried, a dummy LX header is presented.
+ * LDRQAppType - Loader Query Application Type - DosQueryAppType worker.
+ *
+ * We overrides this be able to determin if a convertion is only for a
+ * LDRQAppType call.
+ *
+ * isLdrStateQAppType() returns TRUE when this procedure is on the stack.
+ *
  * @returns   return code.
  * @param     p1
@@ -38,11 +47,29 @@
     APIRET rc;
 
-    kprintf(("_LDRQAppType: entry\n"));
-    fQAppType = 1;
+    kprintf(("myLDRQAppType: entry\n"));
+    rc = KSEMRequestMutex(ptda_ptda_ptdasem(ptdaGetCur()), KSEM_INDEFINITE_WAIT);
+    if (rc != NO_ERROR)
+    {
+        kprintf(("myLDRQAppType: failed to get intra-process semaphore.\n"));
+        return rc;
+    }
+    rc = LDRRequestSem();
+    if (rc != NO_ERROR)
+    {
+        kprintf(("myLDRQAppType: failed to get loader semaphore.\n"));
+        return rc;
+    }
+
+    ASSERT_LdrStateUnknown("myLDRQAppType")
+    setLdrStateQAppType();
 
     rc = LDRQAppType(p1, p2);
 
-    fQAppType = 0;
-    kprintf(("_LDRQAppType: exit\n"));
+    ASSERT_LdrStateQAppType("myLDRQAppType")
+    setLdrStateUnknown();
+
+    LDRClearSem();
+    KSEMReleaseMutex(ptda_ptda_ptdasem(ptdaGetCur()));
+    kprintf(("myLDRQAppType: exit\n"));
 
     return rc;
Index: trunk/src/win32k/ldr/myldrClose.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrClose.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/myldrClose.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: myldrClose.cpp,v 1.5 2000-01-22 18:21:02 bird Exp $
+/* $Id: myldrClose.cpp,v 1.6 2000-09-02 21:08:07 bird Exp $
  *
  * myldrClose - ldrClose
@@ -23,12 +23,14 @@
 #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 "avl.h"
-#include "ModuleBase.h"
 #include "ldr.h"
 #include "ldrCalls.h"
+#include "ModuleBase.h"
+#include "Pe2Lx.h"
 
 
@@ -42,5 +44,5 @@
 {
     /* closes handle */
-    kprintf(("ldrClose: hFile = %.4x\n", hFile));
+    kprintf(("myldrClose: hFile = %.4x\n", hFile));
     if (GetState(hFile) == HSTATE_OUR)
     {
@@ -52,10 +54,10 @@
             pMod->Data.pModule->dumpVirtualLxFile();
         else
-            kprintf(("ldrClose: getModuleBySFN failed!!!"));
+            kprintf(("myldrClose: getModuleBySFN failed!!!"));
         #endif
 
         rc = removeModule(hFile);
         if (rc != NO_ERROR)
-            kprintf(("ldrClose: removeModule retured rc=%d\n", rc));
+            kprintf(("myldrClose: removeModule retured rc=%d\n", rc));
 
         #pragma info(notrd)
@@ -63,5 +65,15 @@
         #pragma info(restore)
     }
+    /*
+     * Invalidate the odin32path if kernel32 is closed.
+     *  (Might possible not be needed as Pe2Lx does invalides
+     *   the odin32path on object destruction.)
+     */
+    else if (Pe2Lx::getKernel32SFN() == hFile)
+        Pe2Lx::invalidateOdin32Path();
 
+    /*
+     * Finally call the real close function.
+     */
     return ldrClose(hFile);
 }
Index: trunk/src/win32k/ldr/myldrCreateMte.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrCreateMte.cpp	(revision 4152)
+++ 	(revision )
@@ -1,20 +1,0 @@
-/* $Id: myldrCreateMte.cpp,v 1.2 2000-01-28 15:28:43 bird Exp $
- *
- * Obsolete
- *
- * Copyright (c) 1998 knut st. osmundsen
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#include <ldr.h>
-
-int LDRCALL myldrCreateMte(ULONG p1, ULONG p2)
-{
-
-    //kernel_printf(("_ldrCreateMte: param1:0x%x  param2:0x%x", p1, p2));
-//  if ( p1 != 0 )
-//      kernel_printf(("_ldrCreateMte: workarea: %s",(PCHAR)p1));
-
-    return _ldrCreateMte(p1,p2);
-}
Index: trunk/src/win32k/ldr/myldrEnum32bitRelRecs.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrEnum32bitRelRecs.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/myldrEnum32bitRelRecs.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: myldrEnum32bitRelRecs.cpp,v 1.2 2000-01-27 23:43:07 bird Exp $
+/* $Id: myldrEnum32bitRelRecs.cpp,v 1.3 2000-09-02 21:08:08 bird Exp $
  *
  * myldrEnum32bitRelRecs - ldrEnum32bitRelRecs
@@ -24,12 +24,13 @@
 #include <stdlib.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+#include "avl.h"
 #include "log.h"
 #include <peexe.h>
 #include <exe386.h>
 #include "OS2Krnl.h"
-#include "avl.h"
-#include "ModuleBase.h"
 #include "ldr.h"
 #include "ldrCalls.h"
+#include "ModuleBase.h"
 
 
@@ -63,5 +64,5 @@
         APIRET rc;
         #if 1
-        kprintf(("ldrEnum32BitRelRecs: pMTE=0x%08x iObject=0x%02x iPageTable=0x%03x pvPage=0x%08x\n"
+        kprintf(("myldrEnum32BitRelRecs: pMTE=0x%08x iObject=0x%02x iPageTable=0x%03x pvPage=0x%08x\n"
                  "                     ulPageAddress=0x%08x pvPTDA=0x%08x\n",
                  pMTE, iObject, iPageTable, pvPage, ulPageAddress, pvPTDA
Index: trunk/src/win32k/ldr/myldrGetMte.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrGetMte.cpp	(revision 4152)
+++ 	(revision )
@@ -1,16 +1,0 @@
-/* $Id: myldrGetMte.cpp,v 1.2 2000-01-28 15:28:43 bird Exp $
- *
- * Obsolete
- *
- * Copyright (c) 1998 knut st. osmundsen
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#include <ldr.h>
-
-int LDRCALL myldrGetMte(ULONG p1, ULONG p2, ULONG p3, ULONG p4, ULONG p5)
-{
-    //kernel_printf(("_ldrGetMte: p1:0x%x p2:0x%x p3:0x%x p4:0x%x p5:0x%x",p1,p2,p3,p4,p5));
-    return _ldrGetMte(p1,p2,p3,p4,p5);
-}
Index: trunk/src/win32k/ldr/myldrGetResource.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrGetResource.cpp	(revision 4152)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/* $Id: myldrGetResource.cpp,v 1.2 2000-01-28 15:28:43 bird Exp $
- *
- * Obsolete
- *
- * Copyright (c) 1998 knut st. osmundsen
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#include <ldr.h>
-
-
-/*
-    Notes: form DosGetResource parameters
-        handle to module            hMod!
-        idType                      idType?
-        idName                      idName?
-        pointer To resource         ppRes?
-
-
-*/
-static global_flag_resource = 0;
-
-
-int LDRCALL myldrGetResource(USHORT idType, ULONG idName, USHORT hMod, PPVOID ppRes, ULONG ulP5)
-{
-    int rc;
-    if ( ulP5 != 1 )
-        kernel_printf(("_ldrGetResource: ulP5=%d (!=1)",ulP5 ));
-    if ( global_flag_resource )
-        kernel_printf(("_ldrGetResource:      idType:0x%x idName:0x%x hMod:0x%x *ppRes:0x%x p5:0x%x", idType, idName, hMod, *((PULONG)ppRes), ulP5));
-    rc = _ldrGetResource(idType, idName, hMod, ppRes, ulP5);
-    if ( global_flag_resource )
-        kernel_printf(("_ldrGetResource-post: idType:0x%x idName:0x%x hMod:0x%x *ppRes:0x%x p5:0x%x", idType, idName, hMod, *((PULONG)ppRes), ulP5));
-
-    return rc;
-}
-
Index: trunk/src/win32k/ldr/myldrOpen.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrOpen.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/myldrOpen.cpp	(revision 4164)
@@ -1,7 +1,7 @@
-/* $Id: myldrOpen.cpp,v 1.10 2000-02-21 09:24:01 bird Exp $
+/* $Id: myldrOpen.cpp,v 1.11 2000-09-02 21:08:09 bird Exp $
  *
  * myldrOpen - ldrOpen.
  *
- * Copyright (c) 1998-1999 knut st. osmundsen
+ * Copyright (c) 1998-2000 knut st. osmundsen
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -17,4 +17,7 @@
 
 #define INCL_OS2KRNL_IO
+#define INCL_OS2KRNL_TCB
+#define INCL_OS2KRNL_SEM
+#define INCL_OS2KRNL_SEC
 
 /*******************************************************************************
@@ -23,4 +26,5 @@
 #include <os2.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "rmalloc.h"
 #include "malloc.h"
@@ -28,28 +32,30 @@
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "log.h"
+#include "avl.h"
+#include "options.h"
 #include <peexe.h>
 #include <exe386.h>
+#include "elf.h"
 #include "OS2Krnl.h"
 #include "dev32.h"
+#include "ldr.h"
+#include "ldrCalls.h"
 #include "ModuleBase.h"
 #include "pe2lx.h"
-#include "elf.h"
-#include "avl.h"
-#include "ldr.h"
-#include "ldrCalls.h"
-#include "options.h"
 #include "myExecPgm.h"
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-extern BOOL fQAppType;                  /* From LDRQAppType */
+#include "env.h"
+#include "vprintf.h"                    /* Make 100% sure we have va_start.  */
+
+
 
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static unsigned getArgsLength(const char *pachArgs);
+/* static */ APIRET     AddArgsToFront(int cArgs,  ...);
+/* static */ APIRET     SetExecName(const char *pszExeName);
+/* static */ APIRET     OpenPATH(PSFN phFile, char *pszFilename, PULONG pfl);
 
 
@@ -59,185 +65,462 @@
  * @param     phFile       Pointer to file handler. Holds filehandle on output.
  * @param     pszFilename  Pointer to filename.
- * @parma     param3       Probably some flags.
+ * @parma     pfl          Pointer to some flags.
  */
-ULONG LDRCALL myldrOpen(PSFN phFile, char *pszFilename, ULONG param3)
+ULONG LDRCALL myldrOpen(PSFN phFile, PSZ pszFilename, PULONG pfl)
 {
-    ULONG rc;
-
-    /*
-     * Try open the file (thats why this function is called anyway)
+    static  int cNesting = 0;           /* This is an variable which hold the nesting */
+                                        /* level of this function. This is useful     */
+                                        /* when we call it recurcively.               */
+                                        /* The maximum nesting level is currently 3.  */
+                                        /* When the maximum depth has been reached    */
+                                        /* we'll not intercept loading any longer!    */
+    ULONG rc;                           /* Return value. */
+
+    /** @sketch
+     * Try open the file (that's why this function is called anyway)
      */
-    rc = ldrOpen(phFile, pszFilename, param3);
-
-    /* log sucesses */
+    rc = ldrOpen(phFile, pszFilename, pfl);
     if (rc == NO_ERROR)
-        kprintf(("ldrOpen:  phFile=%#.4x, flags=%#.8x, pszFn=%s\n", *phFile, param3, pszFilename));
-
-    /*
+        kprintf(("myldrOpen-%d:  phFile=%#.4x, flags=%#.8x, pszFn=%s\n", cNesting, *phFile, pfl, pszFilename));
+
+
+    /** @sketch
      * Are we to intercept the loading?
-     * - Only if open were succesful and one of the loaders are enabled.
+     * - If open were successful.
+     * - And Not too deep nesting.
+     * - And that this isn't an unsupported load.
+     * - And one of the loaders are enabled.
      */
-    if (rc == NO_ERROR && (options.fElf || options.fPE != FLAGS_PE_NOT || options.fScript))
-    {
-        char               *pszBuffer = (char*)rmalloc(640);        /* Read buffer. */
-        PIMAGE_DOS_HEADER   pMzHdr = (PIMAGE_DOS_HEADER)pszBuffer;  /* Pointer to the buffer as it were a dosheader. */
-        PIMAGE_NT_HEADERS   pNtHdrs = (PIMAGE_NT_HEADERS)pszBuffer; /* Pointer to the buffer as if it were an NT header. */
-        char               *pach = pszBuffer;                       /* Finally an pointer to the buffer as if it were chars.. (which it is!) */
-        PEXECPGMBUFFER      pBuffer;                                /* Pointer to a buffer containing the programname and arguments. */
-                                                                    /* For scripts and PE.EXE this has to be changed to have correct */
-                                                                    /* parameters sendt in to the program. */
-        unsigned            cchRead = sizeof(IMAGE_DOS_HEADER);     /* Amount of the buffer which contains valid data. */
-        unsigned            cbFile;                                 /* Filesize (0xffffffff if call to SftFileSize failed - should _never_ happen though)  */
-
-        /*
-         * Verify that rmalloc completed successfully.
-         */
-        if (pszBuffer == NULL)
+    if (rc == NO_ERROR
+        && cNesting < 3
+        && !isLdrStateLoadingUnsupported()
+        && isAnyLoaderEnabled()
+        )
+    {
+        union _u_ReadBufferPointers         /* Read buffer pointer(s). */
         {
-            kprintf(("ldrOpen: rmalloc(1024) failed\n"));
-            return NO_ERROR;
+            char               *pach;       /* Pointer to the buffer as char. */
+            unsigned long      *pul;        /* Pointer to the buffer as unsigned long. */
+            PIMAGE_DOS_HEADER   pMzHdr;     /* Use the buffer as a dosheader. */
+            PIMAGE_NT_HEADERS   pNtHdrs;    /* Use the buffer as a NT header. */
+        } u1;
+        unsigned            cbFile;         /* Filesize (0xffffffff if call to SftFileSize failed - should _never_ happen though) */
+        unsigned            cbRead;         /* Amount of the buffer which contains valid data. */
+        char *              psz;            /* Multipurpose string pointer no.1. */
+        char *              psz2;           /* Multipurpose string pointer no.2. */
+        char *              psz3;           /* Multipurpose string pointer no.3. */
+
+        /** @sketch
+         * Allocate read buffer from resident heap.
+         * IF this fails THEN we'll simply return NO_ERROR.
+         */
+        u1.pach = (char*)rmalloc(640);
+        if (u1.pach == NULL)
+        {
+            kprintf(("myldrOpen-%d: rmalloc(640) failed\n", cNesting));
+            goto ret;
         }
 
-        /*
-         * Try get the filesize
+
+        /** @sketch
+         * Increment nesting level.
+         */
+        cNesting++;
+
+
+        /** @sketch
+         * Get the filesize. On failure filesize is set to ~0.
          */
         rc = SftFileSize(*phFile, (PULONG)SSToDS(&cbFile));
         if (rc != NO_ERROR)
         {
-            kprintf(("ldrOpen: SftFileSize failed with rc=%d\n", rc));
+            kprintf(("myldrOpen-%d: SftFileSize failed with rc=%d\n", cNesting, rc));
             cbFile = (unsigned)~0;
         }
 
-        /*
-         * See if this is an recognizable module format.
-         * This costs up to two disk reads!
-         */
-        rc = ldrRead(*phFile, 0UL, pMzHdr, 0UL, cchRead, NULL);
-        if (rc == NO_ERROR)
+
+        /** @sketch
+         *  Read the size of a DOS (ie. MZ) header.
+         *  IF successful and more stuff in file THEN
+         *      See if this is an recognizable module binary format:
+         */
+        cbRead = min(sizeof(IMAGE_DOS_HEADER), cbFile);
+        rc = ldrRead(*phFile, 0UL, u1.pMzHdr, 0UL, cbRead, NULL);
+        if (rc == NO_ERROR && cbRead < cbFile)
         {
-            /*
-             * PE header?
-             *  - If DOS Magic is found AND a valid e_lfanew (offset of NE/LX/LE/PE header) is found
-             *  - OR if PE siganture is found.
+            /** @sketch
+             * If LX header just give up at once.
              */
-            if ((pMzHdr->e_magic == IMAGE_DOS_SIGNATURE &&
-                 pMzHdr->e_lfanew > sizeof(IMAGE_DOS_HEADER) && pMzHdr->e_lfanew < 0x04000000UL) /* Larger than 64 bytes and less that 64MB. */
-                || *(PULONG)pach == IMAGE_NT_SIGNATURE)
-            {   /*
-                 * MZ or PE header found
+            if (u1.pMzHdr->e_magic == E32MAGIC)
+                goto cleanup;
+
+            /** @sketch
+             * IF PE or MZ header THEN
+             */
+            if (u1.pMzHdr->e_magic == IMAGE_DOS_SIGNATURE
+                || u1.pNtHdrs->Signature == IMAGE_NT_SIGNATURE)
+            {
+                ULONG   offPe;          /* Offset to PE header. */
+
+                /** @sketch
+                 * ---
+                 * We now known that this is file has a MZ or a PE header. If it's
+                 * a MZ header, we might end up with no "New" header or the "New"
+                 * header might turn out to be a NE, LE, or LX header. I any of
+                 * these non PE headers occur OS/2 will take care of it, we'll do nothing.
+                 * ---
+                 * IF PE loading is disable or MZ header and e_lfanew is invalid THEN
+                 *     return (successfully) to the caller.
+                 * ENDIF
+                 * (Find the offset of the PE header while testing (offPe).)
                  */
-
-                /* if PE loading is diable return to the caller */
-                if (options.fPE == FLAGS_PE_NOT)
+                if (isPELoaderDisabled())
+                    goto cleanup;
+                if (u1.pMzHdr->e_magic == IMAGE_DOS_SIGNATURE)
                 {
-                    rfree(pszBuffer);
-                    return NO_ERROR;
+                    offPe = u1.pMzHdr->e_lfanew;
+                    if (offPe < sizeof(IMAGE_DOS_HEADER) || offPe > 0x04000000UL)
+                        goto cleanup;
                 }
-
-                /*
-                 * Read the PE header if it isn't what we allready have!
+                else
+                    offPe = 0;
+
+
+                /** @sketch
+                 * Read the PE header.
+                 * If the read failes or not PE signature, there isn't anything for us to do.
                  */
-                cchRead = sizeof(IMAGE_NT_HEADERS);
-                if (*(PULONG)pach != IMAGE_NT_SIGNATURE)
-                    rc = ldrRead(*phFile, pMzHdr->e_lfanew, pach, 0UL, cchRead, NULL);
-                else
-                    rc = ldrRead(*phFile, 0UL, pach, 0UL, cchRead, NULL);
-
-                /*
-                 * If successfully read, and a PE signature is present the continue and try load it!
-                 * Else don't do anything, simply return NO_ERROR to the caller. (probably NE or LX exec)
+                rc = ldrRead(*phFile, offPe, u1.pach, 0UL, sizeof(IMAGE_NT_HEADERS), NULL);
+                if (rc != NO_ERROR || u1.pNtHdrs->Signature != IMAGE_NT_SIGNATURE)
+                    goto cleanup_noerror;
+
+
+                /** @sketch
+                 * PE signature found!
                  */
-                if (rc == NO_ERROR && *(PULONG)pach == IMAGE_NT_SIGNATURE)
-                {   /*
-                     * PE signature found.
-                     */
-                    kprintf(("ldrOpen: PE executable...\n"));
-
-                    /*
-                     * PE2LX?
-                     *  - When PE2LX flag is set
-                     *  - OR when the MIXED flag is set and the image is with the first 64MB of memory.
-                     */
-                    if (options.fPE == FLAGS_PE_PE2LX
-                        || (options.fPE == FLAGS_PE_MIXED
-                            && !((pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_DLL == 0UL)
-                                 && pNtHdrs->OptionalHeader.ImageBase >= 0x04000000UL /* 64MB */
-                                 )
+                kprintf(("myldrOpen-%d: PE executable...\n", cNesting));
+
+
+                /** @sketch
+                 * Use Pe2Lx?
+                 *  - When Pe2Lx flag is set
+                 *  - When the MIXED flag is set and the image isn't an executable
+                 *    above the first 64MB private limit without relocations
+                 */
+                if (isPe2LxLoaderEnabled()
+                    || (isMixedPeLoaderEnabled()
+                        && ((u1.pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_DLL)
+                            || !(u1.pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)
+                            || u1.pNtHdrs->OptionalHeader.ImageBase < 0x04000000UL /* 64MB */
                             )
                         )
-                    {   /*
-                         * Pe2Lx (Ring0 of course)
-                         * - Create a Pe2Lx class,
-                         * - initiate it
-                         * - Add the module to the module tree so we may find it later...
-                         * - Set the handle state to 'our'.
-                         */
-                        Pe2Lx * pPe2Lx = new Pe2Lx(*phFile);
-                        if (pPe2Lx != NULL)
+                    )
+                {   /** @sketch
+                     *  Pe2Lx (Ring0 of course)
+                     *      - Create a Pe2Lx class,
+                     *      - initiate it
+                     *      - Add the module to the module tree so we may find it later...
+                     *      - Set the (file)handle state to 'our'.
+                     *      - Set pExeModule to module pointer and loaderstate to our exe.
+                     */
+                    Pe2Lx * pPe2Lx = new Pe2Lx(*phFile);
+                    if (pPe2Lx != NULL)
+                    {
+                        rc = pPe2Lx->init(pszFilename);
+                        if (rc == NO_ERROR)
                         {
-                            rc = pPe2Lx->init(pszFilename);
+                            kprintf(("myldrOpen-%d: Successfully init of Pe2Lx object.\n", cNesting));
+                            rc = addModule(*phFile, NULL, MOD_TYPE_PE2LX, pPe2Lx);
                             if (rc == NO_ERROR)
                             {
-                                kprintf(("ldrOpen: Successfully init of Pe2Lx object.\n"));
-                                rc = addModule(*phFile, NULL, MOD_TYPE_PE2LX, pPe2Lx);
-                                if (rc == NO_ERROR)
-                                    #pragma info(notrd)
-                                    SetState(*phFile, HSTATE_OUR);
-                                    #pragma info(restore)
-                                else
-                                    kprintf(("ldrOpen: Failed to add the module. rc=%d\n"));
+                                #pragma info(notrd)
+                                SetState(*phFile, HSTATE_OUR);
+                                #pragma info(restore)
+                                if (pPe2Lx->isExe())
+                                {
+                                    setLdrStateLoadingOurEXE();
+                                    pExeModule = getModuleBySFN(*phFile);
+                                    #ifdef DEBUG
+                                    if (pExeModule == NULL)
+                                        kprintf(("myldrOpen-%d: getModuleBySFN failed when setting pExeModule! FATAL!\n", cNesting));
+                                    #endif
+                                }
                             }
                             else
-                                kprintf(("ldrOpen: Failed to init Pe2Lx object. rc=%d\n"));
-                            if (rc != NO_ERROR)
-                                delete pPe2Lx;
+                                kprintf(("myldrOpen-%d: Failed to add the module. rc=%d\n", cNesting));
                         }
                         else
-                            kprintf(("ldrOpen: Failed to allocate Pe2Lx object.\n"));
+                            kprintf(("myldrOpen-%d: Failed to init Pe2Lx object. rc=%d\n", cNesting));
+                        if (rc != NO_ERROR)
+                            delete pPe2Lx;
                     }
                     else
                     {
-                        /*
-                         * Starting of PE.EXE enable?
+                        kprintf(("myldrOpen-%d: Failed to allocate Pe2Lx object.\n", cNesting));
+                        rc = ERROR_NOT_ENOUGH_MEMORY;
+                    }
+
+                    goto cleanup;
+                }
+
+
+                /** @sketch
+                 *  Using PE.EXE to start EXE?
+                 *      - When the file is an EXE file and PE.EXE is enabled.
+                 */
+                if ((u1.pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_DLL) == 0UL
+                    && (options.fPE == FLAGS_PE_PE || options.fPE == FLAGS_PE_MIXED)
+                    && (isLdrStateExecPgm() || isLdrStateQAppType())
+                    )
+                {
+                    /** @sketch
+                     * PE.EXE:
+                     * Find pe.exe - look in current directory and thru the PATH.
+                     * Note! We use the read buffer (u1.p*) as a storage for the
+                     * pe.exe filename and path.
+                     */
+                    kprintf(("myldrOpen-%d: pe.exe - opening\n", cNesting));
+                    ldrClose(*phFile);
+                    strcpy(u1.pach, "PE.EXE");
+                    rc = ldrOpen(phFile, u1.pach, pfl); /* This isn't recusive! */
+                    if (rc != NO_ERROR)
+                        rc = OpenPATH(phFile, u1.pach, pfl);
+                    if (rc == NO_ERROR)
+                    {
+                        /** @sketch
+                         * If we're in tkExecPgm state we'll have to shuffle the parameters
+                         * and executable filename tkExecPgm were called with.
+                         * If not tkExecPgm we can't do anything about parameters (and there is
+                         * probably nothing to do either).
                          */
-                        if (options.fPE == FLAGS_PE_PE || options.fPE == FLAGS_PE_MIXED)
-                        {   /*
-                             * pe.exe - need the path!
-                             */
-                            kprintf(("ldrOpen: pe.exe - opening\n"));
-                            ldrClose(*phFile);
-                            rc = ldrOpen(phFile, "pe.exe", param3);  /* path....! problems! */
-                            kprintf(("ldrOpen: pe.exe - open returned with rc = %d\n", rc));
-                            rfree(pszBuffer);
-                            return rc;
+                        kprintf(("myldrOpen-%d: pe.exe - %s\n", cNesting, u1.pach));
+                        if (isLdrStateExecPgm() && fTkExecPgm)
+                        {
+                            rc = AddArgsToFront(2, ldrpFileNameBuf, achTkExecPgmFilename);
+                            if (rc == NO_ERROR)
+                            {
+                                rc = SetExecName(ldrpFileNameBuf);
+                                if (rc != NO_ERROR)
+                                    kprintf(("myldrOpen-%d: pe.exe - failed to set pe.exe as execname. rc=%d\n", cNesting));
+                            }
+                            else
+                                kprintf(("myldrOpen-%d: pe.exe - failed to add programname as argument. rc=%d\n", cNesting, rc));
+                            goto cleanup_noerror;
                         }
                     }
+                    else
+                        kprintf(("myldrOpen-%d: pe.exe - couldn't find/open pe.exe\n", cNesting));
                 }
-                rfree(pszBuffer);
-                return NO_ERROR;
+                goto cleanup;
             }
-            else
+            /** @sketch End of PE Loading. */
+
+
+            /** @sketch
+             * ELF image?
+             */
+            if (*u1.pul == ELFMAGICLSB)
             {
+                if (isELFDisabled())
+                    goto cleanup_noerror;
+
                 /*
-                 * ELF image?
+                 * ELF signature found.
                  */
-                if (pach[0] == ELFMAG0 && pach[1] == ELFMAG1 && pach[2] == ELFMAG2 && pach[3] == ELFMAG3)
+                kprintf(("myldrOpen-%d: ELF image! - not implemented yet!\n", cNesting));
+
+                /*
+                 * Do nothing more yet. NEED AN ELF LOADER!!!
+                 */
+                goto cleanup;
+            }
+
+
+            /** @sketch
+             * Java image?
+             */
+            if (*u1.pul == 0xBEBAFECAUL) //CAh FEh BAh BEh
+            {
+                char *pszName = NULL;
+                int   cchName;
+
+                if (isJAVADisabled())
+                    goto cleanup_noerror;
+
+                /** @sketch
+                 * Java signature found.
+                 * Copy the name to a temporary buffer. (only if necessary)
+                 * Remove the extention (.class) and insert a space between the name and the path.
+                 *  (This is the needed processing of the class filename to make it a classpath
+                 *   entry (path) and a class name (filename).)
+                 * Try find the java executor in current dir or PATH: java.exe
+                 */
+                kprintf(("myldrOpen-%d: Jave image!\n", cNesting));
+
+                if (isLdrStateExecPgm() && fTkExecPgm)
                 {
-                    /*
-                     * ELF signature found.
+                    /* Ooops we had to get the file name from the MFT. ldrpFileNameBuf is allways uppercased... */
+                    /* MFT seems to hold uppercased filenames! ARG! But (by pure luck?) achTkExecPgmArguments is
+                     * not uppercased (yet). Nothing could be simpler!
                      */
-                    kprintf(("ldrOpen: ELF executable! - not implemented yet!\n"));
-
-                    /*
-                     * Do nothing more yet. NEED AN ELF LOADER!!!
+                    #if 1
+                    psz3 = achTkExecPgmArguments;
+                    #elif 0
+                    psz3 = SecPathFromSFN(*phFile);
+                    if (psz3 == NULL)
+                        psz3 = ldrpFileNameBuf;
+                    #else
+                    psz3 = ldrpFileNameBuf;
+                    #endif
+                    cchName = strlen(psz3);
+                    pszName = (char*)rmalloc(cchName + 2);
+                    if (pszName == NULL)
+                    {
+                        rc = ERROR_NOT_ENOUGH_MEMORY;
+                        goto cleanup;
+                    }
+                    memcpy(pszName, psz3, cchName+1);
+
+                    psz = pszName + strlen(pszName) - 1;
+                    while (psz > pszName && *psz != '.' && *psz != '\\' && *psz != '/')
+                        psz--;
+                    if (*psz == '.')
+                    {
+                        cchName = psz - pszName;
+                        *psz-- = '\0';
+                        while (psz > pszName && *psz != '\\' && *psz != '/')
+                            psz--;
+
+                        /* check for root and evt. make room for an extra slash. */
+                        if (psz - pszName == 2)
+                        {
+                            memmove(psz + 1, psz, cchName - 1);
+                            *psz++ = '\\';
+                        }
+                    }
+                    /* check if no path */
+                    if (psz == pszName)
+                        memmove(pszName + 1, pszName, cchName + 1);
+                    *psz = ' ';
+                }
+
+                ldrClose(*phFile);
+                rc = ldrOpen(phFile, ".\\JAVA.EXE", pfl);
+                if (rc != NO_ERROR)
+                    rc = OpenPATH(phFile, "JAVA.EXE", pfl);
+                if (rc == NO_ERROR)
+                {
+                    kprintf(("myldrOpen-%d: java - %s\n", cNesting, ldrpFileNameBuf));
+
+                    /** @sketch
+                     * To be able to execute any given class name we'll have to pass in the
+                     * directory as -classpath. But -classpath seems to override the default
+                     * and environmental CLASSPATHs. So, we'll have to pass in the value of
+                     * the CLASSPATH env.var. or generate the default class path (what ever that is).
+                     *
                      */
-                    rfree(pszBuffer);
-                    return NO_ERROR;
+                    if (isLdrStateExecPgm() && fTkExecPgm)
+                    {
+                        psz = u1.pach;
+
+                        /*
+                         * Get classpath and add it as a parameter
+                         */
+                        strcpy(u1.pach, "-classpath ");
+                        psz = u1.pach + strlen(u1.pach);
+
+                        psz3 = (char*)ScanEnv(GetEnv(TRUE), "CLASSPATH");
+                        if (psz3 != NULL)
+                        {   /* environment variable set */
+                            if (strlen(psz3) > 640 - 11 - 1 - cchName) //check for overflow
+                            {   // TODO? should reallocate...
+                                memcpy(psz, psz3, 640 - 11 - 1 - cchName);
+                                psz[640 - 11 - 1 - cchName] = '\0';
+                            }
+                            else
+                                strcpy(psz, psz3);
+                            psz += strlen(psz);
+                        }
+                        else
+                        {
+                            /* Make default classpath by taking the java.exe path + '..\lib\classes.zip' */
+                            strcpy(psz, ldrpFileNameBuf);
+                            psz3 = psz + strlen(psz) - 1;
+                            while (psz3 > psz && *psz3 != '\\' && *psz3 != '/')
+                                psz3--;
+                            strcpy(++psz3, "..\\lib\\classes.zip");
+                            psz = psz3 + strlen(psz3);
+                        }
+
+                        /*
+                         * Add the class directory (as the last classpath entry) and the class name.
+                         * (Note. I may happen that there is no directory, but that don't matter
+                         *        a space is allways preceding the class name.)
+                         */
+                        *psz++ = ';';
+                        strcpy(psz, pszName);
+                        if (pszName != NULL)
+                            rfree(pszName);
+
+                        /*
+                         * Setup JAVA.EXE as executable with the parameters we've build.
+                         */
+                        rc = AddArgsToFront(2, ldrpFileNameBuf, u1.pach);
+                        kprintf(("myldrOpen-%d: java - Exe: %s  Args: %s\n", cNesting, ldrpFileNameBuf, u1.pach));
+                        if (rc == NO_ERROR)
+                        {
+                            rc = SetExecName(ldrpFileNameBuf);
+                            if (rc != NO_ERROR)
+                                kprintf(("myldrOpen-%d: java - failed to set java.exe as execname. rc=%d\n", cNesting, rc));
+                        }
+                        else
+                            kprintf(("myldrOpen-%d: java - failed to setup the parameters. rc=%d\n", cNesting, rc));
+
+                        goto cleanup_noerror;
+                    }
                 }
+                else
+                    kprintf(("myldrOpen-%d: java - couldn't find/open java.exe\n", cNesting));
+
+
+                /** @sketch
+                 *  End of Java loading. (return)
+                 */
+                if (pszName != NULL)
+                    rfree(pszName);
+                goto cleanup;
             }
+
         }
+        else
+        {
+            /** @sketch
+             *  ELSE - the reading size of a DOS header failed or file is smaller than the dos header.
+             *      IF read failed or filesize is less than 4 bytes THEN
+             *          return no_error to the caller.
+             *      ENDIF
+             */
+            #ifdef DEBUG
+            if (rc != NO_ERROR)
+            {
+                kprintf(("myldrOpen-%d: ldrRead failed cbRead=%d, cbFile=%d,  rc=%d\n", cNesting, cbRead, cbFile, rc));
+                goto cleanup_noerror;
+            }
+            if (cbRead < 4)
+            {
+                kprintf(("myldrOpen-%d: File too small! cbFile=%d\n", cNesting, cbFile));
+                goto cleanup_noerror;
+            }
+            #else
+            if (rc != NO_ERROR || cbRead < 4) //just forget files less than 4 bytes!
+                goto cleanup_noerror;
+            #endif
+        }
+        /** @sketch ENDIF (dos header read) */
+
+
 
         /*
-         * Only unreconized files and readerror passes this point!
+         * Only unreconized files passes this point!
          *
          * * Fileformats with lower priority should reside here. *
@@ -245,159 +528,116 @@
          */
 
-        /*
-         * If the initial readoperation failed try to read a smaller amount, in case it is a small script...
-         * 4 bytes is a small amount isn't it?
-         */
-        if (rc != NO_ERROR)
+        /** @sketch
+         *  UNIX styled script?
+         *      - Starts with a hash (#)
+         *      - And we're loading an EXE
+         *      - And we're either in QAppType or ExecPgm state.
+         *      - And that a bang (!) is the first char after the hash (ignoring blanks).
+         */
+        if (*u1.pach == '#'
+            && isLdrStateLoadingEXE()
+            && (isLdrStateQAppType() || isLdrStateExecPgm())
+            )
         {
-            kprintf(("ldrOpen: first ldrread failed with rc=%d. tries to read 4 byte.\n", rc));
-            cchRead = 4;
-            if ((rc = ldrRead(*phFile, 0UL, pach, 0UL, cchRead, NULL)) != NO_ERROR)
-                kprintf(("ldrOpen: second ldrread failed with rc=%d.\n ", rc));
-        }
-
-        /*
-         * Now we'll try again, UNIX styled script?
-         */
-        if (rc == NO_ERROR && *pach == '#' && pach[1] == '!')
-        {
+            if (isUNIXScriptDisabled())
+                goto cleanup_noerror;
             /*
-             * UNIX styled script?
-             * FIXME! Must be more than 64 bytes long?
-             *        No options!
-             *        Firstline < 64 bytes!
+             * Look for a bang (!). Tabs and spaces are skipped, anything else result in error.
              */
-            kprintf(("ldrOpen: unix script?\n"));
-            cchRead = min(cbFile, 256);
-            rc = ldrRead(*phFile, 0UL, pach, 0UL, cchRead, NULL);
-            if (rc == NO_ERROR)
+            psz = u1.pach + 1;
+            while ((*psz == ' ' || *psz == '\t') && psz - u1.pach < cbRead)
+                psz++;
+            if (*psz == '!')
             {
-                char *pszStart = pach+2;
-                kprintf(("ldrOpen: script debug 1\n"));
-
-                /* Make sure we don't read to much... */
-                pszBuffer[cchRead] = '\0';
-
-                /*
-                 * Skip blanks
+                /** @sketch Found UNIX styled script! */
+
+                /** @sketch
+                 * Read more of the script if necessary. (max is 256 chars (- Linux max is 127))
+                 * Terminate the string read from the file to make sure with stop somewhere!
                  */
-                pszStart = pszBuffer + 2; /* skips the "#!" stuff. */
-                while (*pszStart != '\0' && (*pszStart == ' ' || *pszStart == '\t'))
-                    pszStart++;
-                kprintf(("ldrOpen: script debug 2\n"));
-
-                /* anything left on the line? */
-                if (*pszStart != '\0' && *pszStart != '\r' && *pszStart != '\n')
+                if (cbRead < cbFile /*&& cbRead != 256*/)
                 {
-                    char *      pszEnd;         /* Pointer to the end of the string(s) when the next step is finished. */
-                    unsigned    cchToAdd = 1;   /* Chars to add */
-                    BOOL        fFirst = TRUE;  /* Set if a '\0' has not been set yet.
-                                                 * If this is clear, there are one or more parameters after the interpreter name. */
-
-                    /*
-                     * find linesize and make parameters ready for copying
+                    cbRead = min(256, cbFile);
+                    rc = ldrRead(*phFile, 0UL, u1.pach, 0UL, cbRead, NULL);
+                }
+                u1.pach[cbRead] = '\0';
+
+                if (rc == NO_ERROR)
+                {
+                    /** @sketch
+                     * Parse out filename and optional arguments (if any).
+                     * The result of the parsing is that:
+                     *      psz will point at the executable name.
+                     *      psz2 will point at the arguments.
+                     *  Both strings are trimmed.
                      */
-                    pszEnd = pszStart;
-                    kprintf(("ldrOpen: script debug 3\n"));
-                    while (*pszEnd != '\0' && *pszEnd != '\r' && *pszEnd != '\n')
+                    psz++;                                                  /* psz points to the bang, skip it. */
+                    while (*psz == ' ' || *psz == '\t')                     /* skip blanks after bang */
+                        psz++;
+                    if (*psz == '\r' || *psz == '\n' || *psz == '\0')       /* End-of-line? */
                     {
-                        if (fFirst && (*pszEnd == ' ' || *pszEnd == '\t'))
+                        kprintf(("myldrOpen-%d: script no executable name.\n", cNesting));
+                        goto cleanup_noerror; /* other error code? */
+                    }
+                    psz2 = psz + 1;                                         /* Not end-of-line, so add 1 before searching for args. */
+                    while (*psz2 != '\0' && *psz2 != '\n' && *psz2 != '\r'  /* skip executable name. */
+                           && *psz2 != ' ' && *psz2 != '\t')
+                        psz2++;
+                    while (*psz2 == ' ' || *psz2 == '\t')                    /* skip blanks after executable - pad them with '\0'! */
+                        *psz2++ = '\0';
+
+                    psz3 = psz2;
+                    while (*psz3 != '\n' && *psz3 != '\r' && *psz3 != '\0') /* find end of parameters and terminate the string. */
+                        psz3++;
+                    *psz3 = '\0';
+                    while (psz3 >= psz2 && (*psz3 == '\0' || *psz3 == ' ' || *psz3 == '\t')) /* trim args */
+                        *psz3-- = '\0';
+
+
+                    /** @sketch
+                     *  IF tkExecPgm THEN
+                     *      Correct parameters - ie. add exec name (as argv[0]),
+                     *        arguments (psz2) as argv[1+], old exec name, and finally
+                     *        the existing parameters (current argv[1+]).
+                     *      Set the executable name.
+                     *  ENDIF
+                     *  Open the new executable file recursively. (psz)
+                     */
+                    if (isLdrStateExecPgm())
+                    {
+                        if (*psz2)
+                           rc = AddArgsToFront(3, psz, psz2, achTkExecPgmFilename);
+                        else
+                           rc = AddArgsToFront(2, psz, achTkExecPgmFilename);
+                        if (rc != NO_ERROR)
                         {
-                            *pszEnd = '\0';
-                            fFirst = FALSE;
-                            if (pszEnd[1] == '\0' || pszEnd[1] == '\r' || pszEnd[1] == '\n')
-                                fFirst = TRUE;
+                            kprintf(("myldrOpen-%d: AddArgsToFront failed with rc=%d\n", cNesting));
+                            goto cleanup_noerror;
                         }
-
-                        /* next */
-                        pszEnd++;
-                        cchToAdd++;
+                        rc = SetExecName(psz);
+                        if (rc != NO_ERROR)
+                            kprintf(("myldrOpen-%d: SetExecName failed with rc=%d\n", cNesting));
                     }
-                    *pszEnd = '\0';
-                    kprintf(("ldrOpen: script debug 4\n"));
-
-                    /*
-                     * If ldrQueryApp type we don't have any ExecPgm buffer we need to mess with.
-                     * We'll simply try open the the interpreter.
-                     */
-                    if (fQAppType)
+                    ldrClose(*phFile);
+                    rc = myldrOpen(phFile, psz, pfl);
+                    if (rc != NO_ERROR)
                     {
-                        rc = ldrClose(*phFile);
-                        rc = ldrOpen(phFile, pszStart, param3); /* FIXME, recusion! check that name not equal! Use flags to prevent race? */
-                    }
-                    else
-                    {
-                        /*
-                         * Find the ExecPgm buffer.
-                         */
-                        pBuffer = QueryBufferPointerFromFilename(pszFilename);
-                        kprintf(("ldrOpen: script debug 5\n"));
-                        if (pBuffer != NULL)
+                        psz2 = psz + strlen(psz);
+                        if (psz + 4 >= psz2 || strcmp(psz2 - 4, ".EXE") != 0)
                         {
-                            unsigned cchArguments = getArgsLength(pBuffer->achArgs); /* minus the first argument. */
-                            unsigned cchScriptnameDelta = strlen(pBuffer->szFilename) - strlen(pBuffer->achArgs); /* scriptname size difference. */
-
-                            kprintf(("ldrOpen: script debug 6\n"));
-
-                            /*
-                             * Is there enough space in the struct?
-                             */
-                            if (cchArguments + cchToAdd + cchScriptnameDelta < sizeof(pBuffer->achArgs))
-                            {
-                                kprintf(("ldrOpen: script debug 7\n"));
-                                /*
-                                 * Open the interpreter.
-                                 */
-                                rc = ldrClose(*phFile);
-                                rc = ldrOpen(phFile, pszStart, param3); /* FIXME, recusion! check that name not equal! Use flags to prevent race? */
-                                if (rc == NO_ERROR)
-                                {
-                                    kprintf(("ldrOpen: script debug 8\n"));
-                                    /* Make space for the addition arguments. */
-                                    #ifdef DEBUG
-                                    char *psz = &pBuffer->achArgs[0];
-                                    int   i = 0;
-                                    while (*psz != '\0')
-                                    {
-                                        kprintf(("Arg %d: %s\n", i++, psz));
-                                        psz += 1 + strlen(psz);
-                                    }
-                                    #endif
-                                    memmove(&pBuffer->achArgs[cchToAdd + cchScriptnameDelta],
-                                            &pBuffer->achArgs[0], cchArguments);
-
-                                    /*
-                                     * Copy the arguments.
-                                     */
-                                    kprintf(("ldrOpen: script debug 8\n"));
-                                    memcpy(&pBuffer->achArgs[0], pszStart, cchToAdd); /* Interpreter with arguments */
-                                    if (!fFirst)
-                                        pBuffer->achArgs[cchToAdd - 1] = ' ';
-                                    strcpy(&pBuffer->achArgs[cchToAdd], pszFilename); /* Scriptname */
-                                    kprintf(("ldrOpen: script debug a\n"));
-
-                                    #ifdef DEBUG
-                                    psz = &pBuffer->achArgs[0];
-                                    i = 0;
-                                    while (*psz != '\0')
-                                    {
-                                        kprintf(("Arg %d: %s\n", i++, psz));
-                                        psz += 1 + strlen(psz);
-                                    }
-                                    #endif
-                                }
-                                else
-                                    kprintf(("ldrOpen: failed to open interpreter (%s), rc=%d\n", pszStart, rc));
-                            }
-                            else
-                            {
-                                kprintf(("ldrOpen: Argument buffer too small, %d\n", cchArguments + cchToAdd));
-                                rc = ERROR_BAD_EXE_FORMAT;
-                            }
+                            strcpy(psz2, ".EXE");
+                            rc = myldrOpen(phFile, psz, pfl);
+                            *psz2 = '\0';
                         }
                         else
+                            psz2 = NULL;
+
+                        //should we search the PATH??? For a starting, we'll do it.
+                        if (rc != NO_ERROR
+                            && (rc = OpenPATH(phFile, psz, pfl)) != NO_ERROR
+                            && psz2 != NULL)
                         {
-                            kprintf(("ldrOpen: QueryBufferPointerFromFilename failed.\n"));
-                            rc = ERROR_BAD_EXE_FORMAT; /*?*/
+                            *psz2 = '.';
+                            rc = OpenPATH(phFile, psz, pfl);
                         }
                     }
@@ -405,15 +645,101 @@
                 else
                 {
-                    kprintf(("ldrOpen: no interpereter on the first line.\n"));
-                    rc = ERROR_BAD_EXE_FORMAT; /*?*/
+                    kprintf(("myldrOpen-%d: script - failed to read more of the script!, rc=%d cbRead=%d cbFile=%d.\n",
+                             cNesting, rc, cbRead, cbFile));
                 }
+
+                goto cleanup;
             }
             else
             {
-                kprintf(("ldrOpen: read of min(cbFile, 256) = %d failed, rc = %d\n", cchRead, rc));
+                kprintf(("myldrOpen-%d: script - hash found but no bang (!).\n", cNesting));
             }
-        } /* else inn other formats here. */
-        rfree(pszBuffer);
-    }
+        } /**@sketch ENDIF - UNIX styled script. */
+
+
+
+        /** @sketch
+         *  REXX script?
+         *      - Starts with a REXX start comment ('/','*')
+         *      - And we're loading an EXE
+         *      - And we're either in QAppType or ExecPgm state.
+         *      - Extention:
+         *          .RX and .REX are known to be pure REXX scripts.
+         *          While .CMD has to invoked used the commandline OS2_SHELL or COMSPEC variable.
+         */
+        psz2 = pszFilename + strlen(pszFilename) - 1;
+        while (psz2 > pszFilename && *psz2 != '.')
+            psz2--;
+        if (*psz2 == '.'
+            && *u1.pach == '/' && u1.pach[1] == '*'
+            && isLdrStateLoadingEXE()
+            && (isLdrStateQAppType() || isLdrStateExecPgm())
+            && (stricmp(psz2, ".RX") == 0 || stricmp(psz2, ".REX") == 0)
+            )
+        {
+            if (isREXXScriptDisabled())
+                goto cleanup_noerror;
+
+            /** @sketch
+             * Found REXX styled script!
+             * Find the REXX interpreter. We'll use kRx.exe to execute the REXX scripts.
+             * (This interpreter could be embedded as a child of ModuleBase as it turned out
+             * to be quite small about 700 bytes.)
+             */
+            kprintf(("myldrOpen-%d: Found REXX script\n", cNesting));
+            ldrClose(*phFile);
+            psz = "KRX.EXE";
+            rc = ldrOpen(phFile, psz, pfl);
+            if (rc != NO_ERROR)
+                rc = OpenPATH(phFile, psz, pfl);
+
+            /** @sketch
+             *  IF tkExecPgm THEN
+             *      Correct parameters - ie. add exec name (as argv[0]), old exec name,
+             *        and finally the existing parameters (current argv[1+]).
+             *      Set the executable name.
+             *  ENDIF
+             */
+             if (rc == NO_ERROR && isLdrStateExecPgm())
+             {
+                 rc = AddArgsToFront(2, ldrpFileNameBuf, achTkExecPgmFilename);
+                 if (rc != NO_ERROR)
+                 {
+                     kprintf(("myldrOpen-%d: AddArgsToFront failed with rc=%d\n", cNesting));
+                     goto cleanup_noerror;
+                 }
+                 rc = SetExecName(ldrpFileNameBuf);
+                 if (rc != NO_ERROR)
+                     kprintf(("myldrOpen-%d: SetExecName failed with rc=%d\n", cNesting));
+
+                 goto cleanup_noerror;
+             }
+             goto cleanup;
+        } /**@sketch ENDIF - REXX styled script. */
+
+
+        /*
+         * Cleanup with rc set to NO_ERROR.
+         */
+    cleanup_noerror:
+        rc = NO_ERROR;
+
+        /*
+         * Cleanup without having rc set to NO_ERROR.
+         * Decrement the nesting count.
+         */
+    cleanup:
+        rfree(u1.pach);
+        cNesting--;
+    }
+    #ifdef DEBUG
+    else if (cNesting >= 3)
+        kprintf(("myldrOpen-%d: cNesting = %d, which is too deep!\n", cNesting, cNesting));
+    #endif
+
+ret:
+    /** @sketch
+     *  Return rc.
+     */
     return rc;
 }
@@ -421,22 +747,317 @@
 
 /**
- * Get the lenght of the arguments.
- * @returns   Lenght in char, includes the two '\0's.
- * @param     pachArgs  Pointer to the ASCIIZs which makes up the arguments.
- * @status    completely implemented.
+ * Adds new arguments to the front of the startup arguments for the program about to be
+ * executed.
+ *
+ * @returns   OS/2 return code.
+ * @param     cArgs     Count of arguments to add. At least 1!!!
+ * @param     ...       Pointers to the arguments to add.
+ *                      The first argument have to be the executable name. This have to the
+ *                        the only argument in the first string.
+ *                      The other arguements are space separated, so you could add a bunch
+ *                        of arguments in a single string!
+ *                      The last argument should be the old first parameter if this is to be
+ *                        preserved. The old first parameter is overwritten since it's
+ *                        normally the executable name.
+ *
+ * @status    completly implemented.
  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ * @remark    Implementation note:
+ *  The arguments convention is as follows:
+ *      First argument, which should be the executable name, is terminated with a '\0'.
+ *        It starts at offset 0 into the argument buffer, of course.
+ *      All other arguemnts are separated by a space and follows the immediately after the
+ *        first argument.
+ *      The arguments are terminated by a double nulltermination: '\0\0'.
  */
-static unsigned getArgsLength(const char *pachArgs)
+APIRET AddArgsToFront(int cArgs,  ...)
 {
-    unsigned    cch = 1;
-    const char *psz = pachArgs;
-
+    va_list     vaarg;                  /* Variable length argument list. */
+    int         cchOldArgs;             /* Length of the old arguments (including the first argument). */
+                                        /* cchOldArgs = 1 means no arguments. It don't include the very last '\0' */
+                                        /* (remember argumets are terminated with two '\0's). */
+    int         iSecondArg;             /* Index of the second argument. (Used to skip the first argument.) */
+                                        /* Used first on the original arguments and them when adding the first */
+                                        /* new argument. */
+    int         cchNewArgs;             /* Length of the new arguments to be inserted. */
+    int         i;                      /* Loop variable. Current function argument. */
+    char *      psz;                    /* General string pointer. */
+
+
+    /** @sketch
+     *  Assert that we're in the right state.
+     *  Calc the length of the existing parameters.
+     *  Calc the length of the new arguments to determin.
+     *  Assert that the new arguments have length > 0.
+     */
+    #ifdef DEBUG
+    if (!isLdrStateExecPgm())
+    {
+        kprintf(("AddArgsToFront: not in tkExecPgm state.\n"));
+        return ERROR_INVALID_PARAMETER;
+    }
+    #endif
+    if (!fTkExecPgm)
+    {
+        kprintf(("AddArgsToFront: called when not in tkExecPgm data is invalid!\n"));
+        return ERROR_INVALID_PARAMETER;
+    }
+
+    iSecondArg = strlen(&achTkExecPgmArguments[0]) + 1;
+    psz = &achTkExecPgmArguments[iSecondArg];
     while (*psz != '\0')
-    {
-        register unsigned cch2 = strlen(psz);
-        cch += cch2;
-        psz += cch2 + 1;
-    }
-
-    return cch;
+        psz += strlen(psz) + 1;
+    cchOldArgs = psz - &achTkExecPgmArguments[iSecondArg];
+
+    va_start(vaarg, cArgs);
+    for (cchNewArgs = i = 0; i < cArgs; i++)
+        cchNewArgs += strlen(va_arg(vaarg, char *)) + 1; /* 1 is for space or '\0'. */
+    va_end(vaarg);
+    #ifdef DEBUG
+    if (cchNewArgs == 0)
+    {
+        kprintf(("AddArgsToFront: the size of the arguments to add is zero!\n"));
+        return ERROR_INVALID_PARAMETER;
+    }
+    #endif
+
+
+    /** @sketch
+     *  Check if we have enough room for the new arguments. Fail if not enough.
+     *  Move the existing arguments to make room for the new ones.
+     *    !IMPORTANT! The first existing arguments (executable name) is skipped !IMPORTANT!
+     *    !IMPORTANT! in this move as this have to be re-added in this call!    !IMPORTANT!
+     */
+    if (cchOldArgs + cchNewArgs + 1 > CCHARGUMENTS)
+    {
+        kprintf(("AddArgsToFront: argument buffer is too small to hold the arguments to add, cchOldArgs=%d, cchNewArgs=%d\n",
+                 cchOldArgs, cchNewArgs));
+        return ERROR_BAD_ARGUMENTS;
+    }
+
+    if (cchOldArgs > 0)
+    {
+        memmove(&achTkExecPgmArguments[cchNewArgs], &achTkExecPgmArguments[iSecondArg],
+                cchOldArgs + 1);
+    }
+    else
+        achTkExecPgmArguments[cchNewArgs] = '\0';
+
+
+    /** @sketch
+     *  Copy new arguments.
+     *  Since the first argument is special case we'll do it separately. (Uses '\0' as separator.)
+     *    We assume that the entire first argument passed into this function should be the first argument!
+     *    (This don't have to be true for the other arguments since these are space separated. You could
+     *     pass in more than argument in a single string.)
+     *  Loop thru the rest of the new arguments and add them with space as separator.
+     */
+    va_start(vaarg, cArgs);
+    psz = va_arg(vaarg, char *);
+    memcpy(&achTkExecPgmArguments[0], psz, (i = strlen(psz) + 1));
+    psz = &achTkExecPgmArguments[i];
+
+    for (i = 1; i < cArgs; i++)
+    {
+        if (i > 1) *psz++ = ' ';    //Add space if not second argument.
+        strcpy(psz, va_arg(vaarg, char *));
+        psz += strlen(psz);
+    }
+    va_end(vaarg);
+    if (cchOldArgs > 0) *psz++ = ' ';    //Add space if old arguments
+
+    #ifdef DEBUG /* assertion */
+    if (psz != &achTkExecPgmArguments[cchNewArgs])
+    {
+        kprintf(("AddArgsToFront: !Assertion failed! psz didn't end up where it should! (psz -> %d should be %d)\n",
+                 psz - &achTkExecPgmArguments[0], cchNewArgs));
+        if (cchOldArgs <= 1)
+            psz[0] = psz[1] = '\0';
+    }
+    #endif
+
+    return NO_ERROR;
 }
+
+
+/**
+ * Sets the executable name of the module.
+ * This function is normally invoked after a different executable than the one requested was
+ * opened. It does _NOT_ set the new executable name as the first argument, since it is more
+ * convenient to this while calling AddArgsToFront to add other arguments.
+ *
+ * @returns   OS/2 return code.
+ * @param     pszExecName   Pointer to new executable name.
+ * @status    completly implemented.
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ * @remark    .
+ */
+APIRET SetExecName(const char *pszExecName)
+{
+    #ifdef DEBUG
+    int cch;
+    cch = strlen(pszExecName);
+    if (cch > CCHMAXPATH)
+    {
+        kprintf(("ChangeExecName: filename is too long! cch=%d. name=%s\n", cch, pszExecName));
+        return ERROR_FILENAME_EXCED_RANGE;
+    }
+    if (!isLdrStateExecPgm())
+    {
+        kprintf(("ChangeExecName: called when not in tkExecPgm state!!! FATAL ERROR!\n"));
+        return ERROR_INVALID_PARAMETER;
+    }
+    #endif
+    if (!fTkExecPgm)
+    {
+        kprintf(("ChangeExecName: called when not in tkExecPgm data is invalid!!! FATAL ERROR!\n"));
+        return ERROR_INVALID_PARAMETER;
+    }
+
+    strcpy(achTkExecPgmFilename, pszExecName);
+
+    return 0;
+}
+
+
+/**
+ * Opens a file using the PATH environment variable of the current process.
+ * @returns   OS2 return code.
+ * @param     phFile        Pointer to filehandle. The filehandle is set to the SFN for the opened
+ *                          file on successful return.
+ *                          The filehandle is 0 on failure.
+ * @param     pszFilename   Pointer to filename buffer. This will hold the filename on input.
+ *                          On successful return it holds the filepath found.
+ *                          On failiure it's undefined.
+ * @param     pfl           Some flags set by ldrOpen.
+ * @sketch    stub
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ * @remark
+ */
+APIRET OpenPATH(PSFN phFile, char *pszFilename, PULONG pfl)
+{
+    APIRET      rc;
+    USHORT      TCBFailErr_save;
+    int         cchFile;                /* Filename length + 1. */
+    const char *pszFile;                /* Pointer to filename portion. */
+    const char *pszPath = ScanEnv(GetEnv(FALSE), "PATH"); /* Current Process environment? */
+
+    /**@sketch
+     *  No PATH environment.
+     */
+    if (pszPath == NULL)
+        return ERROR_FILE_NOT_FOUND;
+
+    /**@sketch
+     * Skip any paths in the filename.
+     */
+    pszFile = pszFilename + (cchFile = strlen(pszFilename));
+    while (pszFile >= pszFilename && *pszFile != '\\' && *pszFile != '/')
+        pszFile--;
+    cchFile -= pszFile - pszFilename;
+    pszFile++;
+
+    /**@sketch
+     * We'll have to save the TCBFailErr since we don't want to cause
+     * Hard Errors while searching invalid paths, etc. (ldrOpenPath does this!)
+     */
+    TCBFailErr_save = tcbGetTCBFailErr(tcbGetCur());
+
+    /**@ sketch
+     *  Loop thru the PATH trying to open the specified file in each
+     *  directory.
+     */
+    while (*pszPath != '\0')
+    {
+        const char *  pszNext;
+        int           cchPath;
+        char          chEnd;
+        register char ch;
+
+        /*
+         * Find end of this path.
+         */
+        while (*pszPath == ' ') pszPath++; //skip leading spaces.
+        if (*pszPath == '"')
+        {
+            chEnd = '"';
+            pszPath++;
+        }
+        else
+            chEnd = ';';
+        pszNext = pszPath;
+        while ((ch = *pszNext) != chEnd && ch != '\0')
+            pszNext++;
+
+        cchPath = pszNext - pszPath;
+        if (chEnd == '"')
+        {
+            /* Skip anything between the " and the ; or string end. */
+            while ((ch = *pszNext) != ';' && ch != '\0')
+                pszNext++;
+        }
+        else
+        {
+            /* Trim the string. */
+            while (cchPath > 0 && pszPath[cchPath-1] == ' ') //??
+                cchPath--;
+        }
+
+        /*
+         *  No length? No Path! Or path'\'filename too long? => Next
+         */
+        if (cchPath > 0 && cchPath + cchFile + 1 < CCHMAXPATH)
+        {
+            static char     achFilename[CCHMAXPATH];
+            /*
+             * Build filename
+             */
+            memcpy(achFilename, pszPath, cchPath);
+            if ((ch = achFilename[cchPath - 1]) == '\\' || ch == '/')
+                cchPath--;
+            else
+                achFilename[cchPath] = '\\';
+             memcpy(&achFilename[cchPath + 1], pszFile, cchFile); /* cchFile = length + 1; hence we copy the terminator too. */
+
+            /*
+             * Try open the file.
+             */
+            rc = myldrOpen(phFile, achFilename, pfl);
+            switch (rc)
+            {
+                case ERROR_FILE_NOT_FOUND:          case ERROR_PATH_NOT_FOUND:          case ERROR_ACCESS_DENIED:           case ERROR_INVALID_ACCESS:
+                case ERROR_INVALID_DRIVE:           case ERROR_NOT_DOS_DISK:            case ERROR_REM_NOT_LIST:            case ERROR_BAD_NETPATH:
+                case ERROR_NETWORK_BUSY:            case ERROR_DEV_NOT_EXIST:           case ERROR_TOO_MANY_CMDS:           case ERROR_ADAP_HDW_ERR:
+                case ERROR_UNEXP_NET_ERR:           case ERROR_BAD_REM_ADAP:            case ERROR_NETNAME_DELETED:         case ERROR_BAD_DEV_TYPE:
+                case ERROR_NETWORK_ACCESS_DENIED:   case ERROR_BAD_NET_NAME:            case ERROR_TOO_MANY_SESS:           case ERROR_REQ_NOT_ACCEP:
+                case ERROR_INVALID_PASSWORD:        case ERROR_OPEN_FAILED:             case ERROR_INVALID_NAME:            case ERROR_FILENAME_EXCED_RANGE:
+                case ERROR_VC_DISCONNECTED:
+                    break;
+
+                case NO_ERROR:
+                    strcpy(pszFilename, achFilename);
+                default:
+                    tcbSetTCBFailErr(tcbGetCur(), TCBFailErr_save);
+                    return rc;
+            }
+        }
+        #ifdef DEBUG
+        else if (cchPath > 0)   kprintf(("OpenPATH: Path component is too long\n"));
+        #endif
+
+        /*
+         * Next
+         */
+        if (*pszNext == '\0')
+            break;
+        pszPath = pszNext + 1;
+    }
+
+
+    /*
+     * File is not found.
+     */
+    *phFile = 0;
+    tcbSetTCBFailErr(tcbGetCur(), TCBFailErr_save);
+    return ERROR_FILE_NOT_FOUND;
+}
Index: trunk/src/win32k/ldr/myldrOpenNewExe.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrOpenNewExe.cpp	(revision 4152)
+++ 	(revision )
@@ -1,27 +1,0 @@
-/* $Id: myldrOpenNewExe.cpp,v 1.2 2000-01-28 15:28:43 bird Exp $
- *
- * Obsolete
- *
- * Copyright (c) 1998 knut st. osmundsen
- *
- * Project Odin Software License can be found in LICENSE.TXT
- *
- */
-#include <ldr.h>
-
-int LDRCALL myldrOpenNewExe(PCHAR pszName, USHORT lenName, ULONG p3, ULONG p4)
-{
-    char szName[CCHMAXPATH];
-    int i;
-
-    for (i = 0; i < lenName; i++)
-        szName[i] = pszName[i];
-    szName[i] = '\0';
-
-//  kernel_printf(("_ldrOpenNewExe: pszName(p1):%s lenName(p2):0x%x param3:0x%x param4:0x%x", __StackToFlat(szName), lenName, p3, p4));
-
-    return _ldrOpenNewExe(pszName, lenName, p3, p4);
-}
-
-
-
Index: trunk/src/win32k/ldr/myldrOpenPath.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrOpenPath.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/myldrOpenPath.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: myldrOpenPath.cpp,v 1.1 2000-07-16 22:21:16 bird Exp $
+/* $Id: myldrOpenPath.cpp,v 1.2 2000-09-02 21:08:10 bird Exp $
  *
  * myldrOpenPath - ldrOpenPath used to open executables we'll override
@@ -16,4 +16,5 @@
 #define INCL_NOPMAPI
 #define INCL_OS2KRNL_TCB
+#define INCL_OS2KRNL_PTDA
 
 /*******************************************************************************
@@ -25,4 +26,5 @@
 #include <stdlib.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "log.h"
 #include "dev32.h"
@@ -134,18 +136,13 @@
         else
         {
-            struct InfoSegLDT *pInfoSeg;
-            pInfoSeg = (struct InfoSegLDT *)D32Hlp_GetDOSVar(DHGETDOSV_SYSINFOSEG, 0);
-            if (pInfoSeg == NULL)
+            PPTDA   pPTDA = ptdaGetCur();
+            if (pPTDA)
             {
-                pExe = getModuleByhMTE(pInfoSeg->LIS_DI); /* LIS_DI is the same as hmod in LINFOSEG from bsedos16.h.  */
+                pExe = getModuleByhMTE(ptdaGet_ptda_module(pPTDA));
                 #ifdef DEBUG            /* While testing! */
-                kprintf(("myldrOpenPath: getModuleByhMTE returned 0x%x08 for hmod=0x%04\n",
-                         pExe, pInfoSeg->LIS_DI));
+                kprintf(("myldrOpenPath: getModuleByhMTE returned 0x%08x for hmod=0x%04x\n",
+                         pExe, ptdaGet_ptda_module(pPTDA)));
                 #endif
             }
-            #ifdef DEBUG                /* While testing! */
-            else
-                dprintf(("myldrOpenPath: D32Hlp_GetDOSVar(DHGETDOSV_SYSINFOSEG) failed.\n"));
-            #endif
         }
 
Index: trunk/src/win32k/ldr/myldrRead.cpp
===================================================================
--- trunk/src/win32k/ldr/myldrRead.cpp	(revision 4152)
+++ trunk/src/win32k/ldr/myldrRead.cpp	(revision 4164)
@@ -1,7 +1,7 @@
-/* $Id: myldrRead.cpp,v 1.6 2000-01-22 18:21:02 bird Exp $
+/* $Id: myldrRead.cpp,v 1.7 2000-09-02 21:08:10 bird Exp $
  *
  * myldrRead - ldrRead.
  *
- * Copyright (c) 1998-1999 knut st. osmundsen
+ * Copyright (c) 1998-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -23,24 +23,45 @@
 #include <stdlib.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "log.h"
+#include "avl.h"
 #include "dev32.h"
 #include <peexe.h>
 #include <exe386.h>
 #include "OS2Krnl.h"
+#include "ldrCalls.h"
+#include "ldr.h"
 #include "ModuleBase.h"
 #include "pe2lx.h"
-#include "avl.h"
-#include "ldrCalls.h"
-#include "ldr.h"
 
 
+/**
+ * Overloads ldrRead.
+ * @returns   OS/2 return code.
+ * @param     hFile     Filehandle to read from.
+ * @param     pvBuffer  Buffer to read into.
+ * @param     fpBuffer  This is not flags as I first though, but probably a far 16-bit pointer
+ *                      to the buffer.
+ * @param     cbToRead  Count of bytes to read.
+ * @param     pMTE
+ * @sketch    IF it's our module THEN
+ *                Get module pointer. (complain if this failes and backout to ldrRead.)
+ *                Currently - verify that it's a Pe2Lx module. (complain and fail if not.)
+ *                Invoke the read method of the module do the requested read operation.
+ *                Save pMTE if present and not save allready.
+ *            ENDIF
+ *            - backout or not our module -
+ *            forward request to the original ldrRead.
+ * @status    Completely implemented.
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
 ULONG LDRCALL myldrRead(
-                       SFN hFile,
-                       ULONG ulOffset,
-                       PVOID pBuffer,
-                       ULONG ulFlags ,
-                       ULONG ulBytesToRead,
-                       PMTE pMTE
-                       )
+    SFN     hFile,
+    ULONG   ulOffset,
+    PVOID   pvBuffer,
+    ULONG   fpBuffer,
+    ULONG   cbToRead,
+    PMTE    pMTE
+    )
 {
     ULONG   rc;
@@ -50,5 +71,6 @@
     {
         PMODULE pMod;
-        kprintf(("ldrRead+: hF=%+04x off=%+08x pB=%+08x fl=%+08x cb=%+04x pMTE=%+08x\n",hFile,ulOffset,pBuffer,ulFlags,ulBytesToRead,pMTE));
+        kprintf(("myldrRead: hF=%+04x off=%+08x pB=%+08x fp=%+08x cb=%+04x pMTE=%+08x\n",
+                 hFile, ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE));
 
         pMod = getModuleBySFN(hFile);
@@ -59,26 +81,25 @@
                 pMod->pMTE = pMTE;
 
-            /* debug */
-            if (ulFlags != 0)
-                kprintf(("ldrRead: Warning ulFlags = 0x%x (!= 0)\n", ulFlags));
-
             if ((pMod->fFlags & MOD_TYPE_MASK) == MOD_TYPE_PE2LX)
-                rc = pMod->Data.pModule->read(ulOffset, pBuffer, ulBytesToRead, ulFlags, pMTE);
+                rc = pMod->Data.pModule->read(ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE);
             else
             {
-                kprintf(("ldrRead: Invalid module type, %#x\n", pMod->fFlags & MOD_TYPE_MASK));
+                kprintf(("myldrRead: Invalid module type, %#x\n", pMod->fFlags & MOD_TYPE_MASK));
                 rc = ERROR_READ_FAULT;
             }
-            return rc;
         }
         else
-            kprintf(("ldrRead:  DON'T PANIC! - but I can't get Node ptr! - This is really an IPE!\n"));
+        {
+            kprintf(("myldrRead:  DON'T PANIC! - but I can't get Node ptr! - This is really an IPE!\n"));
+            rc = ERROR_READ_FAULT;
+        }
     }
-
-    rc = ldrRead(hFile, ulOffset, pBuffer, ulFlags, ulBytesToRead, pMTE);
-
+    else
+    {
+        rc = ldrRead(hFile, ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE);
+    }
     #if 0
-    kprintf(("ldrRead:  hF=%+04x off=%+08x pB=%+08x fl=%+08x cb=%+04x pMTE=%+08x rc=%d\n",
-             hFile,ulOffset,pBuffer,ulFlags,ulBytesToRead,pMTE,rc));
+    kprintf(("myldrRead:  hF=%+04x off=%+08x pB=%+08x fp=%+08x cb=%+04x pMTE=%+08x rc=%d\n",
+             hFile, ulOffset, pvBuffer, fpBuffer, cbToRead, pMTE, rc));
     #endif
 
Index: trunk/src/win32k/ldr/mytkExecPgm.asm
===================================================================
--- trunk/src/win32k/ldr/mytkExecPgm.asm	(revision 4152)
+++ trunk/src/win32k/ldr/mytkExecPgm.asm	(revision 4164)
@@ -1,3 +1,3 @@
-; $Id: mytkExecPgm.asm,v 1.10 2000-02-23 16:53:04 bird Exp $
+; $Id: mytkExecPgm.asm,v 1.11 2000-09-02 21:08:10 bird Exp $
 ;
 ; mytkExecPgm - tkExecPgm overload
@@ -10,15 +10,20 @@
 
 ;
+;   Defined Constants And Macros
+;
+CCHFILENAME     EQU 261                 ; The size of the filename buffer
+CCHARGUMENTS    EQU 1536                ; The size of the argument buffer
+CCHMAXPATH      EQU CCHFILENAME - 1     ; Max path length
+
+;
 ;   Include files
 ;
     include devsegdf.inc
 
-;
-;   Imported Functions
+
+;
+;   Imported Functions and variables.
 ;
     extrn  _g_tkExecPgm:PROC
-    extrn  AcquireBuffer:PROC
-    extrn  ReleaseBuffer:PROC
-    extrn  QueryBufferSegmentOffset:PROC
 
     ; Scans strings until empy-string is reached.
@@ -45,15 +50,71 @@
     extrn  _f_FuBuff:PROC
 
+
+    ; 32-bit memcpy. (see OS2KTK.h)
+    extrn _TKFuBuff@16:PROC
+
+    ;
+    ; LDR semaphore
+    ;
+    extrn pLdrSem:DWORD
+    extrn _LDRClearSem@0:PROC
+    extrn _KSEMRequestMutex@8:PROC
+    extrn _KSEMQueryMutex@8:PROC
+
+    ;
+    ; Loader State
+    ;
+    extrn ulLDRState:DWORD
+
+    ;
+    ; Pointer to current executable module.
+    ;
+    extrn pExeModule:DWORD
+
+    ;
+    ; DevHlp32
+    ;
+    extrn D32Hlp_VirtToLin:PROC
+
+    ;
+    ; TKSSBase (32-bit)
+    ;
+    extrn pulTKSSBase32:DWORD
+
 ;
 ;   Exported symbols
 ;
     public mytkExecPgm
-
+    public tkExecPgmCopyEnv
+
+    public fTkExecPgm
+    public achTkExecPgmFilename
+    public achTkExecPgmArguments
+
+
+
+;
+; Global data
+;
+
+; Filename and arguments buffers + environment pointer
+; from the tkExecPgm call.
+;
+; This data is only valid at isLdrStateExecPgm time
+; (and you'll have to be behind the loader semaphore of course!)
+DATA16 SEGMENT
+fTkExecPgm              db 0            ; 0 - achTkExecPgmFilename and achTkExecPgmArguments is INVALID
+                                        ; 1 - achTkExecPgmFilename and achTkExecPgmArguments is VALID.
+achTkExecPgmFilename    db CCHFILENAME dup (0)  ; The filename  passed in to tkExecPgm if (fTkExec is TRUE)
+achTkExecPgmArguments   db CCHARGUMENTS dup (0) ; The arguments passed in to tkExecPgm if (fTkExec is TRUE)
+fpachTkExecPgmEnv       dd 0            ; Far pointer to environment passed in to tkExecPgm.
+                                        ; Valid at isLdrStateExecPgm time.
+                                        ; NOTE! User data, don't touch it directly!
+DATA16 ENDS
 
 
 CODE32 SEGMENT
-
 ;;
-;
+; New implementation.
 ; @returns   same as tkExecPgm: eax, edx and carry flag
 ; @param     ax     Exec flag
@@ -65,258 +126,18 @@
 ;            may modify later if this is a UNIX shellscript or
 ;            a PE-file started by pe.exe.
-; @status
+; @status    completely implemented.
 ; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
-; @remark
-;
-;   The buffer we are using is a C struct as follows.
-;   struct Buffer
-;   {
-;       char szFilename[261];  /* offset 0   */
-;       char achArg[1536-261]; /* offset 261 */
-;   };
+;
 ;
 mytkExecPgm PROC FAR
-pBuffer     = dword ptr -04h
-SegBuffer   = -08h
-OffBuffer   = -0Ch
-cchFilename = dword ptr -10h
-cchArgs     = dword ptr -14h
-;usExecFlag  = -18h
-;SegFilename = -1ch
-;OffFilename = -1eh
-;SegEnv      = -20h
-;OffEnv      = -22h
-;SegArg      = -24h
-;OffArg      = -26h
-
-    ASSUME CS:CODE32, DS:NOTHING, SS:NOTHING
-;    int     3
-    push    ebp
-    mov     ebp, esp
-    lea     esp, [ebp + cchArgs]
-
-    push    eax
-    push    ecx
-    push    ds
-    push    es
-    push    edi
-
-    ; parameter validations
-    mov     ax, ds                      ; pointer to filename
-    cmp     ax, 4
-    jb      mytkExecPgm_CalltkExecPgm_X1
-
-    ;
-    ; filename length
-    ;
-    mov     ax, ds
-    mov     es, ax
-    pushad
-    push    es
-    push    ds
-    mov     bx, ds
-    mov     di, dx                      ; es:di is now filename address (ds:dx).
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:_f_FuStrLen
-    movzx   ecx, cx
-    mov     [ebp+cchFilename], ecx
-    pop     ds
-    pop     es
-    popad
-    jc      mytkExecPgm_CalltkExecPgm_X1; If the FuStrLen call failed we bail out!
-
-    ;
-    ; if filename length is more that CCHMAXPATH then we don't do anything!.
-    ;
-    cmp     [ebp+cchFilename], 260
-    jae     mytkExecPgm_CalltkExecPgm_X1; length >= 260
-
-    ;
-    ; args length
-    ; Note: the arguments are a series of ASCIIZs ended by an empty string (ie. '\0').
-    ;
-    pop     edi
-    push    edi
-    xor     ecx, ecx
-    cmp     di, 4                       ; The argument might me a invalid pointer...
-    jb      mytkExecPgm_CalltkExecPgm_1
-
-    pushad
-    push    es
-    push    ds
-    mov     bx, di                      ;
-    mov     di, si                      ; bx:di -> arguments
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:_f_FuStrLenZ
-    movzx   ecx, cx
-    mov     [ebp+cchArgs], ecx
-    pop     ds
-    pop     es
-    popad
-    jc      mytkExecPgm_CalltkExecPgm_X1
-
-mytkExecPgm_CalltkExecPgm_1:
-    mov     ecx, [ebp+cchArgs]
-    add     ecx, [ebp+cchFilename]      ; filename
-    add     ecx, 3 + 260                ;  260 = new argument from a scrip file or something.
-                                        ;    3 = two '\0's and a space after added argument.
-    cmp     ecx, 1536                   ; 1536 = Buffersize.  FIXME! Define this!!!
-    jae     mytkExecPgm_CalltkExecPgm_X1; jmp if argument + file + new file > buffer size
-
-    ;
-    ; Aquire a buffer
-    ;
-    call    AcquireBuffer
-    or      eax, eax
-    jz      mytkExecPgm_CalltkExecPgm_X1; Failed to get buffer.
-    mov     [ebp+pBuffer], eax
-
-    ;
-    ; Get Segment and offset for the buffer
-    ;
-    call    QueryBufferSegmentOffset
-    mov     cx, es
-    mov     [ebp+OffBuffer], ax
-    mov     [ebp+SegBuffer], es
-    test    eax, 000570000h
-    jnz     mytkExecPgm_CalltkExecPgm_X2
-
-    ;
-    ; Copy filename to pBuffer.
-    ;
-    pushad
-    push    es
-    push    ds
-    mov     di, ax                      ; es:di  pBuffer
-    mov     si, dx
-    mov     bx, ds                      ; bx:si  Filename pointer (input ds:dx)
-    mov     ecx, [ebp+cchFilename]
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:_f_FuBuff
-    pop     ds
-    pop     es
-    popad
-    jc      mytkExecPgm_CalltkExecPgm_X2
-
-    ;
-    ; Copy Args to pBuffer + 261
-    ;
-    ; stack: edi, es, ds, ecx, eax
-    pop     edi
-    push    edi
-    add     eax, 261                    ; we'll use eax in the branch
-    cmp     di, 4
-    jb      mytkExecPgm_CalltkExecPgm_2
-    pushad
-    push    es
-    push    ds
-    mov     ecx, [ebp+cchArgs]
-    mov     bx, di                      ; ds:si -> arguments
-    mov     di, ax                      ; es:di -> buffer + 261
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:_f_FuBuff
-    pop     ds
-    pop     es
-    popad
-    jc      mytkExecPgm_CalltkExecPgm_X2
-    jmp     mytkExecPgm_CalltkExecPgm_3
-
-mytkExecPgm_CalltkExecPgm_2:
-    mov     word ptr es:[eax], 0        ; Terminate the empty string!
-
-    ;
-    ; Restore variables pushed on the stack
-    ;
-    ; stack: edi, es, ds, ecx, eax
-mytkExecPgm_CalltkExecPgm_3:
-    pop     edi
-    pop     es
-    pop     ds
-    pop     ecx
-    pop     eax
-
-    ;
-    ; Set new input parameters (call _g_tkExecPgm)
-    ;
-    ; ds:dx is to become SegBuffer:OffBuffer
-    ; di:si is to become SegBuffer:OffBuffer+261
-    ;
-    ; The some of the old values are stored on the stack (for the time being)
-    push    ds
-    push    edi
-    push    esi
-
-    mov     di, [ebp+SegBuffer]
-    mov     ds, di
-    mov     si, [ebp+OffBuffer]
-    mov     dx, si                      ; ds:dx  SegBuffer:OffBuffer
-    add     si, 261                     ; di:si  SegBuffer:OffBuffer+261
-
-    ;
-    ; Call _g_tkExecPgm
-    ;
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:_g_tkExecPgm
-    pushfd
-
-    ;
-    ; Release buffer
-    ;
-    push    eax
-    mov     eax, [ebp + pBuffer]
-    call    ReleaseBuffer
-    mov     [ebp + pBuffer], 0
-    pop     eax
-
-    ;
-    ; Return
-    ;
-    popfd
-    pop     esi
-    pop     edi
-    pop     ds
-    leave
-    retf
-
-mytkExecPgm_CalltkExecPgm_X2:
-    ;
-    ; Release buffer
-    ;
-    mov     eax, [ebp + pBuffer]
-    call    ReleaseBuffer
-    mov     [ebp + pBuffer], 0
-
-mytkExecPgm_CalltkExecPgm_X1:
-    pop     edi
-    pop     es
-    pop     ds
-    pop     ecx
-    pop     eax
-
-mytkExecPgm_CalltkExecPgm:
-    push    cs
-    call    near ptr FLAT:_g_tkExecPgm
-    leave
-    retf
-mytkExecPgm ENDP
-
-
-
-CODE32 ENDS
-
-if 0 ; alternate implementation.
-mytkExecPgm PROC FAR
-pBuffer     = dword ptr -04h
-SegBuffer   = -08h
-OffBuffer   = -0Ch
-cchFilename = -10h
-cchArgs     = -14h
-usExecFlag  = -18h
-SegFilename = -1ch
-OffFilename = -1eh
-SegEnv      = -20h
-OffEnv      = -22h
-SegArg      = -24h
-OffArg      = -26h
+cchFilename = -4h
+cchArgs     = -08h
+usExecFlag  = -0ch
+SegFilename = -10h
+OffFilename = -12h
+SegEnv      = -14h
+OffEnv      = -16h
+SegArg      = -18h
+OffArg      = -1ah
 
     ASSUME CS:CODE32, DS:NOTHING, SS:NOTHING
@@ -325,5 +146,7 @@
     lea     esp, [ebp + OffArg]
 
-    ; save input parameters
+    ;
+    ; Save input parameters
+    ;
     mov     [ebp + usExecFlag], ax
     mov     ax, es
@@ -332,27 +155,32 @@
     mov     [ebp + SegArg], di
     mov     [ebp + OffArg], si
-    mov     ax, ds
-    mov     [ebp + SegFilename], ax
+    mov     bx, ds
+    mov     [ebp + SegFilename], bx
     mov     [ebp + OffFilename], dx
 
-    ; parameter validations
-    cmp     ax, 4                       ; pointer to filename
-    jb      mytkExecPgm_CalltkExecPgm_X1
-
-    ;
-    ; filename length
-    ;
-    mov     bx, ax
+    ;
+    ; Parameter validations - if any of these fail we'll just pass on to
+    ; the real tkExecPgm without setting up any buffers stuff.
+    ; 1) validate the file pointer.
+    ; 2) validate the file name length < 260
+    ; 3) validate that the arguments aren't larger than the buffer.
+    ;
+
+    ; Validate filename pointer
+    ;
+    cmp     bx, 4                       ; pointer to filename
+    jb      tkepgm_backout
+
+    ; Validate filename length
+    ;
     mov     di, dx                      ; bx:di is now filename address
     push    cs                          ; Problem calling far into the calltab segement.
     call    near ptr FLAT:_f_FuStrLen
-    jc      mytkExecPgm_CalltkExecPgm_X1; If the FuStrLen call failed we bail out!
-
-    ;
+    jc      tkepgm_backout              ; If the FuStrLen call failed we bail out!
+
     ; if filename length is more that CCHMAXPATH then we don't do anything!.
-    ;
-    cmp     cx, 260
-    jae     mytkExecPgm_CalltkExecPgm_X1; length >= 260
-    mov     [ebp+cchFilename], cx
+    cmp     cx, CCHMAXPATH
+    jae     tkepgm_backout              ; length >= CCHMAXPATH
+    mov     [ebp + cchFilename], cx
 
     ;
@@ -360,128 +188,227 @@
     ; Note: the arguments are a series of ASCIIZs ended by an empty string (ie. '\0').
     ;
-    mov     bx, [ebp+SegArg]
+    xor     cx, cx                      ; Set length to zero.
+    mov     bx, [ebp + SegArg]
     cmp     bx, 4                       ; The argument might me an NULL pointer
-    xor     cx, cx
-    jb      mytkExecPgm_CalltkExecPgm_1
-
-    mov     di, [ebp+OffArg]            ; bx:di -> arguments
+    jb      tkepgm1
+
+    mov     di, [ebp + OffArg]          ; bx:di -> arguments
     push    cs                          ; Problem calling far into the calltab segement.
     call    near ptr FLAT:_f_FuStrLenZ
-    mov     [ebp+cchArgs], cx
-    jc      mytkExecPgm_CalltkExecPgm_X1
-
-mytkExecPgm_CalltkExecPgm_1:
-    add     cx, [ebp+cchFilename]       ; filename length
-    add     cx, 3 + 260                 ;  260 = new argument from a scrip file or something.
+    jc      tkepgm_backout
+
+tkepgm1:
+    mov     [ebp + cchArgs], cx
+    add     cx, [ebp + cchFilename]     ; filename length
+    add     cx, 3 + 260                 ;  260 = additional arguments from a script file or something.
                                         ;    3 = two '\0's and a space after added argument.
-    cmp     ecx, 1536                   ; 1536 = Buffersize.  FIXME! Define this!!!
-    jae     mytkExecPgm_CalltkExecPgm_X1; jmp if argument + file + new file > buffer size
-
-    ;
-    ; Aquire a buffer
-    ;
-    call    AcquireBuffer
-    mov     [ebp+pBuffer], eax
-    or      eax, eax
-    jz      mytkExecPgm_CalltkExecPgm_X1; Failed to get buffer.
-
-    ;
-    ; Get Segment and offset for the buffer
-    ;
-    call    QueryBufferSegmentOffset
-    mov     cx, es
-    mov     [ebp+OffBuffer], ax
-    mov     [ebp+SegBuffer], es
-    test    eax, 000570000h
-    jnz     mytkExecPgm_CalltkExecPgm_X2
-
-    ;
-    ; Copy filename to pBuffer.
-    ;
-    mov     di, ax                      ; es:di  pBuffer
-    mov     si, dx
-    mov     bx, ds                      ; bx:si  Filename pointer (input ds:dx)
-    mov     cx, [ebp+cchFilename]       ; cx = length of area to copy
+    cmp     cx, CCHARGUMENTS            ; argument Buffersize.
+    jae     tkepgm_backout              ; jmp if argument + file + additional arguments >= buffer size
+
+
+    ;
+    ; Aquire the OS/2 loader semaphore
+    ;   Since parameters looks good, we're ready for getting the loader semaphore.
+    ;   We use the loader semaphore to serialize access to the win32k.sys loader
+    ;   subsystem.
+    ;   Before we can get the loader semaphore, we'll need to set ds and es to
+    ;   flat R0 context.
+    ;   The loader semaphore is later requested by the original tkExecPgm so
+    ;   this shouldn't break anything.
+    ;
+    mov     ax, seg FLAT:DATA32
+    mov     ds, ax
+    mov     es, ax
+    ASSUME  DS:FLAT, ES:FLAT
+
+    mov     eax, pLdrSem                ; Get pointer to the loader semaphore.
+    or      eax, eax                    ; Check if null. (paranoia)
+    jz      tkepgm_backout              ; Fail if null.
+
+    push    0ffffffffh                  ; Wait indefinitely.
+    push    eax                         ; Push LdrSem address (which is the handle).
+    call    near ptr FLAT:_KSEMRequestMutex@8
+    or      eax, eax                    ; Check if failed.
+    jnz     tkepgm_backout              ; Backout on failure.
+
+
+    ;
+    ; From here on we won't backout to the tkepgm_backout lable but
+    ; the tkepgm_backout2 lable. (This will restore the parameters
+    ; and jump in at the call to tkExecPgm behind the Loader Sem.)
+    ;
+
+
+    ;
+    ; Set global data:
+    ;   Zeros pointer to exemodule to NULL (a bit paranoia).
+    ;   Mark global data valid.
+    ;   Store Environment pointer.
+    ;   Set loader state.
+    ;
+    mov     pExeModule, 0               ; Sets the exemodule pointer to NULL.
+    mov     fTkExecPgm, 1               ; Optimistic, mark the global data valid.
+    mov     eax, [ebp + OffEnv]         ; Environment FAR pointer.
+    mov     fpachTkExecPgmEnv, eax      ; Store the Environment pointer. This will
+                                        ; later permit us to get the passed in
+                                        ; environment in for ex. ldrOpenPath.
+    mov     ulLDRState, 1               ; Set the loader state to LDRSTATE_TKEXECPGM!
+    ASSUME  DS:NOTHING, ES:NOTHING
+
+
+    ;
+    ; Copy filename to achBuffer.
+    ;
+    mov     di, seg achTkExecPgmFilename
+    mov     es, di
+    mov     edi, offset achTkExecPgmFilename
+                                        ; es:(e)di -> &achTkExecPgmFilename[0]
+    mov     si, [ebp + OffFilename]
+    mov     bx, [ebp + SegFilename]     ; bx:si  Filename pointer (input ds:dx)
+    ASSUME DS:NOTHING
+    mov     cx, [ebp + cchFilename]     ; cx = length of area to copy
     push    cs                          ; Problem calling far into the calltab segement.
     call    near ptr FLAT:_f_FuBuff
-    jc      mytkExecPgm_CalltkExecPgm_X2
-
-    ;
-    ; Copy Args to pBuffer + 261
-    ;
-    mov     si, [ebp+SegArg]
-    cmp     si, 4
-    jb      mytkExecPgm_CalltkExecPgm_2
-    mov     ds, si
-    mov     si, [ebp+OffArg]            ; ds:si -> arguments
-    mov     di, [ebp+SegBuffer]
+    jc      tkepgm_backout2             ; In case of error back (quite unlikely).
+
+
+    ;
+    ; Copy Args to achTkExecPgmArguments
+    ;
+    mov     di, seg achTkExecPgmArguments
     mov     es, di
-    mov     di, [ebp+OffBuffer]
-    add     di, 261                     ; es:di -> buffer + 261
-    mov     cx, [ebp+cchArgs]           ; cx = length of area to copy
+    mov     edi, offset achTkExecPgmArguments
+                                        ; es:(e)di -> &achTkExecPgmArguments[0]
+    mov     word ptr es:[edi], 0        ; Terminate the argument string in case
+                                        ; there aren't any arguments.('\0\0')
+                                        ; (We're just about to find that out.)
+    mov     bx, [ebp + SegArg]
+    cmp     bx, 4                       ; Is the argument pointer a null-pointer?
+    jb      tkepgm_setup_parms          ; Skip copy if null pointer.
+                                        ; Argument string is '\0\0'.
+    mov     si, [ebp + OffArg]          ; bx:si -> arguments
+    mov     cx, [ebp + cchArgs]         ; cx = length of area to copy
     push    cs                          ; Problem calling far into the calltab segement.
     call    near ptr FLAT:_f_FuBuff
-    jc      mytkExecPgm_CalltkExecPgm_X2
-    jmp     mytkExecPgm_CalltkExecPgm_3
-
-mytkExecPgm_CalltkExecPgm_2:
-    mov     word ptr es:[eax], 0        ; Terminate the empty string!
-
-    ;
-    ; Set new input parameters (call _g_tkExecPgm)
-    ;
-    ; ds:dx is to become SegBuffer:OffBuffer
-    ; di:si is to become SegBuffer:OffBuffer+261
-    ;
-mytkExecPgm_CalltkExecPgm_3:
-    mov     di, [ebp+SegBuffer]
-    mov     ds, di
-    mov     si, [ebp+OffBuffer]
-    mov     dx, si                      ; ds:dx  SegBuffer:OffBuffer
-    add     si, 261                     ; di:si  SegBuffer:OffBuffer+261
-    mov     bx, [ebp+SegEnv]
+    jc      tkepgm_backout2             ; In case of error back (quite unlikely).
+
+
+    ;
+    ; Setup new input parameters (call _g_tkExecPgm)
+    ;
+    ; ds:dx is to become &achTkExecPgmFilename[0]
+    ; di:si is to become &achTkExecPgmArguments[0]
+    ;
+tkepgm_setup_parms:
+    mov     ax, [ebp + usExecFlag]
+    mov     di, seg achTkExecPgmArguments
+    mov     esi, offset achTkExecPgmArguments ; di:si  &achTkExecPgmArguments[0]
+    mov     ds, di                            ; Assumes same segment (which of course is true).
+    mov     edx, offset achTkExecPgmFilename  ; ds:dx  &achTkExecPgmFilename[0]
+    mov     bx, [ebp + SegEnv]
     mov     es, bx
-    mov     bx, [ebp+SegEnv]
+    mov     bx, [ebp + OffEnv]                ; es:bx  Environment
+
 
     ;
     ; Call _g_tkExecPgm
     ;
+tkepgm_callbehind:
     push    cs                          ; Problem calling far into the calltab segement.
     call    near ptr FLAT:_g_tkExecPgm
-    pushfd
-
-    ;
-    ; Release buffer
-    ;
-    push    eax
-    mov     eax, [ebp + pBuffer]
-    call    ReleaseBuffer
-    mov     [ebp + pBuffer], 0
-    pop     eax
-
-    ;
-    ; Return
-    ;
-    push    [ebp + SegFilename]
+    pushfd                              ; preserve flags
+    push    eax                         ; preserve result.
+    push    ecx                         ; preserve ecx just in case
+    push    edx                         ; preserve edx just in case
+    mov     ax, seg FLAT:DATA32
+    mov     ds, ax
+    mov     es, ax
+    ASSUME  ds:FLAT, es:FLAT            ; both ds and es are now FLAT
+
+
+    ;
+    ; Clear loader semaphore?
+    ; and clear loader state, current exe module and tkExecPgm global data flag.
+    ;
+    push    0                           ; Usage count variable.
+    mov     eax, pulTKSSBase32          ; Get TKSSBase
+    mov     eax, [eax]
+    add     eax, esp                    ; Added TKSSBase to the usage count pointer
+    push    eax                         ; Push address of usage count pointer.
+    push    pLdrSem                     ; Push pointer to loader semaphore ( = handle).
+    call    near ptr FLAT:_KSEMQueryMutex@8
+    or      eax, eax                    ; Check return code. (1 = our / free; 0 = not our but take)
+    pop     eax                         ; Pops usage count.
+    je      tkepgm_callbehindret        ; jmp if not taken by us (rc=FALSE).
+    or      eax, eax                    ; Check usage count.
+    jz      tkepgm_callbehindret        ; jmp if 0 (=free).
+    mov     ulLDRState, 0               ; Clears loaderstate. (LDRSTATE_UNKNOWN)
+    mov     pExeModule, 0               ; Sets the exemodule pointer to NULL.
+    mov     fTkExecPgm, 0               ; Marks global data invalid.
+    call    near ptr FLAT:_LDRClearSem@0
+
+    ;
+    ; Restore ds and es (probably unecessary but...) and Return
+    ;
+tkepgm_callbehindret:
+    push    dword ptr [ebp + SegFilename]
     pop     ds
-    push    [ebp + SegEnv]
+    push    dword ptr [ebp + SegEnv]
     pop     es
-    popfd
+    pop     edx                         ; restore edx
+    pop     ecx                         ; restore ecx
+    pop     eax                         ; restore result.
+    popfd                               ; restore flags
     leave
     retf
 
-mytkExecPgm_CalltkExecPgm_X2:
-    ;
-    ; Release buffer
-    ;
-    mov     eax, [ebp + pBuffer]
-    call    ReleaseBuffer
-    mov     [ebp + pBuffer], 0
-
-mytkExecPgm_CalltkExecPgm_X1:
-    pop     ds
+
+;
+; This is a backout were tkExecPgm probably will backout and we're
+; allready behind the loader semaphore.
+;
+tkepgm_backout2:
+    ;
+    ; Set Flat context and invalidate buffer.
+    ;
+    mov     ax, seg FLAT:DATA32
+    mov     ds, ax
+    ASSUME ds:FLAT
+    mov     fTkExecPgm, 0               ; Marks global data invalid.
+
+    ;
+    ; Restore parameters. and call the original tkExecPgm
+    ;
+    mov     ax, [ebp + usExecFlag]
+    mov     dx, [ebp + SegFilename]
+    mov     ds, dx
+    mov     dx, [ebp + OffFilename]
+    mov     bx, [ebp + SegEnv]
+    mov     es, bx
+    mov     bx, [ebp + OffEnv]
+    mov     di, [ebp + SegArg]
+    mov     si, [ebp + OffArg]
+    jmp     tkepgm_callbehind
+
+
+;
+; This is a backout were tkExecPgm too is exspected to back out.
+;
+tkepgm_backout:
+    ;
+    ; Restore parameters. and call the original tkExecPgm
+    ;
+    mov     ax, [ebp + usExecFlag]
+    mov     dx, [ebp + SegFilename]
+    mov     ds, dx
+    mov     dx, [ebp + OffFilename]
+    mov     bx, [ebp + SegEnv]
+    mov     es, bx
+    mov     bx, [ebp + OffEnv]
+    mov     di, [ebp + SegArg]
+    mov     si, [ebp + OffArg]
 
 mytkExecPgm_CalltkExecPgm:
-    push    cs
+    push    cs                          ; Problem calling far into the calltab segement.
     call    near ptr FLAT:_g_tkExecPgm
     leave
@@ -489,6 +416,158 @@
 mytkExecPgm ENDP
 
+
+
+;;
+; Function which copies the environment data passed into tkExecPgm
+; to a given buffer.
+; @cproto    ULONG _Optlink tkExecPgmCopyEnv(char *pachBuffer, unsigned cchBuffer);
+; @returns   OS/2 return code - NO_ERROR on success.
+;            0 on error or no data.
+; @param     pachBuffer     Pointer to buffer which the environment data is
+;                           to be copied to.
+;                           (eax)
+; @param     cchBuffer      Size of the buffer.
+;                           (edx)
+; @uses      eax, edx, ecx
+; @sketch
+; @status
+; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+; @remark
+tkExecPgmCopyEnv PROC NEAR
+cchEnv  = -04h
+    ASSUME ds:FLAT, es:FLAT, ss:NOTHING
+    push    ebp
+    mov     ebp, esp
+    lea     esp, [ebp + cchEnv]
+
+    push    ebx
+    mov     ebx, eax                    ; ebx now holds the buffer pointer.
+
+    ;
+    ; Call tkExecPgmEnvLength to get length and check that pointer is valid.
+    ;
+    push    edx
+    call    tkExecPgmEnvLength
+    pop     ecx                         ; ecx now holds the buffer length.
+
+    cmp     eax, 0
+    ja      tkepce_ok1
+    mov     eax, 232                    ; ERROR_NO_DATA
+    jmp     tkepce_ret                  ; Fail if no data or any other error.
+
+tkepce_ok1:
+    cmp     eax, ecx                    ; (ecx is the buffer size.)
+    jbe     tkepce_ok2                  ; Fail if buffer too small.
+    mov     eax, 111                    ; ERROR_BUFFER_OVERFLOW
+    jmp     tkepce_ret
+
+tkepce_ok2:
+    mov     [ebp + cchEnv], eax         ; Save environment length.
+
+
+    ;
+    ; Thunk the environment 16-bit far pointer to 32-bit.
+    ;
+    mov     eax, fpachTkExecPgmEnv
+    call    D32Hlp_VirtToLin
+    or      eax, eax                    ; check if thunking were successful.
+    jnz     tkepce_ok3                  ; Jump if success.
+    mov     eax, edx                    ; A special feature for D32Hlp_VirtToLin is that edx
+                                        ; have the error code in case on failure.
+    jmp tkepce_ret
+
+tkepce_ok3:
+    ;
+    ; Copy the environment data.
+    ;
+    push    3                           ; Fatal if error.
+    push    dword ptr [ebp + cchEnv]    ; Number of bytes to copy
+    push    eax                         ; Source buffer pointer. (user)
+    push    ebx                         ; Target buffer pointer.
+    call    near ptr FLAT:_TKFuBuff@16
+
+tkepce_ret:
+    pop     ebx
+    leave
+    ret
+tkExecPgmCopyEnv ENDP
+
+
+
+;;
+; This function gets the length of the tkExecPgm environment data.
+; @cproto    ULONG _Optlink tkExecPgmEnvLength(void);
+; @returns   Environment data length in bytes.
+; @uses      eax, edx, ecx
+; @sketch
+; @status
+; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+; @remark
+tkExecPgmEnvLength PROC NEAR
+    ASSUME ds:FLAT, es:FLAT, ss:NOTHING
+    push    ebp
+    mov     ebp, esp
+
+    ;
+    ; Push register which needs to be presered.
+    ;
+    push    es
+    push    ds
+    push    esi
+    push    edi
+    push    ebx
+
+
+    ;
+    ; Check that the data is valid.
+    ;
+    cmp     ulLDRState, 1               ; LDRSTATE_TKEXECPGM
+    jnz     tkepel_err_ret
+
+
+    ;
+    ; Check if the environment pointer is NULL.
+    ;
+    mov     ebx, fpachTkExecPgmEnv
+    ror     ebx, 16
+    cmp     bx, 4
+    jb      tkepel_err_ret
+
+
+tkepel1:
+    ;
+    ; Get the environment length
+    ;
+    mov     edi, ebx
+    ror     edi, 16                     ; bx:di -> [fpachTkExecPgmEnv]
+    xor     ecx, ecx
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_f_FuStrLenZ
+    jc      tkepel_err_ret
+    movzx   eax, cx
+    jmp     tkepel_ret
+
+
+; Failure
+tkepel_err_ret:
+    xor     eax, eax
+
+
+; Return
+tkepel_ret:
+    pop     ebx                         ; restore registers
+    pop     edi
+    pop     esi
+    pop     ds
+    pop     es
+    leave
+    ret
+tkExecPgmEnvLength ENDP
+
+
+
+
+
 CODE32 ENDS
-endif
 
 
Index: trunk/src/win32k/ldr/mytkStartProcess.asm
===================================================================
--- trunk/src/win32k/ldr/mytkStartProcess.asm	(revision 4164)
+++ trunk/src/win32k/ldr/mytkStartProcess.asm	(revision 4164)
@@ -0,0 +1,111 @@
+; $Id: mytkStartProcess.asm,v 1.2 2000-09-02 21:08:10 bird Exp $
+;
+; tkStartProcess overloader. Needed to clear the loader semaphore
+; when a process is being started syncronously.
+;
+; Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+;
+; Project Odin Software License can be found in LICENSE.TXT
+;
+
+    .386p
+
+
+;
+;   Include files
+;
+    include devsegdf.inc
+
+;
+;   Imported Functions and variables.
+;
+
+    ;
+    ; LDR semaphore
+    ;
+    extrn pLdrSem:DWORD
+    extrn _LDRClearSem@0:PROC
+    extrn _KSEMRequestMutex@8:PROC
+    extrn _KSEMQueryMutex@8:PROC
+
+    ;
+    ; Loader State
+    ;
+    extrn ulLDRState:DWORD
+
+    ;
+    ; mytkExecPgm stuff.
+    ;
+    extrn fTkExecPgm:BYTE
+
+    ;
+    ; Pointer to current executable module.
+    ;
+    extrn pExeModule:DWORD
+
+    ;
+    ; TKSSBase (32-bit)
+    ;
+    extrn pulTKSSBase32:DWORD
+
+    ;
+    ; Calltable entry for tkStartProcess
+    ;
+    extrn _tkStartProcess:PROC
+
+;
+;   Exported symbols
+;
+    public mytkStartProcess
+
+
+CODE32 SEGMENT
+
+;;
+; Overloads tkStartProcess. If the loader semahore is taken by us we'll release it.
+; @returns
+; @param
+; @uses      eax, ecx, edx
+; @sketch
+; @status
+; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+; @remark
+mytkStartProcess PROC NEAR
+    ASSUME DS:FLAT, ES:NOTHING, SS:NOTHING
+
+    ;
+    ; Check if the loader semphore is take by us.
+    ; Clear it (and other vars) if it is.
+    ;
+    push    eax
+    push    ecx
+    push    edx
+
+    push    0                           ; Usage count variable.
+    mov     eax, pulTKSSBase32          ; Get TKSSBase
+    mov     eax, [eax]
+    add     eax, esp                    ; Added TKSSBase to the usage count pointer
+    push    eax                         ; Push address of usage count pointer.
+    push    pLdrSem                     ; Push pointer to loader semaphore ( = handle).
+    call    near ptr FLAT:_KSEMQueryMutex@8
+    or      eax, eax                    ; Check return code. (1 = our / free; 0 = not our but take)
+    pop     eax                         ; Pops usage count.
+    jz      mtksp_ret                   ; jmp if not taken by us (rc=FALSE).
+    or      eax, eax                    ; Check usage count.
+    jz      mtksp_ret                   ; jmp if 0 (=free).
+    mov     ulLDRState, 0               ; Clears loaderstate. (LDRSTATE_UNKNOWN)
+    mov     pExeModule, 0               ; Sets the exemodule pointer to NULL.
+    mov     fTkExecPgm, 0               ; Marks global data invalid.
+    cmp     eax, 2                      ; If usage count > 1 then issue a release. (should not happen here)
+    jl      mtksp_ret                   ; jmp if usage count < 2. (tkStartProcess or tkExecPgm will free the last usage).
+    call    near ptr FLAT:_LDRClearSem@0
+
+mtksp_ret:
+    pop     edx
+    pop     ecx
+    pop     eax
+    jmp     near ptr FLAT:_tkStartProcess
+mytkStartProcess ENDP
+
+CODE32 ENDS
+END
Index: trunk/src/win32k/lib/libDosAllocMemEx.c
===================================================================
--- trunk/src/win32k/lib/libDosAllocMemEx.c	(revision 4152)
+++ trunk/src/win32k/lib/libDosAllocMemEx.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: libDosAllocMemEx.c,v 1.3 2000-02-26 19:59:55 bird Exp $
+/* $Id: libDosAllocMemEx.c,v 1.4 2000-09-02 21:08:11 bird Exp $
  *
  * DosAllocMemEx - Extened Edition of DosAllocMem.
@@ -17,5 +17,4 @@
 #define INCL_DOSFILEMGR
 #define INCL_DOSDEVICES
-#define INCL_WIN32K_LIB
 
 
Index: trunk/src/win32k/lib/libTest.c
===================================================================
--- trunk/src/win32k/lib/libTest.c	(revision 4152)
+++ trunk/src/win32k/lib/libTest.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: libTest.c,v 1.1 2000-02-26 20:19:26 bird Exp $
+/* $Id: libTest.c,v 1.2 2000-09-02 21:08:11 bird Exp $
  *
  * Test program for the win32k library.
@@ -12,5 +12,4 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-#define INCL_WIN32K_LIB
 #define INCL_BASE
 
Index: trunk/src/win32k/lib/libW32kQueryOTEs.c
===================================================================
--- trunk/src/win32k/lib/libW32kQueryOTEs.c	(revision 4164)
+++ trunk/src/win32k/lib/libW32kQueryOTEs.c	(revision 4164)
@@ -0,0 +1,74 @@
+/* $Id: libW32kQueryOTEs.c,v 1.2 2000-09-02 21:08:11 bird Exp $
+ *
+ * libW32kQueryOTEs - Get's the object table entries (OTEs) for a given
+ *                    module (given by a module handle).
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define INCL_DOSERRORS
+#define INCL_DOSFILEMGR
+#define INCL_DOSDEVICES
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#include <os2.h>
+#include "win32k.h"
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+extern BOOL     fInited;
+extern HFILE    hWin32k;
+
+
+/**
+ * Gets the object table entries for a module.
+ * @returns     OS2 returncode.
+ * @param       hMTE    Module handle (HMTE) of the module.
+ * @param       pQOte   Pointer to output buffer.
+ * @param       cbQOte  Size (in bytes) of the output buffer.
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark
+ */
+APIRET APIENTRY  W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte)
+{
+    APIRET rc;
+
+    if (fInited)
+    {
+        K32QUERYOTES    Param;
+        ULONG           cbParam = sizeof(Param);
+        ULONG           cbData = 0UL;
+
+        Param.hMTE = hMTE;
+        Param.pQOte = pQOte;
+        Param.cbQOte = cbQOte;
+        Param.rc = ERROR_INVALID_PARAMETER;
+
+        rc = DosDevIOCtl(hWin32k,
+                         IOCTL_W32K_K32,
+                         K32_QUERYOTES,
+                         &Param, sizeof(Param), &cbParam,
+                         "", 1, &cbData);
+
+        if (rc == NO_ERROR)
+            rc = Param.rc;
+    }
+    else
+        rc = ERROR_INIT_ROUTINE_FAILED;
+
+    return rc;
+}
+
Index: trunk/src/win32k/lib/libWin32kInstalled.c
===================================================================
--- trunk/src/win32k/lib/libWin32kInstalled.c	(revision 4164)
+++ trunk/src/win32k/lib/libWin32kInstalled.c	(revision 4164)
@@ -0,0 +1,44 @@
+/* $Id: libWin32kInstalled.c,v 1.2 2000-09-02 21:08:11 bird Exp $
+ *
+ * libWin32kInstalled - checks if Win32k is installed or not.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define INCL_DOSERRORS
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#include <os2.h>
+#include "win32k.h"
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+extern BOOL     fInited;
+
+
+/**
+ * Checks if Win32k is installed or not.
+ * @returns     TRUE:   Win32k is installed.
+ *              FALSE:  Win32k is not installed. (or not inited yet)
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark      The caller is reponsible for having called the libInit
+ *              function before this call to get a decent result.
+ */
+BOOL   APIENTRY  libWin32kInstalled(void)
+{
+    return fInited;
+}
+
Index: trunk/src/win32k/lib/libWin32kQueryOptionsStatus.c
===================================================================
--- trunk/src/win32k/lib/libWin32kQueryOptionsStatus.c	(revision 4164)
+++ trunk/src/win32k/lib/libWin32kQueryOptionsStatus.c	(revision 4164)
@@ -0,0 +1,91 @@
+/* $Id: libWin32kQueryOptionsStatus.c,v 1.2 2000-09-02 21:08:12 bird Exp $
+ *
+ * libWin32kQueryOptionsStatus - Queries the options and/or the status of
+ *                               Win32k.sys driver.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define INCL_DOSERRORS
+#define INCL_DOSFILEMGR
+#define INCL_DOSDEVICES
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#include <os2.h>
+#include "win32k.h"
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+extern BOOL     fInited;
+extern HFILE    hWin32k;
+
+
+/**
+ * Gets the options settings and/or the status of win32k.sys.
+ * @returns     OS2 returncode.
+ * @param       pOptions    Pointer to an options struct. (NULL is allowed)
+ *                          (cb have to be set to the size of the structure.)
+ * @param       pStatus     Pointer to a status struct. (NULL is allowed)
+ *                          (cb have to be set to the size of the structure.)
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark
+ */
+APIRET APIENTRY  libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus)
+{
+    APIRET rc;
+
+    /*
+     * Simple validation.
+     */
+    if ((pOptions != NULL && pOptions->cb != sizeof(K32OPTIONS))
+        ||
+        (pStatus  != NULL && pStatus->cb != sizeof(K32STATUS))
+        ||
+        (pOptions == NULL && pStatus == NULL)
+        )
+        rc = ERROR_INVALID_PARAMETER;
+
+    /*
+     * Check that we're initiated.
+     */
+    else if (fInited)
+    {
+        /*
+         * Build parameters and call win32k.
+         */
+        K32QUERYOPTIONSSTATUS   Param;
+        ULONG           cbParam = sizeof(Param);
+        ULONG           cbData = 0UL;
+
+        Param.pOptions  = pOptions;
+        Param.pStatus   = pStatus;
+        Param.rc = ERROR_INVALID_PARAMETER;
+
+        rc = DosDevIOCtl(hWin32k,
+                         IOCTL_W32K_K32,
+                         K32_QUERYOPTIONSSTATUS,
+                         &Param, sizeof(Param), &cbParam,
+                         "", 1, &cbData);
+
+        if (rc == NO_ERROR)
+            rc = Param.rc;
+    }
+    else
+        rc = ERROR_INIT_ROUTINE_FAILED;
+
+    return rc;
+}
+
Index: trunk/src/win32k/lib/libWin32kSetOptions.c
===================================================================
--- trunk/src/win32k/lib/libWin32kSetOptions.c	(revision 4164)
+++ trunk/src/win32k/lib/libWin32kSetOptions.c	(revision 4164)
@@ -0,0 +1,85 @@
+/* $Id: libWin32kSetOptions.c,v 1.2 2000-09-02 21:08:12 bird Exp $
+ *
+ * libWin32kSetOptions - Sets the changable options of win32k.sys the options.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define INCL_DOSERRORS
+#define INCL_DOSFILEMGR
+#define INCL_DOSDEVICES
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#include <os2.h>
+#include "win32k.h"
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+extern BOOL     fInited;
+extern HFILE    hWin32k;
+
+#include "log.h"
+
+/**
+ * Gets the options settings and/or the status of win32k.sys.
+ * @returns     OS2 returncode.
+ * @param       pOptions    Pointer to an options struct. (NULL is allowed)
+ *                          (cb have to be set to the size of the structure.)
+ * @param       pStatus     Pointer to a status struct. (NULL is allowed)
+ *                          (cb have to be set to the size of the structure.)
+ * @status      completely implelemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark
+ */
+APIRET APIENTRY  libWin32kSetOptions(PK32OPTIONS pOptions)
+{
+    APIRET rc;
+
+    /*
+     * Simple validation.
+     */
+    if (pOptions == NULL || pOptions->cb != sizeof(K32OPTIONS))
+        rc = ERROR_INVALID_PARAMETER;
+
+    /*
+     * Check that we're initiated.
+     */
+    else if (fInited)
+    {
+        /*
+         * Build parameters and call win32k.
+         */
+        K32SETOPTIONS   Param;
+        ULONG           cbParam = sizeof(Param);
+        ULONG           cbData = 0UL;
+
+        Param.pOptions  = pOptions;
+        Param.rc = ERROR_INVALID_PARAMETER;
+
+        rc = DosDevIOCtl(hWin32k,
+                         IOCTL_W32K_K32,
+                         K32_SETOPTIONS,
+                         &Param, sizeof(Param), &cbParam,
+                         "", 1, &cbData);
+
+        if (rc == NO_ERROR)
+            rc = Param.rc;
+    }
+    else
+        rc = ERROR_INIT_ROUTINE_FAILED;
+
+    return rc;
+}
+
Index: trunk/src/win32k/lib/makefile
===================================================================
--- trunk/src/win32k/lib/makefile	(revision 4152)
+++ trunk/src/win32k/lib/makefile	(revision 4164)
@@ -1,4 +1,4 @@
 ##############################################################################
-# $Id: makefile,v 1.3 2000-03-17 17:38:27 bird Exp $
+# $Id: makefile,v 1.4 2000-09-02 21:08:12 bird Exp $
 #
 # PD-Win32 API
@@ -49,5 +49,9 @@
 OBJS     =  $(WIN32KOBJ)\libInit.$(OBJEXT)         \
             $(WIN32KOBJ)\libTerm.$(OBJEXT)     \
+            $(WIN32KOBJ)\libWin32kInstalled.$(OBJEXT) \
+            $(WIN32KOBJ)\libWin32kQueryOptionsStatus.$(OBJEXT) \
+            $(WIN32KOBJ)\libWin32kSetOptions.$(OBJEXT) \
             $(WIN32KOBJ)\libDosAllocMemEx.$(OBJEXT) \
+            $(WIN32KOBJ)\libW32kQueryOTEs.$(OBJEXT) \
             $(WIN32KOBJ)\libGetCS.obj
 
@@ -86,5 +90,6 @@
 ##############################################################################
 dep:
-    $(DEPEND) -obj$(OBJEXT) -o$(WIN32KOBJ) $(CINCLUDES) $(WIN32KBASE)\include\*.h
+    $(DEPEND) -obj$(OBJEXT) -o$(WIN32KOBJ) $(CINCLUDES) \
+        $(WIN32KBASE)\include\*.h *.c* *.asm
 
 !if [$(EXISTS) .depend] == 0
Index: trunk/src/win32k/libconv.c
===================================================================
--- trunk/src/win32k/libconv.c	(revision 4152)
+++ trunk/src/win32k/libconv.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: libconv.c,v 1.2 1999-11-10 01:45:29 bird Exp $
+/* $Id: libconv.c,v 1.3 2000-09-02 21:07:53 bird Exp $
  *
  * Very simple OMF/LIB dumper.
@@ -21,4 +21,5 @@
 
 int fCodeToCode16 = 0;
+int fRemoveExtra = 0;
 
 /*@IntFunc**********************************************************************
@@ -26,5 +27,5 @@
 *******************************************************************************/
 int processFile(const char *pszFilename, const char *pszFilenameOut);
-void *processRecord(void *pvRecord, void *pvBase, FILE *phNew);
+void *processRecord(void *pvRecord, void *pvBase, FILE *phNew, unsigned short *ausTrans);
 
 
@@ -35,4 +36,9 @@
     int argi = 1;
 
+    if (argc == 4)
+    {
+        argi = 2;
+        fRemoveExtra = 1;
+    }
     if (argc != 3)
         printf("syntax error - requires two filename, in.lib and out.lib\n");
@@ -78,9 +84,11 @@
                 if (fread(pvFile, cbFile, 1, phFile) == 1)
                 {
+                    unsigned short * ausTrans = calloc(sizeof(unsigned short), cbFile / 16 ); /* Assumes page size of 16 FIXME! */
                     void *pvNew = pvFile;
+
 
                     /*  main loop */
                     while (pvNew < (void*)(cbFile + (int)pvFile))
-                        pvNew = processRecord(pvNew, pvFile, phNew);
+                        pvNew = processRecord(pvNew, pvFile, phNew, ausTrans);
                 }
                 else
@@ -103,9 +111,10 @@
 
 
-void *processRecord(void *pvRecord, void *pvBase, FILE *phNew)
+void *processRecord(void *pvRecord, void *pvBase, FILE *phNew, unsigned short *ausTrans)
 {
     static char *apszLNames[256];
     static int   cpszLNames = 0;
     static int   iCode16 = 0;
+    static int   cbPage = 16;       /* fixme todo TODO FIXME ASSUMES: pagesize = 16 */
     void *pvRet = pvRecord;
     int  cbRecord;
@@ -116,26 +125,29 @@
     {
        case LIBHDR:
-            fChanged = 1;
-            fwrite(pvRecord, 1, 3, phNew);
             if (*(unsigned short*)((int)pvRecord+1) < 6)
-                fwrite((char*)pvRecord+3, 1, *(unsigned short*)((int)pvRecord+1), phNew);
-            else
-            {
-                i = 0;
-                fwrite(&i, 1, 2, phNew);
-                fwrite(&i, 1, 2, phNew);
-                fwrite(&i, 1, 2, phNew);
-                fwrite((char*)pvRecord+3+6, 1, *(unsigned short*)((int)pvRecord+1) - 6, phNew);
-            }
-            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
-            break;
-
-        case 0x98: /* 16-bit segdef */
-            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+                fprintf(stderr, "error: not supported LIBHDR\n");
+            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+            break;
+
+        case THEADR:
+            /* Add entry to the translation table - used to translate block numbers in the dictionary */
+            ausTrans[((char*)pvRecord - (char*)pvBase) / cbPage] = (unsigned short)(ftell(phNew) / cbPage);
+            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+            break;
+
+        case SEGDEF: /* 16-bit segdef */
+            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+            *((char*)pvRecord + 9) =  0;
             i = *(char*)((int)pvRecord + 6);
             if (cbRecord == 10 && i <= cpszLNames && strcmp(apszLNames[i-1], "CODE") == 0)
-                {
+            {
                 *(char*)((int)pvRecord + 6) = iCode16+1;
-                }
+            }
+            i = *(char*)((int)pvRecord + 6);
+            if (cbRecord == 10 &&  (*((char *)pvRecord + 3) & 0xE0) == 0x20 && i <= cpszLNames && strcmp(apszLNames[i-1], "CODE16_IOSEG") == 0)
+            {   /* change alignment of this segment... */
+                /* fprintf(stderr, "debug %s 0x%02x\n", apszLNames[*(char*)((int)pvRecord + 6) - 1], (*((char *)pvRecord + 3) & 0xFF)); */
+                *((char*)pvRecord + 3) =  0x40 | (*((char*)pvRecord + 3) & 0x1F);
+            }
             break;
 
@@ -148,4 +160,8 @@
             /* it seems to be somthing funny here! - lets try aligning it to on a 16 bytes boundrary... */
             /* PS. I know this I have a wrong approch to the lib files, not using the directory... */
+            /* Aug 13 2000 4:24am: The alignment of modules are found in the library header.
+             *    It's the size of the library header.
+             *    Not implemented yet. TODO FIXME BUGBUG ASSUMES
+             */
             fChanged = 1;
             fwrite(pvRecord, 1, cbRecord, phNew);
@@ -153,11 +169,11 @@
             if (*((unsigned char*)((int)pvRecord+cbRecord)) == 0x00)
             {
-                if ((ul % 16) > 0)
-                    cbRecord += 16 - (ul % 16);
+                if ((ul % cbPage) > 0)
+                    cbRecord += cbPage - (ul % cbPage);
             }
             /*if (*((unsigned char*)pvRecord + cbRecord) != LIBEND)*/
             {
                 ul = ftell(phNew);
-                while (ul++ % 16 != 0)
+                while (ul++ % cbPage != 0)
                     fputc(0, phNew);
             }
@@ -166,19 +182,30 @@
         } break;
 
+        case PUBDEF:
+        {
+            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+            *((char*)pvRecord + cbRecord - 1) = 0;
+            break;
+        }
+
         case LNAMES:
-            {
+        {
             char *apszConv[] =
             {
-                "CODE",     "CODE",
-                "_CODE",    "CODE16",
-                "TEXT",     "CODE16",
-                "_TEXT",    "CODE16",
-                "DATA",     "FAR_DATA",
-                "_DATA",    "DATA16",
-                "DGROUP",   "DATA16_GROUP",
-                "_BSS",     "DATA16BSS",
-                "BSS",      "DATA16BSS",
-                "_CONST",   "DATA16CONST",
-                "CONST",    "DATA16CONST",
+                /* classes */
+                "CODE",         "CODE",
+                "IOSEG_CODE",   "CODE",
+                "DATA",         "FAR_DATA",
+                "BSS",          "DATA16BSS",
+                "CONST",        "DATA16CONST",
+                /* segment names */
+                "_TEXT",        "CODE16",
+                "_IOSEG",       "CODE16_IOSEG",
+                "_CODE",        "CODE16",           /* dhcalls */
+                "_DATA",        "DATA16",
+                "_BSS",         "DATA16BSS",
+                "_CONST",       "DATA16CONST",
+                /* groups */
+                "DGROUP",       "DATA16_GROUP",
                 NULL, NULL
             };
@@ -242,11 +269,79 @@
             fputc(0, phNew);
             break;
-            }
+        }
 
         case LIBEND:
-            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
-            fwrite(pvRecord, 1, cbRecord, phNew);
+        {
+            /* align dictionary at 512 byte (3 is min size of this record) */
+            int cBlocks;
+            unsigned short int cbSize  = (((ftell(phNew) + 3 + 0x1ff) & ~0x1ff) - ftell(phNew)) - 3;
+            unsigned long int  offDict = ftell(phNew) + cbSize + 3;
+            cbRecord = cbSize + 3;
+            fwrite(pvRecord, 1, 1, phNew);
+            fwrite(&cbSize, 1, sizeof(cbSize), phNew);
+            while (cbSize-- > 0)
+                fwrite("\0", 1, 1, phNew);
+
+            /* update header record. */
+            fseek(phNew, 3, SEEK_SET);
+            fwrite(&offDict, 1, sizeof(offDict), phNew);
+            fseek(phNew, offDict, SEEK_SET);
+
+            /* Translate the dictionary */
+            pvRecord = (void*)((char*)pvRecord + *(unsigned short*)((char*)pvRecord + 1) + 3);
+            cBlocks = *(unsigned short *)((char*)pvBase + 7);
+            for (i = 0; i < cBlocks; i++)
+            {
+                int j;
+                char *pchBlock = (char*)pvRecord + i * 512;
+                for (j = 0; j < 37; j++)
+                {
+                    if (pchBlock[j] > 19 && pchBlock[j] < 0xff)
+                    {
+                        unsigned short *pusBlock = (unsigned short*)&pchBlock[pchBlock[j] * 2];
+                        pusBlock = (unsigned short *) ((char*)pusBlock + *(char*)pusBlock + 1);
+                        if (ausTrans[*pusBlock] == 0)
+                            fprintf(stderr, "error: dictionary entry don't point to a THEADR page!\n");
+                        else
+                            *pusBlock = ausTrans[*pusBlock];
+                    }
+                }
+
+            }
+
+            /* Write the dictionary */
+            fwrite(pvRecord, 512, cBlocks, phNew);
             return (void*)0xffffffff; /* FINE */
-            break;
+        }
+
+        case COMENT:
+        {
+            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+            switch (*((unsigned char*)((int)pvRecord+4)))
+            {
+                /* remove "Link Pass Separator" */
+                case 0xA2:
+                /* remove "LIBMOD" - The VAC 3.6.5 Linker don't like these! */
+                case 0xA3:
+                    fChanged = fRemoveExtra;
+                    break;
+            }
+            break;
+        }
+
+        /*
+         * Remove checksum
+         */
+        /*
+        case GRPDEF:
+        case FIXUPP:
+        case FIXUPP2:
+        case LEDATA:
+        {
+            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
+            *((char*)pvRecord + cbRecord - 1) = 0;
+            break;
+        }
+        */
 
         default:
Index: trunk/src/win32k/misc/OS2KPTDA.c
===================================================================
--- trunk/src/win32k/misc/OS2KPTDA.c	(revision 4152)
+++ trunk/src/win32k/misc/OS2KPTDA.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2KPTDA.c,v 1.1 2000-07-16 22:21:17 bird Exp $
+/* $Id: OS2KPTDA.c,v 1.2 2000-09-02 21:08:12 bird Exp $
  *
  * PTDA access functions.
@@ -9,4 +9,9 @@
  */
 
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define INCL_OS2KRNL_SEM
+#define INCL_OS2KRNL_PTDA
 
 /*******************************************************************************
@@ -14,5 +19,5 @@
 *******************************************************************************/
 #include <os2.h>
-#include <OS2KPTDA.h>
+#include <OS2Krnl.h>
 
 
@@ -28,4 +33,6 @@
 extern ULONG    pptda_start;
 extern ULONG    pptda_environ;
+extern ULONG    pptda_ptdasem;
+extern ULONG    pptda_module;
 
 
@@ -35,5 +42,4 @@
  * @returns     Content of the pPTDA->ptda_environ member.
  * @param       pPTDA   PTDA Pointer. (NULL is not allowed!)
- * @sketch
  */
 USHORT  ptdaGet_ptda_environ(PPTDA pPTDA)
@@ -42,2 +48,28 @@
 }
 
+
+/**
+ * Gets the ptda_module PTDA member. This member holds the MTE handle of the process's
+ * executable image.
+ * @returns     Content of the pPTDA->ptda_module member.
+ * @param       pPTDA   PTDA Pointer. (NULL is not allowed!)
+ */
+USHORT  ptdaGet_ptda_module(PPTDA pPTDA)
+{
+    return *(PUSHORT)(void*)(((char*)(void*)pPTDA) + (pptda_module - pptda_start));
+}
+
+
+/**
+ * Gets the ptda_ptdasem PTDA member. This member holds the intra-process semaphore which
+ * for example is used to serialize _LDRQAppType.
+ * @returns     Content of the pPTDA->ptda_ptdasem member.
+ * @param       pPTDA   PTDA Pointer. (NULL is not allowed!)
+ */
+HKSEMMTX    ptda_ptda_ptdasem(PPTDA pPTDA)
+{
+    return (HKSEMMTX)(void*)(((char*)(void*)pPTDA) + (pptda_ptdasem - pptda_start));
+}
+
+
+
Index: trunk/src/win32k/misc/OS2KTCB.c
===================================================================
--- trunk/src/win32k/misc/OS2KTCB.c	(revision 4152)
+++ trunk/src/win32k/misc/OS2KTCB.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: OS2KTCB.c,v 1.1 2000-07-16 22:21:17 bird Exp $
+/* $Id: OS2KTCB.c,v 1.2 2000-09-02 21:08:13 bird Exp $
  *
  * TCB - Thread Control Block access methods.
@@ -15,4 +15,5 @@
 #include <os2.h>
 #include <OS2KTCB.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "options.h"
 
Index: trunk/src/win32k/misc/avl.c
===================================================================
--- trunk/src/win32k/misc/avl.c	(revision 4152)
+++ trunk/src/win32k/misc/avl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: avl.c,v 1.4 2000-03-19 16:00:11 bird Exp $
+/* $Id: avl.c,v 1.5 2000-09-02 21:08:13 bird Exp $
  *
  * AVL-Tree (lookalike) implementation.
@@ -24,4 +24,5 @@
 *******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "avl.h"
 #if defined(RING0) || defined(RING3)
Index: trunk/src/win32k/misc/buffer.asm
===================================================================
--- trunk/src/win32k/misc/buffer.asm	(revision 4152)
+++ trunk/src/win32k/misc/buffer.asm	(revision 4164)
@@ -1,5 +1,5 @@
-; $Id: buffer.asm,v 1.5 2000-02-21 09:24:02 bird Exp $
-;
-; Simple resident buffer for use when overloading tkExecPgm.
+; $Id: buffer.asm,v 1.6 2000-09-02 21:08:13 bird Exp $
+;
+; Simple resident buffer for use when overloading tkExecPgm - obsolete!
 ;
 ; Copyright (c) 2000 knut st. osmundsen
@@ -13,5 +13,5 @@
 ;   Defined Constants And Macros
 ;
-NBR_BUFFERS     EQU 20
+NBR_BUFFERS     EQU 2
 BUFFER_SIZE     EQU 1536
 
Index: trunk/src/win32k/misc/cout.cpp
===================================================================
--- trunk/src/win32k/misc/cout.cpp	(revision 4152)
+++ trunk/src/win32k/misc/cout.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: cout.cpp,v 1.2 1999-10-27 02:02:59 bird Exp $
+/* $Id: cout.cpp,v 1.3 2000-09-02 21:08:13 bird Exp $
  *
  * cout - cout replacement.
@@ -25,4 +25,5 @@
 #include <stdarg.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "cout.h"
 #include "options.h"
Index: trunk/src/win32k/misc/env.c
===================================================================
--- trunk/src/win32k/misc/env.c	(revision 4152)
+++ trunk/src/win32k/misc/env.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: env.c,v 1.2 2000-04-17 02:26:04 bird Exp $
+/* $Id: env.c,v 1.3 2000-09-02 21:08:13 bird Exp $
  *
  * Environment access functions
@@ -14,5 +14,5 @@
 #define INCL_DOSERRORS                  /* Error codes */
 #define INCL_OS2KRNL_VM                 /* OS2KRNL: Virtual Memory Management */
-
+#define INCL_OS2KRNL_PTDA               /* OS2KNRL: (per)ProcessTaskDataArea */
 
 /*******************************************************************************
@@ -21,11 +21,11 @@
 #include <os2.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "dev32.h"
 #include "dev32hlp.h"
 #include "log.h"
-#include "ptda.h"
 #include "OS2Krnl.h"
 #include <string.h>
-
+#include "macros.h"
 #include "env.h"
 
@@ -39,39 +39,51 @@
  * @param     paszEnv   Pointer to the environment data to search.
  *                      The environment data is a list of zero-strings terminated
- *                      by an empty string. The strings are paired, that means
- *                      that the first string is the variable name and the
- *                      following string is the value of the variable.
- *                      AFAIK a variable can't have an empty value string!
- * @param     pszVar    Name of the environment variable to find.
+ *                      by an empty string. The strings consists of two parts which
+ *                      are separated by a euqal char ('='). The first part is the
+ *                      variable name. The second part is the value of the variable.
+ *
+ *                      IF this is NULL we'll simply return NULL.
+ * @param     pszVar    Name of the environment variable to find. (NULL not allowed.)
  */
 const char *ScanEnv(const char *paszEnv, const char *pszVar)
 {
+    int     cchVar;
+    /*
+     * Return if environment not found.
+     */
+    #ifdef DEBUG
+    if (pszVar < (const char *)0x10000 || *pszVar == '\0')
+        kprintf(("ScanEnv: Invalid parameter pszVar (%p)\n", pszVar));
+    #endif
+    if (paszEnv == NULL)
+        return NULL;
+    #ifdef DEBUG
+    if (paszEnv < (const char *)0x10000)
+        kprintf(("ScanEnv: Invalid parameter paszEnv (%p)\n", paszEnv));
+    #endif
+
     /*
      * Loop thru the environment data until an empty string is reached.
      */
+    cchVar = strlen(pszVar);
     while (*paszEnv != '\0')
     {
-        register int i;                 /* Variable use to store the compare result. */
-
         /*
-         * Variable name.
-         * Check if it's matching the name we're searching for and skip the variable name.
+         * Check if the variable name is it's matching the one we're searching for.
          */
-        i = stricmp(paszEnv, pszVar);
-        paszEnv += strlen(paszEnv) + 1;
-        if (i == 0)
-        {   /* Variable was found. Return pointer to the value. */
-            return paszEnv;
+        const char *pszEqual = strchr(paszEnv, '=');
+        if (pszEqual != NULL && (pszEqual - paszEnv) == cchVar
+            && memcmp(paszEnv, pszVar, cchVar) == 0
+            )
+        {
+            /*
+             * Variable was found. Return pointer to the value.
+             */
+            return pszEqual + 1;
         }
 
         /*
-         * !Paranoia!
-         * If no value string we'll quit. This may be an IPE, if not it might
-         * cause one if we continue processing the environment data.
+         * Skip this variable. (Don't use pszEqual since it might be NULL)
          */
-        if (*paszEnv == '\0')
-            break;
-
-        /* Skip value */
         paszEnv += strlen(paszEnv) + 1;
     }
@@ -82,15 +94,19 @@
 
 /**
- * Get the linear pointer to the environment data.
+ * Get the linear pointer to the environment data for the current
+ * process or the process being started (EXECed).
  *
- * @returns   Pointer to environment data.
- *            NULL on failure.
+ * @param       fExecChild      TRUE:  Get exec child environment.
+ *                                     (Not supported by method 2)
+ *                              FALSE: Get current process environment.
+ * @returns     Pointer to environment data.
+ *              NULL on failure.
  */
-const char *GetEnv(void)
+const char *GetEnv(BOOL fExecChild)
 {
-    /*  There is probably two ways of getting the environment data for a the
+    /*  There are probably two ways of getting the environment data for the
      *  current process: 1) get it from the PTDA->ptda_environ
      *                   2) Local infosegment (LIS from GetDosVar devhlp)
-     *  I am not sure which one of these works best. What I know is that
+     *  I am not sure which one of these which works best. What I know is that
      *  method 1) is used by the w_GetEnv API worker. This API is called at
      *  Ring-0 from some delete file operation. (Which uses it to get the
@@ -98,5 +114,5 @@
      *  I don't want to thunk around using that. There for I'll implement
      *  my own GetEnv. So, currently I'll write the code for both 1) and
-     *  2), testing will show which one of them are most handy.
+     *  2), testing will show which one of them are the better.
      */
 
@@ -116,8 +132,8 @@
      */
     pPTDACur = ptdaGetCur();
-    if (pPTDA != NULL)
+    if (pPTDACur != NULL)
     {
-        pPTDA = ptdaGet_pPTDAExecChild(pPTDA);
-        if (pPTDA != NULL)
+        pPTDA = ptdaGet_pPTDAExecChild(pPTDACur);
+        if (pPTDA != NULL && fExecChild)
         {
             hobEnviron = ptdaGet_ptda_environ(pPTDA);
@@ -127,5 +143,5 @@
                 if (rc == NO_ERROR)
                     return (const char *)ulAddr;
-                kprintf(("GetEnv: VMObjHandleInfo failed with rc=%d for hob=0x%04x\n", rc, hobEnviron));
+                kprintf(("GetEnv: (1) VMObjHandleInfo failed with rc=%d for hob=0x%04x \n", rc, hobEnviron));
             }
         }
@@ -135,18 +151,19 @@
         {
             rc = VMObjHandleInfo(hobEnviron, SSToDS(&ulAddr), SSToDS(&ushPTDA));
-            if (rc != NO_ERROR)
-            {
-                kprintf(("GetEnv: VMObjHandleInfo failed with rc=%d for hob=0x%04x\n", rc, hobEnviron));
-            }
+            if (rc == NO_ERROR)
+                return (const char *)ulAddr;
+            kprintf(("GetEnv: (2) VMObjHandleInfo failed with rc=%d for hob=0x%04x\n", rc, hobEnviron));
         }
     }
     else
-    {
+    {   /* Not called at task time? No current task! */
         kprintf(("GetEnv: Failed to get current PTDA.\n"));
     }
 
-    return (const char *)ulAddr;
+    return NULL;
+
 
     #else
+
 
     struct InfoSegLDT * pLIS;           /* Pointer to local infosegment. */
@@ -162,4 +179,5 @@
     {
         kprintf(("GetEnv: Failed to get local info segment\n"));
+        NOREF(fExecChild);
         return NULL;
     }
Index: trunk/src/win32k/misc/log.c
===================================================================
--- trunk/src/win32k/misc/log.c	(revision 4152)
+++ trunk/src/win32k/misc/log.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: log.c,v 1.1 1999-09-06 02:20:02 bird Exp $
+/* $Id: log.c,v 1.2 2000-09-02 21:08:13 bird Exp $
  *
  * log - C-style logging - kprintf.
@@ -23,4 +23,5 @@
 #include <builtin.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "dev32.h"
 #include "options.h"
Index: trunk/src/win32k/misc/malloc.c
===================================================================
--- trunk/src/win32k/misc/malloc.c	(revision 4152)
+++ trunk/src/win32k/misc/malloc.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: malloc.c,v 1.6 2000-01-24 18:19:00 bird Exp $
+/* $Id: malloc.c,v 1.7 2000-09-02 21:08:14 bird Exp $
  *
  * Common Heap - this forwards to the swappable heap!
@@ -20,4 +20,5 @@
 ******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "smalloc.h"
 #include "rmalloc.h"
@@ -28,5 +29,5 @@
 *  Global data
 ******************************************************************************/
-#ifndef RING0
+#if !defined(RING0) || defined(R3TST)
     char           fInited;       /* init flag */
 #endif
@@ -53,5 +54,5 @@
     if (rc != 0)
         return rc;
-    #ifdef RING3
+    #if !defined(RING0) || defined(R3TST)
         fInited = TRUE;
     #endif
@@ -69,4 +70,14 @@
 void * malloc(unsigned cbSize)
 {
+    #ifdef R3TST
+    if (!fInited)
+    {
+        PVOID pv;
+        if (!DosAllocMem(&pv, cbSize, PAG_WRITE | PAG_READ | PAG_COMMIT)) /* no SSToDS! */
+            return pv;
+        else
+            return NULL;
+    }
+    #endif
     return smalloc(cbSize);
 }
@@ -81,4 +92,8 @@
 void *realloc(void *pv, unsigned cbNew)
 {
+    #ifdef R3TST
+    if (!fInited)
+        Int3();
+    #endif
     return srealloc(pv, cbNew);
 }
@@ -91,4 +106,8 @@
 void free(void *pv)
 {
+    #ifdef R3TST
+    if (!fInited) /* controlled leak! */
+       return;
+    #endif
     sfree(pv);
 }
@@ -154,4 +173,5 @@
 
 
+
 #if !defined(RING0) && defined(__IBMC__)
 
@@ -162,5 +182,6 @@
 int _rmem_init(void)
 {
-    int rc = heapInit(CB_RES_INIT, CB_RES_MAX, CB_SWP_INIT, CB_SWP_MAX);
+    int rc;
+    rc = heapInit(CB_RES_INIT, CB_RES_MAX, CB_SWP_INIT, CB_SWP_MAX);
     return rc;
 }
Index: trunk/src/win32k/misc/new.cpp
===================================================================
--- trunk/src/win32k/misc/new.cpp	(revision 4152)
+++ trunk/src/win32k/misc/new.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: new.cpp,v 1.4 2000-01-27 23:46:57 bird Exp $
+/* $Id: new.cpp,v 1.5 2000-09-02 21:08:14 bird Exp $
  *
  * new - new and delete operators.
@@ -21,4 +21,5 @@
 #include <os2.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "new.h"
 #include "rmalloc.h"
Index: trunk/src/win32k/misc/rmalloc.c
===================================================================
--- trunk/src/win32k/misc/rmalloc.c	(revision 4152)
+++ trunk/src/win32k/misc/rmalloc.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: rmalloc.c,v 1.3 2000-01-24 01:45:20 bird Exp $
+/* $Id: rmalloc.c,v 1.4 2000-09-02 21:08:14 bird Exp $
  *
  * Resident Heap.
@@ -50,4 +50,5 @@
 ******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #ifdef RING0
     #include "dev32hlp.h"
Index: trunk/src/win32k/misc/rmalloc_avl.c
===================================================================
--- trunk/src/win32k/misc/rmalloc_avl.c	(revision 4152)
+++ trunk/src/win32k/misc/rmalloc_avl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: rmalloc_avl.c,v 1.5 2000-01-24 18:19:00 bird Exp $
+/* $Id: rmalloc_avl.c,v 1.6 2000-09-02 21:08:14 bird Exp $
  *
  * Resident Heap - AVL.
@@ -47,4 +47,5 @@
 ******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #ifdef RING0
     #include "dev32hlp.h"
@@ -120,5 +121,5 @@
 static PHEAPANCHOR  phaFirst;           /* Pointer to the first anchor block.*/
 static PHEAPANCHOR  phaLast;            /* Pointer to the last anchor block.*/
-static unsigned     cbResHeapMax;       /* Maximum amount of memory used by the heap. */
+unsigned            cbResHeapMax;       /* Maximum amount of memory used by the heap. */
 
 #ifndef RING0
@@ -898,4 +899,84 @@
 
 /**
+ * Get amount of used memory (in bytes)
+ * @returns  Amount of used memory (in bytes).
+ */
+unsigned    _res_memused(void)
+{
+    PHEAPANCHOR pha = phaFirst;
+    unsigned    cb;
+
+    #ifdef ALLWAYS_HEAPCHECK
+    if (!_res_heap_check())
+        kprintf(("_res_memused: _res_heap_check failed!\n"));
+    #endif
+
+    for (cb = 0; pha != NULL; pha = pha->pNext)
+        cb += pha->cbUsed;
+
+    return cb;
+}
+
+
+/**
+ * Collects the heap state.
+ * @returns     0 on success.
+ *              -1 on error.
+ * @param       pState  Pointer to a RES_HEAPSTATE structure which is
+ *                      filled upon successful return.
+ */
+int         _res_state(PHEAPSTATE pState)
+{
+    PHEAPANCHOR pha;
+
+    #ifdef ALLWAYS_HEAPCHECK
+    if (!_res_heap_check())
+    {
+        kprintf(("_res_state: _res_heap_check failed!\n"));
+        return -1;
+    }
+    #endif
+
+    if (pState == NULL)
+        return -1;
+
+    /*
+     * Loop thru all the anchor blocks and all memory blocks
+     * building the stats.
+     */
+    memset(pState, 0, sizeof(HEAPSTATE));
+    for (pha = phaFirst; pha != NULL; pha = pha->pNext)
+    {
+        AVLENUMDATA     EnumData;
+        PAVLENUMDATA    pEnumData = SSToDS(&EnumData);
+        PMEMBLOCK       pmb;
+
+        /* count of free blocks */
+        pmb = (PMEMBLOCK)AVLBeginEnumTree((PPAVLNODECORE)&pha->pmbFree, pEnumData, TRUE);
+        while (pmb)
+        {
+            pState->cBlocksFree++;
+            pmb = (PMEMBLOCK)AVLGetNextNode(pEnumData);
+        }
+
+        /* count of used blocks */
+        pmb = (PMEMBLOCK)AVLBeginEnumTree((PPAVLNODECORE)&pha->pmbUsed, pEnumData, TRUE);
+        while (pmb)
+        {
+            pState->cBlocksUsed++;
+            pmb = (PMEMBLOCK)AVLGetNextNode(pEnumData);
+        }
+
+        /* sizes */
+        pState->cbHeapSize  += pha->cbSize;
+        pState->cbHeapFree  += pha->cbFree;
+        pState->cbHeapUsed  += pha->cbUsed;
+    }
+
+    return 0;
+}
+
+
+/**
  * Checks heap integrety.
  * @returns  TRUE  when ok.
Index: trunk/src/win32k/misc/smalloc_avl.c
===================================================================
--- trunk/src/win32k/misc/smalloc_avl.c	(revision 4152)
+++ trunk/src/win32k/misc/smalloc_avl.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: smalloc_avl.c,v 1.3 2000-01-24 18:19:00 bird Exp $
+/* $Id: smalloc_avl.c,v 1.4 2000-09-02 21:08:15 bird Exp $
  *
  * Swappable Heap - AVL.
@@ -59,4 +59,5 @@
 ******************************************************************************/
 #include <os2.h>
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #ifdef RING0
     #include "dev32hlp.h"
@@ -140,6 +141,6 @@
 static PHEAPANCHOR  phaFirst;           /* Pointer to the first anchor block.*/
 static PHEAPANCHOR  phaLast;            /* Pointer to the last anchor block.*/
-static unsigned     cbSwpHeapMax;       /* Maximum amount of memory used by the heap. */
-static PMEMBLOCKCHUNK pmcFirst;          /* Pointer to the first memblock chunk. */
+unsigned            cbSwpHeapMax;       /* Maximum amount of memory used by the heap. */
+static PMEMBLOCKCHUNK pmcFirst;         /* Pointer to the first memblock chunk. */
 
 #ifndef RING0
@@ -1066,4 +1067,84 @@
 
     return cb;
+}
+
+
+/**
+ * Get amount of used memory (in bytes)
+ * @returns  Amount of used memory (in bytes).
+ */
+unsigned    _swp_memused(void)
+{
+    PHEAPANCHOR pha = phaFirst;
+    unsigned    cb;
+
+    #ifdef ALLWAYS_HEAPCHECK
+    if (!_swp_heap_check())
+        kprintf(("_swp_memused: _swp_heap_check failed!\n"));
+    #endif
+
+    for (cb = 0; pha != NULL; pha = pha->pNext)
+        cb += pha->cbUsed;
+
+    return cb;
+}
+
+
+/**
+ * Collects the heap state.
+ * @returns     0 on success.
+ *              -1 on error.
+ * @param       pState  Pointer to a HEAPSTATE structure which is
+ *                      filled upon successful return.
+ */
+int         _swp_state(PHEAPSTATE pState)
+{
+    PHEAPANCHOR pha;
+
+    #ifdef ALLWAYS_HEAPCHECK
+    if (!_res_heap_check())
+    {
+        kprintf(("_res_state: _res_heap_check failed!\n"));
+        return -1;
+    }
+    #endif
+
+    if (pState == NULL)
+        return -1;
+
+    /*
+     * Loop thru all the anchor blocks and all memory blocks
+     * building the stats.
+     */
+    memset(pState, 0, sizeof(HEAPSTATE));
+    for (pha = phaFirst; pha != NULL; pha = pha->pNext)
+    {
+        AVLENUMDATA     EnumData;
+        PAVLENUMDATA    pEnumData = SSToDS(&EnumData);
+        PMEMBLOCK       pmb;
+
+        /* count of free blocks */
+        pmb = (PMEMBLOCK)AVLBeginEnumTree((PPAVLNODECORE)&pha->pcoreFree, pEnumData, TRUE);
+        while (pmb)
+        {
+            pState->cBlocksFree++;
+            pmb = (PMEMBLOCK)AVLGetNextNode(pEnumData);
+        }
+
+        /* count of used blocks */
+        pmb = (PMEMBLOCK)AVLBeginEnumTree((PPAVLNODECORE)&pha->pcoreUsed, pEnumData, TRUE);
+        while (pmb)
+        {
+            pState->cBlocksUsed++;
+            pmb = (PMEMBLOCK)AVLGetNextNode(pEnumData);
+        }
+
+        /* sizes */
+        pState->cbHeapSize  += pha->cbSize;
+        pState->cbHeapFree  += pha->cbFree;
+        pState->cbHeapUsed  += pha->cbUsed;
+    }
+
+    return 0;
 }
 
Index: trunk/src/win32k/misc/vprintf.c
===================================================================
--- trunk/src/win32k/misc/vprintf.c	(revision 4152)
+++ trunk/src/win32k/misc/vprintf.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: vprintf.c,v 1.7 2000-01-22 18:21:03 bird Exp $
+/* $Id: vprintf.c,v 1.8 2000-09-02 21:08:15 bird Exp $
  *
  * vprintf and printf
@@ -25,5 +25,13 @@
 
 
-#ifdef RING0
+
+#if defined(RING0) && !defined(R3TST)
+    #define COMOUTPUT
+#endif
+#if !defined(RING0) || defined(R3TST)
+    #define DOSWRITEOUTPUT
+#endif
+
+#ifndef DOSWRITEOUTPUT
     #define INCL_NOAPI
 #else
@@ -39,8 +47,11 @@
 #include <stdarg.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 #include "dev32.h"
 #include "vprintf.h"
+#ifdef COMOUTPUT
+    #include <builtin.h>
+#endif
 #ifdef RING0
-    #include <builtin.h>
     #include "options.h"
 #endif
@@ -222,5 +233,5 @@
 int vprintf(const char *pszFormat, va_list args)
 {
-    #ifdef RING0
+    #if defined(RING0) && !defined(R3TST)
     if (!options.fLogging)
         return 0;
@@ -239,7 +250,5 @@
 int vprintf2(const char *pszFormat, va_list args)
 {
-    #ifndef RING0
-        int cch = 0;
-    #endif
+    int cch = 0;
 
     while (*pszFormat != '\0')
@@ -247,11 +256,9 @@
         if (*pszFormat == '%')
         {
-            #ifndef RING0
-                if (cch > 0)
-                {
-                    strout((char*)(pszFormat - cch), cch);
-                    cch = 0;
-                }
-            #endif
+            if (cch > 0)
+            {
+                strout((char*)(pszFormat - cch), cch);
+                cch = 0;
+            }
 
             pszFormat++;  /* skip '%' */
@@ -396,20 +403,14 @@
         else
         {
-            #ifdef RING0
-                chout(*pszFormat++);
-            #else
-                cch++;
-                pszFormat++;
-            #endif
-        }
-    }
-
-    #ifndef RING0
-        if (cch > 0)
-        {
-            strout((char*)(pszFormat - cch), cch);
-            cch = 0;
-        }
-    #endif
+            cch++;
+            pszFormat++;
+        }
+    }
+
+    if (cch > 0)
+    {
+        strout((char*)(pszFormat - cch), cch);
+        cch = 0;
+    }
 
     return 0UL;
@@ -479,7 +480,7 @@
 static void chout(int ch)
 {
-    #ifndef RING0
-        ULONG ulWrote;
-    #endif
+#ifdef DOSWRITEOUTPUT
+    ULONG ulWrote;
+#endif
 
     if (ch != '\r')
@@ -487,22 +488,24 @@
         if (ch == '\n')
         {
-            #ifdef RING0
-                #pragma info(noeff)
-                while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
-                _outp(options.usCom, chReturn);             /* Put the char. */
-                #pragma info(restore)
-            #else
-                DosWrite(1, (void*)&chReturn, 1, &ulWrote);
-            #endif
-        }
-        #ifdef RING0
+        #ifdef COMOUTPUT
             #pragma info(noeff)
             while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
-            _outp(options.usCom, ch);                   /* Put the char. */
+            _outp(options.usCom, chReturn);             /* Put the char. */
             #pragma info(restore)
-            Yield();
-        #else
-            DosWrite(1, (void*)&ch, 1, &ulWrote);
         #endif
+        #ifdef DOSWRITEOUTPUT
+            DosWrite(1, (void*)&chReturn, 1, SSToDS(&ulWrote));
+        #endif
+        }
+    #ifdef COMOUTPUT
+        #pragma info(noeff)
+        while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
+        _outp(options.usCom, ch);                   /* Put the char. */
+        #pragma info(restore)
+        Yield();
+    #endif
+    #ifdef DOSWRITEOUTPUT
+        DosWrite(1, SSToDS(&ch), 1, SSToDS(&ulWrote));
+    #endif
     }
 }
@@ -529,22 +532,23 @@
 
         /* write string part */
-        #ifdef RING0
-            for (ul = 0; ul < cch; ul++)
-            {
-                #pragma info(noeff)
-                while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
-                _outp(options.usCom, psz[ul]);              /* Put the char. */
-                #pragma info(restore)
-            }
-        #else
-            DosWrite(1, (void*)psz, cch, &ul);
-        #endif
+    #ifdef COMOUTPUT
+        for (ul = 0; ul < cch; ul++)
+        {
+            #pragma info(noeff)
+            while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
+            _outp(options.usCom, psz[ul]);              /* Put the char. */
+            #pragma info(restore)
+        }
+    #endif
+    #ifdef DOSWRITEOUTPUT
+        DosWrite(1, psz, cch, SSToDS(&ul));
+    #endif
 
         /* cr and lf check + skip */
-        if (psz[cch] == '\n' || psz[cch] == '\r')
+        if (cch < cchMax && (psz[cch] == '\n' || psz[cch] == '\r'))
         {
             if (psz[cch] == '\n')
             {
-            #ifdef RING0
+            #ifdef COMOUTPUT
                 #pragma info(noeff)
                 while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
@@ -552,9 +556,10 @@
                 while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
                 _outp(options.usCom, chNewLine);            /* Put the char. */
-                cchYield ++;
+                cchYield++;
                 #pragma info(restore)
-            #else
-                DosWrite(1, (void*)&chReturn, 1, &ul);
-                DosWrite(1, (void*)&chNewLine, 1, &ul);
+            #endif
+            #ifdef DOSWRITEOUTPUT
+                DosWrite(1, (void*)&chReturn, 1, SSToDS(&ul));
+                DosWrite(1, (void*)&chNewLine, 1, SSToDS(&ul));
             #endif
 
Index: trunk/src/win32k/pe2lx/makefile
===================================================================
--- trunk/src/win32k/pe2lx/makefile	(revision 4152)
+++ trunk/src/win32k/pe2lx/makefile	(revision 4164)
@@ -1,4 +1,4 @@
 ##############################################################################
-# $Id: makefile,v 1.20 2000-03-08 09:22:21 bird Exp $
+# $Id: makefile,v 1.21 2000-09-02 21:08:16 bird Exp $
 #
 # PD-Win32 API
@@ -20,17 +20,16 @@
 OBJEXT          = pe_obj
 
-
 ##############################################################################
 # Tools and Flags Addjustments
 ##############################################################################
+OBJDIR     = $(WIN32KOBJ)
 CINCLUDES  = -I$(WIN32KINCLUDE)
 
 CFLAGS     = $(CINCLUDES) $(CFLAGS) -DRING3 -DPE2LX \
-             -Ge+ -Wall+ppt-ppc-inl-cnv-gnr-vft-gen-uni-ext- -Gm- -Gn- -Ti+ -Rn
+             -Ge+ -Gm- -Gn- -Ti+ -Rn -Wall+ppt-ppc-inl-cnv-gnr-vft-gen-uni-ext-
 CXXFLAGS   = $(CINCLUDES) $(CXXFLAGS) -DRING3 -DPE2LX \
-             -Ge+ -Wall+ppt-ppc-inl-cnv-gnr-vft- -Gm- -Gn- -Ti+ -Gx -Rn
+             -Ge+ -Gm- -Gn- -Ti+ -Rn -Gx -Wall+ppt-ppc-inl-cnv-gnr-vft-
 
-LD         = ilink
-LDFLAGS    = /nologo /NOI /A:16 /NOE /packcode /packdata /pmtype:vio /Stack:4096 \
+LD2FLAGS   = /nologo /NOI /A:16 /NOE /NOD /packcode /packdata /pmtype:vio /Stack:4096 \
 !ifdef DEBUG
 !ifndef NODEBUGINFO
@@ -85,25 +84,40 @@
 # Main targets.
 ##############################################################################
-TARGET   = pe2lx
+TARGET = pe2lx
 
-OBJS     =  $(OBJDIR)\pe2lx.$(OBJEXT)         \
-            $(OBJDIR)\pe2lxmain.$(OBJEXT)     \
-            $(OBJDIR)\modulebase.$(OBJEXT)    \
-            $(OBJDIR)\malloc.$(OBJEXT)        \
-            $(OBJDIR)\smalloc_avl.$(OBJEXT)   \
-            $(OBJDIR)\avl.$(OBJEXT)           \
-            $(OBJDIR)\rmalloc_avl.$(OBJEXT)   \
-            $(OBJDIR)\new.$(OBJEXT)           \
-            $(OBJDIR)\stricmp.$(OBJEXT)       \
-            $(OBJDIR)\vprintf.$(OBJEXT)
+OBJS =\
+$(OBJDIR)\pe2lx.$(OBJEXT)\
+$(OBJDIR)\pe2lxmain.$(OBJEXT)\
+$(OBJDIR)\modulebase.$(OBJEXT)\
+$(OBJDIR)\malloc.$(OBJEXT)\
+$(OBJDIR)\smalloc_avl.$(OBJEXT)\
+$(OBJDIR)\avl.$(OBJEXT)\
+$(OBJDIR)\rmalloc_avl.$(OBJEXT)\
+$(OBJDIR)\new.$(OBJEXT)\
+$(OBJDIR)\stricmp.$(OBJEXT)\
+$(OBJDIR)\vprintf.$(OBJEXT)
+
+LIBS =\
+!if "$(CCENV)" == "VAC36"
+    $(VACPATH)\lib\cpprni36.lib \
+!else
+    $(VACPATH)\lib\cppon30.lib  \
+!endif
 
 
-
-all:      $(OBJDIR) $(OBJDIR)\$(TARGET).exe
+all:    $(WIN32KBIN)\$(TARGET).exe
 
 
-$(OBJDIR)\$(TARGET).exe: $(OBJS)
+$(WIN32KBIN)\$(TARGET).exe: $(OBJS) makefile
     @echo linking $@
-    $(LD) $(LDFLAGS) /OUT:$@ /MAP:$*.map $**
+    $(LD2) @<<$(OBJDIR)\$(@B).lnk
+$(LD2FLAGS)
+/OUT:$@
+/MAP:$*.map
+$(OBJS: =^
+)
+$(LIBS)
+os2386.lib
+<<KEEP
     $(CP) $@ $(PDWIN32_BIN)
 
@@ -113,5 +127,6 @@
 ##############################################################################
 dep:
-    $(DEPEND) -obj$(OBJEXT) -o$$(OBJDIR) $(CINCLUDES) ..\misc\*.c* ..\include\*.h
+    $(DEPEND) -obj$(OBJEXT) -o$$(OBJDIR) $(CINCLUDES) \
+        *.c* ..\misc\*.c* ..\include\*.h
 
 
Index: trunk/src/win32k/pe2lx/pe2lx.cpp
===================================================================
--- trunk/src/win32k/pe2lx/pe2lx.cpp	(revision 4152)
+++ trunk/src/win32k/pe2lx/pe2lx.cpp	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: pe2lx.cpp,v 1.18 2000-02-27 02:18:10 bird Exp $
+/* $Id: pe2lx.cpp,v 1.19 2000-09-02 21:08:16 bird Exp $
  *
  * Pe2Lx class implementation. Ring 0 and Ring 3
@@ -81,4 +81,6 @@
 #include <exe386.h>                     /* OS/2 LX structs and definitions. */
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+
 #include "malloc.h"                     /* win32k malloc (resident). Not C library! */
 #include "smalloc.h"                    /* win32k swappable heap. */
@@ -95,4 +97,7 @@
 #ifdef RING0
     #include "ldrCalls.h"               /* ldr* calls. (ldrRead) */
+    #include "avl.h"                    /* AVL tree. (ldr.h need it) */
+    #include "ldr.h"                    /* ldr helpers. (ldrGetExePath) */
+    #include "env.h"                    /* Environment helpers. */
 #endif
 #include "modulebase.h"                 /* ModuleBase class definitions, ++. */
@@ -100,4 +105,5 @@
 #include <versionos2.h>                 /* Pe2Lx version. */
 #include "yield.h"                      /* Yield CPU. */
+#include "options.h"                    /* Win32k options. */
 
 
@@ -169,4 +175,9 @@
     {NULL,                                 NULL} /* end-of-list entry */
 };
+
+LONG            Pe2Lx::cLoadedModules;  /* Count of existing objects. Updated by constructor and destructor. */
+const char *    Pe2Lx::pszOdin32Path;   /* Odin32 base path (include a slash). */
+ULONG           Pe2Lx::cchOdin32Path;   /* Odin32 base path length. */
+SFN             Pe2Lx::sfnKernel32;     /* Odin32 Kernel32 filehandle. */
 
 
@@ -205,4 +216,5 @@
     LXHdr.e32_pagesize  = PAGESIZE;
     LXHdr.e32_objtab    = sizeof(LXHdr);
+    cLoadedModules++;
 }
 
@@ -277,4 +289,18 @@
     _res_heapmin();
     _swp_heapmin();
+
+    /*
+     * If no Pe2Lx objects left, then invalidate the Odin32Path.
+     *  We'll have to do this since we may (theoretically) not receive
+     *  a close on a kernel32 handle if loading failes before kernel32
+     *  is loaded and the odin32path is determined using ldrOpenPath.
+     *  (Ie. no sfnKernel32.)
+     */
+    if (--cLoadedModules <= 0)
+        invalidateOdin32Path();
+#ifdef DEBUG
+    if (cLoadedModules < 0)
+        printIPE(("Pe2Lx::cLoadedModules is %d which is less that zero!\n", cLoadedModules));
+#endif
 }
 
@@ -457,8 +483,10 @@
         dumpSectionHeader(&paSections[i]);
 
-        /* 8a. Convert characteristics to flags */
+        /* 8a. Convert characteristics to flags and check/fix incompatible flags! */
         for (j = 0; j < (sizeof(paSecChars2Flags)/sizeof(paSecChars2Flags[0])); j++)
             if ((paSections[i].Characteristics & paSecChars2Flags[j].Characteristics) == paSecChars2Flags[j].Characteristics)
                 flFlags |= paSecChars2Flags[j].flFlags;
+        if ((flFlags & (OBJEXEC | OBJWRITE)) == (OBJEXEC | OBJWRITE))
+            flFlags &= (ULONG)~OBJEXEC;
 
         /* 8b. Virtual/physical size */
@@ -529,4 +557,5 @@
     /* 11.Align section. (Fix which is applied to EXEs/Dlls which contain no fixups and has an
      *    alignment which is not a multiple of 64Kb. The sections are concatenated into one big object. */
+    /* TODO! this test has to be enhanced a bit. WWPack32, new Borland++ depends on image layout. */
     fAllInOneObject = (pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) == IMAGE_FILE_RELOCS_STRIPPED;
     if (fAllInOneObject)
@@ -657,6 +686,8 @@
     Yield();
     _res_heapmin();
-    #if 0 /* testing */
+    #ifndef RING0
+    #if 1 /* testing */
     testApplyFixups();
+    #endif
     #endif
 
@@ -670,5 +701,5 @@
  * @param     pvBuffer   Pointer to buffer where data is to be put.
  * @param     cbToRead   Bytes to be read.
- * @param     flFlag     Flags which was spesified to the ldrRead call.
+ * @param     fpBuffer   Flags which was spesified to the ldrRead call.
  * @parma     pMTE       Pointer to MTE which was specified to the ldrRead call.
  * @return    NO_ERROR if successful something else if not.
@@ -676,5 +707,5 @@
  * @author    knut st. osmundsen
  */
-ULONG Pe2Lx::read(ULONG offLXFile, PVOID pvBuffer, ULONG cbToRead, ULONG flFlags, PMTE pMTE)
+ULONG Pe2Lx::read(ULONG offLXFile, PVOID pvBuffer, ULONG fpBuffer, ULONG cbToRead, PMTE pMTE)
 {
     APIRET rc = NO_ERROR;   /* Return code. */
@@ -696,5 +727,5 @@
     #endif
 
-    printInf(("read(%d, 0x%08x, %d, 0x%08x)\n", offLXFile, pvBuffer, cbToRead, flFlags));
+    printInf(("Pe2Lx::read(%d, 0x%08x, 0x%08x, %d)\n", offLXFile, pvBuffer, fpBuffer, cbToRead));
 
     /* Could we skip right to the datapages? */
@@ -931,5 +962,5 @@
             /* calc PE offset and size of read. */
             cbReadVar = min(paObjects[iObj].cbPhysical - offObject, cbToRead);
-            rc = ReadAtF(hFile, offPEFile, pvBuffer, cbReadVar, flFlags, pMTE);
+            rc = ReadAtF(hFile, offPEFile, pvBuffer, fpBuffer, cbReadVar, pMTE);
         }
         else
@@ -938,5 +969,5 @@
             {   /* before TIBFix code. */
                 cbReadVar = min(paObjects[iObj].Misc.offTIBFix - offObject, cbToRead);
-                rc = ReadAtF(hFile, offPEFile, pvBuffer, cbReadVar, flFlags, pMTE);
+                rc = ReadAtF(hFile, offPEFile, pvBuffer, fpBuffer, cbReadVar, pMTE);
             }
             else
@@ -959,5 +990,5 @@
     }
 
-    NOREF(flFlags);
+    NOREF(fpBuffer);
     NOREF(pMTE);
     return rc;
@@ -1077,4 +1108,5 @@
 
         while ((unsigned)pbr - (unsigned)pBaseRelocs + 8 < cbBaseRelocs /* 8= VirtualAddress and SizeOfBlock members */
+               && pbr->SizeOfBlock >= 8
                && pbr->VirtualAddress < ulRVAPage + PAGESIZE)
         {
@@ -1281,4 +1313,293 @@
 
 
+/**
+ * openPath - opens file eventually searching loader specific paths.
+ * This method is only called for DLLs. (DosLoadModule and Imports.)
+ *
+ *
+ * @returns   OS2 return code.
+ *            pLdrLv->lv_sfn  is set to filename handle.
+ * @param     pachFilename  Pointer to filename. Not zero terminated!
+ * @param     cchFilename   Filename length.
+ * @param     pLdrLv        Loader local variables? (Struct from KERNEL.SDF)
+ * @param     pful          Pointer to flags which are passed on to ldrOpen.
+ * @sketch
+ * This is roughly what the original ldrOpenPath does:
+ *      if !CLASS_GLOBAL or miniifs then
+ *          ldrOpen(pachModName)
+ *      else
+ *          loop until no more libpath elements
+ *              get next libpath element and add it to the modname.
+ *              try open the modname
+ *              if successfull then break the loop.
+ *          endloop
+ *      endif
+ */
+ULONG  Pe2Lx::openPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *pLdrLv, PULONG pful) /* (ldrOpenPath) */
+{
+    #ifdef RING0
+
+    /*
+     * Mark the SFN invalid in the case of error.
+     * Initiate the Odin32 Path static variable and call worker.
+     */
+    return openPath2(pachFilename, cchFilename, pLdrLv, pful, initOdin32Path());
+
+    #else
+    NOREF(pachFilename);
+    NOREF(cchFilename);
+    NOREF(pLdrLv);
+    NOREF(pful);
+    return ERROR_NOT_SUPPORTED;
+    #endif
+}
+
+
+/**
+ * openPath2 - Worker for openPath which is also used by initOdin32Path.
+ *
+ * @returns   OS2 return code.
+ *            pLdrLv->lv_sfn  is set to filename handle.
+ * @param     pachFilename      Pointer to filename. Not zero terminated!
+ * @param     cchFilename       Filename length.
+ * @param     pLdrLv            Loader local variables? (Struct from KERNEL.SDF)
+ * @param     pful              Pointer to flags which are passed on to ldrOpen.
+ * @param     fOdin32PathValid  Flag indicating that the pszOdin32Path is valid or not.
+ * @sketch
+ * This is roughly what the original ldrOpenPath does:
+ *      if !CLASS_GLOBAL or miniifs then
+ *          ldrOpen(pachModName)
+ *      else
+ *          loop until no more libpath elements
+ *              get next libpath element and add it to the modname.
+ *              try open the modname
+ *              if successfull then break the loop.
+ *          endloop
+ *      endif
+ * @remark      cchFilename has to be ULONG due to an optimization bug in VA 3.08.
+ *              (cchFilename should have been USHORT. But, then the compiler would
+ *               treat it as an ULONG.)
+ */
+ULONG  Pe2Lx::openPath2(PCHAR pachFilename, ULONG cchFilename, ldrlv_t *pLdrLv, PULONG pful, BOOL fOdin32PathValid)
+{
+    #ifdef RING0
+
+    APIRET  rc;                         /* Returncode. */
+    ULONG   cchExt;                     /* Count of chars in additional extention. (0 if extention exists.) */
+
+    /* These defines sets the order the paths and pathlists are examined. */
+    #define FINDDLL_EXECUTABLEDIR   1
+    #define FINDDLL_CURRENTDIR      2
+    #define FINDDLL_SYSTEM32DIR     3
+    #define FINDDLL_SYSTEM16DIR     4
+    #define FINDDLL_WINDIR          5
+    #define FINDDLL_PATH            6
+    #define FINDDLL_BEGINLIBPATH    7   /* uses ldrOpenPath */
+    #define FINDDLL_LIBPATH         8   /* uses ldrOpenPath */
+    #define FINDDLL_ENDLIBPATH      9   /* uses ldrOpenPath */
+    #define FINDDLL_FIRST           FINDDLL_EXECUTABLEDIR
+    #define FINDDLL_LAST            FINDDLL_PATH
+
+    struct _LocalVars
+    {
+        char    sz[CCHMAXPATH];
+        char    szPath[CCHMAXPATH];
+    } *pVars;
+
+
+    /** @sketch
+     * Mark the SFN invalid in the case of error.
+     * Allocate memory for local variables.
+     * Check for extention.
+     */
+    pLdrLv->lv_sfn = 0xffff;
+    pVars = (struct _LocalVars*)rmalloc(sizeof(struct _LocalVars));
+    if (pVars == NULL)
+        return ERROR_NOT_ENOUGH_MEMORY;
+
+    cchExt = cchFilename - 1;
+    while (cchExt != 0 && pachFilename[cchExt] != '.')
+        cchExt--;
+    cchExt = cchExt != 0 ? 0 : 4;
+
+
+    /** @sketch
+     * Loop thru the paths and pathlists searching them for the filename.
+     */
+    for (int iPath = FINDDLL_FIRST; iPath <= FINDDLL_LAST; iPath++)
+    {
+        char  * pszPath;                /* Pointer to the path being examined. */
+
+        /** @sketch
+         * Get the path/dir to examin. (This is determined by the value if iPath.)
+         */
+        switch (iPath)
+        {
+            case FINDDLL_EXECUTABLEDIR:
+                if ((pszPath = ldrGetExePath(pVars->szPath, TRUE)) == NULL)
+                    continue;
+                break;
+
+            case FINDDLL_CURRENTDIR:
+                pszPath = ".";
+                break;
+
+            case FINDDLL_SYSTEM32DIR:
+                if (!fOdin32PathValid)
+                    continue;
+                pszPath = pVars->szPath;
+                strcpy(pszPath, pszOdin32Path);
+                strcpy(pszPath + cchOdin32Path, "System32");
+                break;
+
+            case FINDDLL_SYSTEM16DIR:
+                if (!fOdin32PathValid)
+                    continue;
+                pszPath = pVars->szPath;
+                strcpy(pszPath, pszOdin32Path);
+                strcpy(pszPath + cchOdin32Path, "System");
+                break;
+
+            case FINDDLL_WINDIR:
+                if (!fOdin32PathValid)
+                    continue;
+                pszPath = pVars->szPath;
+                strcpy(pszPath, pszOdin32Path);
+                pszPath[cchOdin32Path - 1] = '\0'; /* remove slash */
+                break;
+
+            case FINDDLL_PATH:
+                pszPath = (char*)GetEnv(TRUE);
+                if (pszPath == NULL)
+                    continue;
+                pszPath = (char*)ScanEnv(pszPath, "PATH");
+                break;
+
+            #if 0
+            case FINDDLL_BEGINLIBPATH:
+                pszPath = ptda_GetBeginLibpath()...  ;
+                if (pszPath == NULL)
+                    continue;
+                break;
+
+            case FINDDLL_LIBPATH:
+                pszPath = *pLdrLibPath;
+                break;
+
+            case FINDDLL_ENDLIBPATH:
+                pszPath = ptda_GetEndLibpath()...  ;
+                if (pszPath == NULL)
+                    continue;
+                break;
+            #endif
+            default: /* !internalerror! */
+                printIPE(("Pe2Lx::openPath(%.*s,..): iPath is %d which is invalid.\n", cchFilename, pachFilename, iPath));
+                rfree(pVars);
+                return ERROR_FILE_NOT_FOUND;
+        }
+
+
+        /** @sketch
+         * pszPath is now set to the pathlist to be searched.
+         * So we'll loop thru all the paths in the list.
+         */
+        while (pszPath != NULL && *pszPath != '\0')
+        {
+            char *  pszNext;            /* Pointer to the next pathlist path */
+            int     cch;                /* Length of path (including the slash after the slash is added). */
+
+            /** @sketch
+             * Find the end of the path and set pszNext.
+             * Uncount any trailing slash.
+             * Check that the filename fits within the buffer (and OS/2 filelength limits).
+             */
+            pszNext = strchr(pszPath, ';');
+            if (pszNext != NULL)
+            {
+                cch = pszNext - pszPath;
+                pszNext++;
+            }
+            else
+                cch = strlen(pszPath);
+
+            if (pszPath[cch - 1] == '\\' || pszPath[cch-1] == '/')
+                cch--;
+
+            if (cch == 0 || cch + cchFilename + 2 + cchExt > sizeof(pVars->sz)) /* assertion */
+            {
+                printErr(("Pe2Lx::openPath(%.*s,..): cch (%d) + cchFilename (%d) + 2 + cchExt (%d) > sizeof(pVars->sz) (%d) - path's too long!, iPath=%d",
+                          cchFilename, pachFilename, cch, cchExt, cchFilename, sizeof(pVars->sz), iPath));
+
+                pszPath = pszNext;
+                continue;
+            }
+
+
+            /** @sketch
+             * Copy the path into the pVars->sz buffer.
+             * Add a '\\' and the filename (pszFullname) to the path;
+             * then we'll have a fullpath.
+             */
+            memcpy(pVars->sz, pszPath, cch);
+            pVars->sz[cch++] = '\\';
+            memcpy(&pVars->sz[cch], pachFilename, (size_t)cchFilename);
+            if (cchExt != 0)
+                memcpy(&pVars->sz[cch + cchFilename], ".DLL", 5);
+            else
+                pVars->sz[cch + cchFilename] = '\0';
+
+
+            /** @sketch
+             * Try open the file using myLdrOpen.
+             * Return if successfully opened or if fatal error.
+             */
+            rc = myldrOpen(&pLdrLv->lv_sfn, pVars->sz, pful);
+            switch (rc)
+            {
+                /* these errors are ignored (not fatal) */
+                case ERROR_FILE_NOT_FOUND:          case ERROR_PATH_NOT_FOUND:          case ERROR_ACCESS_DENIED:           case ERROR_INVALID_ACCESS:
+                case ERROR_INVALID_DRIVE:           case ERROR_NOT_DOS_DISK:            case ERROR_REM_NOT_LIST:            case ERROR_BAD_NETPATH:
+                case ERROR_NETWORK_BUSY:            case ERROR_DEV_NOT_EXIST:           case ERROR_TOO_MANY_CMDS:           case ERROR_ADAP_HDW_ERR:
+                case ERROR_UNEXP_NET_ERR:           case ERROR_BAD_REM_ADAP:            case ERROR_NETNAME_DELETED:         case ERROR_BAD_DEV_TYPE:
+                case ERROR_NETWORK_ACCESS_DENIED:   case ERROR_BAD_NET_NAME:            case ERROR_TOO_MANY_SESS:           case ERROR_REQ_NOT_ACCEP:
+                case ERROR_INVALID_PASSWORD:        case ERROR_OPEN_FAILED:             case ERROR_INVALID_NAME:            case ERROR_FILENAME_EXCED_RANGE:
+                case ERROR_VC_DISCONNECTED:
+                    rc = ERROR_FILE_NOT_FOUND;
+                    pszPath = pszNext;
+                    break;
+
+                /* all errors and success is let out here */
+                case NO_ERROR:
+                default:
+                    rfree(pVars);
+                    return rc;
+            }
+
+            /** @sketch
+             * Advance to the next path part
+             */
+            pszPath = pszNext;
+        }
+    } /* for iPath */
+
+
+    /*
+     * Cleanup: free local variables.
+     * Since we haven't found the file yet we'll return thru ldrOpenPath.
+     */
+    rfree(pVars);
+    return ldrOpenPath(pachFilename, (USHORT)cchFilename, pLdrLv, pful);
+
+    #else
+    NOREF(pachFilename);
+    NOREF(cchFilename);
+    NOREF(pLdrLv);
+    NOREF(pful);
+    NOREF(fOdin32PathValid);
+    return ERROR_NOT_SUPPORTED;
+    #endif
+}
+
+
 #ifndef RING0
 /**
@@ -1313,19 +1634,28 @@
     }
 
-    rc = readAtRVA(0x00000000, &achPage[0], PAGESIZE);
-    if (rc != NO_ERROR)
-    {
-        printErr(("readAtRVA failed with rc=%d\n"));
-        return rc;
-    }
-    rc = applyFixups(&mte, 0, ~0UL, &achPage[0], 0x125D0000, NULL);
-
-    rc = readAtRVA(0x00001000, &achPage[0], PAGESIZE);
-    if (rc != NO_ERROR)
-    {
-        printErr(("readAtRVA failed with rc=%d\n"));
-        return rc;
-    }
-    rc = applyFixups(&mte, 1, 1, &achPage[0], 0x125E0000, NULL);
+    /*
+     * Test load and apply all (internal) fixups.
+     */
+    for (i = 0; i < cObjects; i++)
+    {
+        ULONG ulAddress = smte.smte_objtab[i].ote_base;
+        ULONG ulRVA = paObjects[i].ulRVA;
+        LONG  cbObject = paObjects[i].cbVirtual;
+        for (i=i; cbObject > 0; cbObject -= PAGESIZE, ulAddress += PAGESIZE, ulRVA += PAGESIZE)
+        {
+            rc = readAtRVA(ulRVA, &achPage[0], PAGESIZE);
+            if (rc != NO_ERROR)
+            {
+                printErr(("readAtRVA failed with rc=%d\n"));
+                return rc;
+            }
+            rc = applyFixups(&mte, 1, 1, &achPage[0], ulAddress, NULL);
+            if (rc != NO_ERROR)
+            {
+                printErr(("applyFixups failed with rc=%d\n"));
+                return rc;
+            }
+        }
+    }
 
     return rc;
@@ -1381,5 +1711,5 @@
         {
             ULONG cbToRead = min(cbLXFile, sizeof(achReadBuffer));
-            rc = read(offLXFile, &achReadBuffer[0], cbToRead, 0UL, NULL);
+            rc = read(offLXFile, &achReadBuffer[0], 0UL, cbToRead, NULL);
             if (rc != NO_ERROR)
             {
@@ -1411,4 +1741,48 @@
 }
 #endif
+
+
+/**
+ * Is this module an executable?
+ * @returns   TRUE if executable.
+ *            FALSE if not an executable.
+ * @sketch
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+BOOL    Pe2Lx::isExe()
+{
+    return ((this->LXHdr.e32_mflags & E32MODMASK) == E32MODEXE);
+}
+
+
+/**
+ * Is this module an dynamic link library.
+ * @returns   TRUE if dynamic link library.
+ *            FALSE if not a dynamic link library.
+ * @sketch
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+BOOL    Pe2Lx::isDll()
+{
+    return ((this->LXHdr.e32_mflags & E32MODMASK) == E32MODDLL);
+}
+
+
+/**
+ * Invalidates the odin32path.
+ * Called by ldrClose when the kernel32 handle is closed.
+ * @sketch      Free path
+ *              nullify path pointer and kernel32 handle.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ */
+VOID Pe2Lx::invalidateOdin32Path()
+{
+    if (pszOdin32Path != NULL)
+    {
+        rfree((void*)pszOdin32Path);
+        pszOdin32Path = NULL;
+    }
+    sfnKernel32 = NULLHANDLE;
+}
 
 
@@ -2755,5 +3129,6 @@
             {
                 PIMAGE_BASE_RELOCATION pbrCur = pBaseRelocs;
-                while ((void*)pbrCur < (void*)((unsigned)pBaseRelocs + cbBaseRelocs))
+                while ((void*)pbrCur < (void*)((unsigned)pBaseRelocs + cbBaseRelocs)
+                       && pbrCur->SizeOfBlock >= 8)
                 {
                     if ((unsigned)pbrCur->SizeOfBlock + (unsigned)pbrCur > (unsigned)pBaseRelocs + cbBaseRelocs)
@@ -4332,4 +4707,149 @@
 
 
+
+/**
+ * Initiates the odin32path.
+ * @returns     Success indicator.
+ * @sketch      If allready inited ok Then do nothing return TRUE.
+ *
+ *              Check if KERNEL32 is loaded using ldrFindModule.
+ *              If loaded then set path according to the smte_path and return.
+ *
+ *              If the path is set to something then return TRUE. (ie. the following method is allready applied.)
+ *
+ *              Use odinPath2 to locate the KERNEL32 module in the LIBPATHs. The
+ *                win32k loaders are temporarily disabled. Path is returned in
+ *                the ldrpFileNameBuf buffer.
+ *              If found the Then set path according to ldrpFileNameBuf and return
+ *
+ *              Fail returning FALSE.
+ * @status
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark
+ */
+BOOL Pe2Lx::initOdin32Path()
+{
+    #ifdef RING0
+    APIRET rc;
+    PMTE   pMTE;
+
+
+    if (sfnKernel32 != NULLHANDLE)
+        return TRUE;
+
+    /*
+     * Try find it using ldrFindModule.
+     */
+    pMTE = NULL;
+    rc = ldrFindModule("KERNEL32", 8, CLASS_GLOBAL, (PPMTE)SSToDS(&pMTE));
+    if (rc == NO_ERROR && pMTE != NULL && pMTE->mte_swapmte != NULL)
+    {
+        /*
+         * We now take the smte_path. Start at the end and skip the filename,
+         * and one directory up. We assume a fully qualified path is found in
+         * smte_path.
+         */
+        if (pMTE->mte_swapmte->smte_path != NULL)//paranoia
+        {
+            sfnKernel32 = pMTE->mte_sfn;
+            return setOdin32Path(pMTE->mte_swapmte->smte_path);
+        }
+    }
+
+
+    /*
+     * KERNEL32 isn't loaded. We'll only search the paths if
+     */
+    if (pszOdin32Path != NULL)
+        return TRUE;
+
+
+    /*
+     * Try find it searching the LIBPATHs.
+     *
+     * For the time being:
+     *  We'll use odinPath2 to do this, but we'll have to
+     *  disable the win32k.sys overloading temporarily.
+     */
+    ldrlv_t lv = {0};
+    ULONG   ful = 0;
+    ULONG   ul;
+
+    ul = options.fNoLoader;
+    options.fNoLoader = TRUE;
+    lv.lv_class = CLASS_GLOBAL;
+    rc = openPath2("KERNEL32", 8, (ldrlv_t*)SSToDS(&lv), (PULONG)SSToDS(&ful), FALSE);
+    options.fNoLoader = ul;
+    if (rc == NO_ERROR)
+    {
+        /*
+         * Set the odin32path according to the kernel32 path we've found.
+         * (ldrOpen sets ldrpFileNameBuf to the fully qualified path of
+         *  the last opended filed, which in this case is kernel32.dll.)
+         * We'll close the file handle first of course.
+         */
+        rc = setOdin32Path(ldrpFileNameBuf);
+        ldrClose(lv.lv_sfn);
+        return rc;
+    }
+
+    #endif
+    return FALSE;
+}
+
+
+
+/**
+ * Sets the Odin32Path to the given fully qualified filename of kernel32.
+ * @returns     Success indicator.
+ * @param       psz     Fully qualified filename of kernel32 with path.
+ * @sketch
+ * @status
+ * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ * @remark
+ */
+BOOL Pe2Lx::setOdin32Path(const char *psz)
+{
+    const char * psz2;
+
+    /*
+     * We now take the psz. Start at the end and skip the filename,
+     * and one directory up. We assume a fully qualified path.
+     */
+    psz2 = psz + strlen(psz) - 1;
+    while (psz2 > psz && *psz2 != '\\' && *psz2 != '/' && *psz2 != ':')
+        psz2--;
+    psz2--;
+    while (psz2 > psz && *psz2 != '\\' && *psz2 != '/' && *psz2 != ':')
+        psz2--;
+    if (psz2 > psz)
+    {
+        char *pszPath;
+        /*
+         * Free old path (if any) and allocate space for a new path.
+         * Copy the path including the slash.
+         * Remember the kernel32 filehandle (to be able to invalidate the path).
+         */
+        if (pszOdin32Path)
+            rfree((void*)pszOdin32Path);
+        if (*psz2 == ':') //in case someone installed odin in a root directory.
+            psz2++;
+        psz2++;       //include the slash
+        cchOdin32Path = psz2 - psz;
+        pszPath = (char*)rmalloc((size_t)cchOdin32Path);
+        if (pszPath == NULL) return FALSE;
+        memcpy(pszPath, psz, (size_t)cchOdin32Path);
+        pszPath[cchOdin32Path] = '\0';
+        pszOdin32Path = pszPath;
+
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+
+
+
 /**
  * Static method which dumps a set of nt headers.
Index: trunk/src/win32k/test/TestKernels.cmd
===================================================================
--- trunk/src/win32k/test/TestKernels.cmd	(revision 4164)
+++ trunk/src/win32k/test/TestKernels.cmd	(revision 4164)
@@ -0,0 +1,131 @@
+/* $Id: TestKernels.cmd,v 1.2 2000-09-02 21:08:18 bird Exp $
+ *
+ * This script loops thru a set of different kernels running testcase 1.
+ * Note: The kernels and symbols files are in a single directory
+ *      Name format
+ *      nnnn[n]bk[.SYM]
+ *
+ *  nnnn[n]     Build number. (4 or 5 digits). (ex. 9036)
+ *  b           Build type: A - allstrict; H - halfstrict; R - retail (GA)
+ *  k           Kernel type: U - uniprocess; S - smp; 4 - warp 4 fixpack 13+
+ *  [.SYM]      Kernel files has no extention while the symbol files has .SYM.
+ */
+
+    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
+    call SysLoadFuncs;
+
+    parse arg sDir sdummy
+    if (sDir = '' | sDir = '-?' | sDir = '/?' | sDir = '-h' | sDir = '-H' | sDir  = '/h' | sDir = '/H' | sDir = '--help') then
+    do
+        call syntax;
+        exit -1;
+    end
+
+    /*
+     * Read directory
+     */
+    rc = SysFileTree(sDir'\*', 'asFiles', 'FO');
+    if (rc <> 0) then
+    do
+        say 'SysFileTree failed with rc='rc'.';
+        exit -2;
+    end
+    if (asFiles.0 <= 0) then
+    do
+        say 'No files found';
+        exit -3;
+    end
+
+    iRetCode = 0;
+    do i = 1 to asFiles.0
+        /*
+         * Interpret name (get build no., kernel type and build type).
+         */
+        sName = translate(filespec('name', asFiles.i));
+        if (lastpos('.', sName) > 0) then
+        do
+            sExt = substr(sName, lastpos('.', sName) + 1);
+            sName = substr(sName, 1, lastpos('.', sName) - 1);
+        end
+        else
+            sExt = '';
+
+        if (sExt <> '') then
+            iterate
+
+        iBuild = substr(sName, 1, length(sName) - 2);
+        chBuildType = substr(sName, length(sName) - 1, 1);
+        chKernelType = substr(sName, length(sName), 1);
+
+        /*
+         * Validate name.
+         */
+        do j = 1 to length(iBuild)
+            if (substr(iBuild, j, 1) < '0' | substr(iBuild, j, 1) > '9') then
+            do
+                j = -1;
+                leave;
+            end
+        end
+        if (j = -1) then
+            iterate;
+
+        if (chBuildType <> 'A' & chBuildType <> 'H' & chBuildType <> 'R') then
+        do
+            say 'invalid build type char:' chBuildType '('asFiles.i')';
+            exit -4;
+        end
+
+        if (chKernelType <> 'U' & chKernelType <> 'S' & chKernelType <> '4') then
+        do
+            say 'invalid kernel type char:' chKernelType '('asFiles.i')';
+            exit -4;
+        end
+
+        /*
+         * Determin version number (based on build number).
+         */
+        iVerMajor = 2;
+        if (iBuild >= 14000) then
+            iVerMinor = 45;
+        else if (iBuild >= 9000) then
+            iVerMinor = 40;
+        else if (iBuild >= 8000) then
+            iVerMinor = 30;
+        else if (iBuild >= 6200) then
+            iVerMinor = 21;
+        else
+        do
+            say 'unsupported build number:' iBuild '('asFiles.i')';
+            exit(-5);
+        end
+
+        /*
+         * Process it
+         */
+        say;
+        say;
+        say 'Processing' asFiles.i'....';
+        if (chBuildType = 'R') then
+            'win32ktst.exe 1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType;
+        else
+            'win32ktst.exe 1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType asFiles.i||'.SYM';
+        if (rc <> 0) then
+        do
+            say 'failed... rc='rc;
+            exit rc;
+        end
+
+    end
+
+    exit(0);
+
+
+
+
+/*
+ * Write syntax:
+ */
+syntax: procedure;
+    say 'TestKernels.cmd <kernel-directory>';
+    return;
Index: trunk/src/win32k/test/dos.c
===================================================================
--- trunk/src/win32k/test/dos.c	(revision 4152)
+++ trunk/src/win32k/test/dos.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: dos.c,v 1.1 2000-07-16 22:18:14 bird Exp $
+/* $Id: dos.c,v 1.2 2000-09-02 21:08:20 bird Exp $
  *
  * Thunkers for OS/2 APIs.
@@ -22,4 +22,6 @@
 *******************************************************************************/
 #include <os2.h>
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 
 #include "test.h"
Index: trunk/src/win32k/test/fake.c
===================================================================
--- trunk/src/win32k/test/fake.c	(revision 4152)
+++ trunk/src/win32k/test/fake.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: fake.c,v 1.1 2000-07-16 22:18:14 bird Exp $
+/* $Id: fake.c,v 1.2 2000-09-02 21:08:20 bird Exp $
  *
  * Fake stubs for the ldr and kernel functions we imports or overloads.
@@ -29,4 +29,6 @@
 #include <string.h>
 
+#include "devSegDf.h"                   /* Win32k segment definitions. */
+
 #include "log.h"
 #include "OS2Krnl.h"
@@ -60,9 +62,17 @@
  * Pointer to the loader semaphore.
  */
-static LONG     lfakeLDRSem = 0;        /* Used as a counter. */
-HKMTX           fakeLDRSem = (HKMTX)&lfakeLDRSem;
+KSEMMTX         fakeLDRSem;
+
+CHAR            szBeginLibPath[1024];
+CHAR            szEndLibPath[1024];
+CHAR            szLibPath[1024];
+PSZ             fakeLDRLibPath = &szLibPath[0];
+
+CHAR            szldrpFileNameBuf[CCHMAXPATH];
+PSZ             fakeldrpFileNameBuf = &szldrpFileNameBuf[0];
 
 static CHAR     achHeaderBuffer[256];   /* Buffer to read exe header into. */
 PVOID           pheaderbuf = &achHeaderBuffer[0];
+
 
 /*
@@ -112,4 +122,42 @@
 VOID  LDRCALL   fakeldrUCaseString(PCHAR pachString, USHORT cchString);
 ULONG LDRCALL   fakeldrMTEValidatePtrs(PSMTE psmte, ULONG ulMaxAddr, ULONG off);
+unsigned short  getSlot(void);
+
+
+
+/**
+ * Initiate workers (imported kernel functions / vars)
+ * @status    partially implemented.
+ * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+void  workersinit(void)
+{
+    APIRET rc;
+
+    /*
+     * Make code writable.
+     */
+    DosSetMem(&CODE16START, &CODE16END - &CODE16START, PAG_WRITE | PAG_READ);
+    DosSetMem(&CODE32START, &CODE32END - &CODE32START, PAG_WRITE | PAG_READ);
+
+    /*
+     * Loader semaphore
+     */
+    fakeKSEMInit((PKSEM)(void*)&fakeLDRSem, KSEM_MUTEX, KSEM_DEFAULT);
+
+    /*
+     * Intra process semaphore.
+     */
+    fakeKSEMInit((PKSEM)(void*)&fakeptda_ptdasem, KSEM_MUTEX, KSEM_DEFAULT);
+
+    /*
+     * LIBPaths
+     */
+    rc = DosQueryExtLIBPATH(szBeginLibPath, BEGIN_LIBPATH);
+    rc = DosQueryHeaderInfo(NULLHANDLE, 0, szLibPath, sizeof(szLibPath), QHINF_LIBPATH);
+    rc = DosQueryExtLIBPATH(szEndLibPath, END_LIBPATH);
+
+    rc = rc;
+}
 
 
@@ -169,4 +217,6 @@
         if (pfl != NULL)
             *pfl = 0;
+        rc = DosQueryPathInfo(pszFilename, FIL_QUERYFULLNAME, fakeldrpFileNameBuf, CCHMAXPATH);
+        rc = NO_ERROR;
     }
 
@@ -712,12 +762,5 @@
 ULONG LDRCALL fakeLDRClearSem(void)
 {
-    if (lfakeLDRSem == 0)
-        kprintf(("fakeLDRClearSem: lfakeLDRSem is 0 allready\n"));
-    else
-        lfakeLDRSem--;
-
-    printf("fakeLDRClearSem:                usage count = %d, rc = %d\n", lfakeLDRSem, NO_ERROR);
-
-    return NO_ERROR;
+    return fakeKSEMReleaseMutex(&fakeLDRSem);
 }
 
@@ -730,12 +773,154 @@
  * @remark
  */
-ULONG KRNLCALL fakeKSEMRequestMutex(HKMTX hkmtx, ULONG ulTimeout)
-{
-    (*(PLONG)hkmtx)++;
-
-    printf("fakeKSEMRequestMutex:           hkmtx = %p, ulTimeout = 0x%x, usage count = %d, rc = %d\n",
-           hkmtx, ulTimeout, *(PLONG)hkmtx, NO_ERROR);
-
-    return NO_ERROR;
+ULONG KRNLCALL fakeKSEMRequestMutex(HKSEMMTX hkmtx, ULONG ulTimeout)
+{
+    unsigned short usSlot = getSlot();
+    ULONG          rc = NO_ERROR;
+
+    if (memcmp(&hkmtx->debug.ksem_achSignature[0], "KSEM", 4) != 0)
+    {
+        printf("fakeKSEMQueryMutex:             hkmtx = %p, invalid signature (%.4s)\n", hkmtx, hkmtx->debug.ksem_achSignature);
+        return FALSE;
+    }
+
+    if (hkmtx->debug.ksem_Owner == 0)
+    {
+        hkmtx->debug.ksem_Owner = usSlot;
+        hkmtx->debug.ksem_cusNest = 1;
+    }
+    else if (hkmtx->debug.ksem_Owner == usSlot)
+        hkmtx->debug.ksem_cusNest++;
+    else
+        rc = ERROR_SEM_BUSY;
+
+    printf("fakeKSEMRequestMutex:           hkmtx = %p, ulTimeout = 0x%x, owner = %d, usage count = %d, rc = %d\n",
+           hkmtx, ulTimeout, hkmtx->debug.ksem_cusNest, hkmtx->debug.ksem_Owner, ERROR_SEM_BUSY);
+
+    return rc;
+}
+
+
+/**
+ * KSEMReleaseMutex faker.
+ * @returns   NO_ERROR
+ * @param     hkmtx
+ * @param     ulTimeout
+ * @status    completely implemented.
+ * @remark
+ */
+ULONG KRNLCALL fakeKSEMReleaseMutex(HKSEMMTX hkmtx)
+{
+    unsigned int    usSlot = getSlot();
+    int rc = NO_ERROR;
+
+    if (memcmp(&hkmtx->debug.ksem_achSignature[0], "KSEM", 4) != 0)
+    {
+        printf("fakeKSEMQueryMutex:             hkmtx = %p, invalid signature (%.4s)\n", hkmtx, hkmtx->debug.ksem_achSignature);
+        return FALSE;
+    }
+
+    if (hkmtx->debug.ksem_Owner == usSlot)
+    {
+        if (--hkmtx->debug.ksem_cusNest == 0)
+            hkmtx->debug.ksem_Owner = 0;
+    }
+    else
+        rc = ERROR_NOT_OWNER;
+
+    printf("fakeKSEMReleaseMutex:           hkmtx = %p, usage count = %d, owner = %d, rc = %d\n",
+           hkmtx, hkmtx->debug.ksem_cusNest, hkmtx->debug.ksem_Owner, rc);
+
+    return rc;
+}
+
+
+
+/**
+ * KSEMQueryMutex faker.
+ * @returns     TRUE if owner or clear. Clear if *pcusNest is 0.
+ *              FALSE if other owner.
+ * @param       hkmtx       Handle to kernel mutex.
+ * @param       pcusNest    Pointer to variable which is to receive the nesting count.
+ *                          (ie. the number of times we have taken this semaphore.)
+ * @status      completely implemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+BOOL KRNLCALL  fakeKSEMQueryMutex(HKSEMMTX hkmtx, PUSHORT pcusNest)
+{
+    unsigned int    usSlot = getSlot();
+    BOOL            fRc = TRUE;
+
+    if (memcmp(&hkmtx->debug.ksem_achSignature[0], "KSEM", 4) != 0)
+    {
+        printf("fakeKSEMQueryMutex:             hkmtx = %p, invalid signature (%.4s)\n", hkmtx, hkmtx->debug.ksem_achSignature);
+        return FALSE;
+    }
+
+    if (hkmtx->debug.ksem_Owner == 0)
+    {
+        if (pcusNest)
+            *pcusNest = 0;
+        fRc = FALSE;
+    }
+    else
+    {
+        fRc = (hkmtx->debug.ksem_Owner == usSlot);
+        if (pcusNest)
+            *pcusNest = hkmtx->debug.ksem_cusNest;
+    }
+
+    printf("fakeKSEMQueryMutex:             hkmtx = %p, usage count = %d, owner = %d, *pcusNest = %d, rc = %d\n",
+           hkmtx, hkmtx->debug.ksem_cusNest, hkmtx->debug.ksem_Owner, pcusNest ? *pcusNest : -1, fRc);
+
+    return fRc;
+}
+
+
+/**
+ * KSEMInit faker.
+ * @param       pksem       Pointer to the semaphore struct to initiate.
+ * @param       fulType     Semaphore type. (only KSEM_MUTEX is supported)
+ * @param       fulFlags    Semaphore flags. (not validated)
+ * @status      partially implemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+VOID  KRNLCALL  fakeKSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags)
+{
+    if (fulType != KSEM_MUTEX)
+    {
+        printf("fakeKSEMInit:                   Invalid fulType parameter (%d).\n", fulType);
+        return; /*ERROR_INVALID_PARAMETER;*/
+    }
+
+    memcpy(pksem->mtx.debug.ksem_achSignature, "KSEM", 4);
+    pksem->mtx.debug.ksem_bFlags = (char)fulFlags;
+    pksem->mtx.debug.ksem_bType = KSEM_MUTEX;
+    pksem->mtx.debug.ksem_cusNest = 0;
+    pksem->mtx.debug.ksem_cusPendingWriters = 0;
+    pksem->mtx.debug.ksem_Owner = 0;
+
+    printf("fakeKSEMInit:                   pksem=%p, fulType=%d, fulFlags=0x%x.\n", pksem, fulType, fulFlags);
+}
+
+
+/**
+ * Gets the thread slot number.
+ * @returns     Thread slot number.
+ * @status      completely implemented.
+ * @author      knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+unsigned short getSlot(void)
+{
+    PPIB ppib;
+    PTIB ptib;
+    BOOL            f32Stack = ((int)&ppib > 0x10000);
+
+    if (!f32Stack) ThunkStack16To32();
+
+    DosGetInfoBlocks(&ptib, &ppib);
+
+    if (!f32Stack) ThunkStack32To16();
+
+    return (unsigned short)ptib->tib_ordinal;
 }
 
@@ -863,4 +1048,13 @@
 
     printf("tkExecPgmWorker:                execFlag = %d, pArg = %p, pEnv = %p, pszFilename = %s\n", execFlag, pArg, pEnv, pszFilename);
+
+    /*
+     * Take loader semaphore.
+     */
+    rc = KSEMRequestMutex(&fakeLDRSem, KSEM_INDEFINITE_WAIT);
+    if (rc != NO_ERROR)
+    {
+        return rc;
+    }
 
     /*
@@ -1479,5 +1673,5 @@
          i++, psz += 1 + *psz)
     {
-        if (!memcmp(psz+1, "DOSCALLS", *psz))
+        if (*psz == 8 && !strnicmp(psz+1, "DOSCALLS", 8))
             continue;
 
@@ -1563,2 +1757,44 @@
 }
 
+
+PMTE KRNLCALL fakeldrASMpMTEFromHandle(HMTE  hMTE)
+{
+    PMTE pMte = (PMTE)hMTE;
+
+    pMte += 10; //just do something!
+
+    return NULL;
+}
+
+ULONG LDRCALL   fakeldrFindModule(PCHAR pachFilename, USHORT cchFilename, USHORT usClass, PPMTE ppMTE)
+{
+    APIRET rc = NO_ERROR;
+    usClass = usClass;
+    cchFilename = cchFilename;
+    pachFilename = pachFilename;
+    *ppMTE = NULL;
+    return rc;
+}
+
+
+/**
+ * Gets the path (name with fully qualified path) from a SFN.
+ * @returns     Pointer to the path of hFile.
+ * @param       hFile   SFN filehandle.
+ */
+PSZ SECCALL fakeSecPathFromSFN(SFN hFile)
+{
+    APIRET  rc;
+    BOOL    f32Stack = ((int)&hFile > 0x10000);
+
+    if (!f32Stack) ThunkStack16To32();
+
+    rc = ERROR_NOT_SUPPORTED;
+
+    if (!f32Stack) ThunkStack32To16();
+
+    printf("fakeSecPathFromSFN:                    - not implemented - hFile = 0x%04x, rc = %d\n", hFile, rc);
+
+    return rc;
+}
+
Index: trunk/src/win32k/test/fakea.asm
===================================================================
--- trunk/src/win32k/test/fakea.asm	(revision 4152)
+++ trunk/src/win32k/test/fakea.asm	(revision 4164)
@@ -1,3 +1,3 @@
-; $Id: fakea.asm,v 1.1 2000-07-16 22:18:15 bird Exp $
+; $Id: fakea.asm,v 1.2 2000-09-02 21:08:21 bird Exp $
 ;
 ; Fake assembly imports.
@@ -30,16 +30,22 @@
     public fakeptda_start
     public fakeptda_environ
+    public fakeptda_module
+    public fakeptda_ptdasem
+    public fakeptda_pBeginLIBPATH
     public fakef_FuStrLenZ
     public fakef_FuStrLen
     public fakef_FuBuff
     public fakeg_tkExecPgm
+    public fake_tkStartProcess
     public CalltkExecPgm
 
 
 ;
-;   Imported Functions
+;   Imported Functions and Variables.
 ;
     extrn tkExecPgmWorker:PROC          ; fake.c
-
+    extrn _fakeLDRClearSem@0:PROC       ; fake.c
+    extrn _fakeKSEMRequestMutex@8:PROC  ; fake.c
+    extrn fakeLDRSem:BYTE               ; fake.c
 
 DATA16 SEGMENT
@@ -56,4 +62,8 @@
 fakeptda_dummy              db  123 dup (0)
 fakeptda_environ            dw      1   ; 1 is the hardcoded HOB of the win32ktst.exe's environment.
+fakeptda_ptdasem            db  20  dup (0) ; PTDA semaphore - Intra-Process serialisation mutex KSEM (sg244640).
+fakeptda_module             dw      1   ; 1 is the hardcoded HMTE of the current executable module.
+fakeptda_pBeginLIBPATH      dd      0   ; BEGINLIBPATH not implemented.
+                            dd      0   ; ENDLIBPATH not implemented.
 
 
@@ -249,4 +259,34 @@
 
 CODE32 SEGMENT
+;;
+; Faker of which simply clears the loader semaphore.
+; @cproto    none! (void _Optlink   fake_tkStartProcess(void))
+; @returns
+; @param
+; @uses
+; @equiv
+; @time
+; @sketch
+; @status
+; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+; @remark
+fake_tkStartProcess PROC NEAR
+    push    ebp
+    mov     ebp, esp
+
+    push    ebx
+    push    ecx
+
+    call    _fakeLDRClearSem@0
+
+    pop     ecx
+    pop     ebx
+
+    xor     eax, eax
+    leave
+    ret
+fake_tkStartProcess ENDP
+
+
 ;;
 ; Fake g_tkExecPgm implementation.
@@ -270,5 +310,5 @@
 
     ;
-    ; We just have to make some common code...
+    ; Call C worker
     ;
     sub     esp, 10h
@@ -302,5 +342,15 @@
                                         ;     ebp+8, ebp+c, ebp+10, ebp+14
                                         ;     esp+0, esp+4, esp+08, esp+0c
-
+    or      eax, eax
+    jnz     ftkep_ret
+    call    fake_tkStartProcess         ; If succesfully so far. call start process.
+    jmp     ftkep_ret2                  ; <Currently no parameters are implemented.>
+
+ftkep_ret:
+    push    eax
+    call    _fakeLDRClearSem@0          ; clear the semaphore.
+    pop     eax
+
+ftkep_ret2:
     leave
     ret
Index: trunk/src/win32k/test/tst.sh
===================================================================
--- trunk/src/win32k/test/tst.sh	(revision 4164)
+++ trunk/src/win32k/test/tst.sh	(revision 4164)
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "ole"
Index: trunk/src/win32k/test/tst2.sh
===================================================================
--- trunk/src/win32k/test/tst2.sh	(revision 4164)
+++ trunk/src/win32k/test/tst2.sh	(revision 4164)
@@ -0,0 +1,2 @@
+#!/bin/sh -arg1 -arg2 -arg3
+echo "ole"
Index: trunk/src/win32k/test/win32ktst.c
===================================================================
--- trunk/src/win32k/test/win32ktst.c	(revision 4152)
+++ trunk/src/win32k/test/win32ktst.c	(revision 4164)
@@ -1,3 +1,3 @@
-/* $Id: win32ktst.c,v 1.1 2000-07-16 22:18:16 bird Exp $
+/* $Id: win32ktst.c,v 1.2 2000-09-02 21:08:21 bird Exp $
  *
  * Win32k test module.
@@ -26,8 +26,14 @@
     (PVOID)( ( (((unsigned)(flataddr) << 3) & 0xfff80000) | (SEL_LDT_RPL3 << 16) ) | ((unsigned)(flataddr) & 0xffff) )
 
+#define DWORD   ULONG
+#define WORD    USHORT
+
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
 #include <os2.h>
+#include <exe386.h>
+
+#include "devSegDf.h"                   /* Win32k segment definitions. */
 
 #include "malloc.h"
@@ -42,4 +48,6 @@
 #include "devcmd.h"
 #include "os2krnl.h"
+#include "avl.h"
+#include "ldr.h"
 #include "ldrCalls.h"
 #include "test.h"
@@ -47,4 +55,7 @@
 #include "macros.h"
 #include "log.h"
+
+
+
 
 
@@ -133,26 +144,123 @@
 
 /*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+#ifndef QS_MTE
+   /* From OS/2 Toolkit v4.5 (BSEDOS.H) */
+
+   /* Global Record structure
+    * Holds all global system information. Placed first in user buffer
+    */
+   typedef struct qsGrec_s {  /* qsGrec */
+           ULONG         cThrds;
+           ULONG         c32SSem;
+           ULONG         cMFTNodes;
+   }qsGrec_t;
+
+   /*
+    *      System wide MTE information
+    *      ________________________________
+    *      |       pNextRec                |----|
+    *      |-------------------------------|    |
+    *      |       hmte                    |    |
+    *      |-------------------------------|    |
+    *      |       ctImpMod                |    |
+    *      |-------------------------------|    |
+    *      |       ctObj                   |    |
+    *      |-------------------------------|    |
+    *      |       pObjInfo                |----|----------|
+    *      |-------------------------------|    |          |
+    *      |       pName                   |----|----|     |
+    *      |-------------------------------|    |    |     |
+    *      |       imported module handles |    |    |     |
+    *      |          .                    |    |    |     |
+    *      |          .                    |    |    |     |
+    *      |          .                    |    |    |     |
+    *      |-------------------------------| <--|----|     |
+    *      |       "pathname"              |    |          |
+    *      |-------------------------------| <--|----------|
+    *      |       Object records          |    |
+    *      |       (if requested)          |    |
+    *      |_______________________________|    |
+    *                                      <-----
+    *      NOTE that if the level bit is set to QS_MTE, the base Lib record will be followed
+    *      by a series of object records (qsLObj_t); one for each object of the
+    *      module.
+    */
+
+   typedef struct qsLObjrec_s {  /* qsLOrec */
+           ULONG         oaddr;  /* object address */
+           ULONG         osize;  /* object size */
+           ULONG         oflags; /* object flags */
+   } qsLObjrec_t;
+
+   typedef struct qsLrec_s {     /* qsLrec */
+           void  FAR        *pNextRec;      /* pointer to next record in buffer */
+           USHORT           hmte;           /* handle for this mte */
+           USHORT           fFlat;          /* true if 32 bit module */
+           ULONG            ctImpMod;       /* # of imported modules in table */
+           ULONG            ctObj;          /* # of objects in module (mte_objcnt)*/
+           qsLObjrec_t FAR  *pObjInfo;      /* pointer to per object info if any */
+           UCHAR     FAR    *pName;         /* -> name string following struc */
+   } qsLrec_t;
+
+
+
+   /* Pointer Record Structure
+    *      This structure is the first in the user buffer.
+    *      It contains pointers to heads of record types that are loaded
+    *      into the buffer.
+    */
+
+   typedef struct qsPtrRec_s {   /* qsPRec */
+           qsGrec_t        *pGlobalRec;
+           void            *pProcRec;      /* ptr to head of process records */
+           void            *p16SemRec;     /* ptr to head of 16 bit sem recds */
+           void            *p32SemRec;     /* ptr to head of 32 bit sem recds */
+           void            *pMemRec;       /* ptr to head of shared mem recs */
+           qsLrec_t        *pLibRec;       /* ptr to head of mte records */
+           void            *pShrMemRec;    /* ptr to head of shared mem records */
+           void            *pFSRec;        /* ptr to head of file sys records */
+   } qsPtrRec_t;
+
+#endif
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+extern BOOL     fInited;                /* malloc.c */
+int             cObjectsFake = 14;
+OTE             aKrnlOTE[24];
+
+
+/*******************************************************************************
+*   External Functions                                                         *
+*******************************************************************************/
+#ifndef QS_MTE
+   /* from OS/2 Toolkit v4.5 */
+
+   APIRET APIENTRY DosQuerySysState(ULONG EntityList, ULONG EntityLevel, PID pid,
+                                    TID tid, PVOID pDataBuf, ULONG cbBuf);
+    #define QS_MTE         0x0004
+#endif
+
+
+/*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
 void    syntax(void);
+int     kernelInit(int iTest, int argc, char **argv);
 void    workersinit(void);
 void    initRPInit(RP32INIT *pRpInit, char *pszInitArgs);
 int     tests(int iTest, int argc, char **argv);
-int     TestCase1(void);
+int     TestCase1(int argc, char **argv);
 int     TestCase2(void);
 int     TestCase3(void);
 int     TestCase4(void);
 int     TestCase5(void);
+int     TestCase6(void);
 int     CompareOptions(struct options *pOpt);
-int     TestCaseExeLoad1(void);
-
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-extern BOOL     fInited;                /* malloc.c */
-const char *    pszInternalRevision = "\r\nInternal revision 14.040_W4";
-int             cObjectsFake = 14;
-
+int     TestCaseExeLoad2(void);
 
 
@@ -186,4 +294,9 @@
     workersinit();
 
+    /*
+     * Init Kernel
+     */
+    if (!kernelInit(iTest, argc, argv))
+        return -2;
 
     /*
@@ -219,7 +332,7 @@
 {
     printf(
-        "Win32kTst.exe v%d.%d.%d - Ring 3 testing of win32k.sys\n"
-        "syntax: Win32kTst.exe <testcase number> [optional arguments]\n",
-        0,0,4
+           "Win32kTst.exe v%d.%d.%d - Ring 3 testing of win32k.sys\n"
+           "syntax: Win32kTst.exe <testcase number> [optional arguments]\n",
+           0,0,4
            );
 }
@@ -227,12 +340,201 @@
 
 /**
- * Initiate workers (imported kernel functions / vars)
- * @status    partially implemented.
- * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
- */
-void  workersinit(void)
+ * test case 1: Load the specified kernel
+ * other cases: Load running kernel.
+ * @returns Success indicator. (true/false)
+ * @param   iTest   Testcase number.
+ * @param   argc    main argc
+ * @param   argv    main argv
+ * @status  completely implemented.
+ * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
+ */
+int     kernelInit(int iTest, int argc, char **argv)
 {
-    DosSetMem(&CODE16START, &CODE16END - &CODE16START, PAG_WRITE | PAG_READ);
-    DosSetMem(&CODE32START, &CODE32END - &CODE32START, PAG_WRITE | PAG_READ);
+    static char     achBuffer[1024*256];
+    char            szError[256];
+    HMODULE         hmod = NULLHANDLE;
+    int             rc;
+    char            szName[CCHMAXPATH];
+    char *          pszSrcName;
+    char *          pszTmp;
+    ULONG           ulAction;
+    HFILE           hFile;
+    struct e32_exe* pe32 = (struct e32_exe*)(void*)&achBuffer[0];
+    qsPtrRec_t *    pPtrRec = (qsPtrRec_t*)(void*)&achBuffer[0];
+    qsLrec_t *      pLrec;
+    int             i;
+    FILESTATUS3     fsts3;
+
+    /*
+     * If not testcase 1, use the running kernel.
+     */
+    if (iTest != 1)
+    {
+        ULONG   ulBootDrv = 3;
+        pszSrcName = "c:\\os2krnl";
+        DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, SSToDS(&ulBootDrv), sizeof(ulBootDrv));
+        pszSrcName[0] = (char)(ulBootDrv + 'a' - 1);
+    }
+    else
+    {
+        if (argc < 3)
+        {
+            printf("Missing parameter!\n");
+            return FALSE;
+        }
+        pszSrcName = argv[2];
+    }
+
+    /*
+     * Make a temporary copy of the kernel.
+     */
+    if (DosScanEnv("TMP", &pszTmp) != NO_ERROR || pszTmp == NULL)
+    {
+        printf("Environment variable TMP is not set.\n");
+        return FALSE;
+    }
+    strcpy(szName, pszTmp);
+    if (szName[strlen(pszTmp) - 1] != '\\' && szName[strlen(pszTmp) - 1] != '/')
+        strcat(szName, "\\");
+    strcat(szName, "os2krnl");
+    rc = DosCopy(pszSrcName, szName, DCPY_EXISTING);
+    if (rc != NO_ERROR)
+    {
+        printf("Failed to copy %s to %s.\n", pszSrcName, szName);
+        return FALSE;
+    }
+    if (DosQueryPathInfo(szName, FIL_STANDARD, &fsts3, sizeof(fsts3)) != NO_ERROR
+        ||  !(fsts3.attrFile = FILE_ARCHIVED)
+        ||  DosSetPathInfo(szName, FIL_STANDARD, &fsts3, sizeof(fsts3), 0) != NO_ERROR
+        )
+    {
+        printf("Failed to set attributes for %s.\n", szName);
+        return FALSE;
+    }
+
+    /*
+     * Patch the kernel.
+     *      Remove the entrypoint.
+     */
+    ulAction = 0;
+    rc = DosOpen(szName, &hFile, &ulAction, 0, FILE_NORMAL,
+                 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
+                 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+                 NULL);
+    if (rc != NO_ERROR)
+    {
+        printf("Failed to open temporary kernel file. rc = %d\n", rc);
+        return FALSE;
+    }
+    rc = DosRead(hFile, &achBuffer[0], 0x200, &ulAction);
+    if (rc != NO_ERROR)
+    {
+        DosClose(hFile);
+        printf("Failed to read LX header from temporary kernel file.\n");
+        return FALSE;
+    }
+    pe32 = (struct e32_exe*)(void*)&achBuffer[*(unsigned long*)(void*)&achBuffer[0x3c]];
+    if (*(PUSHORT)pe32->e32_magic != E32MAGIC)
+    {
+        DosClose(hFile);
+        printf("Failed to read LX header from temporary kernel file (2).\n");
+        return FALSE;
+    }
+    pe32->e32_eip = 0;
+    pe32->e32_startobj = 0;
+    pe32->e32_mflags &= ~(E32LIBTERM | E32LIBINIT);
+    if ((rc = DosSetFilePtr(hFile, *(unsigned long*)(void*)&achBuffer[0x3c], FILE_BEGIN, &ulAction)) != NO_ERROR
+        || (rc = DosWrite(hFile, pe32, sizeof(struct e32_exe), &ulAction)) != NO_ERROR)
+    {
+        DosClose(hFile);
+        printf("Failed to write patched LX header to temporary kernel file.\n");
+        return FALSE;
+    }
+    DosClose(hFile);
+
+    /*
+     * Load the module.
+     */
+    rc = DosLoadModule(szError, sizeof(szError), szName, SSToDS(&hmod));
+    if (rc != NO_ERROR && (rc != ERROR_INVALID_PARAMETER && hmod == NULLHANDLE))
+    {
+        printf("Failed to load OS/2 kernel image %s.");
+        return FALSE;
+    }
+
+    /*
+     * Get object information.
+     */
+    rc = DosQuerySysState(QS_MTE, QS_MTE, 0L, 0L, pPtrRec, sizeof(achBuffer));
+    if (rc != NO_ERROR)
+    {
+        printf("DosQuerySysState failed with rc=%d.\n", rc);
+        return FALSE;
+    }
+
+    pLrec = pPtrRec->pLibRec;
+    while (pLrec != NULL)
+    {
+        /*
+         * Bug detected in OS/2 FP13. Probably a problem which occurs
+         * in _LDRSysMteInfo when qsCheckCache is calle before writing
+         * object info. The result is that the cache flushed and the
+         * attempt of updating the qsLrec_t next and object pointer is
+         * not done. This used to work earlier and on Aurora AFAIK.
+         *
+         * The fix for this problem is to check if the pObjInfo is NULL
+         * while the number of objects isn't 0 and correct this. pNextRec
+         * will also be NULL at this time. This will be have to corrected
+         * before we exit the loop or moves to the next record.
+         * There is also a nasty alignment of the object info... Hope
+         * I got it right. (This aligment seems new to FP13.)
+         */
+        if (pLrec->pObjInfo == NULL /*&& pLrec->pNextRec == NULL*/ && pLrec->ctObj > 0)
+            {
+            pLrec->pObjInfo = (qsLObjrec_t*)(void*)(
+                (char*)(void*)pLrec
+                + ((sizeof(qsLrec_t)                            /* size of the lib record */
+                   + pLrec->ctImpMod * sizeof(short)            /* size of the array of imported modules */
+                   + strlen((char*)(void*)pLrec->pName) + 1     /* size of the filename */
+                   + 3) & ~3));                                 /* the size is align on 4 bytes boundrary */
+            pLrec->pNextRec = (qsLrec_t*)(void*)((char*)(void*)pLrec->pObjInfo
+                                                 + sizeof(qsLObjrec_t) * pLrec->ctObj);
+            }
+        if (pLrec->hmte == hmod)
+            break;
+
+        /*
+         * Next record
+         */
+        pLrec = (qsLrec_t*)pLrec->pNextRec;
+    }
+
+    if (pLrec == NULL)
+    {
+        printf("DosQuerySysState(os2krnl): not found\n");
+        return FALSE;
+    }
+    if (pLrec->pObjInfo == NULL)
+    {
+        printf("DosQuerySysState(os2krnl): no object info\n");
+        return FALSE;
+    }
+
+    /*
+     * Fill the aKrnlOTE array.
+     */
+    for (i = 0; i < pLrec->ctObj; i++)
+    {
+        aKrnlOTE[i].ote_size    = pLrec->pObjInfo[i].osize;
+        aKrnlOTE[i].ote_base    = pLrec->pObjInfo[i].oaddr;
+        aKrnlOTE[i].ote_flags   = pLrec->pObjInfo[i].oflags;
+        aKrnlOTE[i].ote_pagemap = i > 0 ? aKrnlOTE[i-1].ote_pagemap + aKrnlOTE[i-1].ote_mapsize : 0;
+        aKrnlOTE[i].ote_mapsize = (pLrec->pObjInfo[i].osize + 0x0FFF) / 0x1000;
+        aKrnlOTE[i].ote_sel     = (USHORT)FlatToSel(pLrec->pObjInfo[i].oaddr);
+        aKrnlOTE[i].ote_hob     = 0;
+    }
+    cObjectsFake = pLrec->ctObj;
+
+    return TRUE;
 }
 
@@ -273,9 +575,7 @@
     switch (iTest)
     {
-        case 1:     rc = TestCase1();   break;
+        case 1:     rc = TestCase1(argc, argv);   break;
         case 2:     rc = TestCase2();   break;
         case 3:     rc = TestCase3();   break;
-        case 4:     rc = TestCase4();   break;
-        case 5:     rc = TestCase5();   break;
 
         default:
@@ -294,5 +594,7 @@
 /**
  * Test case 1.
- * Checks that default initiation works fine for Aurora SMP kernels.
+ * Checks that default initiation works fine for a given kernel.
+ *
+ * Syntax:  win32ktst.exe 1 <os2krnl> <majorver> <minorver> <build> <kerneltype: S|U|4> <buildtype: A|H|R> [os2krnl.sym]
  *
  * @sketch  Create init packet with no arguments.
@@ -305,17 +607,28 @@
  * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  */
-int TestCase1(void)
+int TestCase1(int argc, char **argv)
 {
+    static char szInitArgs[CCHMAXPATH + 10];
     int         rc = 1;
     RP32INIT    rpinit;
 
+    /* verify argument count */
+    if (argc < 8 || argc > 9)
+    {
+        printf("Invalid parameter count for testcase 1.\n");
+        return ERROR_INVALID_PARAMETER;
+    }
+
     /* init fake variabels */
-    pszInternalRevision ="\r\nInternal revision 14.040_SMP";
-    cObjectsFake = 15;
-    _usFakeVerMajor = 20;
-    _usFakeVerMinor = 45;
+    _usFakeVerMajor = (USHORT)atoi(argv[3]);
+    _usFakeVerMinor = (USHORT)atoi(argv[4]);
+
+    /* make init string */
+    strcpy(szInitArgs, "-w3");
+    if (argc >= 9)
+        strcat(strcat(szInitArgs, " -S:"), argv[8]);
 
     /* $elf */
-    initRPInit(SSToDS(&rpinit), "-w3");
+    initRPInit(SSToDS(&rpinit), szInitArgs);
     rc = InitElf(&rpinit);              /* no SSToDS! */
     printf("InitElf returned status=0x%04x\n", rpinit.rph.Status);
@@ -323,5 +636,5 @@
     {
         /* $win32k */
-        initRPInit(SSToDS(&rpinit), "-w3");
+        initRPInit(SSToDS(&rpinit), szInitArgs);
         rc = InitWin32k(&rpinit);       /* no SSToDS! */
         printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status);
@@ -329,15 +642,12 @@
         {
             struct options opt = DEFAULT_OPTION_ASSIGMENTS;
-            opt.fKernel = KF_SMP;
-            opt.ulBuild = 14040;
-            opt.usVerMajor = 20;
-            opt.usVerMinor = 45;
             opt.ulInfoLevel = 3;
+            opt.fKernel = (argv[6][0] == 'S' ? KF_SMP : (argv[6][0] == '4' ? KF_W4 | KF_UNI : KF_UNI))
+                            | (argv[7][0] == 'A' || argv[7][0] == 'H' ? KF_DEBUG : 0);
+            opt.ulBuild = atoi(argv[5]);
+            opt.usVerMajor = (USHORT)atoi(argv[3]);
+            opt.usVerMinor = (USHORT)atoi(argv[4]);
 
             rc = CompareOptions(SSToDS(&opt));
-            if (rc == NO_ERROR)
-            {
-                rc = TestCaseExeLoad1();
-            }
         }
         else
@@ -350,8 +660,7 @@
 }
 
-
 /**
  * Test case 2.
- * Checks that default initiation works fine for Aurora UNI kernels.
+ * Checks that all parameters are read correctly (1).
  *
  * @sketch  Create init packet with no arguments.
@@ -368,13 +677,10 @@
     int         rc = 1;
     RP32INIT    rpinit;
-
-    /* init fake variabels */
-    pszInternalRevision ="\r\nInternal revision 14.040_UNI";
-    cObjectsFake = 14;
-    _usFakeVerMajor = 20;
-    _usFakeVerMinor = 45;
+    char *      pszInitArgs = "-C1 -L:E -Verbose -Elf:Yes -Pe:Mixed -Script:Yes -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000";
+
+    options.fLogging = TRUE;
 
     /* $elf */
-    initRPInit(SSToDS(&rpinit), "");
+    initRPInit(SSToDS(&rpinit), pszInitArgs);
     rc = InitElf(&rpinit);              /* no SSToDS! */
     printf("InitElf returned status=0x%04x\n", rpinit.rph.Status);
@@ -382,5 +688,5 @@
     {
         /* $win32k */
-        initRPInit(SSToDS(&rpinit), "");
+        initRPInit(SSToDS(&rpinit), pszInitArgs);
         rc = InitWin32k(&rpinit);       /* no SSToDS! */
         printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status);
@@ -388,10 +694,21 @@
         {
             struct options opt = DEFAULT_OPTION_ASSIGMENTS;
-            opt.fKernel = KF_UNI;
-            opt.ulBuild = 14040;
-            opt.usVerMajor = 20;
-            opt.usVerMinor = 45;
+            opt.cbSwpHeapInit   = 512000;
+            opt.cbSwpHeapMax    = 4096000;
+            opt.cbResHeapInit   = 0256000;
+            opt.cbResHeapMax    = 0x100000;
+            opt.fElf            = TRUE;
+            opt.fUNIXScript     = TRUE;
+            opt.fPE             = FLAGS_PE_MIXED;
+            opt.fQuiet          = FALSE;
+            opt.fLogging        = TRUE;
+            opt.usCom           = OUTPUT_COM1;
+            opt.ulInfoLevel     = INFOLEVEL_INFOALL;
 
             rc = CompareOptions(SSToDS(&opt));
+            if (rc == NO_ERROR)
+            {
+                 rc = TestCaseExeLoad2();
+            }
         }
         else
@@ -404,8 +721,7 @@
 }
 
-
 /**
  * Test case 3.
- * Checks that default initiation works fine for Warp FP13 kernel.
+ * Checks that all parameters are read correctly (1).
  *
  * @sketch  Create init packet with no arguments.
@@ -422,119 +738,5 @@
     int         rc = 1;
     RP32INIT    rpinit;
-
-    /* init fake variabels */
-    pszInternalRevision ="\r\nInternal revision 14.040_W4";
-    cObjectsFake = 14;
-    _usFakeVerMajor = 20;
-    _usFakeVerMinor = 45;
-
-    /* $elf */
-    initRPInit(SSToDS(&rpinit), "");
-    rc = InitElf(&rpinit);              /* no SSToDS! */
-    printf("InitElf returned status=0x%04x\n", rpinit.rph.Status);
-    if ((rpinit.rph.Status & (STDON | STERR)) == STDON)
-    {
-        /* $win32k */
-        initRPInit(SSToDS(&rpinit), "");
-        rc = InitWin32k(&rpinit);       /* no SSToDS! */
-        printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status);
-        if ((rpinit.rph.Status & (STDON | STERR)) == STDON)
-        {
-            struct options opt = DEFAULT_OPTION_ASSIGMENTS;
-            opt.fKernel = KF_UNI | KF_W4;
-            opt.ulBuild = 14040;
-            opt.usVerMajor = 20;
-            opt.usVerMinor = 45;
-
-            rc = CompareOptions(SSToDS(&opt));
-        }
-        else
-            printf("!failed!\n");
-    }
-    else
-        printf("!failed!\n");
-
-    return rc;
-}
-
-
-/**
- * Test case 4.
- * Checks that default initiation works fine for Aurora SMP kernels.
- *
- * @sketch  Create init packet with no arguments.
- *          Initiate elf$
- *          Create init packet with no arguments.
- *          Initiate win32k$
- * @returns 0 on success.
- *          1 on failure.
- * @status  completely implemented.
- * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
- */
-int TestCase4(void)
-{
-    int         rc = 1;
-    RP32INIT    rpinit;
-
-    /* init fake variabels */
-    pszInternalRevision ="\r\nInternal revision 9.036";
-    cObjectsFake = 14;
-    _usFakeVerMajor = 20;
-    _usFakeVerMinor = 40;
-
-    /* $elf */
-    initRPInit(SSToDS(&rpinit), "");
-    rc = InitElf(&rpinit);              /* no SSToDS! */
-    printf("InitElf returned status=0x%04x\n", rpinit.rph.Status);
-    if ((rpinit.rph.Status & (STDON | STERR)) == STDON)
-    {
-        /* $win32k */
-        initRPInit(SSToDS(&rpinit), "");
-        rc = InitWin32k(&rpinit);       /* no SSToDS! */
-        printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status);
-        if ((rpinit.rph.Status & (STDON | STERR)) == STDON)
-        {
-            struct options opt = DEFAULT_OPTION_ASSIGMENTS;
-            opt.fKernel     = KF_UNI;
-            opt.ulBuild     = 9036;
-            opt.usVerMajor  = 20;
-            opt.usVerMinor  = 40;
-
-            rc = CompareOptions(SSToDS(&opt));
-        }
-        else
-            printf("!failed!\n");
-    }
-    else
-        printf("!failed!\n");
-
-    return rc;
-}
-
-
-/**
- * Test case 5.
- * Checks that all parameters are read correctly (1) (Warp FP13 kernel).
- *
- * @sketch  Create init packet with no arguments.
- *          Initiate elf$
- *          Create init packet with no arguments.
- *          Initiate win32k$
- * @returns 0 on success.
- *          1 on failure.
- * @status  completely implemented.
- * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
- */
-int TestCase5(void)
-{
-    int         rc = 1;
-    RP32INIT    rpinit;
-    char *      pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:Mixed -Script:No -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000";
-
-    /* init fake variabels */
-    pszInternalRevision ="\r\nInternal revision 14.040_W4";
-    cObjectsFake = 14;
-    _usFakeVerMajor = 20;
-    _usFakeVerMinor = 45;
+    char *      pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:PE -Script:Yes -Rexx:NES -Java:NYes -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000";
 
     /* $elf */
@@ -551,8 +753,4 @@
         {
             struct options opt = DEFAULT_OPTION_ASSIGMENTS;
-            opt.fKernel         = KF_UNI | KF_W4;
-            opt.ulBuild         = 14040;
-            opt.usVerMajor      = 20;
-            opt.usVerMinor      = 45;
             opt.cbSwpHeapInit   = 512000;
             opt.cbSwpHeapMax    = 4096000;
@@ -560,6 +758,8 @@
             opt.cbResHeapMax    = 0x100000;
             opt.fElf            = TRUE;
-            opt.fUNIXScript     = FALSE;
-            opt.fPE             = FLAGS_PE_MIXED;
+            opt.fUNIXScript     = TRUE;
+            opt.fJava           = FALSE;
+            opt.fREXXScript     = FALSE;
+            opt.fPE             = FLAGS_PE_PE;
             opt.fQuiet          = TRUE;
             opt.fLogging        = FALSE;
@@ -568,4 +768,8 @@
 
             rc = CompareOptions(SSToDS(&opt));
+            if (rc == NO_ERROR)
+            {
+                 rc = TestCaseExeLoad2();
+            }
         }
         else
@@ -577,4 +781,5 @@
     return rc;
 }
+
 
 /**
@@ -598,12 +803,15 @@
     if (options.fLogging != pOpt->fLogging)
         printf("fLogging = %d - should be %d\n", options.fLogging, pOpt->fLogging, rc++);
-    if (options.fKernel != pOpt->fKernel)
-        printf("fKernel = %d - should be %d\n", options.fKernel, pOpt->fKernel, rc++);
-    if (options.ulBuild != pOpt->ulBuild)
-        printf("ulBuild = %d - should be %d\n", options.ulBuild, pOpt->ulBuild, rc++);
-    if (options.usVerMajor != pOpt->usVerMajor)
-        printf("usVerMajor = %d - should be %d\n", options.usVerMajor, pOpt->usVerMajor, rc++);
-    if (options.usVerMinor != pOpt->usVerMinor)
-        printf("usVerMinor = %d - should be %d\n", options.usVerMinor, pOpt->usVerMinor, rc++);
+    if (pOpt->ulBuild != ~0UL)
+    {
+        if (options.fKernel != pOpt->fKernel)
+            printf("fKernel = %d - should be %d\n", options.fKernel, pOpt->fKernel, rc++);
+        if (options.ulBuild != pOpt->ulBuild)
+            printf("ulBuild = %d - should be %d\n", options.ulBuild, pOpt->ulBuild, rc++);
+        if (options.usVerMajor != pOpt->usVerMajor)
+            printf("usVerMajor = %d - should be %d\n", options.usVerMajor, pOpt->usVerMajor, rc++);
+        if (options.usVerMinor != pOpt->usVerMinor)
+            printf("usVerMinor = %d - should be %d\n", options.usVerMinor, pOpt->usVerMinor, rc++);
+    }
     if (options.fPE != pOpt->fPE)
         printf("fPE = %d - should be %d\n", options.fPE, pOpt->fPE, rc++);
@@ -633,6 +841,4 @@
 
 
-
-
 /**
  * Simulates a executable loading (no errors).
@@ -647,7 +853,9 @@
  * @remark
  */
-int TestCaseExeLoad1(void)
+int TestCaseExeLoad2(void)
 {
     APIRET rc;
+    int    cch;
+    char * psz;
 
     /*
@@ -658,22 +866,95 @@
      * Do the real execution.
      */
-    printf("--- TestcaseExeLoad1 - loading win32ktst.exe (LX image) ----\n");
+    printf("--- TestcaseExeLoad2 - loading win32ktst.exe (LX image) ----\n");
     rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "win32ktst.exe");
     if (rc == NO_ERROR)
     {
-        printf("--- TestcaseExeLoad1 - loading libconv.exe (LX image) ----\n");
+        psz = "BIN\\DEBUG\\LIBCONV.EXE\0";
+        printf("--- TestcaseExeLoad2 - loading libconv.exe (LX image) ----\n");
         rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "bin\\debug\\libconv.exe");
+        if (rc == NO_ERROR)
+        {
+            #if 0 //not implemented by CalltkExecPgm...???
+            /* check result */
+            if (memcmp(achTkExecPgmArguments, psz, strlen(psz) + 1) != 0)
+            {
+                rc  = ERROR_BAD_ARGUMENTS;
+                printf("Bad Arguments! (%s)\n", achTkExecPgmArguments);
+            }
+            #else
+            psz = psz;
+            #endif
+        }
     }
 
     if (rc == NO_ERROR)
     {
-        printf("--- TestcaseExeLoad1 - loading rexx\\tst.cmd (REXX script) ----\n");
-        rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "rexx\\tst.cmd");
+        psz = "REXX\\TST.RX\0OriginalArgument1 OriginalArgument2\0OriginalArgument3\0";
+        printf("--- TestcaseExeLoad2 - loading rexx\\tst.rx (REXX script) ----\n");
+        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "rexx\\tst.rx");
+        if (rc == NO_ERROR)
+        {
+            /* check result */
+            psz = "REXX\\TST.RX OriginalArgument1 OriginalArgument2\0OriginalArgument3\0";
+            cch = strlen(psz);
+            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
+            {
+                rc  = ERROR_BAD_ARGUMENTS;
+                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
+            }
+        }
     }
 
     if (rc == NO_ERROR)
     {
-        printf("--- TestcaseExeLoad1 - loading SOL.EXE (PE image) ----\n");
-        rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "e:\\Win32Prog\\Sol\\Sol.exe");
+        psz = "TEST\\TST.SH\0OrgArg1 OrgArg2\0OrgArg3\0";
+        printf("--- TestcaseExeLoad2 - loading test\\tst.sh (UNIX shell script) ----\n");
+        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "test\\tst.sh");
+        if (rc == NO_ERROR)
+        {
+            /* check result */
+            psz = "TEST\\TST.SH OrgArg1 OrgArg2\0OrgArg3\0";
+            cch = strlen(psz);
+            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
+            {
+                rc  = ERROR_BAD_ARGUMENTS;
+                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
+            }
+        }
+    }
+
+    if (rc == NO_ERROR)
+    {
+        psz = "TEST\\TST2.SH\0OrgArg1 OrgArg2\0OrgArg3\0";
+        printf("--- TestcaseExeLoad2 - loading test\\tst2.sh (UNIX shell script) ----\n");
+        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "test\\tst2.sh");
+        if (rc == NO_ERROR)
+        {
+            /* check result */
+            psz = "-arg1 -arg2 -arg3 TEST\\TST2.SH OrgArg1 OrgArg2\0OrgArg3\0";
+            cch = strlen(psz) + 1;
+            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
+            {
+                rc  = ERROR_BAD_ARGUMENTS;
+                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
+            }
+        }
+    }
+
+    if (rc == NO_ERROR)
+    {
+        psz = "E:\\WIN32PROG\\SOL\\SOL.EXE\0";
+        printf("--- TestcaseExeLoad2 - loading SOL.EXE (PE image) ----\n");
+        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "e:\\Win32Prog\\Sol\\Sol.exe");
+        if (rc == NO_ERROR)
+        {
+            /* check result */
+            cch = strlen(psz) + 1 + 1;
+            if (memcmp(achTkExecPgmArguments, psz, cch) != 0)
+            {
+                rc  = ERROR_BAD_ARGUMENTS;
+                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
+            }
+        }
     }
 
@@ -683,2 +964,3 @@
     return rc;
 }
+
Index: trunk/src/win32k/utils/Win32kCC.c
===================================================================
--- trunk/src/win32k/utils/Win32kCC.c	(revision 4164)
+++ trunk/src/win32k/utils/Win32kCC.c	(revision 4164)
@@ -0,0 +1,665 @@
+/* $Id: Win32kCC.c,v 1.2 2000-09-02 21:08:22 bird Exp $
+ *
+ * Win32CC - Win32k Control Center.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+
+/*
+ * Private Window Messages
+ */
+#define  WM_SETCONTROLS         (WM_USER + 10)
+#define  WM_QUERYCONTROLS       (WM_USER + 11)
+
+
+/*
+ * Include defines
+ */
+#define INCL_DOSERRORS
+#define INCL_DOSFILEMGR
+#define INCL_DOSRESOURCES
+#define INCL_WINERRORS
+#define INCL_WINDIALOGS
+#define INCL_WINMESSAGEMGR
+#define INCL_WINSTDSPIN
+#define INCL_WINBUTTONS
+#define INCL_WINWINDOWMGR
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <os2.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <malloc.h>
+
+#include <Win32k.h>
+#include <devSegDf.h>                   /* Win32k segment definitions. */
+#include <Options.h>
+
+#include "Win32kCC.h"
+
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct _WIN32KCC
+{
+    HWND    hwnd;
+    HAB     hab;
+    BOOL    fDirty;
+
+    K32OPTIONS Options;
+    K32OPTIONS NewOptions;
+    K32STATUS  Status;
+
+} WIN32KCC, *PWIN32KCC;
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+BOOL    fNotExit;                       /* Global variable used to stop WM_QUITS.
+                                         * As long as this is true the message
+                                         * loop will never exit, but ignore all
+                                         * WM_QUITs.
+                                         */
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+MRESULT EXPENTRY    Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
+BOOL                Complain(HWND hwndOwner, int id, ...);
+PCSZ                getLastErrorMsg(HAB hab);
+PSZ                 getMessage(ULONG id);
+
+
+
+
+/**
+ * Main function.
+ * (No parameters)
+ * @returns     -1  WinInitialize failed.
+ *              -2  Failed to create message queue.
+ *              -3  Failed to load dialog.
+ *              0   Dialog was closed using cancel.
+ *              1   Dialog was close using ok.
+ */
+int main(void)
+{
+    HAB     hab;
+    HMQ     hmq;
+    ULONG   rc = 0;
+    HWND    hwnd;
+
+    /*
+     * Initialize PM.
+     */
+    hab = WinInitialize(0);
+    if (hab == NULLHANDLE)
+    {
+        return -1;
+    }
+
+    /*
+     * Create Message Queue.
+     */
+    hmq = WinCreateMsgQueue(hab, 0);
+    if (hmq == NULLHANDLE)
+    {
+        WinTerminate(hab);
+        return -2;
+    }
+
+    /*
+     * Init Win32k library.
+     */
+    rc = libWin32kInit();
+    if (rc != NO_ERROR)
+    {
+        switch (rc)
+        {
+            case ERROR_FILE_NOT_FOUND:
+                Complain(HWND_DESKTOP, IDS_ERR_WIN32K_NOT_LOADED);
+                break;
+
+            default:
+                Complain(HWND_DESKTOP, IDS_ERR_WIN32K_OPEN_FAILED, rc);
+        }
+    }
+
+    /*
+     * Load the dialog.
+     */
+    hwnd = WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP,
+                      Win32kCCDlgProc,
+                      NULLHANDLE,
+                      DL_WIN32KCC,
+                      NULL);
+
+    /*
+     * Process the dialog.
+     */
+    if (hwnd != NULLHANDLE)
+    {
+        QMSG qmsg;
+        do
+        {
+            fNotExit = FALSE;
+            while(WinGetMsg(hab, &qmsg, NULLHANDLE, NULLHANDLE, NULLHANDLE))
+                WinDispatchMsg(hab, &qmsg);
+        } while (fNotExit);
+
+
+    }
+    else
+    {
+        Complain(HWND_DESKTOP,
+                 IDS_ERR_DIALOGLOAD,
+                 DL_WIN32KCC,
+                 WinGetLastError(hab),
+                 getLastErrorMsg(hab)
+                 );
+        rc = -3;
+    }
+
+    /*
+     * Cleanup.
+     */
+    WinDestroyMsgQueue(hmq);
+    WinTerminate(hab);
+    libWin32kTerm();
+
+    return rc;
+}
+
+#pragma info(noord) /*remove annoying (and possible incorrect) messages on the MP* macros */
+
+/**
+ * Dialog procedure for the DL_WIN32KCC dialog.
+ * (See PMREF for the general specifications of this function.)
+ */
+MRESULT EXPENTRY Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
+{
+    PWIN32KCC   pThis;
+
+
+    /*
+     * Get instance data pointer (pThis).
+     */
+    if (msg != WM_INITDLG)
+    {
+        pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
+        if (pThis == NULL)
+            return WinDefDlgProc(hwnd, msg, mp1, mp2);
+    }
+
+
+    /*
+     * Message switch.
+     */
+    switch (msg)
+    {
+        /*
+         * Sets the controls according to the data from win32k.
+         *
+         * mr:  Focus changed or not.
+         * mp1: hwnd of dialog
+         * mp2: (user data) (NULL)
+         */
+        case WM_INITDLG:
+        {
+
+            /*
+             * Initiate controls (ie. behaviour not data).
+             *  - Ranges of the info level spinbuttons.
+             *  - Max length of the max heap size entry fields.
+             */
+            WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);
+            WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);
+
+            WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);
+            WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);
+
+
+            /*
+             * Init and set instance data.
+             */
+            pThis = malloc(sizeof(*pThis));
+            if (pThis == NULL)
+            {
+                /* complain, dismiss and return. */
+                Complain(hwnd, IDS_ERR_MALLOC_FAILED, __FILE__, __LINE__, __FUNCTION__);
+                WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
+                return FALSE;
+            }
+            pThis->hwnd = hwnd;
+            pThis->hab = WinQueryAnchorBlock(hwnd);
+            if (!WinSetWindowPtr(hwnd, QWL_USER, pThis))
+            {
+                /* complain, dismiss and return. */
+                Complain(hwnd, IDS_ERR_SET_INSTACEDATA,
+                         WinGetLastError(pThis->hab),
+                         getLastErrorMsg(pThis->hab));
+                WinDismissDlg(hwnd, 0);
+                WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
+                free(pThis);
+                return FALSE;
+            }
+
+            /*
+             * Send a set controls message which gets data from
+             * win32k and puts it into the controls.
+             */
+            WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
+            break;
+        }
+
+
+        /*
+         * The user wants me to do something...
+         */
+        case WM_COMMAND:
+            switch (SHORT1FROMMP(mp1))
+            {
+                /*
+                 * The user pushed the "Apply" button.
+                 */
+                case PB_APPLY:
+                {
+                    /* Check and get data from the dialog. */
+                    if (WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL)
+                        && pThis->fDirty
+                        )
+                    {
+                        APIRET rc;
+                        rc = libWin32kSetOptions(&pThis->NewOptions);
+                        if (rc != NO_ERROR)
+                            Complain(hwnd, IDS_ERR_SETPOPTIONS, rc);
+                        WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
+                    }
+                }
+                break;
+
+
+                /*
+                 * User pushed the "Refresh" button.
+                 */
+                case PB_REFRESH:
+                    WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
+                break;
+
+
+                /*
+                 * The user pushed the "Close" button.
+                 */
+                case DID_OK:
+                    /* Check if data is dirty */
+                    if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)FALSE, NULL) || pThis->fDirty)
+                    {
+                        if (WinMessageBox(HWND_DESKTOP, hwnd,
+                                          getMessage(IDM_INFO_DIRTY),
+                                         "Win32k Control Center", 0, MB_YESNO | MB_WARNING | MB_MOVEABLE)
+                             != MBID_YES)
+                        {
+                            fNotExit = TRUE;
+                            return NULL;
+                        }
+                    }
+                    /* Close the dialog */
+                    fNotExit = FALSE;
+                    WinDismissDlg(hwnd, 0);
+                    WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
+                    break;
+            }
+            return NULL;
+
+
+        /*
+         * Close window. Typically sent when Alt-F4 pressed or system-menu-Close is selected.
+         */
+        case WM_CLOSE:
+            fNotExit = TRUE;
+            WinSendMsg(hwnd, WM_COMMAND,
+                       MPFROMSHORT(DID_OK), MPFROM2SHORT(CMDSRC_MENU, FALSE));
+            break;
+
+
+        /*
+         * Window is destroyed (last message which ever should reach us!)
+         *  -Free instance data
+         *  -Set the instance data pointer to NULL (just in case).
+         */
+        case WM_DESTROY:
+        {
+            free(pThis);
+            WinSetWindowPtr(hwnd, QWL_USER, NULL);
+            break;
+        }
+
+
+        /*
+         * Gets data from win32k.
+         * Sets the controls according to the data from win32k.
+         *
+         * mr:  reserved
+         * mp1: reserved
+         * mp2: reserved
+         */
+        case WM_SETCONTROLS:
+        {
+            APIRET  rc;
+            CHAR    szNumber[16];
+
+
+            /*
+             * Call Win32k.sys to get options and statuses.
+             */
+            memset(&pThis->Options, 0, sizeof(K32OPTIONS));
+            pThis->Options.cb = sizeof(K32OPTIONS);
+            memset(&pThis->Status, 0, sizeof(K32STATUS));
+            pThis->Status.cb = sizeof(K32STATUS);
+            rc = libWin32kQueryOptionsStatus(&pThis->Options, &pThis->Status);
+            if (rc != NO_ERROR)
+            {
+                Complain(hwnd, IDS_ERR_QUERYOPTIONSTATUS, rc);
+                fNotExit = FALSE;
+                WinDismissDlg(hwnd, 0);
+                WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
+                return NULL;
+            }
+
+            /*
+             * Set the controls.
+             */
+            /* logging */
+            WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED,     BM_SETCHECK,    (MPARAM)(pThis->Options.fLogging),                  NULL);
+            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x3f8),            NULL);
+            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x2f8),            NULL);
+            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x3e8),            NULL);
+            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x2e8),            NULL);
+
+            /* loaders */
+            WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL,     BM_SETCHECK,    (MPARAM)(pThis->Options.fNoLoader),                  NULL);
+            /* PE */
+            WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE,         BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE2LX),     NULL);
+            WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED,        BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_MIXED),     NULL);
+            WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE,           BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE),        NULL);
+            WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT,          BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_NOT),       NULL);
+            WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL,    SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel),         NULL); /* FIXME to be changed */
+            /* Elf */
+            WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED,     BM_SETCHECK,    (MPARAM)(pThis->Options.fElf),                      NULL);
+            WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL,   SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel),         NULL); /* FIXME to be changed */
+            /* UNIX Shell Scripts */
+            WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS,   BM_SETCHECK,    (MPARAM)(pThis->Options.fUNIXScript),               NULL);
+            /* JAVA */
+            WinSendDlgItemMsg(hwnd, CB_LDR_JAVA,            BM_SETCHECK,    (MPARAM)(pThis->Options.fJava),                     NULL);
+            /* REXX Scripts */
+            WinSendDlgItemMsg(hwnd, CB_LDR_REXX,            BM_SETCHECK,    (MPARAM)(pThis->Options.fREXXScript),               NULL);
+
+            /* heaps */
+            /* Resident */
+            WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX,        SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL);
+            sprintf(szNumber, "%d", pThis->Status.cbResHeapInit / 1024);
+            WinSetDlgItemText(hwnd, TX_HEAP_RES_INIT_VAL,   szNumber);
+            sprintf(szNumber, "%d", pThis->Status.cbResHeapUsed / 1024);
+            WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_VAL,   szNumber);
+            /* Swappable */
+            WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX,        SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbSwpHeapMax / 1024), NULL);
+            sprintf(szNumber, "%d", pThis->Status.cbSwpHeapInit / 1024);
+            WinSetDlgItemText(hwnd, TX_HEAP_SWP_INIT_VAL,   szNumber);
+            sprintf(szNumber, "%d", pThis->Status.cbSwpHeapUsed / 1024);
+            WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_VAL,   szNumber);
+
+            pThis->fDirty = FALSE;
+            return NULL;
+        }
+
+
+        /*
+         * Validate data in the controls. Complains accoring to mp1.
+         * Put the data into the win32k option struct.
+         *
+         * mr:  Valid indicator.
+         *      TRUE:   Valid data.
+         *      FALSE:  Not valid data.
+         * mp1: BOOL fComplain.
+         *      TRUE:   Do complain about errors. The pThis->Options struct
+         *              is updated on successful return.
+         *      FALSE:  Do not complain about errors, and don't update the
+         *              pThis->Options struct.
+         * mp2: reserved.
+         */
+        case WM_QUERYCONTROLS:
+        {
+            BOOL        fComplain = (BOOL)mp1;
+            ULONG       ul;
+
+            /*
+             * Init temporary option struct.
+             */
+            memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS));
+            pThis->NewOptions.cb = sizeof(K32OPTIONS);
+
+            /*
+             * Logging.
+             */
+            pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;
+            if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.usCom = 0x3f8;
+            else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.usCom = 0x2f8;
+            else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.usCom = 0x3e8;
+            else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.usCom = 0x2e8;
+            else
+            {
+                if (fComplain)
+                    Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON);
+                return (MPARAM)FALSE;
+            }
+
+            /*
+             * Loaders
+             */
+            pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0;
+            /* PE */
+            if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.fPE = FLAGS_PE_PE2LX;
+            else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.fPE = FLAGS_PE_MIXED;
+            else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.fPE = FLAGS_PE_PE;
+            else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_QUERYCHECK, NULL, NULL))
+                pThis->NewOptions.fPE = FLAGS_PE_NOT;
+            else
+            {
+                if (fComplain)
+                    Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);
+                return (MPARAM)FALSE;
+            }
+            if (!WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
+            {
+                if (fComplain)
+                {
+                    Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);
+                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_PE_INFOLEVEL));
+                }
+                return (MPARAM)FALSE;
+            }
+            pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */
+
+            /* Elf */
+            pThis->NewOptions.fElf = WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;
+            if (!WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
+            {
+                if (fComplain)
+                {
+                    Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);
+                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_ELF_INFOLEVEL));
+                }
+                return (MPARAM)FALSE;
+            }
+            //pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */
+            /* UNIX Shell Scripts */
+            pThis->NewOptions.fUNIXScript = WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_QUERYCHECK, NULL, NULL) != 0;
+            /* JAVA */
+            pThis->NewOptions.fJava = WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_QUERYCHECK, NULL, NULL) != 0;
+            /* REXX Scripts */
+            pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0;
+
+            /*
+             * Heaps
+             */
+            /* Resident */
+            if (!WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
+            {
+                if (fComplain)
+                {
+                    Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE);
+                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_RES_MAX));
+                }
+                return (MPARAM)FALSE;
+            }
+            pThis->NewOptions.cbResHeapMax = ul*1024;
+            /* Swappable */
+            if (!WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
+            {
+                if (fComplain)
+                {
+                    Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE);
+                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_SWP_MAX));
+                }
+                return (MPARAM)FALSE;
+            }
+            pThis->NewOptions.cbSwpHeapMax = ul*1024;
+
+            /*
+             * Check if there is any change and set the fDirty flag accordingly.
+             */
+            pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0;
+            return (MPARAM)TRUE;
+        }
+
+
+    }
+
+    /*
+     * Return thru the default dialog procedure.
+     */
+    return WinDefDlgProc(hwnd, msg, mp1, mp2);
+}
+
+
+/**
+ * Pops up a message box displaying some complaint or error.
+ * @returns     Success indicator.
+ * @param       hwndOwner   Handle of owner window.
+ * @param       id          String table id of the message.
+ * @param       ...         Arguments passed on to vsprintf to format the message.
+ */
+BOOL Complain(HWND hwndOwner, int id, ...)
+{
+    ULONG   rc;
+    char    szMsg[1024];
+    char    szMsgOutput[4096];
+
+
+    /*
+     * Load the string and format it.
+     */
+    if (WinLoadString(WinQueryAnchorBlock(hwndOwner), 0, id, sizeof(szMsg), szMsg))
+    {
+        va_list args;
+        va_start(args, id);
+        vsprintf(szMsgOutput, szMsg, args);
+        va_end(args);
+    }
+    else
+        sprintf(szMsgOutput, "Failed to load the message id %id.\n", id);
+
+
+    /*
+     * Show message.
+     */
+    rc = WinMessageBox(HWND_DESKTOP, hwndOwner,
+                       szMsgOutput,
+                       "Win32k Control Center - error",
+                       0,
+                       MB_APPLMODAL | MB_ICONHAND | MB_OK | MB_MOVEABLE);
+    if (rc == (ULONG)MBID_ERROR)
+    {
+        rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
+                           szMsgOutput,
+                           "Win32k Control Center - error",
+                           0,
+                           MB_ICONHAND | MB_OK | MB_MOVEABLE);
+    }
+
+
+    /*
+     * Return according to rc.
+     */
+    return rc != MBID_ERROR;
+}
+
+
+/**
+ * Gets the message string for the last error message.
+ * @returns     Pointer to message string.
+ * @param       hab     Handle of application anchor block.
+ */
+PCSZ getLastErrorMsg(HAB hab)
+{
+    char     *pszErrInfo;
+    PERRINFO pErrInfo = WinGetErrorInfo(hab);
+
+    if (pErrInfo != NULL && pErrInfo->cDetailLevel > 0)
+    {
+        pszErrInfo = (char*)(void*)pErrInfo;
+        pszErrInfo += ((PUSHORT)(void*)(pszErrInfo + pErrInfo->offaoffszMsg))[pErrInfo->cDetailLevel-1];
+    }
+    else
+        pszErrInfo = "<none>";
+
+    return pszErrInfo;
+}
+
+
+/**
+ * Gets a message from the executable resources.
+ * @returns     Pointer to read-only string.
+ *              NULL if not found/error.
+ * @param       id      String Id.
+ */
+PSZ getMessage(ULONG id)
+{
+    PSZ psz;
+
+    if (DosGetResource(NULLHANDLE, RT_MESSAGE, id / 16 + 1, (PPVOID)(void*)&psz) == NO_ERROR)
+    {
+        psz +=2;
+        id %= 16;
+        while (id-- > 0)
+            psz += 1 + *psz;
+        return psz+1;
+    }
+    else
+        psz = NULL;
+
+    return psz;
+}
+
+
Index: trunk/src/win32k/utils/Win32kCC.dlg
===================================================================
--- trunk/src/win32k/utils/Win32kCC.dlg	(revision 4164)
+++ trunk/src/win32k/utils/Win32kCC.dlg	(revision 4164)
@@ -0,0 +1,66 @@
+#ifndef OS2_INCLUDED
+   #include <os2.h>
+   #include "win32kcc.h"
+#endif
+DLGINCLUDE 1 "win32kcc.h"
+
+DLGTEMPLATE DL_WIN32KCC LOADONCALL MOVEABLE DISCARDABLE
+BEGIN
+    DIALOG  "Win32k Control Center", DL_WIN32KCC, 173, 69, 274, 256, WS_VISIBLE, FCF_SYSMENU |
+            FCF_TITLEBAR | FCF_TASKLIST
+    BEGIN
+        AUTOCHECKBOX    "Enabled", CB_LOGGING_ENABLED, 14, 228, 50, 10
+        GROUPBOX        "Logging", GR_LOGGING, 6, 225, 216, 25
+        AUTORADIOBUTTON "COM1", RB_LOGGING_COM1, 68, 228, 36, 10, WS_TABSTOP
+        AUTORADIOBUTTON "COM2", RB_LOGGING_COM2, 106, 228, 36, 10,
+                        WS_TABSTOP
+        AUTORADIOBUTTON "COM3", RB_LOGGING_COM3, 142, 228, 36, 10,
+                        WS_TABSTOP
+        AUTORADIOBUTTON "COM4", RB_LOGGING_COM4, 180, 228, 36, 10,
+                        WS_TABSTOP
+        GROUPBOX        "Loaders", GR_LOADERS, 6, 100, 262, 118
+        AUTOCHECKBOX    "Disable all loaders", CB_LDR_DISABLE_ALL, 14, 196,
+                        112, 10
+        GROUPBOX        "PE Loader", 101, 14, 142, 118, 48
+        AUTORADIOBUTTON "Pure", RB_LDR_PE_PURE, 22, 170, 44, 10, WS_TABSTOP
+        AUTORADIOBUTTON "Mixed", RB_LDR_PE_MIXED, 22, 160, 44, 10,
+                        WS_TABSTOP
+        AUTORADIOBUTTON "PE.EXE", RB_LDR_PE_PE, 78, 170, 44, 10, WS_TABSTOP
+        AUTORADIOBUTTON "Disabled", RB_LDR_PE_NOT, 78, 160, 51, 10,
+                        WS_TABSTOP
+        SPINBUTTON      SB_LDR_PE_INFOLEVEL, 78, 148, 28, 12,
+                        SPBS_NUMERICONLY | SPBS_MASTER | WS_GROUP
+        LTEXT           "Infolevel:", TX_LDR_PE_INFOLEVEL, 26, 148, 48, 8
+        GROUPBOX        "ELF Loader", GR_LDR_ELF, 142, 152, 118, 37
+        AUTOCHECKBOX    "Enabled", CB_LDR_ELF_ENABLED, 150, 168, 55, 10
+        LTEXT           "Infolevel:", TX_LDR_ELF_INFOLEVEL, 154, 157, 48, 8
+        SPINBUTTON      SB_LDR_ELF_INFOLEVEL, 206, 157, 28, 12, SPBS_NUMERICONLY |
+                        SPBS_MASTER | WS_GROUP
+        AUTOCHECKBOX    "UNIX Shell Scripts", CB_LDR_SHELL_SCRIPTS, 14, 124,
+                        160, 10
+        AUTOCHECKBOX    "JAVA", CB_LDR_JAVA, 14, 114, 160, 10
+        AUTOCHECKBOX    "(Pure) REXX Scripts (.RX/.REX)", CB_LDR_REXX, 14,
+                        104, 160, 10
+        GROUPBOX        "Heaps", GR_HEAPS, 6, 26, 262, 65
+        GROUPBOX        "Resident Heap", GR_HEAP_RES, 14, 33, 118, 48
+        LTEXT           "Max (KB):", TX_HEAP_RES_MAX, 22, 62, 53, 8
+        SPINBUTTON      SB_HEAP_RES_MAX, 80, 62, 42, 8, SPBS_NUMERICONLY |
+                        SPBS_MASTER | WS_GROUP | SPBS_FASTSPIN
+
+        LTEXT           "Initial (KB)", TX_HEAP_RES_INIT, 22, 50, 50, 8
+        RTEXT           "256", TX_HEAP_RES_INIT_VAL, 78, 50, 46, 8
+        LTEXT           "Used (KB)", TX_HEAP_RES_USED, 22, 38, 50, 8
+        RTEXT           "256", TX_HEAP_RES_USED_VAL, 78, 38, 46, 8
+        GROUPBOX        "Swappable Heap", GR_HEAP_SWP, 142, 33, 118, 48
+        LTEXT           "Max (KB):", TX_HEAP_SWP_MAX, 150, 62, 53, 8
+        SPINBUTTON      SB_HEAP_SWP_MAX, 208, 62, 42, 8, SPBS_NUMERICONLY |
+                        SPBS_MASTER | WS_GROUP | SPBS_FASTSPIN
+        LTEXT           "Initial (KB)", TX_HEAP_SWP_INIT, 150, 50, 50, 8
+        RTEXT           "256", TX_HEAP_SWP_INIT_VAL, 206, 50, 46, 8
+        LTEXT           "Used (KB)", TX_HEAP_SWP_USED, 150, 38, 50, 8
+        RTEXT           "256", TX_HEAP_SWP_USED_VAL, 206, 38, 46, 8
+        DEFPUSHBUTTON   "~Refresh", PB_REFRESH, 6, 4, 40, 14
+        PUSHBUTTON      "Apply", PB_APPLY, 49, 4, 40, 14
+        PUSHBUTTON      "Close", DID_OK, 92, 4, 40, 14
+    END
+END
Index: trunk/src/win32k/utils/Win32kCC.h
===================================================================
--- trunk/src/win32k/utils/Win32kCC.h	(revision 4164)
+++ trunk/src/win32k/utils/Win32kCC.h	(revision 4164)
@@ -0,0 +1,93 @@
+/* $Id: Win32kCC.h,v 1.2 2000-09-02 21:08:22 bird Exp $
+ *
+ *
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/*
+ * General PushButton ID(s)
+ */
+#define PB_APPLY                    0xfffe
+#define PB_REFRESH                  0xfffd
+
+
+/*
+ * String IDs.
+ */
+#define  IDS_ERR_DIALOGLOAD             1
+#define  IDS_ERR_MALLOC_FAILED          2
+#define  IDS_ERR_SET_INSTACEDATA        3
+#define  IDS_ERR_WIN32K_NOT_LOADED      4
+#define  IDS_ERR_WIN32K_OPEN_FAILED     5
+#define  IDS_ERR_QUERYOPTIONSTATUS      6
+#define  IDS_ERR_NO_COM_RADIOBUTTON     7
+#define  IDS_ERR_NO_PE_RADIOBUTTON      8
+#define  IDS_ERR_INVALID_INFOLEVEL      9
+#define  IDS_ERR_INVALID_MAXHEAPSIZE   10
+#define  IDS_ERR_SETPOPTIONS           11
+
+/*
+ * Message IDs.
+ */
+#define  IDM_INFO_DIRTY             1
+
+
+/*
+ * The Win32kCC (main) dialog.
+ */
+#define DL_WIN32KCC                 1000
+
+#define GR_LOGGING                  1010
+#define CB_LOGGING_ENABLED          1011
+#define RB_LOGGING_COM1             1012
+#define RB_LOGGING_COM2             1013
+#define RB_LOGGING_COM3             1014
+#define RB_LOGGING_COM4             1015
+
+
+#define GR_LOADERS                  1030
+#define CB_LDR_DISABLE_ALL          1031
+
+#define RB_LDR_PE                   1040
+#define RB_LDR_PE_PURE              1041
+#define RB_LDR_PE_MIXED             1042
+#define RB_LDR_PE_PE                1043
+#define RB_LDR_PE_NOT               1044
+#define TX_LDR_PE_INFOLEVEL         1045
+#define SB_LDR_PE_INFOLEVEL         1046
+
+#define GR_LDR_ELF                  1060
+#define CB_LDR_ELF_ENABLED          1061
+#define TX_LDR_ELF_INFOLEVEL        1062
+#define SB_LDR_ELF_INFOLEVEL        1063
+
+#define CB_LDR_SHELL_SCRIPTS        1070
+#define CB_LDR_JAVA                 1080
+#define CB_LDR_REXX                 1090
+
+
+#define GR_HEAPS                    1150
+
+#define GR_HEAP_RES                 1160
+#define TX_HEAP_RES_MAX             1161
+#define SB_HEAP_RES_MAX             1162
+#define TX_HEAP_RES_INIT            1163
+#define TX_HEAP_RES_INIT_VAL        1164
+#define TX_HEAP_RES_USED            1165
+#define TX_HEAP_RES_USED_VAL        1166
+
+#define GR_HEAP_SWP                 1170
+#define TX_HEAP_SWP_MAX             1171
+#define SB_HEAP_SWP_MAX             1172
+#define TX_HEAP_SWP_INIT            1173
+#define TX_HEAP_SWP_INIT_VAL        1174
+#define TX_HEAP_SWP_USED            1175
+#define TX_HEAP_SWP_USED_VAL        1176
+
Index: trunk/src/win32k/utils/Win32kCC.rc
===================================================================
--- trunk/src/win32k/utils/Win32kCC.rc	(revision 4164)
+++ trunk/src/win32k/utils/Win32kCC.rc	(revision 4164)
@@ -0,0 +1,41 @@
+/* $Id: Win32kCC.rc,v 1.2 2000-09-02 21:08:23 bird Exp $
+ *
+ * Resource File for Win32k Control Center.
+ *
+ * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+#include <os2.h>
+#include "Win32kCC.h"
+
+STRINGTABLE
+BEGIN
+    /*
+     * Error strings (input for sprintf!).
+     */
+    IDS_ERR_DIALOGLOAD,         "Failed to load dialog.\rdialogid = %d\rlasterr = 0x%x\rmsg = %s"
+    IDS_ERR_MALLOC_FAILED,      "Malloc failed. (file %s; line %d; function %s)"
+    IDS_ERR_SET_INSTACEDATA,    "Call to WinSetWindowPtr failed.\rlasterror = %d\rmsg = %s"
+    IDS_ERR_WIN32K_NOT_LOADED,  "Win32k.sys is not loaded.\rTo fix it you'll have to add it to your config.sys. (see the Odin32 readme.txt for more details.)"
+    IDS_ERR_WIN32K_OPEN_FAILED, "Failed to open Win32k.sys. (rc=0x%x)"
+    IDS_ERR_QUERYOPTIONSTATUS,  "Failed to get option and status data from Win32k.sys. (rc=0x%x)"
+    IDS_ERR_NO_COM_RADIOBUTTON, "Internal error. No COM port is selected!"
+    IDS_ERR_NO_PE_RADIOBUTTON,  "Internal error. No PE Loader mode is selected!"
+    IDS_ERR_INVALID_INFOLEVEL,  "Invalid infolevel."
+    IDS_ERR_INVALID_MAXHEAPSIZE,"Invalid heapsize."
+    IDS_ERR_SETPOPTIONS,        "Error occured in win32k while changing the options. (rc=0x%x)"
+END
+
+MESSAGETABLE
+BEGIN
+    /*
+     * Messages.
+     */
+    IDM_INFO_DIRTY,             "You have changed the settings but not applied them. Sure you wan't to exit?"
+END
+
+
+RCINCLUDE "Win32kCC.dlg"
Index: trunk/src/win32k/utils/makefile
===================================================================
--- trunk/src/win32k/utils/makefile	(revision 4164)
+++ trunk/src/win32k/utils/makefile	(revision 4164)
@@ -0,0 +1,106 @@
+##############################################################################
+# $Id: makefile,v 1.2 2000-09-02 21:08:23 bird Exp $
+#
+# PD-Win32 API
+#
+#       Win32kCC.exe makefile
+#
+##############################################################################
+
+##############################################################################
+# Include
+##############################################################################
+EXETARGET=1
+!include ..\makefile.inc
+!include $(PDWIN32_INCLUDE)\pdwin32.mk
+
+##############################################################################
+# Object extention
+##############################################################################
+OBJEXT          = obj
+
+##############################################################################
+# Tools and Flags Addjustments
+##############################################################################
+OBJDIR     = $(WIN32KOBJ)
+CINCLUDES  = -I$(WIN32KINCLUDE)
+
+CFLAGS     = $(CINCLUDES) $(CFLAGS) -DRING3 \
+             -Ge+ -Wall+ppt-ppc-inl-cnv-gnr-vft-gen-uni-ext- -Gm- -Gn- -Ti+
+CXXFLAGS   = $(CINCLUDES) $(CXXFLAGS) -DRING3 \
+             -Ge+ -Wall+ppt-ppc-inl-cnv-gnr-vft- -Gm- -Gn- -Ti+
+
+LD2FLAGS    = $(LD2FLAGS) /pmtype:pm
+
+
+##############################################################################
+# Interference rules. Note: -Fo is IBMCPP specific.
+##############################################################################
+.c{$(OBJDIR)}.$(OBJEXT):
+    @echo compiling: $(@B).c
+    @$(CC) $(CFLAGS) -c -Fo$@ $<
+
+.cpp{$(OBJDIR)}.$(OBJEXT):
+    @echo compiling: $(@B).cpp
+    @$(CXX) $(CXXFLAGS) -c -Fo$@ $<
+
+.rc{$(OBJDIR)}.res:
+    @echo Compiling resources: $(@B).res
+    @$(OS2RC) $(OS2RCFLAGS) $(CINCLUDES:-I=-i ) $< $@
+
+
+#
+# Visual slick edit!
+#
+.c.obj:
+    @echo compiling: $(@B).c
+    @$(CC) $(CFLAGS) -c -Fa$(WIN32KLIST)\$(@B)_pe.asm -Fo$(OBJDIR)\$(@B).$(OBJEXT) $<
+
+.cpp.obj:
+    @echo compiling: $(@B).cpp
+    @$(CXX) $(CXXFLAGS) -c -Fa$(WIN32KLIST)\$(@B)_pe.asm -Fo$(OBJDIR)\$(@B).$(OBJEXT) $<
+
+
+##############################################################################
+# Main targets.
+##############################################################################
+TARGET = Win32kCC
+
+OBJS   = $(OBJDIR)\Win32kCC.$(OBJEXT)
+
+all:    $(WIN32KBIN)\$(TARGET).exe
+    $(CP) $(WIN32KBIN)\$(TARGET).exe
+
+$(WIN32KBIN)\$(TARGET).exe: $(OBJS) $(OBJDIR)\$(@B).res $(PDWIN32_LIB)\win32k.lib
+    @echo linking $@
+    $(LD2) @<<$(OBJDIR)\$(*B).lnk
+$(LD2FLAGS)
+/OUT:$@
+/MAP:$*.map
+$(OBJS)
+$(RTLLIB)
+$(PDWIN32_LIB)\win32k.lib
+os2386.lib
+<<KEEP
+    $(OS2RC) $(OS2RCLFLAGS) $(OBJDIR)\$(@B).res $@
+    $(CP) $@ $(PDWIN32_BIN)
+
+
+##############################################################################
+# Dependencies.
+##############################################################################
+dep:
+    $(DEPEND) -obj$(OBJEXT) -o$$(OBJDIR) $(CINCLUDES) *.cpp *.c *.h \
+        *.rc *.dlg ..\include\*.h
+
+
+##############################################################################
+# Cleanup
+##############################################################################
+#clean2:
+#    @$(RM) $(OBJS) $(TARGET).exe $(WIN32KLIST)\$(TARGET).map *.pch
+
+
+
+# Includes the common rules.
+!include $(PDWIN32_INCLUDE)\pdwin32.post
Index: trunk/src/win32k/win32k.def
===================================================================
--- trunk/src/win32k/win32k.def	(revision 4152)
+++ trunk/src/win32k/win32k.def	(revision 4164)
@@ -11,14 +11,23 @@
 
 SEGMENTS
-    DATA16          class 'FAR_DATA'
-    DATA16_BSS      class 'FAR_DATA'
-    DATA16_CONST    class 'FAR_DATA'
-    CODE16          class 'CODE'
-    CODE32          class 'CODE'
-    DATA32          class 'DATA'
-    c_common        class 'DATA'
-    BSS32           class 'BSS'
-    _VFT            class 'CONST'
-    CONST32_RO      class 'CONST'
-    CALLTAB         class 'DATA'
+    DATA16              class 'FAR_DATA'
+    DATA16_BSS          class 'FAR_DATA'
+    DATA16_CONST        class 'FAR_DATA'
+    DATA16_GLOBAL       class 'FAR_DATA'
+    DATA16_INIT         class 'FAR_DATA'
+    DATA16_INIT_BSS     class 'FAR_DATA'
+    DATA16_INIT_CONST   class 'FAR_DATA'
 
+    CODE16              class 'CODE'
+    CODE16_IOSEG        class 'CODE'
+    CODE16_INIT         class 'CODE'
+
+    CODE32              class 'CODE'
+
+    DATA32              class 'DATA'
+    c_common            class 'DATA'
+    BSS32               class 'BSS'
+    _VFT                class 'CONST'
+    CONST32_RO          class 'CONST'
+    CALLTAB             class 'DATA'
+
Index: trunk/src/win32k/win32k.vpj
===================================================================
--- trunk/src/win32k/win32k.vpj	(revision 4164)
+++ trunk/src/win32k/win32k.vpj	(revision 4164)
@@ -0,0 +1,148 @@
+[COMPILER]
+MACRO=odin32_maketagfile();\n
+FILTEREXPANSION=1 1 1 1 0 0 1 1 1 0 0 0 0 1
+compile=concur|capture|clear|:Compile:&Compile,nmake %n.obj
+make=concur|capture|clear|:Build:&Build,nmake
+rebuild=concur|capture|clear|:Rebuild:&Rebuild,nmake /A
+debug=:Debug:&Debug,
+execute=:Execute:E&xecute,
+user1=hide|:User 1:User 1,
+user2=hide|:User 2:User 2,
+usertool_resource_editor=hide|:Resource Editor:Resource Editor,dlgedit
+workingdir=..\..\src\win32k
+includedirs=include;..\..\include;..\..\include\win;%(INCLUDE)
+tagfiles=
+reffile=
+FILTERNAME=Dev16\nDev32\nLoader\nPe2Lx\nElf2Lx\nRexx\nMisc\nKernelStuff\nTest\nDef Files\nMakefiles\nLibrary\nk32\nOther Files\n
+FILTERPATTERN=d16*;prob*;symdb*;vprintf16*;dev16*;omf*;sym*\nd32*;dev*;calltab*\nldr*;my*;ModuleBase*\npe*;ModuleBas*\nElf*;ModuleBase*\nkRx*;ModuleBase*\nmalloc*;smallo*;rmall*;heap*;new*;vpr*;spr*;vspr*;yield*;str*;macros*;cout*;buffer*;avl*;asmutil*;log*;env*;option*;type*\nOS2K*;calltab*;probe*;d32ini*\ndh.asm;dos*;fake*;init.asm;win32ktst*;test*\n*.def\nmakefile*;*.mak;Check*;configure*\nlib*;win32k.h\nk32*\n*.*\n
+FILTERAPPCOMMAND=\n\n\n\n\n\n\n\n\n\n\n\n\n\n
+FILTERASSOCIATEFILETYPES=0 0 0 0 0 0 0 0 0 0 0 0 0 0
+[FILES]
+calltrees.txt
+Check.cmd
+Check.mk
+configure.cmd
+fastdep.c
+history.txt
+libconv.c
+Makefile
+Makefile.inc
+win32k.def
+win32k.txt
+win32ktst.def
+..\..\include\win\peexe.h
+dev16\d16globl.c
+dev16\d16init.c
+dev16\d16strat.c
+dev16\probkrnl.c
+dev16\SymDB.c
+dev16\vprntf16.c
+dev32\d32ElfIOCtl.c
+dev32\d32globals.c
+dev32\d32hlp.asm
+dev32\d32init.c
+dev32\d32Win32kIOCtl.c
+dev32\devfirst.asm
+dev32\devlast.asm
+elf2lx\elf2lx.cpp
+elf2lx\elf2lxmain.cpp
+elf2lx\elfdumper.cpp
+elf2lx\makefile
+include\errors.h
+include\OS2KSEC.h
+include\asmutils.h
+include\avl.h
+include\cout.h
+include\dev16.h
+include\dev1632.h
+include\dev32.h
+include\dev32hlp.h
+include\devSegDf.inc
+include\elf.h
+include\elf2lx.h
+include\env.h
+include\k32.h
+include\ldr.h
+include\ldrCalls.h
+include\log.h
+include\macros.h
+include\malloc.h
+include\ModuleBase.h
+include\myExecPgm.h
+include\new.h
+include\omf.h
+include\options.h
+include\OS2KIO.h
+include\OS2KPTDA.h
+include\OS2Krnl.h
+include\OS2Krnl.inc
+include\OS2KSEM.h
+include\OS2KTCB.h
+include\OS2KTK.h
+include\OS2KVM.h
+include\pe2lx.h
+include\probkrnl.h
+include\rmalloc.h
+include\smalloc.h
+include\sprintf.h
+include\sym.h
+include\test.h
+include\types.h
+include\vprintf.h
+include\vprntf16.h
+include\Win32k.h
+include\yield.h
+k32\k32AllocMemEx.cpp
+ldr\calltab.asm
+ldr\ldr.cpp
+ldr\ModuleBase.cpp
+ldr\myldrClose.cpp
+ldr\myldrEnum32bitRelRecs.cpp
+ldr\myldrOpen.cpp
+ldr\myldrOpenPath.cpp
+ldr\myLDRQAppType.cpp
+ldr\myldrRead.cpp
+ldr\mytkExecPgm.asm
+ldr\mytkStartProcess.asm
+ldr\myVMAllocMem.cpp
+lib\libDosAllocMemEx.c
+lib\libGetCS.asm
+lib\libInit.c
+lib\libTerm.c
+lib\libTest.c
+lib\makefile
+misc\asmutils.asm
+misc\avl.c
+misc\buffer.asm
+misc\cout.cpp
+misc\env.c
+misc\heaptest.c
+misc\log.c
+misc\makefile
+misc\malloc.c
+misc\malloc_old.c
+misc\new.cpp
+misc\OS2KPTDA.c
+misc\OS2KTCB.c
+misc\rmalloc.c
+misc\rmalloc_avl.c
+misc\smalloc_avl.c
+misc\stricmp.c
+misc\vprintf.c
+misc\vsprintf.c
+misc\yield.c
+pe2lx\makefile
+pe2lx\pe2lx.cpp
+pe2lx\pe2lxmain.cpp
+rexx\kRx.c
+rexx\kRx.def
+rexx\kRxa.asm
+rexx\makefile
+test\dh.asm
+test\dos.c
+test\dosa.asm
+test\fake.c
+test\fakea.asm
+test\init.asm
+test\win32ktst.c
+[ASSOCIATION]
Index: trunk/src/win32k/win32ktst.def
===================================================================
--- trunk/src/win32k/win32ktst.def	(revision 4152)
+++ trunk/src/win32k/win32ktst.def	(revision 4164)
@@ -12,20 +12,28 @@
 
 SEGMENTS
-    DATA16          class 'FAR_DATA'
-    DATA16_BSS      class 'FAR_DATA'
-    DATA16_CONST    class 'FAR_DATA'
-    CODE16          class 'CODE'
-    CODE32          class 'CODE'
-    CALLTAB         class 'DATA'
-    DATA32          class 'DATA'
-    c_common        class 'DATA'
-    DDE4_DATA32     class 'DATA'
-    CTOR_DTOR1      class 'DATA'
-    CTOR_DTOR2      class 'DATA'
-    CTOR_DTOR3      class 'DATA'
-    _VFT            class 'CONST'
-    CONST32_RO      class 'CONST'
-    EH_DATA         class 'CONST'
-    BSS32           class 'BSS'
+    DATA16              class 'FAR_DATA'
+    DATA16_BSS          class 'FAR_DATA'
+    DATA16_CONST        class 'FAR_DATA'
+    DATA16_GLOBAL       class 'FAR_DATA'
+    DATA16_INIT         class 'FAR_DATA'
+    DATA16_INIT_BSS     class 'FAR_DATA'
+    DATA16_INIT_CONST   class 'FAR_DATA'
+
+    CODE16              class 'CODE'
+    CODE16_IOSEG        class 'CODE'
+    CODE16_INIT         class 'CODE'
+
+    CODE32              class 'CODE'
+    CALLTAB             class 'DATA'
+    DATA32              class 'DATA'
+    c_common            class 'DATA'
+    DDE4_DATA32         class 'DATA'
+    CTOR_DTOR1          class 'DATA'
+    CTOR_DTOR2          class 'DATA'
+    CTOR_DTOR3          class 'DATA'
+    _VFT                class 'CONST'
+    CONST32_RO          class 'CONST'
+    EH_DATA             class 'CONST'
+    BSS32               class 'BSS'
 
 IMPORTS
@@ -33,3 +41,3 @@
      _DOS16OPEN       = DOSCALL1.70
      _DOS16CLOSE      = DOSCALL1.59
-
+     DosQuerySysState = DOSCALL1.368
