Index: trunk/src/win32k/kKrnlLib/include/kKLlog.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/kKLlog.h	(revision 7113)
+++ trunk/src/win32k/kKrnlLib/include/kKLlog.h	(revision 7115)
@@ -1,3 +1,3 @@
-/* $Id: kKLlog.h,v 1.1 2001-09-14 01:50:17 bird Exp $
+/* $Id: kKLlog.h,v 1.2 2001-10-19 00:04:44 bird Exp $
  *
  * log - C-style logging - kprintf.
@@ -26,17 +26,38 @@
 #define dprintf kprintf
 #if defined(DEBUG) && !defined(NOLOGGING)
-    #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!
+    #if 0
+        #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 <kKLprintf.h>
+            #ifdef __cplusplus
+                #define kprintf(a)      ::printf a
+            #else
+                #define kprintf(a)      printf a
+            #endif
+        #endif
     #else
-        /* 32-bit */
-        #include <stdarg.h>
-        #include "kKLprintf.h"
-        #ifdef __cplusplus
-            #define kprintf(a)      ::printf a
+        #ifndef KLOG_MOD
+            #define KLOG_MOD    0
+        #endif
+
+        #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
-            #define kprintf(a)      printf a
+            /* 32-bit */
+            #include <kKLstdarg.h>
+            #ifdef __cplusplus
+                #define kprintf(a)      ::kLogv(KLOG_MOD, KLOGPOS_EXT, KLOG_TYPE_PRINTF, ::kLogFixPrintf a)
+            #else
+                #define kprintf(a)      kLogv(KLOG_MOD, KLOGPOS_EXT, KLOG_TYPE_PRINTF, kLogFixPrintf a)
+            #endif
         #endif
     #endif
Index: trunk/src/win32k/kKrnlLib/include/kKLprintf.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/kKLprintf.h	(revision 7113)
+++ trunk/src/win32k/kKrnlLib/include/kKLprintf.h	(revision 7115)
@@ -1,3 +1,3 @@
-/* $Id: kKLprintf.h,v 1.2 2001-09-27 03:04:32 bird Exp $
+/* $Id: kKLprintf.h,v 1.3 2001-10-19 00:04:45 bird Exp $
  *
  * printf/vprintf header file.
@@ -28,9 +28,5 @@
 int vprintf2(const char *pszFormat, va_list args);
 
-/*
- * va_start have to be redeclared. Compiler don't accept SSToDS() as va_start argument.
- */
-#undef va_start
-#define va_start(ap, last) ap = ((va_list)SSToDS(&last)) + __nextword(last)
+#include <kKLstdarg.h>
 
 #ifdef __cplusplus
Index: trunk/src/win32k/kKrnlLib/include/kKrnlLib.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/kKrnlLib.h	(revision 7113)
+++ trunk/src/win32k/kKrnlLib/include/kKrnlLib.h	(revision 7115)
@@ -1,3 +1,3 @@
-/* $Id: kKrnlLib.h,v 1.2 2001-09-17 01:44:01 bird Exp $
+/* $Id: kKrnlLib.h,v 1.3 2001-10-19 00:04:45 bird Exp $
  *
  * Top level header file for kKrnlLib exports.
@@ -61,4 +61,6 @@
  */
 #ifdef INCL_KKL_LOG
+    #include "kKLstdarg.h"
+    #include "kLog.h"
     #include "kKLlog.h"
 #endif
Index: trunk/src/win32k/kKrnlLib/include/kLog.h
===================================================================
--- trunk/src/win32k/kKrnlLib/include/kLog.h	(revision 7113)
+++ trunk/src/win32k/kKrnlLib/include/kLog.h	(revision 7115)
@@ -1,3 +1,3 @@
-/* $Id: kLog.h,v 1.2 2001-10-16 02:20:39 bird Exp $
+/* $Id: kLog.h,v 1.3 2001-10-19 00:04:45 bird Exp $
  *
  * kLog - Generic Logging and Trace Routines.
@@ -10,4 +10,7 @@
 #define _kLog_h_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*******************************************************************************
@@ -17,11 +20,17 @@
  * Standard log types.
  */
-#define KLOG_INITMOD    1               /* Function entry */
-#define KLOG_TERMMOD    2               /* Function entry */
-#define KLOG_ENTRY      3               /* Function entry */
-#define KLOG_EXIT       4               /* Function exit  */
-#define KLOG_ASSERT     5               /* Assertion failed / Kernel Panic. */
-
-#define KLOG_USER       0x1000          /* First user log type.  */
+#define KLOG_TYPE_INITMOD    1          /* Log Module Init. */
+#define KLOG_TYPE_TERMMOD    2          /* Log Module Termination. */
+#define KLOG_TYPE_START      3          /* Start sequence and function entry. */
+#define KLOG_TYPE_ENTRY      4          /* Function entry. */
+#define KLOG_TYPE_EXIT       5          /* Function exit. */
+#define KLOG_TYPE_STOP       6          /* Stop sequence and function exit.  */
+#define KLOG_TYPE_PRINTF     7          /* kprintf and printf log output. */
+#define KLOG_TYPE_ASSERT     8          /* Assertion failed / Kernel Panic. */
+#define KLOG_TYPE_LOGASSERT  9          /* Assertion failed within kLog. */
+
+#define KLOG_TYPE_LAST_REQ   KLOG_TYPE_ASSERT   /* Last required type. */
+
+#define KLOG_TYPE_USER       0x1000     /* First user log type.  */
 
 
@@ -29,11 +38,16 @@
  * Flags.
  */
-#define KLOG_TYPEDEF_PTR    0x8000      /* flags this typedef as a pointer. */
-#define KLOG_TYPEDEF_SIZE   0xfff       /* Mask to get the size. */
-
-#define KLOG_TYPE_DISABLED  0x00
-#define KLOG_TYPE_ENABLED   0x01
-#define KLOG_TYPE_COMOUTPUT 0x10
-#define KLOG_TYPE_MASK      0x11
+#define KLOG_TYPEDEF_PTR        0x8000  /* flags this typedef as a pointer. */
+#define KLOG_TYPEDEF_SIZE       0x0fff  /* Mask to get the size. */
+
+#define KLOG_FLAGS_DISABLED     0x0000
+#define KLOG_FLAGS_ENABLED      0x0001
+#ifdef RING0
+#define KLOG_FLAGS_COMOUTPUT    0x0010
+#else
+#define KLOG_FLAGS_COMOUTPUT    0x0000
+#endif
+#define KLOG_FLAGS_MASK         0x0011
+#define KLOG_FLAGS_AS_ABOVE     0xffff  /* Inherit options from above option level. */
 
 /*
@@ -64,4 +78,5 @@
 typedef unsigned long int  HKLOGMOD;    /* Loghandle for a module. */
 
+#ifdef _kAVL_h_
 
 /**
@@ -82,5 +97,9 @@
 typedef struct kLogTypedefInfo
 {
-    const char *            pszType;
+    union
+    {
+        const char *        pszType;
+        AVLSTRNODECORE      avlnodecore;
+    } u1;
     const char *            pszFormat;
     const unsigned short    cb;
@@ -113,4 +132,19 @@
 
 
+/**
+ * Describes one file.
+ */
+typedef struct kLogFileInfo
+{
+    union
+    {
+        const char *        pszFile;
+        AVLSTRNODECORE      avlnodecore;
+    } u1;
+    unsigned short          fCurrent;
+    const unsigned short    fDefault;
+} KLOGFILEINFO, *PKLOGFILEINFO;
+
+
 
 /**
@@ -120,22 +154,33 @@
 {
     const char *    pszModuleName;      /* Module name. */
-    const char *    pszModuleDescription; /* Module description. */
-
-    int             cTypedefs;          /* Number of typesdef in paTypedefs. */
-    PKLOGTYPEDEFINFO paTypedefs;        /* Array of typedef descriptions. */
-
-    int             cUserTypes;         /* Number of user types in paUserTypes. */
-    PKLOGTYPEINFO   paUserTypes;        /* Array of user type descriptions. */
-
-    int             cDefTypes;          /* Number of default types in paDefTypes. */
-    PKLOGDEFTYPEINFO paDefTypes;        /* Array of default type descriptions. */
+    const char *    pszModuleDescription;/*Module description. */
+
+    int                     cTypedefs;  /* Number of typesdef in paTypedefs. */
+    PKLOGTYPEDEFINFO        paTypedefs; /* Array of typedef descriptions. */
+
+    int                     cUserTypes; /* Number of user types in paUserTypes. */
+    PKLOGTYPEINFO           paUserTypes;/* Array of user type descriptions. */
+
+    int                     cDefTypes;  /* Number of default types in paDefTypes. */
+    PKLOGDEFTYPEINFO        paDefTypes; /* Array of default type descriptions. */
+
+    int                     cFiles;     /* Number of files in paFiles. */
+    PKLOGFILEINFO           paFiles;    /* Array of per file settings. */
 
     /* Module Data Used by Log System - Do NOT touch! */
-    AVLULNODECORE   avlnodecore;        /* AVL Tree node with module handle as key. */
-    unsigned long   ulLastSeq;           /* Last sequence number. */
+    AVLULNODECORE           avlnodecore;/* AVL Tree node with module handle as key. */
+    PAVLSTRNODECORE         pavlTypedefs;/*Tree of typedef into entries. */
+    PAVLSTRNODECORE         pavlFiles;  /* Tree of file into entries. */
+    unsigned long           ulLastSeq;  /* Last sequence number. */
+    unsigned short          fCurrent;
+    const unsigned short    fDefault;
 
 } KLOGMODDATA, *PKLOGMODDATA;
-
-
+#endif /* #ifdef _kAVL_h_ */
+
+
+/**
+ * The sequence handle on the stack.
+ */
 typedef union kLogSeqHandle
 {
@@ -156,14 +201,23 @@
 KBOOL       KLIBCALL kLogInitBuffer(unsigned long cbBufferSize);
 
+#ifdef _kAVL_h_
 HKLOGMOD    KLIBCALL kLogInitMod(PKLOGMODDATA pMod, KLOGPOS_DECL);
+#endif
 void        KLIBCALL kLogEntry(HKLOGMOD hLogMod, KLOGPOS_DECL, const char *pszFuncProto, KBOOL fOptlink, ...);
 void        KLIBCALL kLogExit(HKLOGMOD hLogMod, KLOGPOS_DECL, const char *pszReturnType, unsigned uReturn);
 void        KLIBCALL kLog(HKLOGMOD hLogMod, KLOGPOS_DECL, int iType, ...);
+#if defined(va_arg) || defined(va_list) || defined(va_start) || defined(va_end)
+void        KLIBCALL kLogv(HKLOGMOD hLogMod, KLOGPOS_DECL, int iType, va_list args);
+va_list     KLIBCALL kLogFixPrintf(const char *pszFormat, ...); /* a hack! */
+#endif
 
 #define KLOGINITMOD(pMod)                   kLogInitMod(pMod, KLOGPOS_EXT)
-#define KLOGENTRY(hLogMod, pszFuncProto)        kLogEntry(hLogMod, KLOGPOS_EXT, pszFuncProto, FALSE)
-#define KLOGEXIT(hLogMod, pszType, uValue)      kLogExit(hLogMod, KLOGPOS_EXT, pszType, uValue)
-
-
-#endif
-
+#define KLOGENTRY(hLogMod, pszProto, parg0) kLogEntry(hLogMod, KLOGPOS_EXT, pszFuncProto, FALSE, parg0)
+#define KLOGEXIT(hLogMod, pszType, uValue)  kLogExit(hLogMod, KLOGPOS_EXT, pszType, uValue)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
