Index: trunk/src/win32k/kKrnlLib/Makefile
===================================================================
--- trunk/src/win32k/kKrnlLib/Makefile	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/Makefile	(revision 6696)
@@ -0,0 +1,478 @@
+# $Id: Makefile,v 1.1 2001-09-11 01:27:21 bird Exp $
+
+#
+# kKrnlLib.sys makefile.
+#
+# Copyright 1998-2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+#
+# Project Odin Software License can be found in LICENSE.TXT
+#
+
+
+#
+# Include path definitions, common stuff and our own tools.
+#
+!include makefile.inc
+!include ../../../makefile.inc
+!include ../win32k.tools.mk
+
+
+#
+# Main targetname
+#
+NAME = kKrnlLib
+
+
+#
+# Main rules.
+#
+!if "$(DDKPATH)" != "" && "$(MSCPATH)" != ""  && "$(TOOLKIT)" != "" && "$(VACPATH)" != ""
+all:    $(WIN32KBIN)\$(NAME).sys \
+        $(ODIN32_LIB)\$(NAME).lib
+!endif
+
+
+#
+# kKrnlLib.sys 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)\calltaba.obj \
+#    $(WIN32KOBJ)\locks.obj \
+    $(WIN32KOBJ)\malloc.obj \
+    $(WIN32KOBJ)\smalloc.obj \
+    $(WIN32KOBJ)\rmalloc.obj \
+    $(WIN32KOBJ)\avl.obj \
+    $(WIN32KOBJ)\new.obj \
+    $(WIN32KOBJ)\stricmp.obj \
+    $(WIN32KOBJ)\vsprintf.obj \
+    $(WIN32KOBJ)\vprintf.obj \
+    $(WIN32KOBJ)\abort.obj \
+    $(WIN32KOBJ)\OS2KTCB.obj \
+    $(WIN32KOBJ)\OS2KPTDA.obj \
+    $(WIN32KOBJ)\env.obj \
+    $(WIN32KOBJ)\vprntf16.obj \
+    $(WIN32KOBJ)\d32init.obj \
+    $(WIN32KOBJ)\d16init.obj_init \
+    $(WIN32KOBJ)\ProbKrnl.obj_init \
+    $(WIN32KOBJ)\SymDB.obj
+
+LASTOBJ =\
+    $(WIN32KOBJ)\devlast.obj
+
+LIBS =\
+    $(VACPATH)\lib\$(RTLLIB_NRE) \
+    $(DDKPATH)\lib\os2386.lib \
+    $(WIN32KOBJ)\devhelp.lib \
+    $(WIN32KOBJ)\clib.lib
+
+
+#
+# kKrnlLib.sys rule. (Don't mess with the order or objects and libraries!)
+#
+$(NAME).sys: $(WIN32KBIN)\$(NAME).sys
+
+$(WIN32KBIN)\$(NAME).sys:   $(WIN32KBIN)\clfix.exe \
+                            $(WIN32KINCLUDE)\options.inc \
+                            $(OBJS) \
+                            $(LIBS) \
+                            $(WIN32KOBJ)\$(NAME)bldlevel.def \
+                            $(LASTOBJ) \
+                            $(LIBSINIT) \
+                            $(WIN32KOBJ)\$(@B).lnk \
+                            Makefile makefile.inc ..\..\..\makefile.inc
+    -@$(ECHO) recompiling d16globl to get correct build time and date:
+    $(CC16) -c $(CFLAGS16) $(CDEFINES16) $(CINCLUDES16) -Fo$(WIN32KOBJ)\d16globl.obj \
+        -Fa$(WIN32KLIST)\d16globl.s dev16\d16globl.c
+    -@$(ECHO) linking: $@
+!ifdef GREP
+    -4 $(LD) $(LFLAGS) @$(WIN32KOBJ)\$(@B).lnk | $(GREP) -v LNK4001 | $(GREP) -v LNK4031
+!else
+    -4 $(LD) $(LFLAGS) @$(WIN32KOBJ)\$(@B).lnk
+!endif
+    cd $(WIN32KBIN)
+    @mapsym $(*B).map > nul
+    cd $(WIN32KBASE)
+    if not exist $(ODIN32_BIN) $(CREATEPATH) $(ODIN32_BIN)
+    $(CP) $@ $(ODIN32_BIN)
+    $(CP) $*.sym $(ODIN32_BIN)
+    $(CP) $(WIN32KBASE)\$(*B).ddp $(ODIN32_BIN)
+
+# Linker file.
+$(WIN32KOBJ)\$(NAME).lnk: Makefile makefile.inc ..\..\..\makefile.inc
+    echo Creating linkerfile: @<<$(WIN32KOBJ)\$(NAME).lnk
+/OUT:$(WIN32KBIN)\$(NAME).sys
+/MAP:$(WIN32KBIN)\$(NAME).map
+$(OBJS:  =^
+)
+/IG
+$(LIBS:  =^
+)
+$(LASTOBJ)
+$(WIN32KOBJ)\$(NAME)bldlevel.def
+<<KEEP
+
+# Add bldlevel signature to kKrnlLib.def - creates temporary kKrnlLibbldlevel.def.
+$(WIN32KOBJ)\$(NAME)bldlevel.def: $(NAME).def Makefile
+    -$(ECHO) Creates $@ with bldlevel signature string.
+    $(BLDLEVELINF) $(NAME).def $@ -R"$(NAME).def" \
+        -V"#define=ODIN32_VERSION,$(ODIN32_INCLUDE)\odinbuild.h" \
+        -M"#define=ODIN32_BUILD_NR,$(ODIN32_INCLUDE)\odinbuild.h"
+
+
+#
+# Win32ktst.exe object configuration.
+#   (It should be as identical as possible to kKrnlLib.sys.)
+#   (Don't mess with the order or objects and libraries!)
+#
+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)\TstFakers.obj \
+    $(WIN32KOBJ)\d16strat.obj \
+    $(WIN32KOBJ)\d32CallGate.obj \
+    $(WIN32KOBJ)\d32hlp.obj \
+    $(WIN32KOBJ)\d32globals.obj \
+    $(WIN32KOBJ)\d16globl.obj \
+    $(WIN32KOBJ)\abort.obj \
+    $(WIN32KOBJ)\asmutils.obj \
+    $(WIN32KOBJ)\calltaba.obj \
+    $(WIN32KOBJ)\locks.obj \
+    $(WIN32KOBJ)\malloc.obj_tst. \
+    $(WIN32KOBJ)\smalloc_avl.obj \
+    $(WIN32KOBJ)\avl.obj \
+    $(WIN32KOBJ)\rmalloc_avl.obj \
+    $(WIN32KOBJ)\new.obj \
+    $(WIN32KOBJ)\env.obj \
+    $(WIN32KOBJ)\PerTaskW32kData.obj \
+    $(WIN32KOBJ)\stricmp.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)\myldrOpenPatha.obj \
+    $(WIN32KOBJ)\myldrFindModule.obj \
+    $(WIN32KOBJ)\myldrCheckInternalName.obj \
+    $(WIN32KOBJ)\myldrGetFileName.obj \
+    $(WIN32KOBJ)\d32Events.obj \
+    $(WIN32KOBJ)\OS2KTCB.obj \
+    $(WIN32KOBJ)\OS2KPTDA.obj \
+    $(WIN32KOBJ)\pe2lx.obj \
+    $(WIN32KOBJ)\ModuleBase.obj \
+    $(WIN32KOBJ)\d32ElfIOCtl.obj \
+    $(WIN32KOBJ)\d32Win32kIOCtl.obj \
+    $(WIN32KOBJ)\d32Win32kOpenClose.obj \
+    $(WIN32KOBJ)\k32AllocMemEx.obj \
+    $(WIN32KOBJ)\k32KillProcessEx.obj \
+    $(WIN32KOBJ)\k32HandleSystemEvent.obj \
+    $(WIN32KOBJ)\k32ProcessReadWrite.obj \
+    $(WIN32KOBJ)\k32QueryCallGate.obj \
+    $(WIN32KOBJ)\k32QueryOTEs.obj \
+    $(WIN32KOBJ)\k32QueryOptionsStatus.obj \
+    $(WIN32KOBJ)\k32QuerySystemMemInfo.obj \
+    $(WIN32KOBJ)\k32SetEnvironment.obj \
+    $(WIN32KOBJ)\k32SetOptions.obj \
+    $(WIN32KOBJ)\mytkExecPgm.obj \
+    $(WIN32KOBJ)\mytkStartProcess.obj \
+    $(WIN32KOBJ)\vprntf16.obj_tst. \
+    $(WIN32KOBJ)\d32init.obj_tst. \
+    $(WIN32KOBJ)\d16init.obj_tst_init. \
+    $(WIN32KOBJ)\ProbKrnl.obj_tst_init. \
+    $(WIN32KOBJ)\SymDB.obj
+
+TSTLASTOBJ = $(LASTOBJ)
+
+TSTLIBS = $(LIBS)
+
+
+#
+# kKrnlLibtst.exe rule.
+#   This is a test executable; kKrnlLib.sys wrapped into an executable with emulation
+#   code for most of the OS/2 kernel dependencies.
+#
+$(NAME)tst.exe: $(WIN32KBIN)\$(NAME)tst.exe
+    $(CP) $(WIN32KBIN)\$@ $@
+$(WIN32KBIN)\$(NAME)tst.exe:    $(WIN32KBIN)\clfix.exe \
+                                Test\TstFakers.c \
+                                $(NAME)tst.def \
+                                $(TSTOBJS:. = ) \
+                                $(TSTLIBS) \
+                                $(TSTLASTOBJ) \
+                                $(WIN32KOBJ)\$(@B).lnk \
+                                Makefile makefile.inc ..\..\..\makefile.inc
+    -@$(ECHO) linking: $@
+!ifdef GREP
+    -4 $(LD) $(LFLAGS) @$(WIN32KOBJ)\$(@B).lnk | $(GREP) -v LNK4001 | $(GREP) -v LNK4031
+!else
+    -4 $(LD) $(LFLAGS) @$(WIN32KOBJ)\$(@B).lnk
+!endif
+
+# Linker file.
+$(WIN32KOBJ)\$(NAME)tst.lnk: Makefile makefile.inc ..\..\..\makefile.inc
+    echo Creating linkerfile: @<<$(WIN32KOBJ)\$(NAME)tst.lnk
+/DEBUG
+/OUT:$(WIN32KBIN)\$(NAME)tst.exe
+/MAP:$(WIN32KBIN)\$(NAME)tst.map
+$(TSTOBJS:  =^
+)
+/IG
+$(TSTLIBS:  =^
+)
+$(TSTLASTOBJ)
+$(NAME)tst.def
+<<KEEP
+
+
+
+#
+#
+#   L i b r a r i e s
+#
+#
+
+#
+# kKrnlLib Import library.
+#
+$(NAME).lib: $(ODIN32_LIB)\$(NAME).lib
+$(ODIN32_LIB)\$(NAME).lib: $(WIN32KBIN)\mkcalltab.exe
+    $(WIN32KBIN)\mkcalltab.exe deffile > $(WIN32KOBJ)\$(NAME)implib.def
+    $(IMPLIB) $(IMPLIB_FLAGS) $@ $(WIN32KOBJ)\$(NAME)implib.def
+
+
+#
+# Libraries - segments are renamed for the 16-bit libraries.
+#
+
+# List of object files in the converted devhelp library.
+DHLPOBJS =  +$(WIN32KOBJ)\dhcall5b.obj +$(WIN32KOBJ)\dhcal11a.obj \
+            +$(WIN32KOBJ)\dhcal11g.obj +$(WIN32KOBJ)\dhret.obj
+
+# Make corrected devhelp library with only the required object files.
+$(WIN32KOBJ)\devhelp.lib: $(DDKPATH)\lib\dhcalls.lib $(WIN32KBIN)\libconv.exe $(DHLPOBJS:+=)
+    @$(RM) $@
+    @cd $(WIN32KOBJ)
+    $(DDKPATH)\tools\lib /nologo $@ $(DHLPOBJS);
+    @cd $(MAKEDIR)
+
+# Convert devhelp library.
+$(WIN32KOBJ)\devhelp_.lib: $(DDKPATH)\lib\dhcalls.lib
+    $(WIN32KBIN)\libconv $** $@
+
+# Extract required object files from the converted devhelp library.
+$(DHLPOBJS:+=): $(WIN32KOBJ)\devhelp_.lib
+    @cd $(WIN32KOBJ)
+    $(DDKPATH)\tools\lib /nologo $** *$@;
+    @cd $(MAKEDIR)
+
+
+# List of object files in the converted crt library.
+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)\anlshl.obj
+
+# Make corrected crt library with only the required object files.
+$(WIN32KOBJ)\clib.lib: $(MSCPATH)\lib\clibcep.lib $(WIN32KBIN)\libconv.exe $(CLIBOBJS:+=)
+    @$(RM) $@
+    @cd $(WIN32KOBJ)
+    $(DDKPATH)\tools\lib /nologo $@ $(CLIBOBJS);
+    @cd $(MAKEDIR)
+
+# Convert devhelp library.
+$(WIN32KOBJ)\clib_.lib: $(MSCPATH)\lib\clibcep.lib
+    $(WIN32KBIN)\libconv $** $@ > nul
+
+# Extract required object files from the converted crt library.
+$(CLIBOBJS:+=): $(WIN32KOBJ)\clib_.lib
+    @cd $(WIN32KOBJ)
+    $(ILIB) $** *$@;
+    @cd $(MAKEDIR)
+
+
+#
+# Make last library.
+#
+$(WIN32KOBJ)\last.lib: $(WIN32KOBJ)\devlast.obj
+    -@$(RM) $@ > nul 2> nul
+    $(ILIB) $@ $**;
+
+
+#
+#
+#   S o u r c e
+#
+#
+
+#
+# Generate calltaba.asm
+#
+dev32\calltaba.asm \
+$(WIN32KBASE)\dev32\calltaba.asm : dev16\probkrnl.c $(WIN32KBIN)\mkcalltab.exe
+    $(WIN32KBIN)\mkcalltab.exe calltab > $@
+
+
+#
+# Generate TstFakers.c
+#
+test\TstFakers.c \
+$(WIN32KBASE)\test\TstFakers.c: dev16\probkrnl.c include\probkrnl.h $(WIN32KBIN)\mkcalltab.exe
+    $(WIN32KBIN)\mkcalltab.exe tstfakers > $@
+
+
+#
+# Make assembly version of options.h; options.inc
+#
+$(WIN32KINCLUDE)\options.inc:  $(WIN32KINCLUDE)\options.h
+    @$(ECHO) H2Inc: $**
+    $(H2INC) $** > $@
+
+
+#
+#
+#   T o o l s
+#
+#
+
+#
+# Make the convert tool.
+#
+libconv.exe: $(WIN32KBIN)\libconv.exe
+$(WIN32KBIN)\libconv.exe: Tools\libconv.c
+    icc -Q+ -Ti+ -Fe$@ -Fo$(WIN32KOBJ)\$(*B).obj $**
+
+
+#
+# Make the MkCallTab.exe utillity.
+#
+
+# MkCallTab objects.
+MKCALLTABOBJS = \
+    $(WIN32KOBJ)\mkcalltab.obj_c \
+    $(WIN32KOBJ)\probkrnl.obj_c \
+    $(WIN32KOBJ)\d16globl.obj_c \
+    $(WIN32KOBJ)\vprntf16.obj_c
+
+# Rule to build MkCallTab.exe
+mkcalltab.exe mkcalltab: $(WIN32KBIN)\mkcalltab.exe
+$(WIN32KBIN)\mkcalltab.exe: $(WIN32KBIN)\clfix.exe $(MKCALLTABOBJS)
+    $(LD) $(LFLAGS) /pmtype:vio @<<$(WIN32KOBJ)\$(@B).lnk
+        /OUT:$@
+        /MAP:$(WIN32KBIN)\$(@B).map
+        $(MKCALLTABOBJS)
+        $(TOOLKIT)\lib\os2286.lib
+        $(MSCPATH)\lib\clibcep.lib
+<<keep
+
+# Interference rule to make the MkCallTab objects.
+{dev16}.c.obj_c:
+    @$(ECHO) compiling 16bit (mkcalltab): $<
+    @$(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp -DDEBUG -DEXTRACT \
+        -Fa$(WIN32KLIST)\$(*B)_c.s -Fo$(WIN32KOBJ)\$(@B).obj_c $(CINCLUDES16) $<
+
+
+#
+# Make the clfix.exe utillity - clfix.exe
+#   This should fix some of the problems we are experiencing with the
+#   MSC v6.0a compiler (cl.exe) (16-bit).
+#
+clfix.exe: $(WIN32KBIN)\clfix.exe
+$(WIN32KBIN)\clfix.exe: Tools\clfix.c
+    $(CC) -Fe$(WIN32KBIN)\$(@F) -Fo$(WIN32KBIN)\$(@B).obj $**
+
+
+#
+# Make the symbol extract utillity - Extract.exe
+#
+
+# Extract object files.
+EXTRACTOBJS = \
+    $(WIN32KOBJ)\extract.obj_e \
+    $(WIN32KOBJ)\probkrnl.obj_e \
+    $(WIN32KOBJ)\d16globl.obj_e \
+    $(WIN32KOBJ)\vprntf16.obj_e
+
+# Rules to build Extract.exe.
+$(WIN32KBIN)\extract.exe: $(WIN32KBIN)\clfix.exe $(EXTRACTOBJS)
+    $(LD) $(LFLAGS) /pmtype:vio @<<$(WIN32KOBJ)\$(@B).lnk
+        /OUT:$@
+        /MAP:$(WIN32KBIN)\$(@B).map
+        $(EXTRACTOBJS)
+        $(TOOLKIT)\lib\os2286.lib
+        $(MSCPATH)\lib\clibcep.lib
+<<keep
+
+# Copy rule.
+extract.exe: $(WIN32KBIN)\extract.exe
+    $(CP) $** $@
+
+# Interference rule to make the Extract objects.
+{dev16}.c.obj_e:
+    @$(ECHO) compiling 16bit (extract): $<
+    @$(CC16) -c -W3 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp -DDEBUG -DEXTRACT \
+        -Fa$(WIN32KLIST)\$(*B)_e.s -Fo$(WIN32KOBJ)\$(@B).obj_e $(CINCLUDES16) $<
+
+
+#
+# Dependencies - all deps are autogenereated.
+#
+dep:
+    $(RM) .depend
+    $(ODIN32_TOOLS)\fastdep @<<
+        -f+ -o$$(WIN32KOBJ) $(CINCLUDES) -xdev32\calltaba.asm -xtest\TstFakers.c
+        dev32\*.c* clib\*.c* kern\*.c* test\*.c*
+        -objobj_tst
+        dev32\*.c* clib\*.c* kern\*.c* test\*.c*
+        $(WIN32KINCLUDE)\*.h
+<<
+    $(ODIN32_TOOLS)\fastdep @<<
+        -a+ -o$$(WIN32KOBJ) -I$(WIN32KINCLUDE) -I$(DDKPATH)\inc
+        -xdev32\calltaba.asm -xtest\TstFakers.c
+        dev16\*.asm dev32\*.asm clib\*.asm kern\*.asm test\*.asm
+        $(WIN32KINCLUDE)\*.inc
+<<
+    $(ODIN32_TOOLS)\fastdep @<<
+        -a+ -o$$(WIN32KOBJ) $(CINCLUDES16)
+        dev16\*.c*
+        -objobj_e           $(CINCLUDES16) dev16\*.c*
+        -objobj_c           $(CINCLUDES16) dev16\*.c*
+        -objobj_tst         $(CINCLUDES16) dev16\*.c*
+        -objobj_init        $(CINCLUDES16) dev16\*.c*
+        -objobj_tst_init    $(CINCLUDES16) dev16\*.c*
+<<
+
+
+#
+# Include the .depend file.
+#
+!if [$(EXISTS) .depend] == 0
+!   include .depend
+!else
+!   if [$(ECHO) .depend doesn't exist]
+!   endif
+!endif
+
+
+#
+# Generate Visual SlickEdit project file
+#
+kKrnlLib.vpj:
+    ..\..\..\tools\vslick\genproject.cmd $@  $(CINCLUDES) -s -r
+
Index: trunk/src/win32k/kKrnlLib/configure.cmd
===================================================================
--- trunk/src/win32k/kKrnlLib/configure.cmd	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/configure.cmd	(revision 6696)
@@ -0,0 +1,267 @@
+/* $Id: configure.cmd,v 1.1 2001-09-11 01:27:21 bird Exp $
+ *
+ * Configuration script.
+ * Generates makefile.inc and an empty .depend file.
+ *
+ * Copyright (c) 1999-2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
+    call SysLoadFuncs;
+
+    /* Argument defaults */
+    fInteractive    = 1;
+    fkKrnlLib         = 1;
+
+    /* parse arguments */
+    parse arg asArgs.1 asArgs.2 asArgs.3 asArgs.4 asArgs.5 asArgs.6 asArgs.7 asArgs.8 asArgs.9
+    asArgs.0 = 0;
+    do i = 1 to 9
+        if (asArgs.i <> '') then
+            asArgs.0 = i;
+    end
+    do i = 1 to asArgs.0
+        if (substr(asArgs.i, 1, 1) = '-' | substr(asArgs.i, 1, 1) = '/')  then
+        do
+            sArg = translate(substr(asArgs.i, 2));
+            ch = substr(sArg, 1, 1);
+            select
+                when (ch = 'N') then
+                    fInteractive = 0;
+                when (ch = 'I') then
+                    fInteractive = 1;
+                when (ch = 'W') then
+                    fkKrnlLib = 0;
+                when (ch = '?' | ch = 'H' | substr(sArg, 1, 2) = '-H') then
+                do
+                    say 'Odin32 Configure.cmd. $Revision: 1.1 $.'
+                    say 'syntax: Configure.cmd [-n] [-w]'
+                    say '  -n   Noninteractive.'
+                    say '  -w   Don''t build kKrnlLib.'
+                    say '  -h   This text.'
+                    exit(1);
+                end
+                otherwise
+                    say 'syntax error ('asArgs.i')';
+                    exit(2);
+            end
+        end
+    end
+
+    /* strings */
+    sIncFile='Makefile.inc';
+
+    /* delete old target files */
+    call SysFileDelete sIncFile;
+
+    /* open target file */
+    if (stream(sIncFile, 'c', 'open write' ) <> '') then
+    do
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# Generated by 'directory()'\configure.cmd'
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, ''
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# BASE DIRECTORIES - kKrnlLib'
+        call lineout sIncFile, '# Note! These should be absolute paths!'
+        call lineout sIncFile, '################################################################################'
+        kKrnlLibBase = directory();
+        call lineout sIncFile, 'WIN32KBASE       =' kKrnlLibBase;
+        call lineout sIncFile, 'WIN32KDEV16      =' kKrnlLibBase'\dev16'
+        call lineout sIncFile, 'WIN32KDEV32      =' kKrnlLibBase'\dev32'
+        call lineout sIncFile, 'WIN32KELF2LX     =' kKrnlLibBase'\elf2lx'
+        call lineout sIncFile, 'WIN32KINCLUDE    =' kKrnlLibBase'\include'
+        call lineout sIncFile, 'WIN32KK32        =' kKrnlLibBase'\k32'
+        call lineout sIncFile, 'WIN32KLDR        =' kKrnlLibBase'\ldr'
+        call lineout sIncFile, 'WIN32KLIB        =' kKrnlLibBase'\lib'
+        call lineout sIncFile, 'WIN32KMISC       =' kKrnlLibBase'\misc'
+        call lineout sIncFile, 'WIN32KPE2LX      =' kKrnlLibBase'\pe2lx'
+        call lineout sIncFile, '!ifdef DEBUG'
+        call lineout sIncFile, 'WIN32KBIN        =' kKrnlLibBase'\out\bin\debug.$(CCENV)'
+        call lineout sIncFile, 'WIN32KLIST       =' kKrnlLibBase'\out\list\debug.$(CCENV)'
+        call lineout sIncFile, 'WIN32KOBJ        =' kKrnlLibBase'\out\object\debug.$(CCENV)'
+        call lineout sIncFile, '!else'
+        call lineout sIncFile, 'WIN32KBIN        =' kKrnlLibBase'\out\bin\release.$(CCENV)'
+        call lineout sIncFile, 'WIN32KLIST       =' kKrnlLibBase'\out\list\release.$(CCENV)'
+        call lineout sIncFile, 'WIN32KOBJ        =' kKrnlLibBase'\out\object\release.$(CCENV)'
+        call lineout sIncFile, '!endif'
+        call lineout sIncFile, 'WIN32KOBJECT     = $(WIN32KOBJ)'
+        call lineout sIncFile, ''
+
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# DDKPATH: base directory of ddk base (i.e. \DDK\BASE not \DDK for DDK v4.0+).'
+        call lineout sIncFile, '################################################################################'
+        sDDK = SearchPaths('INCLUDE', '..\h\dhcalls.h', 'PATH', '..\h\dhcalls.h', 'BOOKSHELF', '..\base\.\h\dhcalls.h', 'Path to DDK "\BASE" directory (i.e. F:\DDK\BASE):');
+        sDDK = ValidatePath(sDDK, 'h\devhdr.h', 'DDK Base Path');
+        call lineout sIncFile, 'DDKPATH          =' sDDK
+        call lineout sIncFile, ''
+
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# OS/2 TOOLKIT'
+        call lineout sIncFile, '################################################################################'
+        sTLKT = SearchPaths('INCLUDE', '..\h\os2.h', 'PATH', '..\h\os2.h', 'BOOKSHELF', '..\h\os2.h', 'Path to OS/2 Toolkit directory:');
+        sTLKT = ValidatePath(sTLKT, 'h\bsememf.h', 'OS/2 Toolkit Path');
+        call lineout sIncFile, 'TOOLKIT          =' sTLKT
+        call lineout sIncFile, ''
+
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# IBM VisualAge for C++ base path'
+        call lineout sIncFile, '################################################################################'
+        sVA = Value('CPPMAIN',, 'OS2ENVIRONMENT'); /* not sure if CPPMAIN or CPPLOCAL is the one to search... */
+        if (sVA <> '' & stream(sVA'\bin\icc.exe', 'c', 'query exists') = '') then
+            sVA = ''
+        if (sVA = '') then
+            sVA = SearchPaths('PATH', '..\bin\icc.exe', 'BOOKSHELF', '..\bin\icc.exe', 'Path to IBM VisualAge for C++ or IBM C and C++ Compilers, and set its environment you compile:');
+        sVA = ValidatePath(sVA, 'bin\icc.exe', 'VisualAge Path');
+        call lineout sIncFile, 'VACPATH          =' sVA
+        call lineout sIncFile, ''
+
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# Microsoft C v6.0, v6.0a or v7.0'
+        call lineout sIncFile, '################################################################################'
+        sMSC = SearchPaths('PATH', '..\binp\c3l.exe', 'INCLUDE', '..\binp\c3l.exe','LIB', '..\binp\c3l.exe', 'Path to Microsoft C v6.0, v6.0a or v7.0 directory:');
+        sMSC = ValidatePath(sMSC, 'binp\cl.exe', 'Microsoft C Path');
+        call lineout sIncFile, 'MSCPATH          =' sMSC
+        call lineout sIncFile, ''
+
+        call lineout sIncFile, '################################################################################'
+        call lineout sIncFile, '# Grep'
+        call lineout sIncFile, '################################################################################'
+        sGrep = SearchPaths('PATH', 'grep.exe', 'Path to UNIX-like grep utility which supports -v.');
+        if (sGrep <> '') then
+            call lineout sIncFile, 'GREP             =' sGrep || '\grep.exe'
+        call lineout sIncFile, ''
+
+        call stream sIncFile, 'c', 'close';
+
+        /*
+         * Create output directories.
+         */
+        '@mkdir out > nul 2> nul'
+
+        '@mkdir out\bin > nul 2> nul'
+        '@mkdir out\bin\Release.vac3 > nul 2> nul'
+        '@mkdir out\bin\Release.vac36 > nul 2> nul'
+        '@mkdir out\bin\Debug.vac3 > nul 2> nul'
+        '@mkdir out\bin\Debug.vac36 > nul 2> nul'
+
+        '@mkdir out\list > nul 2> nul'
+        '@mkdir out\list\Release.vac3 > nul 2> nul'
+        '@mkdir out\list\Release.vac36 > nul 2> nul'
+        '@mkdir out\list\Debug.vac3 > nul 2> nul'
+        '@mkdir out\list\Debug.vac36 > nul 2> nul'
+
+        '@mkdir out\object > nul 2> nul'
+        '@mkdir out\object\Debug.vac3 > nul 2> nul'
+        '@mkdir out\object\Debug.vac36 > nul 2> nul'
+        '@mkdir out\object\Release.vac3 > nul 2> nul'
+        '@mkdir out\object\Release.vac36 > nul 2> nul'
+
+        /*
+         * Display output.
+         */
+        if (0 /*fInteractive = 1*/) then /* currently disabled since we're now called from main config. */
+        do
+            say 'Configuration completed!'
+            say ''
+            say 'You should now verify that the settings are correct by listing the file';
+            say ''''sIncFile'''';
+            say ''
+            say 'Remember to do a ''nmake dep'' before making kKrnlLib.'
+        end
+    end
+    else
+    do
+        say 'oops, failed to open outputfile,' sIncFile;
+        exit 1;
+    end
+    exit 0;
+
+
+
+/*****************/
+/* function area */
+/*****************/
+
+
+/**
+ * SearchPaths
+ * Parameters:
+ *   Takes pair of <envionment variable name> and <filename> as parameters
+ *   As final optional parameter you may specify a question to request the string from the user.
+ * Returns:
+ *   sPath-sFile ignoring '..\'s in sFile.
+ */
+SearchPaths: procedure expose fInteractive fkKrnlLib;
+    /*
+     * Check if there is need to waste time searching.
+     * Init local variables.
+     */
+    if (\fkKrnlLib) then
+        return '';
+    i = 1;
+    sPath = '';
+
+    /*
+     * Search for the given environments/files combinations.
+     */
+    do i = 2 to arg() by 2
+        sEnv  = arg(i-1);
+        sFile = arg(i);
+        /* say i':' sEnv '-' sFile; */
+        sPath = SysSearchPath(sEnv, sFile);
+        /* say 'SysSearchPath('sEnv',' sFile') ->' sPath; */
+        if (sPath <> '') then
+           leave;
+    end
+
+    /* did we find it? */
+    if (sPath = '') then
+    do  /*
+         * If interactive mode, we'll ask for the the path, else skip it.
+         */
+        say arg(arg());
+        if (fInteractive = 1) then
+            sPath = linein();
+        else
+            say '!ignored!';
+    end
+    else
+    do  /*
+         * Trim the result for the file part.
+         */
+        /* look for .\ or ..\ */
+        i = lastpos('.\', sFile);
+        if (i <> 0) then
+            sFile = substr(sFile, i + 1);
+
+        /* cut equally */
+        i = lastpos(sFile, sPath);
+        if (i = 0) then
+            say '!error! sFile:'sFile  'sPath:'sPath;
+        /* debug: say 'sPath:'sPath  'sFile:'sFile */
+        sPath = strip(substr(sPath, 1, i-1), 'T', '\');
+    end
+
+return sPath;
+
+
+/**
+ * Validate if a file exists to ensure that the given path is valid.
+ * @returns The path if valid. If invalid an empty string is returned.
+ */
+ValidatePath: procedure expose fkKrnlLib
+    parse arg sPath, sFile, sDesc
+
+    if (strip(sPath) = "" & \fkKrnlLib) then
+        return "";
+
+    rc = stream(sPath'\'sFile, 'c', 'query exists')
+    if (rc <> '') then
+        return sPath;
+    say 'Warning: Validatation of the' sPath 'failed. kKrnlLib.sys will not be built.'
+    say '         path='sPath;
+return '';
+
Index: trunk/src/win32k/kKrnlLib/include/dev16.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/dev16.h	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/include/dev16.h	(revision 6696)
@@ -0,0 +1,178 @@
+/* $Id: dev16.h,v 1.1 2001-09-11 01:27:27 bird Exp $
+ * dev16 - 16-bit specific. Should not be used in 32-bit C/C++.
+ *
+ * Copyright (c) 1999 knut st. osmundsen
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+#ifndef _d16_h_
+#define _d16_h_
+
+#ifndef VMDHA_USEHIGHMEM /* macro from dhcalls.h where LIN and PLIN normally is declared. */
+typedef ULONG       LIN;
+typedef ULONG  FAR *PLIN;
+#endif
+#ifndef MAX_DISKDD_CMD   /* macro from reqpkt.h where these normally is declared. */
+typedef void   FAR *PRPINITIN;
+typedef void   FAR *PRPINITOUT;
+typedef void   FAR *PRP_GENIOCTL;
+typedef ULONG       DDHDR;
+#endif
+
+/*
+ * Ring 0 init IOCtl (dev1 -> dev0)
+ */
+#define D16_IOCTL_CAT               0xC0
+
+/*
+ * Get Kernel OTEs. No params. Data is KRNLOBJTABLE (dev1632.h).
+ */
+#define D16_IOCTL_GETKRNLINFO       0x40
+
+
+/*
+ * Verify aImportTab. No params. No data (aImportTab is used).
+ */
+#define D16_IOCTL_VERIFYIMPORTTAB   0x41
+typedef struct _D16VERIFYIMPORTTABDATA
+{
+    USHORT usRc;
+} D16VERIFYIMPORTTABDATA;
+typedef D16VERIFYIMPORTTABDATA FAR *PD16VERIFYIMPORTTABDATA;
+
+
+/**
+ * Regards goes to Matthieu Willm for (parts of) this!
+ */
+#ifdef INCL_16
+    typedef void FAR * FPVOID;
+#else
+    typedef ULONG FPVOID;
+#endif
+typedef struct _DosTable /* dt */
+{
+    UCHAR  cul;             /* count of entries (dwords) in this table.*/
+    FPVOID fph_HardError;
+    FPVOID fph_UCase;
+    ULONG  UnknownOrReserved1;
+    ULONG  UnknownOrReserved2;
+    ULONG  UnknownOrReserved3;
+    FPVOID fph_MemMapAlias;
+    FPVOID fph_MemUnmapAlias;
+    FPVOID fph_GoProtAll;
+    FPVOID fph_GoRealAll;
+    FPVOID fph_doshlp_RedirDev;
+    ULONG  UnknownOrReserved4;
+    ULONG  UnknownOrReserved5;
+    FPVOID fph_SFFromSFN;
+    FPVOID fph_SegGetInfo;
+    FPVOID fph_AsgCheckDrive;
+    ULONG  UnknownOrReserved6;
+    ULONG  UnknownOrReserved7;
+} DOSTABLE, FAR *PDOSTABLE , NEAR *NPDOSTABLE;
+
+typedef struct _DosTable2 /* dt2 */
+{
+    UCHAR  cul;             /* count of entries (dwords) in this table.*/
+    FPVOID fpErrMap24;
+    FPVOID fpErrMap24End;
+    FPVOID fpErr_Table_24;
+    FPVOID fpCDSAddr;
+    FPVOID fpGDT_RDR1;
+    FPVOID fpInterrupLevel;
+    FPVOID fp_cInDos;
+    ULONG  UnknownOrReserved1;
+    ULONG  UnknownOrReserved2;
+    ULONG  R0FlatCS;
+    ULONG  R0FlatDS;
+    LIN    pTKSSBase;
+    LIN    pintSwitchStack;
+    LIN    pprivatStack;
+    FPVOID fpPhysDiskTablePtr;
+    LIN    pforceEMHandler;
+    LIN    pReserveVM;
+    LIN    p_pgpPageDir;
+    ULONG  UnknownOrReserved3;
+} DOSTABLE2, FAR *PDOSTABLE2 , NEAR *NPDOSTABLE2;
+
+
+/*
+ * init functions
+ */
+USHORT NEAR devInit(PRPINITIN pRpIn, PRPINITOUT pRpOut);
+USHORT NEAR R0Init16(PRP_GENIOCTL pRp);
+USHORT NEAR initGetDosTableData(void);
+ULONG  NEAR GetR0InitPtr(void);
+
+/*
+ * Thunking "functions" prototypes
+ */
+ULONG  NEAR CallR0Addr32bit(LIN ulAddr, ULONG ulParam);
+USHORT NEAR CallGetKernelInfo32(ULONG addressKrnlInfoBuf);
+USHORT NEAR CallVerifyImportTab32(void);
+
+
+/*
+ * These are only for use in the 'aDevHdrs'.
+ */
+extern void NEAR strategyAsm0(void);
+extern void NEAR strategyAsm1(void);
+
+/*
+ * Global data.
+ */
+extern DDHDR    aDevHdrs[2];
+extern PFN      Device_Help;
+extern ULONG    TKSSBase16;
+extern USHORT   R0FlatCS16;
+extern USHORT   R0FlatDS16;
+extern LIN      linDT;
+extern LIN      linDT2;
+extern BOOL     fInitTime;
+
+
+/*
+ * Stack to Flat DS - 16-bit version.
+ */
+/*#define SSToDS_16(pStackVar) ((LIN)(getTKSSBaseValue() + (ULONG)(USHORT)(pStackVar)))*/
+#define SSToDS_16(pStackVar) (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 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      ;
+extern char PASCAL BSS32START       ;
+extern char PASCAL CONST32_ROSTART  ;
+extern char PASCAL _VFTSTART        ;
+extern char PASCAL EH_DATASTART     ;
+
+extern char PASCAL CODE16END      ;
+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      ;
+extern char PASCAL BSS32END       ;
+extern char PASCAL CONST32_ROEND  ;
+extern char PASCAL _VFTEND        ;
+extern char PASCAL EH_DATAEND     ;
+
+
+#endif
Index: trunk/src/win32k/kKrnlLib/include/dev1632.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/dev1632.h	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/include/dev1632.h	(revision 6696)
@@ -0,0 +1,83 @@
+/* $Id: dev1632.h,v 1.1 2001-09-11 01:27:27 bird Exp $
+ * dev1632.h - Common header file for 16-bit and 32-bit C
+ *
+ * Copyright (c) 1999 knut st. osmundsen
+ *
+ */
+
+#ifndef _dev1632_h_
+#define _dev1632_h_
+
+#pragma pack(1)
+
+typedef struct _RPH32
+{
+  UCHAR         Len;
+  UCHAR         Unit;
+  UCHAR         Cmd;
+  USHORT        Status;
+  UCHAR         Flags;
+  UCHAR         Reserved_1[3];
+  ULONG         Link;
+} RPH32;
+
+typedef struct _RP32INIT
+{
+    RPH32       rph;
+    UCHAR       Unit;
+    ULONG       DevHlpEP; /* 16 bit far pointer */
+    PSZ         InitArgs;
+    UCHAR       DriveNum;
+} RP32INIT;
+
+typedef struct _RP32GENIOCTL
+{
+    RPH32       rph;
+    UCHAR       Category;
+    UCHAR       Function;
+    PVOID       ParmPacket;
+    PVOID       DataPacket;
+    USHORT      sfn;
+    USHORT      ParmLen;
+    USHORT      DataLen;
+} RP32GENIOCTL, *PRP32GENIOCTL;
+
+typedef struct _RP32OPENCLOSE
+{
+    RPH32       rph;
+    USHORT      sfn;
+} RP32OPENCLOSE, *PRP32OPENCLOSE;
+
+#ifdef _OS2KLDR_H_
+
+
+#define MAXKRNLOBJECTS 24
+typedef struct _KRNLINFO
+{
+    unsigned long   ulBuild;
+    unsigned short  fKernel;
+    unsigned char   cObjects;
+    unsigned char   chPadding;
+    OTE             aObjects[MAXKRNLOBJECTS];
+} KRNLINFO, FAR * PKRNLINFO;
+
+#else
+
+#define PKRNLINFO void *
+
+#endif
+
+#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/kKrnlLib/include/dev32.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/dev32.h	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/include/dev32.h	(revision 6696)
@@ -0,0 +1,144 @@
+/* $Id: dev32.h,v 1.1 2001-09-11 01:27:27 bird Exp $
+ *
+ * dev32 - header file for 32-bit part of the driver.
+ *
+ * Copyright (c) 1999 knut st. osmundsen
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+#ifndef _dev32_h_
+#define _dev32_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Wrapper for declaration from dev1632.h used in this file.
+ */
+#ifndef _dev1632_h_
+    #define RP32INIT        void
+    #define PRP32INIT       void *
+    #define RP32GENIOCTL    void
+    #define PRP32GENIOCTL   void *
+    #define RP32GENIOCTL    void
+    #define PRP32GENIOCTL   void *
+    #define RP32OPENCLOSE   void
+    #define PRP32OPENCLOSE  void *
+    #define PKRNLINFO       void *
+#endif
+
+
+/*
+ * Defines from reqpkt.h.
+ */
+#define MAX_DISKDD_CMD      29
+
+#define STERR               0x8000      /* Bit 15 - Error                   */
+#define STINTER             0x0400      /* Bit 10 - Interim character       */
+#define STBUI               0x0200      /* Bit  9 - Busy                    */
+#define STDON               0x0100      /* Bit  8 - Done                    */
+#define STECODE             0x00FF      /* Error code                       */
+#define WRECODE             0x0000
+
+#define STATUS_DONE         0x0100
+#define STATUS_ERR_UNKCMD   0x8003
+
+
+#define RPF_Int13RP         0x01        /* Int 13 Request Packet            */
+#define RPF_CallOutDone     0x02        /* Int 13 Callout completed         */
+#define RPF_PktDiskIOTchd   0x04        /* Disk_IO has touched this packet  */
+#define RPF_CHS_ADDRESSING  0x08        /* CHS Addressing used in RBA field */
+#define RPF_Internal        0x10        /* Internal request packet command  */
+#define RPF_TraceComplete   0x20        /* Trace completion flag            */
+
+
+/*
+ * Function prototypes.
+ */
+#if !defined(__cplusplus) && defined(RING0)
+USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit);
+USHORT _loadds _Far32 _Pascal GetKernelInfo32(PKRNLINFO pKrnlInfo);
+USHORT _loadds _Far32 _Pascal VerifyImportTab32(void);
+USHORT _loadds _Far32 _Pascal ElfIOCtl(PRP32GENIOCTL pRpIOCtl);
+USHORT _loadds _Far32 _Pascal Win32kIOCtl(PRP32GENIOCTL pRpIOCtl);
+USHORT _loadds _Far32 _Pascal Win32kOpen(PRP32OPENCLOSE pRpOpen);
+USHORT _loadds _Far32 _Pascal Win32kClose(PRP32OPENCLOSE pRpClose);
+#endif
+#ifdef _OS2KLDR_H_
+PMTE _System GetOS2KrnlMTE(void); /* (devfirst.asm) */
+#endif
+ULONG  _Optlink InitCallGate(void);
+ULONG  _Optlink x86DisableWriteProtect(void);
+ULONG  _Optlink x86RestoreWriteProtect(ULONG flWP);
+
+
+
+/*
+ * Global variables
+ */
+extern PULONG pulTKSSBase32;
+extern USHORT CallGateGDT;
+
+/*
+ * SSToDS( stack pointer )
+ *
+ * In RING-0 this translates pointers to stack memory in the
+ * Stack Segment (SS) to pointers to stack memory in the
+ * Data Segment (DS). SS is 16-bit compatible, DS is 32-bit flat.
+ * It is vitally important to use this macro whenever creating
+ * a pointer to stack memory which don't implies that is a pointer
+ * relative to SS. For example when passing the pointer to an stack
+ * variable into an function call; like the addToModule calls.
+ *
+ * Warning - At init-time you have ot make sure that the pulTKSSBase32 pointer is set!
+ *
+ * @returns    32-bit FLAT pointer.
+ */
+#ifdef RING0
+    #define SSToDS(a)   ((PVOID)((ULONG)(a) + *pulTKSSBase32))
+#else
+    #define SSToDS(a)   ((PVOID)(a))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*
+ * START and END labels. NOTE: these are not bytes only assembly labels.
+ */
+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      ;
+extern char BSS32START       ;
+extern char CONST32_ROSTART  ;
+extern char _VFTSTART        ;
+extern char EH_DATASTART     ;
+
+extern char CODE16END      ;
+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      ;
+extern char BSS32END       ;
+extern char CONST32_ROEND  ;
+extern char _VFTEND        ;
+extern char EH_DATAEND     ;
+
+#endif
Index: trunk/src/win32k/kKrnlLib/include/dev32hlp.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/dev32hlp.h	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/include/dev32hlp.h	(revision 6696)
@@ -0,0 +1,132 @@
+/* $Id: dev32hlp.h,v 1.1 2001-09-11 01:27:27 bird Exp $
+ *
+ * Dev32Hlp - 32-bit Device helpers.
+ *
+ * Copyright (c) 1999 knut st. osmundsen
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+#ifndef _dev32hlp_h_
+#define _dev32hlp_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*******************************************************************************
+*   Defined Constants                                                          *
+*******************************************************************************/
+#define D32HLPCALL _Optlink
+#define D32RET     ULONG
+
+
+/*
+ * D32Hlp_VMAlloc
+ */
+#define VMDHA_16M               0x0001UL
+#define VMDHA_FIXED             0x0002UL
+#define VMDHA_SWAP              0x0004UL
+#define VMDHA_CONTIG            0x0008UL
+#define VMDHA_PHYS              0x0010UL
+#define VMDHA_PROCESS           0x0020UL
+#define VMDHA_SGSCONT           0x0040UL
+#define VMDHA_RESERVE           0x0100UL
+#define VMDHA_USEHIGHMEM        0x0800UL
+
+/*
+ * D32Hlp_VMLock
+ */
+#define VMDHL_NOBLOCK           0x0001UL
+#define VMDHL_CONTIGUOUS        0x0002UL
+#define VMDHL_16M               0x0004UL
+#define VMDHL_WRITE             0x0008UL
+#define VMDHL_LONG              0x0010UL
+#define VMDHL_VERIFY            0x0020UL
+
+/*
+ * D32Hlp_VMSetMem
+ */
+#define VMDHS_DECOMMIT          0x0001UL
+#define VMDHS_RESIDENT          0x0002UL
+#define VMDHS_SWAP              0x0004UL
+
+/*
+ * D32Hlp_GetDOSVar
+ */
+/*                                       0  reserved */
+#define DHGETDOSV_SYSINFOSEG             1
+#define DHGETDOSV_LOCINFOSEG             2
+/*                                       3  reserved */
+#define DHGETDOSV_VECTORSDF              4
+#define DHGETDOSV_VECTORREBOOT           5
+#define DHGETDOSV_YIELDFLAG              7
+#define DHGETDOSV_TCYIELDFLAG            8
+#define DHGETDOSV_DOSTABLES              9  /* undocumented */
+#define DHGETDOSV_STRP_COMMON           10  /* undocumented */
+#define DHGETDOSV_DOSCODEPAGE           11
+#define DHGETDOSV_INTERRUPTLEV          13
+#define DHGETDOSV_DEVICECLASSTABLE      14
+#define DHGETDOSV_DMQSSELECTOR          15
+#define DHGETDOSV_APMINFO               16
+#define DHGETDOSV_APM_LENGTH            17  /* undocumented? */
+
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#ifndef __infoseg_h
+#define __infoseg_h
+#include <infoseg.h>
+#endif
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct vmlh_s /* #memb 5 size 12 (0x00c) */
+{
+    unsigned                lh_page  : 20,     /* off:   0(00)  size:  4(04) */
+                            lh_flags : 12;
+    short                   lh_hptda;          /* off:   4(04)  size:  2(02) */
+    short                   lh_npages;         /* off:   6(06)  size:  2(02) */
+    short                   lh_hob;            /* off:   8(08)  size:  2(02) */
+    short                   lh_sig;            /* off:  10(0a)  size:  2(02) */
+} LOCKHANDLE, *PLOCKHANDLE;
+
+
+/*******************************************************************************
+*   Function Prototypes                                                        *
+*******************************************************************************/
+PVOID  D32HLPCALL D32Hlp_VirtToLin(ULONG  ulPtr16);
+PVOID  D32HLPCALL D32Hlp_VirtToLin2(USHORT usSelector,
+                                    ULONG  ulOffset);
+D32RET D32HLPCALL D32Hlp_VirtToLin3(USHORT usSelector,
+                                    ULONG  ulOffset,
+                                    PPVOID ppvLinAddress);
+PVOID  D32HLPCALL D32Hlp_GetDOSVar(USHORT ulVarNumber, USHORT ulVarMember);
+VOID   D32HLPCALL D32Hlp_Yield(VOID);
+PVOID  D32HLPCALL D32Hlp_VMAlloc(ULONG  flFlags,
+                                 ULONG  cbSize,
+                                 ULONG  ulPhysAddr);
+D32RET D32HLPCALL D32Hlp_VMFree(PVOID pvAddress);
+D32RET D32HLPCALL D32Hlp_VMSetMem(PVOID pvAddress,
+                                  ULONG cbSize,
+                                  ULONG flFlags);
+D32RET D32HLPCALL D32Hlp_VMLock(PVOID   pvAddress,
+                                ULONG   ulLength,
+                                ULONG   flFlags,
+                                PVOID   pvPagelist,
+                                PLOCKHANDLE  pLockHandle,
+                                PULONG  pulPageListCount);
+D32RET D32HLPCALL D32Hlp_VMLock2(PVOID   pvAddress,
+                                 ULONG   ulLength,
+                                 ULONG   flFlags,
+                                 PLOCKHANDLE  pLockHandle);
+D32RET D32HLPCALL D32Hlp_VMUnLock(PLOCKHANDLE pLockHandle);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: trunk/src/win32k/kKrnlLib/include/devSegDf.inc
===================================================================
--- trunk/src/win32k/kKrnlLib/include/devSegDf.inc	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/include/devSegDf.inc	(revision 6696)
@@ -0,0 +1,101 @@
+; $Id: devSegDf.inc,v 1.1 2001-09-11 01:27:27 bird Exp $
+;
+; Segment definitions for win32k.sys.
+;
+; Copyright (c) 1998-2000 knut st. osmundsen
+;
+; Project Odin Software License can be found in LICENSE.TXT
+;
+
+
+DATA16 segment word public 'FAR_DATA' use16
+DATA16 ends
+
+DATA16_BSS segment word public 'FAR_DATA' use16
+DATA16_BSS ends
+
+DATA16_CONST segment word public 'FAR_DATA' use16
+DATA16_CONST ends
+
+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
+
+KKLENTRYFIXUPS segment word public 'FAR_DATA' use16
+KKLENTRYFIXUPS 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, KKLENTRYFIXUPS, 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
+
+
+CODE32 segment dword public 'CODE' use32
+CODE32 ends
+
+EH_CODE segment dword public 'CODE' use32
+EH_CODE ends
+
+
+;DGROUP group BSS32, DATA32
+DGROUP group BSS32, DATA32, CONST32_RO, _VFT, c_common, DDE4_DATA32, CTOR_DTOR1, CTOR_DTOR2, CTOR_DTOR3, EH_DATA, KKLENTRY
+
+DATA32  segment dword public 'DATA' use32
+DATA32 ends
+
+c_common segment dword public 'DATA' use32
+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
+
+CONST32_RO segment dword public 'CONST' use32
+CONST32_RO ends
+
+_VFT segment dword public 'CONST' use32
+_VFT ends
+
+EH_DATA segment byte public 'CONST' use32
+EH_DATA ends
+
+KKLENTRY segment dword public 'DATA' use32
+KKLENTRY ends
+
+
Index: trunk/src/win32k/kKrnlLib/include/devsegdf.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/devsegdf.h	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/include/devsegdf.h	(revision 6696)
@@ -0,0 +1,38 @@
+/* $Id: devsegdf.h,v 1.1 2001-09-11 01:27:27 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/kKrnlLib/include/kKLInitHlp.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/kKLInitHlp.h	(revision 6695)
+++ trunk/src/win32k/kKrnlLib/include/kKLInitHlp.h	(revision 6696)
@@ -1,3 +1,3 @@
-/* $Id: kKLInitHlp.h,v 1.1 2001-09-11 00:54:06 bird Exp $
+/* $Id: kKLInitHlp.h,v 1.2 2001-09-11 01:27:28 bird Exp $
  *
  * Definition of the R0 initiation helper IOCtl interface.
@@ -17,5 +17,5 @@
  * Ring 0 init helper IOCtl
  */
-#define KKL_DRIVE_NAME              "kKrnlHlp"
+#define KKL_DEVICE_NAME             "kKrnlHlp"
 #define KKL_IOCTL_CAT               0xC1
 #define KKL_IOCTL_RING0INIT         0x42
Index: trunk/src/win32k/kKrnlLib/kKrnlLib.ddp
===================================================================
--- trunk/src/win32k/kKrnlLib/kKrnlLib.ddp	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/kKrnlLib.ddp	(revision 6696)
@@ -0,0 +1,16 @@
+* $Id: kKrnlLib.ddp,v 1.1 2001-09-11 01:27:21 bird Exp $
+*
+* kKrnlLib.sys
+*
+* Copyright (c) 1998-2001 knut st. osmundsen (kosmunds@csc.com)
+*
+
+:TITLE
+kKrnlLib - Odin32 Ring-0 Kernel Library
+
+:FILES
+kKrnlLib.sys \os2\boot\kKrnlLib.sys
+kKrnlLib.sym \os2\boot\kKrnlLib.sym
+
+:CONFIG
+device=\os2\boot\kKrnlLib.sys
Index: trunk/src/win32k/kKrnlLib/kKrnlLib.def
===================================================================
--- trunk/src/win32k/kKrnlLib/kKrnlLib.def	(revision 6696)
+++ trunk/src/win32k/kKrnlLib/kKrnlLib.def	(revision 6696)
@@ -0,0 +1,33 @@
+;******************************************************************************
+; Copyright 1998-2001 knut st. osmundsen
+; Definition file for kKrnlLib
+; Project Odin Software License can be found in LICENSE.TXT
+;******************************************************************************
+PHYSICAL DEVICE kKrnlLib
+DESCRIPTION "Odin32 Ring-0 Kernel Library - copyright (c) 1998-2001 knut st. osmundsen"
+
+CODE PRELOAD EXECUTEREAD
+DATA PRELOAD
+
+SEGMENTS
+    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'
+
+
