Index: trunk/src/helpers/dosh.c
===================================================================
--- trunk/src/helpers/dosh.c	(revision 239)
+++ trunk/src/helpers/dosh.c	(revision 240)
@@ -1657,5 +1657,5 @@
        )
     {
-        CHAR szTemp[30] = "?:\\long.name.file";
+        CHAR szTemp[] = "?:\\long.name.file";
         szTemp[0]  = ulLogicalDrive + 'A' - 1;
         if (!(arc = DosOpen(szTemp,
@@ -4014,5 +4014,5 @@
  +      PDOSHPERFSYS pPerf = NULL;
  +      APIRET arc;
- +      if (!(arc = arc = doshPerfOpen(&pPerf)))
+ +      if (!(arc = doshPerfOpen(&pPerf)))
  +      {
  +          // this should really be in a timer,
@@ -4043,6 +4043,5 @@
 
     // allocate DOSHPERFSYS structure
-    *ppPerfSys = (PDOSHPERFSYS)malloc(sizeof(DOSHPERFSYS));
-    if (!*ppPerfSys)
+    if (!(*ppPerfSys = (PDOSHPERFSYS)malloc(sizeof(DOSHPERFSYS))))
         arc = ERROR_NOT_ENOUGH_MEMORY;
     else
Index: trunk/src/helpers/dosh2.c
===================================================================
--- trunk/src/helpers/dosh2.c	(revision 239)
+++ trunk/src/helpers/dosh2.c	(revision 240)
@@ -383,5 +383,5 @@
     }
 
-    return(ERROR_BUFFER_OVERFLOW);
+    return ERROR_BUFFER_OVERFLOW;
 }
 
@@ -607,6 +607,6 @@
     {
         // try additional things then
-        PSZ psz2 = (PSZ)malloc(strlen(pcszCommand) + 20);
-        if (psz2)
+        PSZ psz2;
+        if (psz2 = (PSZ)malloc(strlen(pcszCommand) + 20))
         {
             ULONG   ul;
Index: trunk/src/helpers/exeh.c
===================================================================
--- trunk/src/helpers/exeh.c	(revision 239)
+++ trunk/src/helpers/exeh.c	(revision 240)
@@ -257,7 +257,7 @@
                               &cbFile,
                               &pFile)))
-            // file opened successfully:
        )
     {
+        // file opened successfully:
         pExec->pFile = pFile;
         pExec->cbDosExeHeader = sizeof(DOSEXEHEADER);
@@ -505,5 +505,5 @@
     } // end if (fLoadNewHeader)
 
-    if (arc != NO_ERROR)
+    if (arc)
         // error: clean up
         exehClose(&pExec);
Index: trunk/src/helpers/gpih.c
===================================================================
--- trunk/src/helpers/gpih.c	(revision 239)
+++ trunk/src/helpers/gpih.c	(revision 240)
@@ -2807,5 +2807,5 @@
  *
  *      This function may relieve this a bit. This
- *      creates a memory DC, an memory PS, and a bitmap,
+ *      creates a memory DC, a memory PS, and a bitmap,
  *      and selects the bitmap into the memory PS.
  *      You can then use any GPI function on the memory
@@ -2820,6 +2820,6 @@
  *      Example:
  *
- +          PXBITMAP pbmp = gpihCreateXBitmap(hab, 100, 100);
- +          if (pbmp)
+ +          PXBITMAP pbmp;
+ +          if (pbmp = gpihCreateXBitmap(hab, 100, 100))
  +          {
  +              GpiMove(pbmp->hpsMem, ...);
@@ -2845,6 +2845,6 @@
 {
     BOOL fOK = FALSE;
-    PXBITMAP pbmp = (PXBITMAP)malloc(sizeof(XBITMAP));
-    if (pbmp)
+    PXBITMAP pbmp;
+    if (pbmp = (PXBITMAP)malloc(sizeof(XBITMAP)))
     {
         memset(pbmp, 0, sizeof(XBITMAP));
Index: trunk/src/helpers/procstat.c
===================================================================
--- trunk/src/helpers/procstat.c	(revision 239)
+++ trunk/src/helpers/procstat.c	(revision 240)
@@ -497,10 +497,55 @@
 
 /*
+ *@@ prc32GetInfo2:
+ *      nifty interface to DosQuerySysState, the 32-bit
+ *      version of DosQProcStat.
+ *
+ *      This returns the head of a newly allocated buffer
+ *      which has plenty of pointers for subsequent browing.
+ *
+ *      As opposed to prc32GetInfo, with this call you can
+ *      specify the information that would like to retrieve.
+ *
+ *      Use prc32FreeInfo to free the buffer.
+ *
+ *@@added V1.0.1 (2003-01-10) [umoeller]
+ */
+
+PQTOPLEVEL32 prc32GetInfo2(ULONG fl,        // in: QS32_* flags
+                           APIRET *parc)    // out: error, ptr can be NULL
+{
+    APIRET          arc;
+    PQTOPLEVEL32    pReturn = NULL;
+
+    #define BUFSIZE (1024 * 1024) // 1 meg
+
+    if (!(arc = DosAllocMem((PVOID*)&pReturn,
+                            BUFSIZE,
+                            PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_TILE)))
+    {
+        if (arc = DosQuerySysState(fl,
+                                   fl,      // this was missing V0.9.10 (2001-04-08) [umoeller]
+                                   0, 0,
+                                   (PCHAR)pReturn,
+                                   BUFSIZE))
+        {
+            DosFreeMem(pReturn);
+            pReturn = NULL;
+        }
+    }
+
+    if (parc)
+        *parc = arc;
+
+    return pReturn;
+}
+
+/*
  *@@ prc32GetInfo:
- *      nifty interface to DosQuerySysState,
- *      the 32-bit version of DosQProcStat.
- *      This returns the head of a newly
- *      allocated buffer which has plenty
- *      of pointers for subsequent browing.
+ *      nifty interface to DosQuerySysState, the 32-bit
+ *      version of DosQProcStat.
+ *
+ *      This returns the head of a newly allocated buffer
+ *      which has plenty of pointers for subsequent browing.
  *
  *      Use prc32FreeInfo to free the buffer.
@@ -513,30 +558,6 @@
 PQTOPLEVEL32 prc32GetInfo(APIRET *parc)     // out: error, ptr can be NULL
 {
-    #define BUFSIZE (1024 * 1024) // 1 meg
-
-    PCHAR pBuf = NULL; // (PCHAR)malloc(BUFSIZE);
-
-    if (DosAllocMem((PVOID*)&pBuf,
-                    BUFSIZE,
-                    PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_TILE)
-            == NO_ERROR)
-        if (pBuf)
-        {
-            APIRET arc = DosQuerySysState(QS32_SUPPORTED,
-                                          QS32_SUPPORTED,       // this was missing
-                                                                // V0.9.10 (2001-04-08) [umoeller]
-                                          0, 0,
-                                          (PCHAR)pBuf,
-                                          BUFSIZE);
-            if (parc)
-                *parc = arc;
-
-            if (arc == NO_ERROR)
-                return (PQTOPLEVEL32)pBuf;
-            else
-                DosFreeMem(pBuf);
-        }
-
-    return NULL;
+    return prc32GetInfo2(QS32_SUPPORTED,
+                         parc);
 }
 
Index: trunk/src/helpers/stringh.c
===================================================================
--- trunk/src/helpers/stringh.c	(revision 239)
+++ trunk/src/helpers/stringh.c	(revision 240)
@@ -178,4 +178,39 @@
     *string1 = '\0';
     return string1;
+}
+
+/*
+ *@@ strhCopyBuf:
+ *      copies pcszSource to pszTarget, taking
+ *      its length into account.
+ *
+ *      Returns:
+ *
+ *      --  NO_ERROR
+ *
+ *      --  ERROR_INVALID_PARAMETER: pcszSource is
+ *          null or points to a null byte.
+ *
+ *      --  ERROR_FILENAME_EXCED_RANGE: pcszSource
+ *          is too long to fit into pszTarget.
+ *
+ *@@added V1.0.1 (2003-01-05) [umoeller]
+ */
+
+APIRET strhCopyBuf(PSZ pszTarget,
+                   PCSZ pcszSource,
+                   ULONG cbTarget)
+{
+    ULONG cb;
+    if (!pcszSource || !*pcszSource)
+        return ERROR_INVALID_PARAMETER;
+    cb = strlen(pcszSource) + 1;
+    if (cb > cbTarget)
+        return ERROR_FILENAME_EXCED_RANGE;
+
+    memcpy(pszTarget,
+           pcszSource,
+           cb);
+    return NO_ERROR;
 }
 
