Index: trunk/src/win32k/kKrnlLib/include/d16crt.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/d16crt.h	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/include/d16crt.h	(revision 8144)
@@ -0,0 +1,37 @@
+/* $Id: d16crt.h,v 1.1 2002-03-31 19:30:40 bird Exp $
+ *
+ * Moved all the crt replacements used by the 16-bit part into one file.
+ *
+ * Copyright (c) 1998-2002 knut st. osmundsen (bird@anduin.net)
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+
+#ifndef _dev16crt_h_
+#define _dev16crt_h_
+
+
+/* File an output replacements */
+HFILE    fopen(const char * pszFilename, const char * pszIgnored);
+int      fread(void * pvBuffer, unsigned short cbBlock, unsigned short cBlock,  HFILE hFile);
+int      fseek(HFILE hfile, signed long off, int iOrg);
+unsigned long fsize(HFILE hFile);
+int      feof(HFILE hFile);
+char *   fgets(char * psz, int num, HFILE hFile);
+
+/* C-library replacements and additions. */
+void *   kmemcpy(char *psz1, const char *psz2, int cch);
+char *   kstrstr(const char *psz1, const char *psz2);
+int      kstrcmp(const char *psz1, const char *psz2);
+int      kstrncmp(const char *psz1, const char *psz2, int cch);
+int      kstrnicmp(const char *psz1, const char *psz2, int cch);
+int      kstrlen(const char *psz);
+char *   kstrcpy(char * pszTarget, const char * pszSource);
+char *   kstrncpy(char * pszTarget, const char * pszSource, int cch);
+char *   kstrcat(char * pszTarget, const char * pszSource);
+char *   kstrtok(char * pszTarget, const char * pszToken);
+int      kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen);
+
+#endif
Index: trunk/src/win32k/kKrnlLib/include/d16vprintf.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/d16vprintf.h	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/include/d16vprintf.h	(revision 8144)
@@ -0,0 +1,41 @@
+/* $Id: d16vprintf.h,v 1.1 2002-03-31 19:30:40 bird Exp $
+ *
+ * printf/vprintf header file - 16bit.
+ *
+ * WARNING: Do not include stdarg.h! AND it's only for use during init!!!
+ *
+ * Copyright (c) 1999 knut st. osmundsen
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+#ifndef _vprintf_h_
+#define _vprintf_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Argument definitions.
+ */
+typedef char _far *va_list;
+#define va_start(ap,v) ap = (va_list)&v + sizeof(v)
+#define va_arg(ap, t) ((t _far *)(ap += sizeof(t)))[-1]
+#define va_end(ap) ap = NULL
+
+
+/*
+ * Function prototypes
+ */
+int FAR printf16(const char *pszFormat, ...);
+int FAR vprintf16(const char *pszFormat, va_list args);
+
+/*#pragma alloc_text(CODE16, printf16, vprintf16)*/
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: trunk/src/win32k/kKrnlLib/kKrnlLibR3Tst.def
===================================================================
--- trunk/src/win32k/kKrnlLib/kKrnlLibR3Tst.def	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/kKrnlLibR3Tst.def	(revision 8144)
@@ -0,0 +1,62 @@
+;/* $Id: kKrnlLibR3Tst.def,v 1.1 2002-03-31 19:30:39 bird Exp $
+; *
+; * Definition file for the Ring-3 test program.
+; *
+; * Copyright (c) 1998-2001 knut st. osmundsen (bird@anduin.net)
+; *
+; * Project Odin Software License can be found in LICENSE.TXT
+; *
+; */
+
+NAME kKrnlLibR3Tst WINDOWCOMPAT
+DESCRIPTION "Odin32 Ring-0 Kernel Library - Ring-3 Testing - Copyright (c) 1998-2002 knut st. osmundsen"
+
+STACKSIZE 4096
+
+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'
+
+    LOGDATA_16BIT       class 'LOGDATA_16BIT'
+
+    CALLTAB16           class 'CALLTAB16_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'
+
+    SYMBOLDB32          class 'SYMBOLDB32'
+
+    CODE32              class 'CODE'
+
+    STACK32             class 'STACK' STACK
+
+IMPORTS
+     DosQuerySysState = DOSCALL1.368
+
+     _DosRead         = DOSCALL1.281
+     _DosWrite        = DOSCALL1.282
+     _DosOpen         = DOSCALL1.273
+     _DosClose        = DOSCALL1.257
+     _DosSetFilePtr   = DOSCALL1.256
+
+     _DOS16OPEN       = DOSCALL1.70
+     _DOS16CLOSE      = DOSCALL1.59
Index: trunk/src/win32k/kKrnlLib/kKrnlLibR3Tst.mak
===================================================================
--- trunk/src/win32k/kKrnlLib/kKrnlLibR3Tst.mak	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/kKrnlLibR3Tst.mak	(revision 8144)
@@ -0,0 +1,106 @@
+# $Id: kKrnlLibR3Tst.mak,v 1.1 2002-03-31 19:30:39 bird Exp $
+
+#
+# kKrnlLib - Ring3 Test suite for the driver.
+#
+# Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
+#
+
+
+#
+# Setup.
+#
+PATH_ROOT = ..\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+
+
+#
+# kLib overrides variables.
+#
+!if [SET KLIB_INC=$(MAKEDIR)\kLib.inc]
+!endif
+
+
+#
+# Config.
+#
+TARGET_MODE = EXE
+TARGET_NAME = kKrnlLibR3Tst
+TARGET_IGNORE_LINKER_WARNINGS=1
+MAKEFILE    = $(TARGET_NAME).mak
+ALL_INCLUDES= -I../include
+ALL_DEFINES = -DKKRNLLIB -DR3TST
+
+
+#
+# Object files.
+#
+#$(PATH_TARGET)\stub.$(EXT_OBJ)\
+TARGET_OBJS =\
+$(PATH_OBJ)\kKrnlLib_first.$(EXT_LIB)\kKrnlLib_first.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_testcase.$(EXT_LIB)\kKrnlLib_testcase.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_srcR3Tst.$(EXT_LIB)\kKrnlLib_srcR3Tst.$(EXT_LIB)\
+
+TARGET_LIBS =\
+$(PATH_OBJ)\kLibR0.$(EXT_LIB)\kLibR0.$(EXT_LIB)\
+os2386p.$(EXT_LIB)\
+os2386.$(EXT_LIB)\
+os2286p.$(EXT_LIB)\
+!if "$(BUILD_ENV)" == "VAC308"
+cppon30.$(EXT_LIB)\
+!else
+!if "$(BUILD_ENV)" == "VAC365"
+cpprni36.$(EXT_LIB)\
+!else
+$(LIB_C_OBJ)\
+!endif
+!endif
+$(PATH_OBJ)\kKrnlLib_devhelp.$(EXT_LIB)\kKrnlLib_devhelp.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_clib16.$(EXT_LIB)\kKrnlLib_clib16.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_last.$(EXT_LIB)\kKrnlLib_last.$(EXT_LIB)
+
+TARGET_DEPS =\
+$(PATH_OBJ)\kLibR0.$(EXT_LIB)\kLibR0.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_devhelp.$(EXT_LIB)\kKrnlLib_devhelp.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_clib16.$(EXT_LIB)\kKrnlLib_clib16.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_last.$(EXT_LIB)\kKrnlLib_last.$(EXT_LIB)
+
+SUBDIRS     = include src kLib testcase
+
+PREMAKEFILES= clib16.mak devhelp16.mak
+
+
+
+#
+# Process
+#
+!include $(MAKE_INCLUDE_PROCESS)
+
+
+#
+# Commandline for working in kLib.
+#
+cmd:
+    $(COMSPEC) /K
+
+
+#
+# Generate calltaba.asm
+#
+CallTaba.asm:
+    $(PATH_TOOLS)\MkCallTab.exe calltab > $@
+
+
+#
+# kKrnlLib Import library.
+#
+$(TARGET).lib: $(PATH_LIB)\$(TARGET).lib
+$(PATH_LIB)\$(TARGET).lib: $(PATH_TOOLS)\MkCallTab.exe
+    $(PATH_TOOLS)\MkCallTab.exe deffile > $(PATH_TARGET)\$(TARGET)implib.def
+    $(IMPLIB) $(IMPLIB_FLAGS) $@ $(PATH_TARGET)\$(TARGET)implib.def
+
+
+
+$(PATH_TOOLS)\MkCallTab.exe: force
+    $(PATH_)
+
Index: trunk/src/win32k/kKrnlLib/kLib.inc
===================================================================
--- trunk/src/win32k/kKrnlLib/kLib.inc	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/kLib.inc	(revision 8144)
@@ -0,0 +1,29 @@
+# $Id: kLib.inc,v 1.1 2002-03-31 19:30:40 bird Exp $
+
+#
+# kLib.mk - configuration overloader for kLib in kLibKrnl.sys.
+#
+# Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)
+#
+# GPL
+#
+
+
+#
+# The Win32k Makefile.inc
+#
+!include $(PATH_ROOT)\Makefile.inc
+
+
+#
+# Some changes are to be done.. :-)
+#
+ALL_INCLUDES    = -I$(PATH_KKRNLLIB:\=/)/include -I$(PATH_KKRNLLIB:\=/)/include/kLib
+ALL_DEFINES     = -DKKRNLLIB
+KLIB_POSTFIX    = R0
+TARGET_MODE     = SYSLIB
+PATH_ROOT       = $(PATH_WIN32K)\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+
+
+
Index: trunk/src/win32k/kKrnlLib/src/Dev16R3Tst.mak
===================================================================
--- trunk/src/win32k/kKrnlLib/src/Dev16R3Tst.mak	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/src/Dev16R3Tst.mak	(revision 8144)
@@ -0,0 +1,49 @@
+# $Id: Dev16R3Tst.mak,v 1.1 2002-03-31 19:30:40 bird Exp $
+
+#
+# kKrnlLib/Dev16R3Tst
+#
+#
+
+
+#
+# Setup.
+#
+!if [SET INCLUDE=]
+!endif
+BUILD_ENV  = MSCV6
+PATH_ROOT  = ..\..\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+!include ..\..\makefile.inc
+
+
+
+#
+# Config.
+#
+TARGET_MODE = SYSLIB
+TARGET_NAME = kKrnlLib_Dev16R3Tst
+MAKEFILE    = Dev16R3Tst.mak
+CC_INCLUDES = -I../include -I$(PATH_DDKBASE)/h -I$(PATH_MSC)/include -I$(PATH_TOOLKIT)/h
+ALL_DEFINES = -DKKRNLLIB -DR3TST
+CC_SEGS     = -NTCODE16 -NDDATA16
+
+
+#
+# Targets.
+#
+TARGET_OBJS =\
+$(PATH_TARGET)\d16Globl.$(EXT_OBJ)\
+$(PATH_TARGET)\d16Init.$(EXT_OBJ)\
+$(PATH_TARGET)\d16Strat.$(EXT_OBJ)\
+$(PATH_TARGET)\d16crt.$(EXT_OBJ)\
+$(PATH_TARGET)\d16vprintf.$(EXT_OBJ)\
+$(PATH_TARGET)\d16ProbeKrnl.$(EXT_OBJ)\
+$(PATH_TARGET)\krnlImportTable.$(EXT_OBJ)\
+
+
+#
+# Process.
+#
+!include $(MAKE_INCLUDE_PROCESS)
+
Index: trunk/src/win32k/kKrnlLib/src/newdbgR3Tst.mak
===================================================================
--- trunk/src/win32k/kKrnlLib/src/newdbgR3Tst.mak	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/src/newdbgR3Tst.mak	(revision 8144)
@@ -0,0 +1,43 @@
+# $Id: newdbgR3Tst.mak,v 1.1 2002-03-31 19:30:40 bird Exp $
+
+#
+# newdbgR3Tst - separate make file for the debug new (R3Tst build).
+#
+# Copyright (c) 1998-2002 knut st. osmundsen (bird@anduin.net)
+#
+# Project Odin Software License can be found in LICENSE.TXT
+#
+
+
+#
+# Setup.
+#
+ALL_INCLUDES= -I../include
+ALL_DEFINES = -DKKRNLLIB -DR3TST
+PATH_ROOT   = ..\..\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+!if "$(BUILD_ENV)" == "VAC308" || "$(BUILD_ENV)" == "VAC365"
+CXX_FLAGS_SYS = $(CXX_FLAGS_SYS) -Tm+
+!endif
+
+
+#
+# Config.
+#
+TARGET_MODE = SYSLIB
+TARGET_NAME = kKrnlLib_newdbgR3Tst
+MAKEFILE    = newdbgR3Tst.mak
+
+
+#
+# Object files.
+#
+TARGET_OBJS =\
+$(PATH_TARGET)\newdbg.$(EXT_OBJ)
+
+
+#
+# Process
+#
+!include $(MAKE_INCLUDE_PROCESS)
+
Index: trunk/src/win32k/kKrnlLib/src/newrelR3Tst.mak
===================================================================
--- trunk/src/win32k/kKrnlLib/src/newrelR3Tst.mak	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/src/newrelR3Tst.mak	(revision 8144)
@@ -0,0 +1,43 @@
+# $Id: newrelR3Tst.mak,v 1.1 2002-03-31 19:30:40 bird Exp $
+
+#
+# newrelR3Tst - separate make file for the release new (R3Tst build).
+#
+# Copyright (c) 1998-2002 knut st. osmundsen (bird@anduin.net)
+#
+# Project Odin Software License can be found in LICENSE.TXT
+#
+
+
+#
+# Setup.
+#
+ALL_INCLUDES= -I../include
+ALL_DEFINES = -DKKRNLLIB -DR3TST
+PATH_ROOT   = ..\..\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+!if "$(BUILD_ENV)" == "VAC308" || "$(BUILD_ENV)" == "VAC365"
+CXX_FLAGS_SYS = $(CXX_FLAGS_SYS) -Tm-
+!endif
+
+
+#
+# Config.
+#
+TARGET_MODE = SYSLIB
+TARGET_NAME = kKrnlLib_newrelR3Tst
+MAKEFILE    = newrelR3Tst.mak
+
+
+#
+# Object files.
+#
+TARGET_OBJS =\
+$(PATH_TARGET)\newrel.$(EXT_OBJ)
+
+
+#
+# Process
+#
+!include $(MAKE_INCLUDE_PROCESS)
+
Index: trunk/src/win32k/kKrnlLib/src/srcR3Tst.mak
===================================================================
--- trunk/src/win32k/kKrnlLib/src/srcR3Tst.mak	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/src/srcR3Tst.mak	(revision 8144)
@@ -0,0 +1,78 @@
+# $Id: srcR3Tst.mak,v 1.1 2002-03-31 19:30:41 bird Exp $
+
+#
+# kKrnlLib/srcR3Tst makefile.
+#
+#
+
+#
+# Load the build setup.
+#
+PATH_ROOT = ..\..\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+
+
+#
+# Config.
+#
+TARGET_MODE  = SYSLIB
+TARGET_NAME  = kKrnlLib_srcR3Tst
+MAKEFILE     = srcR3Tst.mak
+ALL_INCLUDES = -I../include
+ALL_DEFINES  = -DKKRNLLIB -DR3TST
+
+
+#
+# Targets.
+#
+PREMAKEFILES = newdbgR3Tst.mak newrelR3Tst.mak Dev16R3Tst.mak
+
+TARGET_OBJS =\
+$(PATH_TARGET)\d32Globals.$(EXT_OBJ)\
+$(PATH_TARGET)\d32Hlp.$(EXT_OBJ)\
+$(PATH_TARGET)\d32Init.$(EXT_OBJ)\
+$(PATH_TARGET)\log.$(EXT_OBJ)\
+\
+$(PATH_TARGET)\env.$(EXT_OBJ)\
+$(PATH_TARGET)\krnlInit.$(EXT_OBJ)\
+$(PATH_TARGET)\krnlLockedWrite.$(EXT_OBJ)\
+$(PATH_TARGET)\krnlOverloading.$(EXT_OBJ)\
+$(PATH_TARGET)\krnlPrologs.$(EXT_OBJ)\
+$(PATH_TARGET)\krnlStubs.$(EXT_OBJ)\
+$(PATH_TARGET)\OS2KPTDA.$(EXT_OBJ)\
+$(PATH_TARGET)\OS2KTCB.$(EXT_OBJ)\
+\
+$(PATH_TARGET)\abort.$(EXT_OBJ)\
+$(PATH_TARGET)\fltused.$(EXT_OBJ)\
+$(PATH_TARGET)\malloc.$(EXT_OBJ)\
+$(PATH_TARGET)\rmalloc.$(EXT_OBJ)\
+$(PATH_TARGET)\smalloc.$(EXT_OBJ)\
+$(PATH_TARGET)\stricmp.$(EXT_OBJ)\
+$(PATH_TARGET)\vprintf.$(EXT_OBJ)\
+$(PATH_TARGET)\vsprintf.$(EXT_OBJ)\
+$(PATH_OBJ)\kKrnlLib_newdbgR3Tst.$(EXT_LIB)\kKrnlLib_newdbgR3Tst.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_newrelR3Tst.$(EXT_LIB)\kKrnlLib_newrelR3Tst.$(EXT_LIB)\
+\
+$(PATH_ROOT)\obj\$(NAME_1)$(NAME_2)mscv6\kKrnlLib_dev16R3Tst.$(EXT_LIB)\kKrnlLib_dev16R3Tst.$(EXT_LIB)\
+\
+$(PATH_TARGET)\SymDB32.$(EXT_OBJ)\
+$(PATH_TARGET)\calltaba.$(EXT_OBJ)\
+$(PATH_TARGET)\TstFakers.$(EXT_OBJ)\
+
+
+TARGET_DEPS =\
+$(PATH_OBJ)\kKrnlLib_newdbgR3Tst.$(EXT_LIB)\kKrnlLib_newdbgR3Tst.$(EXT_LIB)\
+$(PATH_OBJ)\kKrnlLib_newrelR3Tst.$(EXT_LIB)\kKrnlLib_newrelR3Tst.$(EXT_LIB)\
+$(PATH_ROOT)\obj\$(NAME_1)$(NAME_2)mscv6\kKrnlLib_dev16.$(EXT_LIB)\kKrnlLib_dev16.$(EXT_LIB)\
+
+
+
+#
+# Load the build process rules.
+#
+!include $(MAKE_INCLUDE_PROCESS)
+
+# generated code.
+TstFakers.c:
+    $(TOOL_DOMAKES) "MkCallTab.mak" $(TOOL_MAKE) $@
+
Index: trunk/src/win32k/kKrnlLib/testcase/Makefile
===================================================================
--- trunk/src/win32k/kKrnlLib/testcase/Makefile	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/testcase/Makefile	(revision 8144)
@@ -0,0 +1,43 @@
+# $Id: Makefile,v 1.1 2002-03-31 19:30:41 bird Exp $
+
+#
+# kKrnlLib/testcase makefile.
+#
+#
+
+#
+# Load the build setup.
+#
+!include ..\..\Makefile.inc
+PATH_ROOT = ..\..\..\..
+!include $(PATH_ROOT)\tools\make\setup.mak
+
+
+#
+# Config.
+#
+TARGET_MODE  = SYSLIB
+TARGET_NAME  = kKrnlLib_testcase
+ALL_INCLUDES = -I../include
+AS_INCLUDES  = -I$(PATH_DDKBASE)\inc
+ALL_DEFINES  = -DKKRNLLIB -DR3TST
+
+
+#
+# Targets.
+#
+TARGET_OBJS =\
+$(PATH_TARGET)\tstDH.$(EXT_OBJ)\
+$(PATH_TARGET)\tstDos.$(EXT_OBJ)\
+$(PATH_TARGET)\tstDosA.$(EXT_OBJ)\
+$(PATH_TARGET)\tstFake.$(EXT_OBJ)\
+$(PATH_TARGET)\tstFakeA.$(EXT_OBJ)\
+$(PATH_TARGET)\tstInit.$(EXT_OBJ)\
+$(PATH_TARGET)\tstkKrnlLib.$(EXT_OBJ)\
+
+
+#
+# Load the build process rules.
+#
+!include $(MAKE_INCLUDE_PROCESS)
+
Index: trunk/src/win32k/kKrnlLib/tools/TestKernels.cmd
===================================================================
--- trunk/src/win32k/kKrnlLib/tools/TestKernels.cmd	(revision 8144)
+++ trunk/src/win32k/kKrnlLib/tools/TestKernels.cmd	(revision 8144)
@@ -0,0 +1,138 @@
+/* $Id: TestKernels.cmd,v 1.1 2002-03-31 19:30:41 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 sR3Tst sDir sdummy
+    if (sR3Tst = '' | 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
+
+        if (substr(sName, 5, 1) <= '9') then    cchBuild = 5;
+        else                                    cchBuild = 4;
+        iBuild = substr(sName, 1, cchBuild);
+        chBuildType = substr(sName, cchBuild + 1, 1);
+        chKernelType = substr(sName, cchBuild + 2, 1);
+        chRev = substr(sName, cchBuild + 3, 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
+            sCmd = sR3Tst '1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev;
+        else
+            sCmd = sR3Tst '1' asFiles.i iVerMajor iVerMinor iBuild chKernelType chBuildType chRev asFiles.i||'.SYM';
+        say sCmd;
+        sCmd;
+        if (rc <> 0) then
+        do
+            say 'failed... rc='rc;
+            say 'cmd:' sCmd
+            exit rc;
+        end
+
+    end
+
+    exit(0);
+
+
+
+
+/*
+ * Write syntax:
+ */
+syntax: procedure;
+    say 'TestKernels.cmd <kKrnlLibR3Tst.exe> <kernel-directory>';
+    return;
