Index: /trunk/kStuff/kHlp/Bare/kHlpBareAssert.c
===================================================================
--- /trunk/kStuff/kHlp/Bare/kHlpBareAssert.c	(revision 3581)
+++ /trunk/kStuff/kHlp/Bare/kHlpBareAssert.c	(revision 3582)
@@ -35,6 +35,8 @@
 # define INCL_ERRORS
 # include <os2.h>
+
 #elif  K_OS == K_OS_WINDOWS
 # include <Windows.h>
+
 #else
 # error "port me"
@@ -63,5 +65,5 @@
             DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten);
         DosWrite((HFILE)2, "\r\n", 2, &cbWritten);
-#else /* __WIN32__ */
+#else /* K_OS == K_OS_WINDOWS */
         if (cbWritten)
             WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL);
@@ -82,5 +84,5 @@
 #if K_OS == K_OS_OS2
         DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten);
-#else /* __WIN32__ */
+#else /* K_OS == K_OS_WINDOWS */
         WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL);
 #endif
Index: /trunk/kStuff/kLdr/kLdrDyldFind.c
===================================================================
--- /trunk/kStuff/kLdr/kLdrDyldFind.c	(revision 3581)
+++ /trunk/kStuff/kLdr/kLdrDyldFind.c	(revision 3582)
@@ -30,5 +30,8 @@
 *   Header Files                                                               *
 *******************************************************************************/
-#ifdef __OS2__
+#include <k/kLdr.h>
+#include "kLdrInternal.h"
+
+#if K_OS == K_OS_OS2
 # define INCL_BASE
 # define INCL_ERRORS
@@ -47,10 +50,10 @@
 # define QHINF_MAPSEL        8 /* NE only */
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
+# undef IMAGE_DOS_SIGNATURE
+# undef IMAGE_NT_SIGNATURE
 # include <Windows.h>
+
 #endif
-
-#include <k/kLdr.h>
-#include "kLdrInternal.h"
 
 
@@ -236,5 +239,5 @@
      * The OS/2 search parameters.
      */
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     rc = DosQueryHeaderInfo(NULLHANDLE, 0, kLdrDyldOS2Libpath, sizeof(kLdrDyldOS2Libpath), QHINF_LIBPATH);
     if (rc)
@@ -266,5 +269,5 @@
      * The windows search parameters.
      */
-#if defined(__WIN__)
+#if K_OS == K_OS_WINDOWS
     cch = GetSystemDirectory(kLdrDyldWindowsSystemDir, sizeof(kLdrDyldWindowsSystemDir));
     if (cch >= sizeof(kLdrDyldWindowsSystemDir))
@@ -320,5 +323,5 @@
 
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
         DWORD dwSize = GetModuleFileName(NULL /* the executable */, kLdrDyldAppDir, sizeof(kLdrDyldAppDir));
         if (dwSize > 0)
@@ -665,5 +668,5 @@
     psz = &s_szFilename[cchPath];
     if (psz[-1] != '/'
-#if defined(__OS2__) || defined(__WIN__)
+#if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS
         && psz[-1] != '\\'
         && psz[-1] != ':'
@@ -737,5 +740,5 @@
         while (     *pszEnd != '\0'
                &&   *pszEnd != ';'
-#if defined(__OS2__) || defined(__WIN__)
+#if K_OS == K_OS_OS2 || K_OS == K_OS_WINDOWS
                && (     *pszEnd != ':'
                    ||   (   pszEnd - psz == 1
@@ -790,5 +793,5 @@
 #if defined(__OS2__)
         *penmSearch = KLDRDYLD_SEARCH_OS2;
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
         *penmSearch = KLDRDYLD_SEARCH_WINDOWS;
 #else
Index: /trunk/kStuff/kLdr/kLdrDyldMod.c
===================================================================
--- /trunk/kStuff/kLdr/kLdrDyldMod.c	(revision 3581)
+++ /trunk/kStuff/kLdr/kLdrDyldMod.c	(revision 3582)
@@ -205,10 +205,10 @@
     rc = kld
     {
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     HMODULE hmod = NULLHANDLE;
     APIRET rc = DosQueryModuleHandle(kRdrName(pRdr), &hmod);
     if (!rc)
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     HMODULE hmod = NULL;
     if (GetModuleHandle(kRdrName(pRdr))
Index: /trunk/kStuff/kLdr/kLdrDyldOS.c
===================================================================
--- /trunk/kStuff/kLdr/kLdrDyldOS.c	(revision 3581)
+++ /trunk/kStuff/kLdr/kLdrDyldOS.c	(revision 3582)
@@ -29,16 +29,20 @@
 *   Header Files                                                               *
 *******************************************************************************/
-#ifdef __OS2__
+#include <k/kLdr.h>
+#include "kLdrInternal.h"
+
+#if K_OS == K_OS_OS2
 # define INCL_BASE
 # define INCL_ERRORS
 # include <os2.h>
-#elif defined(__WIN__)
+
+#elif K_OS == K_OS_WINDOWS
+# undef IMAGE_DOS_SIGNATURE
+# undef IMAGE_NT_SIGNATURE
 # include <Windows.h>
+
 #else
 # error "port me"
 #endif
-
-#include <k/kLdr.h>
-#include "kLdrInternal.h"
 
 
@@ -52,5 +56,5 @@
 void *kldrDyldOSAllocStack(KSIZE cb)
 {
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     APIRET rc;
     PVOID pv;
@@ -64,5 +68,5 @@
     return NULL;
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
 
     if (!cb)
@@ -90,5 +94,5 @@
 #if defined(__OS2__)
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     /*
      * Invoke the entrypoint on the current stack for now.
Index: /trunk/kStuff/kLdr/kLdrModNative.c
===================================================================
--- /trunk/kStuff/kLdr/kLdrModNative.c	(revision 3581)
+++ /trunk/kStuff/kLdr/kLdrModNative.c	(revision 3582)
@@ -31,5 +31,6 @@
 #include <k/kLdr.h>
 #include "kLdrInternal.h"
-#ifdef __OS2__
+
+#if K_OS == K_OS_OS2
 # define INCL_BASE
 # include <os2.h>
@@ -48,5 +49,5 @@
 # define QHINF_MAPSEL        8 /* NE only */
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
 # undef IMAGE_NT_SIGNATURE
 # undef IMAGE_DOS_SIGNATURE
@@ -59,5 +60,5 @@
 #include <winnt.h> */
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
 # include <dlfcn.h>
 # include <errno.h>
@@ -85,5 +86,5 @@
 #endif
 
-#if defined(__WIN__) || defined(__NT__)
+#if K_OS == K_OS_WINDOWS
 /** @def KLDRMODNATIVE_RVA2TYPE
  * Converts a RVA to a pointer of the specified type.
@@ -114,9 +115,9 @@
      * If ~(KU32)0 this hasn't been determined yet. */
     KU32                        cImportModules;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     /** The module handle. */
     HMODULE                     hmod;
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     /** The module handle. */
     HANDLE                      hmod;
@@ -126,5 +127,5 @@
     const IMAGE_SECTION_HEADER *paShdrs;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** The dlopen() handle.*/
     void                       *pvMod;
@@ -179,5 +180,5 @@
      * Load the image.
      */
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     HMODULE hmod;
 
@@ -189,5 +190,5 @@
         DosFreeModule(hmod);
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     HMODULE hmod;
 
@@ -199,5 +200,5 @@
         FreeLibrary(hmod);
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     void *pvMod;
 
@@ -238,5 +239,5 @@
      * size of the module instance.
      */
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     char szFilename[CCHMAXPATH];
     int rc;
@@ -254,5 +255,5 @@
     cSegments = 1;
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     DWORD                       dw;
     char                        szFilename[MAX_PATH];
@@ -288,5 +289,5 @@
     paShdrs = (const IMAGE_SECTION_HEADER *)(pNtHdrs + 1);
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     char    szFilename[1] = "";
     cSegments = 0; /** @todo Figure out the Mac OS X dynamic loader. */
@@ -341,5 +342,5 @@
      * Set native instance data.
      */
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     pModNative->hmod = (HMODULE)uHandle;
 
@@ -358,5 +359,5 @@
     pMod->aSegments[0].MapAddress = 0;
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     pModNative->hmod = (HMODULE)uHandle;
     pModNative->pNtHdrs = pNtHdrs;
@@ -495,5 +496,5 @@
     }
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Figure out the Mac OS X dynamic loader. */
 
@@ -516,8 +517,8 @@
     int rc;
 
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     rc = DosFreeModule(pModNative->hmod);
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     if (FreeLibrary(pModNative->hmod))
         rc = 0;
@@ -525,5 +526,5 @@
         rc = GetLastError();
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     dlclose(pModNative->pvMod);
 
@@ -546,10 +547,10 @@
     PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData;
     const char *pszSymbol = pchSymbol;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     APIRET rc;
     PFN pfn;
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     FARPROC pfn;
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     void *pfn;
 #else
@@ -566,5 +567,5 @@
     }
 
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     if (!pchSymbol && iSymbol >= 0x10000)
         return KLDR_ERR_SYMBOL_NOT_FOUND;
@@ -597,5 +598,5 @@
     }
 
-#elif defined(__WIN__)
+#elif K_OS == K_OS_WINDOWS
     if (!pszSymbol && iSymbol >= 0x10000)
         return KLDR_ERR_SYMBOL_NOT_FOUND;
@@ -609,5 +610,5 @@
                 | KLDRSYMKIND_NO_TYPE;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     if (!pszSymbol && iSymbol != NIL_KLDRMOD_SYM_ORDINAL)
         return KLDR_ERR_SYMBOL_NOT_FOUND;
@@ -635,5 +636,5 @@
 {
     PKLDRMODNATIVE                  pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement export enumeration on OS/2. */
@@ -641,5 +642,5 @@
     return ERROR_NOT_SUPPORTED;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     const KU32                     *paFunctions;
     const IMAGE_EXPORT_DIRECTORY   *pExpDir;
@@ -713,5 +714,5 @@
     return 0;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo implement enumeration on darwin. */
     (void)pModNative;
@@ -729,5 +730,5 @@
 {
     PKLDRMODNATIVE                  pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement import enumeration on OS/2. */
@@ -735,5 +736,5 @@
     return ERROR_NOT_SUPPORTED;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     const IMAGE_IMPORT_DESCRIPTOR  *pImpDesc;
     const char                     *pszImportName;
@@ -771,5 +772,5 @@
     return rc;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement import enumeration on darwin. */
     (void)pModNative;
@@ -786,5 +787,5 @@
 {
     PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement import counting on OS/2. */
@@ -792,5 +793,5 @@
     return -1;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     if (pModNative->cImportModules == ~(KU32)0)
     {
@@ -816,5 +817,5 @@
     return pModNative->cImportModules;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement import counting on Darwin. */
     (void)pModNative;
@@ -831,5 +832,5 @@
 {
     PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement stack info on OS/2. */
@@ -837,5 +838,5 @@
     return ERROR_NOT_SUPPORTED;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     pStackInfo->Address = NIL_KLDRADDR;
     pStackInfo->LinkAddress = NIL_KLDRADDR;
@@ -844,5 +845,5 @@
     return 0;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement stack info on Darwin. */
     (void)pModNative;
@@ -859,5 +860,5 @@
 {
     PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement me on OS/2. */
@@ -865,5 +866,5 @@
     return ERROR_NOT_SUPPORTED;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     /*
      * Convert the address from the header.
@@ -874,5 +875,5 @@
     return 0;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement me on Darwin. */
     (void)pModNative;
@@ -889,5 +890,5 @@
 {
     PKLDRMODNATIVE                  pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement me on OS/2. */
@@ -895,5 +896,5 @@
     return ERROR_NOT_SUPPORTED;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     const IMAGE_DEBUG_DIRECTORY    *pDbgDir;
     KU32                            iDbgInfo;
@@ -954,5 +955,5 @@
     return rc;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement me on Darwin. */
     (void)pModNative;
@@ -969,5 +970,5 @@
 {
     PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData;
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
 
     /** @todo implement me on OS/2. */
@@ -975,5 +976,5 @@
     return KLDR_ERR_NO_DEBUG_INFO;
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     /*
      * Base this entirely on the presence of a debug directory.
@@ -985,5 +986,5 @@
     return 0;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement me on Darwin. */
     (void)pModNative;
@@ -1061,13 +1062,13 @@
 static KLDRADDR kldrModNativeSize(PKLDRMOD pMod)
 {
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     return 0; /* don't bother */
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     /* just because we can. */
     PKLDRMODNATIVE pModNative = (PKLDRMODNATIVE)pMod->pvData;
     return pModNative->pNtHdrs->OptionalHeader.SizeOfImage;
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     /** @todo Implement me on Darwin. */
     return 0;
@@ -1082,11 +1083,11 @@
 static int kldrModNativeGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser)
 {
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     return ERROR_NOT_SUPPORTED; /* don't bother */
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     return ERROR_NOT_SUPPORTED; /* don't bother even if we could implement this. */
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     return KLDR_ERR_TODO; /* don't bother. */
 
@@ -1101,11 +1102,11 @@
                                      PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser)
 {
-#ifdef __OS2__
+#if K_OS == K_OS_OS2
     return ERROR_NOT_SUPPORTED; /* don't bother */
 
-#elif defined(__WIN__) || defined(__NT__)
+#elif K_OS == K_OS_WINDOWS || defined(__NT__)
     return ERROR_NOT_SUPPORTED; /* don't bother even if we could implement this. */
 
-#elif defined(__DARWIN__)
+#elif K_OS == K_OS_DARWIN
     return KLDR_ERR_TODO; /* don't bother. */
 
Index: /trunk/kStuff/kRdr/kRdrFile.cpp
===================================================================
--- /trunk/kStuff/kRdr/kRdrFile.cpp	(revision 3581)
+++ /trunk/kStuff/kRdr/kRdrFile.cpp	(revision 3582)
@@ -41,7 +41,4 @@
 # define WIN32_NO_STATUS
 # include <Windows.h>
-# ifndef __WIN__
-#  define __WIN__
-# endif
 # include <ntsecapi.h>
 # include <ntstatus.h>
