Index: trunk/src/helpers/apps.c
===================================================================
--- trunk/src/helpers/apps.c	(revision 139)
+++ trunk/src/helpers/apps.c	(revision 140)
@@ -1250,5 +1250,5 @@
                 ProgDetails.pszParameters = strParamsPatched.psz;
 
-                _Pmpf((__FUNCTION__ ": progt.progc: %d", ProgDetails.progt.progc));
+                /* _Pmpf((__FUNCTION__ ": progt.progc: %d", ProgDetails.progt.progc));
                 _Pmpf(("    progt.fbVisible: 0x%lX", ProgDetails.progt.fbVisible));
                 _Pmpf(("    progt.pszTitle: \"%s\"", (ProgDetails.pszTitle) ? ProgDetails.pszTitle : "NULL"));
@@ -1257,5 +1257,5 @@
                 _Pmpf(("    startup: \"%s\"", (ProgDetails.pszStartupDir) ? ProgDetails.pszStartupDir : "NULL"));
                 _Pmpf(("    pszIcon: \"%s\"", (ProgDetails.pszIcon) ? ProgDetails.pszIcon : "NULL"));
-                /* _Pmpf(("    environment: "));
+                _Pmpf(("    environment: "));
                 {
                     PSZ pszThis = ProgDetails.pszEnvironment;
@@ -1268,5 +1268,5 @@
                    */
 
-                _Pmpf(("    swpInitial.fl = 0x%lX, x = %d, y = %d, cx = %d, cy = %d:",
+                /* _Pmpf(("    swpInitial.fl = 0x%lX, x = %d, y = %d, cx = %d, cy = %d:",
                             ProgDetails.swpInitial.fl,
                             ProgDetails.swpInitial.x,
@@ -1279,4 +1279,5 @@
                             ProgDetails.swpInitial.ulReserved1,
                             ProgDetails.swpInitial.ulReserved2));
+                   */
 
                 if (pszFailingName)
@@ -1308,5 +1309,5 @@
                     {
                         // cannot start app:
-                        _Pmpf((__FUNCTION__ ": WinStartApp failed"));
+                        // _Pmpf((__FUNCTION__ ": WinStartApp failed"));
                         arc = ERROR_FILE_NOT_FOUND;
                         // unfortunately WinStartApp doesn't
@@ -1405,5 +1406,5 @@
     } // end if (ProgDetails.pszExecutable)
 
-    _Pmpf((__FUNCTION__ ": returning %d", arc));
+    // _Pmpf((__FUNCTION__ ": returning %d", arc));
 
     return (arc);
Index: trunk/src/helpers/exeh.c
===================================================================
--- trunk/src/helpers/exeh.c	(revision 139)
+++ trunk/src/helpers/exeh.c	(revision 140)
@@ -2490,5 +2490,5 @@
     if (ulObjPageTblIndexThis - 1 >= pExec->pLXHeader->ulPageCount)
     {
-        _Pmpf(("ulObjPageTblIndexThis %d is too large", ulObjPageTblIndexThis));
+        // _Pmpf(("ulObjPageTblIndexThis %d is too large", ulObjPageTblIndexThis));
         return ERROR_INVALID_SEGMENT_NUMBER;     // 180
     }
@@ -2535,10 +2535,10 @@
         ulOffset +=   ulExeOffset;
 
-        _Pmpf(("  reading pgtbl %d, ofs %d, type %s",
+        /* _Pmpf(("  reading pgtbl %d, ofs %d, type %s",
                 ulObjPageTblIndex,
                 ulOffset,
                 (ulFlags == 0x0001) ? "ITERDATA"
                 : (ulFlags == 0x0005) ? "ITERDATA2"
-                : "uncompressed"));
+                : "uncompressed")); */
 
         if (ulSize > ulPageSize)
@@ -2551,5 +2551,5 @@
                                     0)))
         {
-            _Pmpf(("   %d bytes read", ulSize));
+            // _Pmpf(("   %d bytes read", ulSize));
 
             // terminate buffer for decompress
@@ -2644,7 +2644,7 @@
     *ppbResData = 0;
 
-    _Pmpf((__FUNCTION__ " %s: ulType = %d, idResource %d",
+    /* _Pmpf((__FUNCTION__ " %s: ulType = %d, idResource %d",
             pExec->pFile->pszFilename,
-            ulType, idResource));
+            ulType, idResource)); */
 
     if (!(pLXHeader = pExec->pLXHeader))
@@ -2693,5 +2693,5 @@
                 if (pRsEntry->obj - 1 >= pLXHeader->ulObjCount)
                 {
-                    _Pmpf(("pRsEntry->obj %d is too large", pRsEntry->obj));
+                    // _Pmpf(("pRsEntry->obj %d is too large", pRsEntry->obj));
                     arc = ERROR_INVALID_SEGMENT_NUMBER;     // 180
                 }
@@ -2756,10 +2756,10 @@
                                 ulPageThis;
 
-                        _Pmpf(("  found RT_POINTER %d, size %d, resofs %d",
+                        /* _Pmpf(("  found RT_POINTER %d, size %d, resofs %d",
                                 pRsEntry->name,
                                 pRsEntry->cb,
                                 pRsEntry->offset));
                         _Pmpf(("  ulFirstPage %d, ulResOffsetInFirstPage %d, cPages %d",
-                                ulFirstPage, ulResOffsetInFirstPage, cPages));
+                                ulFirstPage, ulResOffsetInFirstPage, cPages)); */
 
                         ulPageThis = ulObjPageTblIndex + ulFirstPage;
@@ -2826,5 +2826,5 @@
     }
 
-    _Pmpf((__FUNCTION__ ": returning %d", arc));
+    // _Pmpf((__FUNCTION__ ": returning %d", arc));
 
     return (arc);
@@ -3011,5 +3011,5 @@
         ulNewHeaderOfs = pExec->pDosExeHeader->ulNewHeaderOfs;
 
-    _Pmpf((__FUNCTION__ ": entering, checking %d resources", pNEHeader->usResSegmCount));
+    // _Pmpf((__FUNCTION__ ": entering, checking %d resources", pNEHeader->usResSegmCount));
 
     if (!(cResources = pNEHeader->usResSegmCount))
@@ -3080,6 +3080,6 @@
             arc = ERROR_NO_DATA;
     }
-    else
-        _Pmpf(("exehLoadOS2NEMaps returned %d"));
+    // else
+        // _Pmpf(("exehLoadOS2NEMaps returned %d"));
 
     return (arc);
Index: trunk/src/helpers/gpih.c
===================================================================
--- trunk/src/helpers/gpih.c	(revision 139)
+++ trunk/src/helpers/gpih.c	(revision 140)
@@ -1526,6 +1526,6 @@
         bih2.cPlanes = (cPlanes) ? cPlanes : alData[0];
         bih2.cBitCount = (cBitCount) ? cBitCount : alData[1];
-            _Pmpf((__FUNCTION__ ": cPlanes %d, cBitCount %d",
-                        bih2.cPlanes, bih2.cBitCount));
+            // _Pmpf((__FUNCTION__ ": cPlanes %d, cBitCount %d",
+               //          bih2.cPlanes, bih2.cBitCount));
         bih2.ulCompression = BCA_UNCOMP;
         bih2.cbImage = (    (   (bih2.cx
Index: trunk/src/helpers/stringh.c
===================================================================
--- trunk/src/helpers/stringh.c	(revision 139)
+++ trunk/src/helpers/stringh.c	(revision 140)
@@ -81,7 +81,7 @@
                       PCSZ pcszSource,
                       PULONG pulLength,        // out: length of new string (ptr can be NULL)
-                      const char *pcszSourceFile,
+                      PCSZ pcszSourceFile,
                       unsigned long ulLine,
-                      const char *pcszFunction)
+                      PCSZ pcszFunction)
 {
     ULONG ulLength = 0;
@@ -169,5 +169,5 @@
  */
 
-PSZ strhcpy(PSZ string1, const char *string2)
+PSZ strhcpy(PSZ string1, PCSZ string2)
 {
     if (string2)
@@ -187,9 +187,9 @@
  */
 
-PSZ strhdupDebug(const char *pcszSource,
+PSZ strhdupDebug(PCSZ pcszSource,
                  unsigned long *pulLength,
-                 const char *pcszSourceFile,
+                 PCSZ pcszSourceFile,
                  unsigned long ulLine,
-                 const char *pcszFunction)
+                 PCSZ pcszFunction)
 {
     PSZ     pszReturn = NULL;
@@ -225,5 +225,5 @@
  */
 
-PSZ strhdup(const char *pcszSource,
+PSZ strhdup(PCSZ pcszSource,
             unsigned long *pulLength)       // out: length of string excl. null terminator (ptr can be NULL)
 {
@@ -259,5 +259,5 @@
  */
 
-int strhcmp(const char *p1, const char *p2)
+int strhcmp(PCSZ p1, PCSZ p2)
 {
     if (p1 && p2)
@@ -286,5 +286,5 @@
  */
 
-int strhicmp(const char *p1, const char *p2)
+int strhicmp(PCSZ p1, PCSZ p2)
 {
     if (p1 && p2)
@@ -312,5 +312,5 @@
  */
 
-PSZ strhistr(const char *string1, const char *string2)
+PSZ strhistr(PCSZ string1, PCSZ string2)
 {
     PSZ prc = NULL;
@@ -352,5 +352,5 @@
 
 ULONG strhncpy0(PSZ pszTarget,
-                const char *pszSource,
+                PCSZ pszSource,
                 ULONG cbSource)
 {
@@ -378,5 +378,5 @@
  */
 
-ULONG strhCount(const char *pszSearch,
+ULONG strhCount(PCSZ pszSearch,
                 CHAR c)
 {
@@ -424,9 +424,9 @@
  */
 
-PSZ strhSubstrDebug(const char *pBegin,      // in: first char
-                    const char *pEnd,        // in: last char (not included)
-                    const char *pcszSourceFile,
+PSZ strhSubstrDebug(PCSZ pBegin,      // in: first char
+                    PCSZ pEnd,        // in: last char (not included)
+                    PCSZ pcszSourceFile,
                     unsigned long ulLine,
-                    const char *pcszFunction)
+                    PCSZ pcszFunction)
 {
     PSZ pszSubstr = NULL;
@@ -469,6 +469,6 @@
  */
 
-PSZ strhSubstr(const char *pBegin,      // in: first char
-               const char *pEnd)        // in: last char (not included)
+PSZ strhSubstr(PCSZ pBegin,      // in: first char
+               PCSZ pEnd)        // in: last char (not included)
 {
     PSZ pszSubstr = NULL;
@@ -671,7 +671,7 @@
  */
 
-PSZ strhins(const char *pcszBuffer,
+PSZ strhins(PCSZ pcszBuffer,
             ULONG ulInsertOfs,
-            const char *pcszInsert)
+            PCSZ pcszInsert)
 {
     PSZ     pszNew = NULL;
@@ -723,6 +723,6 @@
                       PULONG pulOfs,               // in: where to begin search (0 = start);
                                                    // out: ofs of first char after replacement string
-                      const char *pcszSearch,      // in: search string; cannot be NULL
-                      const char *pcszReplace)     // in: replacement string; cannot be NULL
+                      PCSZ pcszSearch,      // in: search string; cannot be NULL
+                      PCSZ pcszReplace)     // in: replacement string; cannot be NULL
 {
     ULONG   ulrc = 0;
@@ -797,15 +797,15 @@
 BOOL strhGetWord(PSZ *ppszStart,        // in: start of search,
                                         // out: start of word (if TRUE is returned)
-                 const char *pLimit,    // in: ptr to last char after *ppszStart to be
+                 PCSZ pLimit,    // in: ptr to last char after *ppszStart to be
                                         // searched; if the word does not end before
                                         // or with this char, FALSE is returned
-                 const char *pcszBeginChars, // stringh.h defines STRH_BEGIN_CHARS
-                 const char *pcszEndChars, // stringh.h defines STRH_END_CHARS
+                 PCSZ pcszBeginChars, // stringh.h defines STRH_BEGIN_CHARS
+                 PCSZ pcszEndChars, // stringh.h defines STRH_END_CHARS
                  PSZ *ppszEnd)          // out: first char _after_ word
                                         // (if TRUE is returned)
 {
     // characters after which a word can be started
-    // const char *pcszBeginChars = "\x0d\x0a ";
-    // const char *pcszEndChars = "\x0d\x0a /-";
+    // PCSZ pcszBeginChars = "\x0d\x0a ";
+    // PCSZ pcszEndChars = "\x0d\x0a /-";
 
     PSZ pStart = *ppszStart;
@@ -855,9 +855,9 @@
  */
 
-BOOL strhIsWord(const char *pcszBuf,
-                const char *p,                 // in: start of word
+BOOL strhIsWord(PCSZ pcszBuf,
+                PCSZ p,                 // in: start of word
                 ULONG cbSearch,                // in: length of word
-                const char *pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
-                const char *pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
+                PCSZ pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
+                PCSZ pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
 {
     BOOL    fEndOK = FALSE;
@@ -915,8 +915,8 @@
  */
 
-PSZ strhFindWord(const char *pszBuf,
-                 const char *pszSearch,
-                 const char *pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
-                 const char *pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
+PSZ strhFindWord(PCSZ pszBuf,
+                 PCSZ pszSearch,
+                 PCSZ pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
+                 PCSZ pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
 {
     PSZ     pszReturn = 0;
@@ -926,5 +926,5 @@
     if ((cbBuf) && (cbSearch))
     {
-        const char *p = pszBuf;
+        PCSZ p = pszBuf;
 
         do  // while p
@@ -966,9 +966,9 @@
  */
 
-PSZ strhFindEOL(const char *pcszSearchIn,        // in: where to search
+PSZ strhFindEOL(PCSZ pcszSearchIn,        // in: where to search
                 PULONG pulOffset)       // out: offset (ptr can be NULL)
 {
-    const char *p = pcszSearchIn,
-               *prc = 0;
+    PCSZ    p = pcszSearchIn,
+            prc = 0;
     while (TRUE)
     {
Index: trunk/src/helpers/wphandle.c
===================================================================
--- trunk/src/helpers/wphandle.c	(revision 139)
+++ trunk/src/helpers/wphandle.c	(revision 140)
@@ -260,4 +260,10 @@
 /*
  *@@ wphRebuildNodeHashTable:
+ *      builds all the complex cache trees in the
+ *      given handles buffer.
+ *
+ *      If (fQuitOnErrors == TRUE), we'll fail as
+ *      soon as an invalid handle is found. Otherwise
+ *      we will try to continue if the error is not fatal.
  *
  *      Returns:
@@ -269,8 +275,13 @@
  *      --  ERROR_WPH_CORRUPT_HANDLES_DATA
  *
+ *      --  ERROR_WPH_DRIV_TREEINSERT_FAILED: duplicate DRIV node
+ *          (non-fatal)
+ *
  *@@added V0.9.16 (2001-10-02) [umoeller]
- */
-
-APIRET wphRebuildNodeHashTable(HHANDLES hHandles)
+ *@@changted V0.9.17 (2002-02-05) [umoeller]: added fQuitOnErrors
+ */
+
+APIRET wphRebuildNodeHashTable(HHANDLES hHandles,
+                               BOOL fQuitOnErrors)
 {
     APIRET arc = NO_ERROR;
@@ -322,5 +333,6 @@
                                    (TREE*)pLastDriveTreeNode,
                                    treeCompareStrings))
-                        arc = ERROR_WPH_DRIV_TREEINSERT_FAILED;
+                        if (fQuitOnErrors)
+                            arc = ERROR_WPH_DRIV_TREEINSERT_FAILED;
                 }
 
@@ -355,6 +367,9 @@
                         PNODETREENODE pParent;
                         if (!(pParent = pHandlesBuf->NodeHashTable[pNode->usParentHandle]))
+                        {
                             // this parent handle is invalid:
-                            arc = ERROR_WPH_INVALID_PARENT_HANDLE;
+                            if (fQuitOnErrors)
+                                arc = ERROR_WPH_INVALID_PARENT_HANDLE;
+                        }
                         else
                         {
@@ -372,13 +387,18 @@
                         }
                         else
-                            arc = ERROR_WPH_NODE_BEFORE_DRIV;
-
-                    if (!arc)
+                            if (fQuitOnErrors)
+                                arc = ERROR_WPH_NODE_BEFORE_DRIV;
+
+                    if (ppTree && pcChildren)
                         if (!treeInsert(ppTree,
                                         pcChildren,
                                         (TREE*)pNew,
                                         treeCompareStrings))
+                        {
                             // store PNODE in hash table
                             pHandlesBuf->NodeHashTable[pNode->usHandle] = pNew;
+                            // do not free
+                            pNew = NULL;
+                        }
                         else
                             ;
@@ -387,5 +407,5 @@
                             // arc = ERROR_WPH_NODE_TREEINSERT_FAILED;
 
-                    if (arc)
+                    if (pNew)
                         free(pNew);
 
@@ -641,5 +661,6 @@
         // rebuild cache
         if (!pHandlesBuf->fCacheValid)
-            arc = wphRebuildNodeHashTable(hHandles);
+            arc = wphRebuildNodeHashTable(hHandles,
+                                          TRUE);        // fail on errors
 
         if (!arc)
@@ -922,5 +943,6 @@
         {
             if (!pHandlesBuf->fCacheValid)
-                arc = wphRebuildNodeHashTable(hHandles);
+                arc = wphRebuildNodeHashTable(hHandles,
+                                              TRUE);        // fail on errors
 
             if (!arc)
