Index: trunk/src/kWorker/Makefile.kmk
===================================================================
--- trunk/src/kWorker/Makefile.kmk	(revision 2933)
+++ trunk/src/kWorker/Makefile.kmk	(revision 2934)
@@ -48,5 +48,5 @@
 	$(PATH_SDK_WINDDK71_LIB_WNET)/psapi.lib
 kWorker_LDFLAGS.win = \
-	/BASE:0x10000 /DYNAMICBASE:NO /FIXED /SECTION:DefLdBuf,EWR
+	/BASE:0x10000 /DYNAMICBASE:NO /FIXED
 
 
Index: trunk/src/kWorker/kWorker.c
===================================================================
--- trunk/src/kWorker/kWorker.c	(revision 2933)
+++ trunk/src/kWorker/kWorker.c	(revision 2934)
@@ -4504,4 +4504,88 @@
 #endif /* WITH_TEMP_MEMORY_FILES */
 
+/**
+ * Worker for kwFsIsCacheableExtensionA and kwFsIsCacheableExtensionW
+ *
+ * @returns K_TRUE if cacheable, K_FALSE if not.
+ * @param   wcFirst             The first extension character.
+ * @param   wcSecond            The second extension character.
+ * @param   wcThird             The third extension character.
+ * @param   fAttrQuery          Set if it's for an attribute query, clear if for
+ *                              file creation.
+ */
+static KBOOL kwFsIsCacheableExtensionCommon(wchar_t wcFirst, wchar_t wcSecond, wchar_t wcThird, KBOOL fAttrQuery)
+{
+    /* C++ header without an extension or a directory. */
+    if (wcFirst == '\0')
+    {
+        /** @todo exclude temporary files...  */
+        return K_TRUE;
+    }
+
+    /* C Header: .h */
+    if (wcFirst == 'h' || wcFirst == 'H')
+    {
+        if (wcSecond == '\0')
+            return K_TRUE;
+
+        /* C++ Header: .hpp, .hxx */
+        if (   (wcSecond == 'p' || wcSecond == 'P')
+            && (wcThird  == 'p' || wcThird  == 'P'))
+            return K_TRUE;
+        if (   (wcSecond == 'x' || wcSecond == 'X')
+            && (wcThird  == 'x' || wcThird  == 'X'))
+            return K_TRUE;
+    }
+    /* Misc starting with i. */
+    else if (wcFirst == 'i' || wcFirst == 'I')
+    {
+        if (wcSecond != '\0')
+        {
+            if (wcSecond == 'n' || wcSecond == 'N')
+            {
+                /* C++ inline header: .inl */
+                if (wcThird == 'l' || wcThird == 'L')
+                    return K_TRUE;
+
+                /* Assembly include file: .inc */
+                if (wcThird == 'c' || wcThird == 'C')
+                    return K_TRUE;
+            }
+        }
+    }
+    /* Assembly header: .mac */
+    else if (wcFirst == 'm' || wcFirst == 'M')
+    {
+        if (wcSecond == 'a' || wcSecond == 'A')
+        {
+            if (wcThird == 'c' || wcThird == 'C')
+                return K_TRUE;
+        }
+    }
+    else if (fAttrQuery)
+    {
+        /* Dynamic link library: .dll */
+        if (wcFirst == 'd' || wcFirst == 'D')
+        {
+            if (wcSecond == 'l' || wcSecond == 'L')
+            {
+                if (wcThird == 'l' || wcThird == 'L')
+                    return K_TRUE;
+            }
+        }
+        /* Executable file: .exe */
+        else if (wcFirst == 'e' || wcFirst == 'E')
+        {
+            if (wcSecond == 'x' || wcSecond == 'X')
+            {
+                if (wcThird == 'e' || wcThird == 'e')
+                    return K_TRUE;
+            }
+        }
+    }
+
+    return K_FALSE;
+}
+
 
 /**
@@ -4514,95 +4598,20 @@
  *                              file creation.
  */
-static KBOOL kwFsIsCachableExtensionA(const char *pszExt, KBOOL fAttrQuery)
-{
-    char const chFirst = *pszExt;
-
-    /* C++ header without an extension or a directory. */
-    if (chFirst == '\0')
-    {
-        /** @todo exclude temporary files...  */
-        return K_TRUE;
-    }
-
-    /* C Header: .h */
-    if (chFirst == 'h' || chFirst == 'H')
-    {
-        char        chThird;
-        char const  chSecond = pszExt[1];
-        if (chSecond == '\0')
-            return K_TRUE;
-        chThird = pszExt[2];
-
-        /* C++ Header: .hpp, .hxx */
-        if (   (chSecond == 'p' || chSecond == 'P')
-            && (chThird  == 'p' || chThird  == 'P')
-            && pszExt[3] == '\0')
-            return K_TRUE;
-        if (   (chSecond == 'x' || chSecond == 'X')
-            && (chThird  == 'x' || chThird  == 'X')
-            && pszExt[3] == '\0')
-            return K_TRUE;
-    }
-    /* Misc starting with i. */
-    else if (chFirst == 'i' || chFirst == 'I')
-    {
-        char const chSecond = pszExt[1];
-        if (chSecond != '\0')
-        {
-            if (chSecond == 'n' || chSecond == 'N')
-            {
-                char const chThird = pszExt[2];
-
-                /* C++ inline header: .inl */
-                if (   (chThird == 'l' || chThird == 'L')
-                    && pszExt[3] == '\0')
-                    return K_TRUE;
-
-                /* Assembly include file: .inc */
-                if (   (chThird == 'c' || chThird == 'C')
-                    && pszExt[3] == '\0')
-                    return K_TRUE;
-            }
-        }
-    }
-    /* Assembly header: .mac */
-    else if (chFirst == 'm' || chFirst == 'M')
-    {
-        char const  chSecond = pszExt[1];
-        if (chSecond == 'a' || chSecond == 'A')
-        {
-            char const chThird = pszExt[2];
-            if (  (chThird == 'c' || chThird == 'C')
-                && pszExt[3] == '\0')
-                return K_TRUE;
-        }
-    }
-    else if (fAttrQuery)
-    {
-        /* Dynamic link library: .dll */
-        if (chFirst == 'd' || chFirst == 'D')
-        {
-            char const chSecond = pszExt[1];
-            if (chSecond == 'l' || chSecond == 'L')
-            {
-                char const chThird = pszExt[2];
-                if (chThird == 'l' || chThird == 'L')
-                    return K_TRUE;
-            }
-        }
-        /* Executable file: .exe */
-        else if (chFirst == 'e' || chFirst == 'E')
-        {
-            char const chSecond = pszExt[1];
-            if (chSecond == 'x' || chSecond == 'X')
-            {
-                char const chThird = pszExt[2];
-                if (chThird == 'e' || chThird == 'e')
-                    return K_TRUE;
-            }
-        }
-    }
-
-    return K_FALSE;
+static KBOOL kwFsIsCacheableExtensionA(const char *pszExt, KBOOL fAttrQuery)
+{
+    wchar_t const wcFirst = *pszExt;
+    if (wcFirst)
+    {
+        wchar_t const wcSecond = pszExt[1];
+        if (wcSecond)
+        {
+            wchar_t const wcThird = pszExt[2];
+            if (pszExt[3] == '\0')
+                return kwFsIsCacheableExtensionCommon(wcFirst, wcSecond, wcThird, fAttrQuery);
+            return K_FALSE;
+        }
+        return kwFsIsCacheableExtensionCommon(wcFirst, 0, 0, fAttrQuery);
+    }
+    return kwFsIsCacheableExtensionCommon(0, 0, 0, fAttrQuery);
 }
 
@@ -4617,23 +4626,14 @@
  *                              file creation.
  */
-static KBOOL kwFsIsCachablePathExtensionW(const wchar_t *pwszPath, KBOOL fAttrQuery)
-{
-    /*
-     * Extract the extension, check that it's in the applicable range, roughly
-     * convert it to ASCII/ANSI, and feed it to kwFsIsCachableExtensionA for
-     * the actual check.  This avoids a lot of code duplication.
-     */
-    wchar_t         wc;
-    char            szExt[4];
+static KBOOL kwFsIsCacheablePathExtensionW(const wchar_t *pwszPath, KBOOL fAttrQuery)
+{
     KSIZE           cwcExt;
     wchar_t const  *pwszExt = kwFsPathGetExtW(pwszPath, &cwcExt);
     switch (cwcExt)
     {
-        case 3: if ((wchar_t)(szExt[2] = (char)(wc = pwszExt[2])) == wc) { /*likely*/ } else break;
-        case 2: if ((wchar_t)(szExt[1] = (char)(wc = pwszExt[1])) == wc) { /*likely*/ } else break;
-        case 1: if ((wchar_t)(szExt[0] = (char)(wc = pwszExt[0])) == wc) { /*likely*/ } else break;
-        case 0:
-            szExt[cwcExt] = '\0';
-            return kwFsIsCachableExtensionA(szExt, fAttrQuery);
+        case 3: kwFsIsCacheableExtensionCommon(pwszExt[0], pwszExt[1], pwszExt[2], fAttrQuery);
+        case 2: kwFsIsCacheableExtensionCommon(pwszExt[0], pwszExt[1], 0,          fAttrQuery);
+        case 1: kwFsIsCacheableExtensionCommon(pwszExt[0], 0,          0,          fAttrQuery);
+        case 0: kwFsIsCacheableExtensionCommon(0,          0,          0,          fAttrQuery);
     }
     return K_FALSE;
@@ -4827,5 +4827,5 @@
                 {
                     const char *pszExt = kHlpGetExt(pszFilename);
-                    if (kwFsIsCachableExtensionA(pszExt, K_FALSE /*fAttrQuery*/))
+                    if (kwFsIsCacheableExtensionA(pszExt, K_FALSE /*fAttrQuery*/))
                     {
                         KFSLOOKUPERROR enmError;
@@ -4918,5 +4918,5 @@
                         && pSecAttrs->lpSecurityDescriptor == NULL ) )
                 {
-                    if (kwFsIsCachablePathExtensionW(pwszFilename, K_FALSE /*fAttrQuery*/))
+                    if (kwFsIsCacheablePathExtensionW(pwszFilename, K_FALSE /*fAttrQuery*/))
                     {
                         /** @todo rewrite in pure UTF-16. */
@@ -5327,5 +5327,5 @@
         && cchToWrite <= pOutBuf->u.Fully.cchBufAlloc - pOutBuf->u.Fully.cchBuf)
     {
-        memcpy(&pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf], pchBuffer, cchToWrite);
+        kHlpMemCopy(&pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf], pchBuffer, cchToWrite);
         pOutBuf->u.Fully.cchBuf += cchToWrite;
     }
@@ -5343,5 +5343,5 @@
             if (cchLine <= pOutBuf->u.Fully.cchBufAlloc - pOutBuf->u.Fully.cchBuf)
             {
-                memcpy(&pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf], pchBuffer, cchLine);
+                kHlpMemCopy(&pOutBuf->u.Fully.pchBuf[pOutBuf->u.Fully.cchBuf], pchBuffer, cchLine);
                 pOutBuf->u.Fully.cchBuf += cchLine;
             }
@@ -5371,5 +5371,5 @@
                 KWOUT_LOG(("kwSandboxOutBufWrite: flushing %u bytes\n", pOutBuf->u.Fully.cchBuf));
                 kwSandboxOutBufWriteIt(pOutBuf->hBackup, pOutBuf->u.Fully.pchBuf, pOutBuf->u.Fully.cchBuf);
-                memcpy(&pOutBuf->u.Fully.pchBuf[0], pchBuffer, cchLine);
+                kHlpMemCopy(&pOutBuf->u.Fully.pchBuf[0], pchBuffer, cchLine);
                 pOutBuf->u.Fully.cchBuf = cchLine;
             }
@@ -6032,5 +6032,5 @@
     DWORD       fRet;
     const char *pszExt = kHlpGetExt(pszFilename);
-    if (kwFsIsCachableExtensionA(pszExt, K_TRUE /*fAttrQuery*/))
+    if (kwFsIsCacheableExtensionA(pszExt, K_TRUE /*fAttrQuery*/))
     {
         KFSLOOKUPERROR enmError;
@@ -6065,5 +6065,5 @@
 {
     DWORD fRet;
-    if (kwFsIsCachablePathExtensionW(pwszFilename, K_TRUE /*fAttrQuery*/))
+    if (kwFsIsCacheablePathExtensionW(pwszFilename, K_TRUE /*fAttrQuery*/))
     {
         KFSLOOKUPERROR enmError;
@@ -6100,5 +6100,5 @@
 {
     DWORD cwcRet;
-    if (kwFsIsCachablePathExtensionW(pwszLongPath, K_TRUE /*fAttrQuery*/))
+    if (kwFsIsCacheablePathExtensionW(pwszLongPath, K_TRUE /*fAttrQuery*/))
     {
         KFSLOOKUPERROR enmError;
@@ -6253,5 +6253,5 @@
     else
     {
-        memcpy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuf, cwcBuf * sizeof(wchar_t));
+        kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuf, cwcBuf * sizeof(wchar_t));
         pSandbox->Combined.cwcBuf += cwcBuf;
     }
@@ -6467,5 +6467,5 @@
             if (offLastIncompleteLine == 0)
             {
-                memcpy(&pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf], pwcBuffer, cwcToWrite * sizeof(wchar_t));
+                kHlpMemCopy(&pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf], pwcBuffer, cwcToWrite * sizeof(wchar_t));
                 pLineBuf->u.Con.cwcBuf += cwcToWrite;
                 return;
@@ -6480,12 +6480,12 @@
             if (pLineBuf->u.Con.cwcBuf > 0)
             {
-                memcpy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf],
-                       pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf * sizeof(wchar_t));
+                kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf],
+                            pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf * sizeof(wchar_t));
                 pSandbox->Combined.cwcBuf += pLineBuf->u.Con.cwcBuf;
                 pLineBuf->u.Con.cwcBuf = 0;
             }
 
-            memcpy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf],
-                   pwcBuffer, offLastIncompleteLine * sizeof(wchar_t));
+            kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf],
+                        pwcBuffer, offLastIncompleteLine * sizeof(wchar_t));
             pSandbox->Combined.cwcBuf += offLastIncompleteLine;
         }
@@ -6510,10 +6510,10 @@
                 if (pLineBuf->u.Con.cwcBuf + offNextLine + pSandbox->Combined.cwcBuf <= K_ELEMENTS(pSandbox->Combined.wszBuf))
                 {
-                    memcpy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf],
-                           pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf * sizeof(wchar_t));
+                    kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf],
+                                pLineBuf->u.Con.pwcBuf, pLineBuf->u.Con.cwcBuf * sizeof(wchar_t));
                     pSandbox->Combined.cwcBuf += pLineBuf->u.Con.cwcBuf;
                     pLineBuf->u.Con.cwcBuf = 0;
 
-                    memcpy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuffer, offNextLine * sizeof(wchar_t));
+                    kHlpMemCopy(&pSandbox->Combined.wszBuf[pSandbox->Combined.cwcBuf], pwcBuffer, offNextLine * sizeof(wchar_t));
                     pSandbox->Combined.cwcBuf += offNextLine;
                 }
@@ -6524,5 +6524,5 @@
                     {
                         KU32 cwcCopy = K_MIN(cwcLeft, offNextLine);
-                        memcpy(&pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf], pwcBuffer, cwcCopy * sizeof(wchar_t));
+                        kHlpMemCopy(&pLineBuf->u.Con.pwcBuf[pLineBuf->u.Con.cwcBuf], pwcBuffer, cwcCopy * sizeof(wchar_t));
                         pLineBuf->u.Con.cwcBuf += cwcCopy;
                         off += cwcCopy;
@@ -6557,5 +6557,5 @@
         if (offLastIncompleteLine < cwcToWrite)
         {
-            memcpy(&pLineBuf->u.Con.pwcBuf[0], &pwcBuffer[offLastIncompleteLine], cchLastIncompleteLine * sizeof(wchar_t));
+            kHlpMemCopy(&pLineBuf->u.Con.pwcBuf[0], &pwcBuffer[offLastIncompleteLine], cchLastIncompleteLine * sizeof(wchar_t));
             pLineBuf->u.Con.cwcBuf = cchLastIncompleteLine;
         }
