Index: /trunk/src/VBox/Runtime/common/ldr/ldrLX.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/ldr/ldrLX.cpp	(revision 74639)
+++ /trunk/src/VBox/Runtime/common/ldr/ldrLX.cpp	(revision 74640)
@@ -152,10 +152,12 @@
 static int kldrModLXDoIterData2Unpacking(uint8_t *pbDst, const uint8_t *pbSrc, int cbSrc);
 static void kLdrModLXMemCopyW(uint8_t *pbDst, const uint8_t *pbSrc, int cb);
+static int kldrModLXDoForwarderQuery(PKLDRMODLX pModLX, const struct e32_entry *pEntry,
+                                     PFNRTLDRIMPORT pfnGetForwarder, void *pvUser, PRTLDRADDR puValue, uint32_t *pfKind);
+#if 0
 static int kldrModLXDoProtect(PKLDRMODLX pModLX, void *pvBits, unsigned fUnprotectOrProtect);
 static int kldrModLXDoCallDLL(PKLDRMODLX pModLX, void *pvMapping, unsigned uOp, uintptr_t uHandle);
-static int kldrModLXDoForwarderQuery(PKLDRMODLX pModLX, const struct e32_entry *pEntry,
-                                     PFNRTLDRIMPORT pfnGetForwarder, void *pvUser, PRTLDRADDR puValue, uint32_t *pfKind);
+static int32_t kldrModLXDoCall(uintptr_t uEntrypoint, uintptr_t uHandle, uint32_t uOp, void *pvReserved);
+#endif
 static int kldrModLXDoLoadFixupSection(PKLDRMODLX pModLX);
-static int32_t kldrModLXDoCall(uintptr_t uEntrypoint, uintptr_t uHandle, uint32_t uOp, void *pvReserved);
 static int kldrModLXDoReloc(uint8_t *pbPage, int off, RTLDRADDR PageAddress, const struct r32_rlc *prlc,
                             int iSelector, RTLDRADDR uValue, uint32_t fKind);
@@ -343,5 +345,5 @@
      */
     rc = pRdr->pfnRead(pRdr, (void *)pModLX->pbLoaderSection, pModLX->Hdr.e32_ldrsize, pModLX->Hdr.e32_objtab + pModLX->offHdr);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
     ((uint8_t *)pModLX->pbLoaderSectionLast)[1] = 0;
@@ -568,5 +570,5 @@
     {
         rc = kldrModLXDoNameLookup(pModLX, pchSymbol, cchSymbol, &iSymbol);
-        if (rc)
+        if (RT_FAILURE(rc))
             return rc;
     }
@@ -644,5 +646,5 @@
                          + offObject
                          + pModLX->aSegments[pBundle->b32_obj - 1].RVA;
-            return 0;
+            return VINF_SUCCESS;
         }
 
@@ -680,5 +682,5 @@
  * Do name lookup.
  *
- * @returns See kLdrModQuerySymbol.
+ * @returns IPRT status code.
  * @param   pModLX      The module to lookup the symbol in.
  * @param   pchSymbol   The symbol to lookup.
@@ -716,5 +718,5 @@
 
     *piSymbol = *(const uint16_t *)(pbName + 1 + *pbName);
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -766,5 +768,5 @@
  * Deal with a forwarder entry.
  *
- * @returns See kLdrModQuerySymbol.
+ * @returns IPRT status code.
  * @param   pModLX          The PE module interpreter instance.
  * @param   pEntry          The forwarder entry.
@@ -811,5 +813,5 @@
         {
             rc = kldrModLXDoLoadFixupSection(pModLX);
-            if (rc)
+            if (RT_FAILURE(rc))
                 return rc;
         }
@@ -893,5 +895,5 @@
  * The fixup section isn't loaded until it's accessed. It's also freed by kLdrModDone().
  *
- * @returns 0 on success, non-zero kLdr or native status code on failure.
+ * @returns IPRT status code.
  * @param   pModLX          The PE module interpreter instance.
  */
@@ -1049,5 +1051,5 @@
                         szName[*pbName] = '\0';
                         rc = pfnCallback(pMod, szName, iOrdinal, uValue, /*fKind,*/ pvUser);
-                        if (rc)
+                        if (rc != VINF_SUCCESS)
                             return rc;
 
@@ -1071,5 +1073,5 @@
                         szName[*pbName] = '\0';
                         rc = pfnCallback(pMod, szName, iOrdinal, uValue, /*fKind,*/ pvUser);
-                        if (rc)
+                        if (rc != VINF_SUCCESS)
                             return rc;
 
@@ -1086,5 +1088,5 @@
                     RT_NOREF(fKind);
                     rc = pfnCallback(pMod, NULL /*pszName*/, iOrdinal, uValue, /*fKind,*/ pvUser);
-                    if (rc)
+                    if (rc != VINF_SUCCESS)
                         return rc;
                 }
@@ -1110,5 +1112,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1167,5 +1169,5 @@
     {
         rc = kldrModLXDoLoadFixupSection(pModLX);
-        if (rc)
+        if (RT_FAILURE(rc))
             return rc;
     }
@@ -1187,5 +1189,5 @@
         memcpy(pszName, pb + 1, *pb);
         pszName[*pb] = '\0';
-        rc = 0;
+        rc = VINF_SUCCESS;
     }
     else
@@ -1233,5 +1235,5 @@
     else
     {
-        pStackInfo->Address = NIL_RTLDRADDR;
+        pSt0ackInfo->Address = NIL_RTLDRADDR;
         pStackInfo->LinkAddress = NIL_RTLDRADDR;
     }
@@ -1239,5 +1241,5 @@
     pStackInfo->cbStackThread = 0;
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1258,5 +1260,5 @@
         ? BaseAddress + pModLX->aSegments[pModLX->Hdr.e32_startobj - 1].RVA + pModLX->Hdr.e32_eip
         : NIL_RTLDRADDR;
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1278,5 +1280,5 @@
      */
     if (kldrModLXHasDbgInfo(pMod, pvBits))
-        return 0;
+        return VINF_SUCCESS;
 #if 0
     /*
@@ -1286,5 +1288,5 @@
 #endif
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1302,5 +1304,5 @@
         ||  !pModLX->Hdr.e32_debuglen)
         return VERR_NOT_FOUND;
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1336,5 +1338,5 @@
     }
     rc = kHlpPageAlloc(&pvBase, pModLX->cbMapped, KPROT_EXECUTE_READWRITE, fFixed);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -1343,7 +1345,7 @@
      */
     rc = kldrModLXDoLoadBits(pModLX, pvBase);
-    if (!rc)
+    if (RT_SUCCESS(rc))
         rc = kldrModLXDoProtect(pModLX, pvBase, 0 /* protect */);
-    if (!rc)
+    if (RT_SUCCESS(rc))
     {
         uint32_t i;
@@ -1365,6 +1367,5 @@
  * Loads the LX pages into the specified memory mapping.
  *
- * @returns 0 on success.
- * @returns non-zero kLdr or OS status code on failure.
+ * @returns IPRT status code.
  *
  * @param   pModLX  The LX module interpreter instance.
@@ -1375,5 +1376,5 @@
     const PRTLDRREADER pRdr = pModLX->Core.pReader;
     uint8_t *pbTmpPage = NULL;
-    int rc = 0;
+    int rc = VINF_SUCCESS;
     uint32_t i;
 
@@ -1391,5 +1392,5 @@
          * Iterate the page map pages.
          */
-        for (iPage = 0; !rc && iPage < pObj->o32_mapsize; iPage++, pbPage += OBJPAGELEN)
+        for (iPage = 0; RT_SUCCESS(rc) && iPage < pObj->o32_mapsize; iPage++, pbPage += OBJPAGELEN)
         {
             const struct o32_map *pMap = &pModLX->paPageMappings[iPage + pObj->o32_pagemap - 1];
@@ -1429,5 +1430,5 @@
                     rc = pRdr->pfnRead(pRdr, pbTmpPage, pMap->o32_pagesize,
                                        pModLX->Hdr.e32_datapage + (pMap->o32_pagedataoffset << pModLX->Hdr.e32_pageshift));
-                    if (rc)
+                    if (RT_FAILURE(rc))
                         break;
                     memset(pbTmpPage + pMap->o32_pagesize, 0, 4);
@@ -1453,5 +1454,5 @@
             }
         }
-        if (rc)
+        if (RT_FAILURE(rc))
             break;
 
@@ -1472,5 +1473,5 @@
  * Unpacks iterdata (aka EXEPACK).
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
+ * @returns IPRT status code.
  * @param   pbDst       Where to put the uncompressed data. (Assumes OBJPAGELEN size.)
  * @param   pbSrc       The compressed source data.
@@ -1536,5 +1537,5 @@
         memset(pbDst, 0, cbDst);
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1543,5 +1544,5 @@
  * Unpacks iterdata (aka EXEPACK).
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
+ * @returns IPRT status code.
  * @param   pbDst       Where to put the uncompressed data. (Assumes OBJPAGELEN size.)
  * @param   pbSrc       The compressed source data.
@@ -1751,5 +1752,5 @@
         memset(pbDst, 0, cbDst);
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1802,6 +1803,5 @@
  * Unprotects or protects the specified image mapping.
  *
- * @returns 0 on success.
- * @returns non-zero kLdr or OS status code on failure.
+ * @returns IPRT status code.
  *
  * @param   pModLX  The LX module interpreter instance.
@@ -1860,5 +1860,5 @@
 
         rc = kHlpPageProtect(pv, pModLX->aSegments[i].cbMapped, enmProt);
-        if (rc)
+        if (RT_FAILURE(rc))
             break;
 
@@ -1866,5 +1866,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1906,5 +1906,5 @@
         && pModLX->pvMapping)
         return KLDR_ERR_NOT_MAPPED;
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1936,5 +1936,5 @@
      */
     rc = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 1 /* unprotect */);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -1948,5 +1948,5 @@
      */
     rc2 = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 0 /* protect */);
-    if (!rc && rc2)
+    if (RT_SUCCESS(rc) && RT_FAILURE(rc2))
         rc = rc2;
     return rc;
@@ -1970,5 +1970,5 @@
      */
     rc = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 1 /* unprotect */);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -1983,5 +1983,5 @@
      */
     rc2 = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 0 /* protect */);
-    if (!rc && rc2)
+    if (RT_SUCCESS(rc) && RT_FAILURE(rc2))
         rc = rc2;
     return rc;
@@ -2011,5 +2011,5 @@
         rc = kldrModLXDoCallDLL(pModLX, pvMapping, 0 /* attach */, uHandle);
     else
-        rc = 0;
+        rc = VINF_SUCCESS;
     return rc;
 }
@@ -2035,5 +2035,5 @@
     if (    !pModLX->Hdr.e32_startobj
         ||  pModLX->Hdr.e32_startobj > pModLX->Hdr.e32_objcnt)
-        return 0;
+        return VINF_SUCCESS;
 
     /*
@@ -2045,9 +2045,9 @@
                          uHandle, uOp, NULL);
     if (rc)
-        rc = 0;
+        rc = VINF_SUCCESS;
     else if (uOp == 0 /* attach */)
         rc = KLDR_ERR_MODULE_INIT_FAILED;
     else /* detach: ignore failures */
-        rc = 0;
+        rc = VINF_SUCCESS;
     return rc;
 }
@@ -2138,5 +2138,5 @@
         kldrModLXDoCallDLL(pModLX, pvMapping, 1 /* detach */, uHandle);
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2150,5 +2150,5 @@
     RT_NOREF(uHandle);
     RT_NOREF(fAttachingOrDetaching);
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2204,5 +2204,5 @@
         &&  NewBaseAddress == pModLX->paObjs[0].o32_base
         &&  !pModLX->Hdr.e32_impmodcnt)
-        return 0;
+        return VINF_SUCCESS;
 
     /*
@@ -2212,5 +2212,5 @@
     {
         rc = kldrModLXDoLoadFixupSection(pModLX);
-        if (rc)
+        if (RT_FAILURE(rc))
             return rc;
     }
@@ -2229,5 +2229,7 @@
          * Iterate the page map pages.
          */
-        for (iPage = 0, rc = 0; !rc && iPage < pObj->o32_mapsize; iPage++, pbPage += OBJPAGELEN, PageAddress += OBJPAGELEN)
+        for (iPage = 0, rc = VINF_SUCCESS;
+             RT_SUCCESS(rc) && iPage < pObj->o32_mapsize;
+             iPage++, pbPage += OBJPAGELEN, PageAddress += OBJPAGELEN)
         {
             const uint8_t * const   pbFixupRecEnd = pModLX->pbFixupRecs + pModLX->paoffPageFixups[iPage + pObj->o32_pagemap];
@@ -2252,5 +2254,6 @@
                 union _rel
                 {
-                    const uint8_t *             pb;
+
+                    const uint8_t          *pb;
                     const struct r32_rlc   *prlc;
                 } u;
@@ -2356,5 +2359,5 @@
                         /* resolve it. */
                         rc = pfnGetImport(pMod, szImpModule, NULL, iSymbol, &uValue, /*&fKind,*/ pvUser);
-                        if (rc)
+                        if (RT_FAILURE(rc))
                             return rc;
                         iSelector = -1;
@@ -2413,5 +2416,5 @@
                         /* resolve it. */
                         rc = pfnGetImport(pMod, szImpModule, szSymbol, UINT32_MAX, &uValue, /*&fKind,*/ pvUser);
-                        if (rc)
+                        if (RT_FAILURE(rc))
                             return rc;
                         iSelector = -1;
@@ -2463,5 +2466,5 @@
                         /* generic */
                         rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind);
-                        if (rc)
+                        if (RT_FAILURE(rc))
                             return rc;
                     }
@@ -2483,5 +2486,5 @@
                             {
                                 rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind);
-                                if (rc)
+                                if (RT_FAILURE(rc))
                                     return rc;
                             }
@@ -2498,5 +2501,5 @@
                             {
                                 rc = kldrModLXDoReloc(pbPage, off, PageAddress, u.prlc, iSelector, uValue, fKind);
-                                if (rc)
+                                if (RT_FAILURE(rc))
                                     return rc;
                             }
@@ -2508,5 +2511,5 @@
                         {
                             rc = kldrModLXDoReloc(pbPage, *poffSrc++, PageAddress, u.prlc, iSelector, uValue, fKind);
-                            if (rc)
+                            if (RT_FAILURE(rc))
                                 return rc;
                         }
@@ -2524,5 +2527,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2534,5 +2537,5 @@
  * are dealt with seperately.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
+ * @returns IPRT status code.
  * @param   pbPage      The page in which to apply the fixup.
  * @param   off         Page relative offset of where to apply the offset.
@@ -2554,11 +2557,11 @@
             uint16_t    off;
             uint16_t    Sel;
-        }           Far16;
+        }               Far16;
         struct
         {
             uint32_t    off;
             uint16_t    Sel;
-        }           Far32;
-    }               uData;
+        }               Far32;
+    }                   uData;
 #pragma pack()
     const uint8_t      *pbSrc;
@@ -2634,5 +2637,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2647,6 +2650,5 @@
     for (uint32_t iSeg = 0; iSeg < cSegments; iSeg++)
     {
-        RTLDRSEG Seg = pThis->aSegments[iSeg];
-        int rc = pfnCallback(pMod, &Seg, pvUser);
+        int rc = pfnCallback(pMod, &pThis->aSegments[iSeg], pvUser);
         if (rc != VINF_SUCCESS)
             return rc;
@@ -2753,11 +2755,14 @@
 static DECLCALLBACK(int) rtldrLX_ReadDbgInfo(PRTLDRMODINTERNAL pMod, uint32_t iDbgInfo, RTFOFF off, size_t cb, void *pvBuf)
 {
-    //PKLDRMODLX pThis = RT_FROM_MEMBER(pMod, KLDRMODLX, Core);
-    RT_NOREF(pMod, iDbgInfo, off, cb, pvBuf);
+    PKLDRMODLX pThis = RT_FROM_MEMBER(pMod, KLDRMODLX, Core);
+    if (iDbgInfo == 0)
+        return pThis->Core.pReader->pfnRead(pThis->Core.pReader, pvBuf, cb, off);
     return VERR_OUT_OF_RANGE;
 }
 
 
-/** @interface_method_impl{RTLDROPS,pfnQueryProp} */
+/**
+ * @interface_method_impl{RTLDROPS,pfnQueryProp}
+ */
 static DECLCALLBACK(int) rtldrLX_QueryProp(PRTLDRMODINTERNAL pMod, RTLDRPROP enmProp, void const *pvBits,
                                           void *pvBuf, size_t cbBuf, size_t *pcbRet)
@@ -2821,5 +2826,5 @@
     rtldrLX_SegOffsetToRva,
     rtldrLX_RvaToSegOffset,
-    NULL,
+    rtldrLX_ReadDbgInfo,
     rtldrLX_QueryProp,
     NULL /*pfnVerifySignature*/,
@@ -2853,5 +2858,5 @@
             pThis->Core.u32Magic = RTLDRMOD_MAGIC;
             *phLdrMod = &pThis->Core;
-            return 0;
+            return VINF_SUCCESS;
         }
         rc = VERR_LDR_ARCH_MISMATCH;
Index: /trunk/src/VBox/Runtime/common/ldr/ldrMachO.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/ldr/ldrMachO.cpp	(revision 74639)
+++ /trunk/src/VBox/Runtime/common/ldr/ldrMachO.cpp	(revision 74640)
@@ -342,8 +342,8 @@
     RTLDRADDR   LinkAddress  = NIL_RTLDRADDR;
     uint8_t     uEffFileType = 0;
-    if (!rc)
+    if (RT_SUCCESS(rc))
         rc = kldrModMachOPreParseLoadCommands(pbLoadCommands, &s.Hdr32, pRdr, offImage, fOpenFlags,
                                               &cSegments, &cSections, &cbStringPool, &fCanLoad, &LinkAddress, &uEffFileType);
-    if (rc)
+    if (RT_FAILURE(rc))
     {
         RTMemFree(pbLoadCommands);
@@ -475,11 +475,9 @@
      */
     rc = kldrModMachOParseLoadCommands(pThis, (char *)pThis + cbModAndSegs, cbStringPool);
-    if (rc)
-        return rc;
 
     /*
      * We're done.
      */
-    return 0;
+    return rc;
 }
 
@@ -505,6 +503,5 @@
  * debug enumeration callback API.
  *
- * @returns 0 on success.
- * @returns VERR_LDRMACHO_* on failure.
+ * @returns IPRT status code.
  * @param   pbLoadCommands  The load commands to parse.
  * @param   pHdr            The header.
@@ -579,5 +576,5 @@
                 section_32_t   *pSect         = pFirstSect;
                 uint32_t        cSectionsLeft = pSrcSeg->nsects;
-                uint64_t            offSect       = 0;
+                uint64_t        offSect       = 0;
 
                 /* Convert and verify the segment. */
@@ -1051,5 +1048,5 @@
     *pcbStringPool = (uint32_t)cbStringPool;
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1060,7 +1057,6 @@
  * This fills in the segment table and perhaps some other properties.
  *
- * @returns 0 on success.
- * @returns VERR_LDRMACHO_* on failure.
- * @param   pThis       The module.
+ * @returns IPRT status code.
+ * @param   pThis           The module.
  * @param   pbStringPool    The string pool
  * @param   cbStringPool    The size of the string pool.
@@ -1105,5 +1101,5 @@
 
                 /* Adds a segment, used by the macro below and thus shared with the 64-bit segment variant. */
-                #define NEW_SEGMENT(a_cBits, a_achName1, a_fObjFile, a_achName2, a_SegAddr, a_cbSeg, a_fFileBits, a_offFile, a_cbFile) \
+#define NEW_SEGMENT(a_cBits, a_achName1, a_fObjFile, a_achName2, a_SegAddr, a_cbSeg, a_fFileBits, a_offFile, a_cbFile) \
                 do { \
                     pDstSeg->SegInfo.pszName = pbStringPool; \
@@ -1146,5 +1142,5 @@
 
                 /* Closes the new segment - part of NEW_SEGMENT. */
-                #define CLOSE_SEGMENT() \
+#define CLOSE_SEGMENT() \
                 do { \
                     pDstSeg->cSections = (uint32_t)(pSectExtra - pDstSeg->paSections); \
@@ -1154,5 +1150,5 @@
 
                 /* Shared with the 64-bit variant. */
-                #define ADD_SEGMENT_AND_ITS_SECTIONS(a_cBits) \
+#define ADD_SEGMENT_AND_ITS_SECTIONS(a_cBits) \
                 do { \
                     bool fAddSegOuter = false; \
@@ -1175,5 +1171,5 @@
                         && strcmp(pSrcSeg->segname, "__CTF") ) \
                     { \
-                        NEW_SEGMENT(a_cBits, pSrcSeg->segname, false /*a_fObjFile*/, 0 /*a_achName2*/, \
+                        NEW_SEGMENT(a_cBits, pSrcSeg->segname, false /*a_fObjFile*/, "" /*a_achName2*/, \
                                     pSrcSeg->vmaddr, pSrcSeg->vmsize, \
                                     pSrcSeg->filesize != 0, pSrcSeg->fileoff, pSrcSeg->filesize); \
@@ -1409,5 +1405,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1419,5 +1415,5 @@
 {
     PKLDRMODMACHO pThis = RT_FROM_MEMBER(pMod, KLDRMODMACHO, Core);
-    int rc = 0;
+    int rc = VINF_SUCCESS;
     KLDRMODMACHO_ASSERT(!pThis->pvMapping);
 
@@ -1454,10 +1450,8 @@
  * Gets the right base address.
  *
- * @returns 0 on success.
- * @returns A non-zero status code if the BaseAddress isn't right.
  * @param   pThis       The interpreter module instance
  * @param   pBaseAddress    The base address, IN & OUT. Optional.
  */
-static int kldrModMachOAdjustBaseAddress(PKLDRMODMACHO pThis, PRTLDRADDR pBaseAddress)
+static void kldrModMachOAdjustBaseAddress(PKLDRMODMACHO pThis, PRTLDRADDR pBaseAddress)
 {
     /*
@@ -1466,5 +1460,4 @@
     if (*pBaseAddress == RTLDR_BASEADDRESS_LINK)
         *pBaseAddress = pThis->LinkAddress;
-    return 0;
 }
 
@@ -1476,6 +1469,6 @@
  * and segments.  This function checks for these and returns the right value.
  *
- * @returns 0 or VERR_SYMBOL_NOT_FOUND.
- * @param   pThis           The interpreter module instance.
+ * @returns VINF_SUCCESS or VERR_SYMBOL_NOT_FOUND.
+ * @param   pThis               The interpreter module instance.
  * @param   pchSymbol           The symbol.
  * @param   cchSymbol           The length of the symbol.
@@ -1611,5 +1604,5 @@
         *puValue = uValue;
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1633,7 +1626,5 @@
      * Resolve defaults.
      */
-    int rc = kldrModMachOAdjustBaseAddress(pThis, &BaseAddress);
-    if (rc)
-        return rc;
+    kldrModMachOAdjustBaseAddress(pThis, &BaseAddress);
 
     /*
@@ -1647,4 +1638,5 @@
      * Take action according to file type.
      */
+    int rc;
     if (   pThis->Hdr.filetype == MH_OBJECT
         || pThis->Hdr.filetype == MH_EXECUTE /** @todo dylib, execute, dsym: symbols */
@@ -1655,5 +1647,5 @@
     {
         rc = kldrModMachOLoadObjSymTab(pThis);
-        if (!rc)
+        if (RT_SUCCESS(rc))
         {
             if (    pThis->Hdr.magic == IMAGE_MACHO32_SIGNATURE
@@ -1696,5 +1688,5 @@
  * Lookup a symbol in a 32-bit symbol table.
  *
- * @returns See kLdrModQuerySymbol.
+ * @returns IPRT status code.
  * @param   pThis
  * @param   paSyms      Pointer to the symbol table.
@@ -1817,5 +1809,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1824,5 +1816,5 @@
  * Lookup a symbol in a 64-bit symbol table.
  *
- * @returns See kLdrModQuerySymbol.
+ * @returns IPRT status code.
  * @param   pThis
  * @param   paSyms      Pointer to the symbol table.
@@ -1945,5 +1937,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -1956,17 +1948,15 @@
 {
     PKLDRMODMACHO pThis = RT_FROM_MEMBER(pMod, KLDRMODMACHO, Core);
+    RT_NOREF(pvBits);
+
+    /*
+     * Resolve defaults.
+     */
+    kldrModMachOAdjustBaseAddress(pThis, &BaseAddress);
+
+    /*
+     * Take action according to file type.
+     */
     int rc;
-    RT_NOREF(pvBits);
-
-    /*
-     * Resolve defaults.
-     */
-    rc  = kldrModMachOAdjustBaseAddress(pThis, &BaseAddress);
-    if (rc)
-        return rc;
-
-    /*
-     * Take action according to file type.
-     */
     if (   pThis->Hdr.filetype == MH_OBJECT
         || pThis->Hdr.filetype == MH_EXECUTE /** @todo dylib, execute, dsym: symbols */
@@ -1977,5 +1967,5 @@
     {
         rc = kldrModMachOLoadObjSymTab(pThis);
-        if (!rc)
+        if (RT_SUCCESS(rc))
         {
             if (    pThis->Hdr.magic == IMAGE_MACHO32_SIGNATURE
@@ -2000,5 +1990,5 @@
  * Enum a 32-bit symbol table.
  *
- * @returns See kLdrModQuerySymbol.
+ * @returns IPRT status code.
  * @param   pThis
  * @param   paSyms      Pointer to the symbol table.
@@ -2102,8 +2092,8 @@
          */
         rc = pfnCallback(&pThis->Core, psz, iSym, uValue/*, fKind*/, pvUser);
-        if (rc)
+        if (rc != VINF_SUCCESS)
             return rc;
     }
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2112,5 +2102,5 @@
  * Enum a 64-bit symbol table.
  *
- * @returns See kLdrModQuerySymbol.
+ * @returns IPRT status code.
  * @param   pThis
  * @param   paSyms      Pointer to the symbol table.
@@ -2214,8 +2204,8 @@
          */
         rc = pfnCallback(&pThis->Core, psz, iSym, uValue/*, fKind*/, pvUser);
-        if (rc)
+        if (rc != VINF_SUCCESS)
             return rc;
     }
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2247,8 +2237,8 @@
 
     if (pThis->Hdr.filetype == MH_OBJECT)
-        return 0;
+        return VINF_SUCCESS;
 
     /* later */
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2267,8 +2257,6 @@
     /* later */
 
-    return 0;
-}
-
-#endif
+    return VINF_SUCCESS;
+}
 
 
@@ -2284,5 +2272,5 @@
      */
     rc = kldrModMachOBitsAndBaseAddress(pThis, NULL, &BaseAddress);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -2299,7 +2287,8 @@
     RT_NOREF(pMod);
 #endif
-    return 0;
-}
-
+    return VINF_SUCCESS;
+}
+
+#endif
 
 /** @copydoc kLdrModQueryImageUuid */
@@ -2369,5 +2358,5 @@
         ||  !pThis->Hdrs.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress)
         return KLDR_ERR_NO_DEBUG_INFO;
-    return 0;
+    return VINF_SUCCESS;
 #else
     RT_NOREF(pMod);
@@ -2413,5 +2402,5 @@
     /* try do the prepare */
     rc = kRdrMap(pMod->pRdr, &pvBase, pMod->cSegments, pMod->aSegments, fFixed);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -2426,5 +2415,5 @@
     pThis->pvMapping = pvBase;
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2447,5 +2436,5 @@
      */
     rc = kRdrUnmap(pMod->pRdr, pThis->pvMapping, pMod->cSegments, pMod->aSegments);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -2457,5 +2446,5 @@
         pMod->aSegments[i].MapAddress = 0;
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2472,5 +2461,5 @@
         && !pThis->pvMapping )
         return KLDR_ERR_NOT_MAPPED;
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2517,5 +2506,5 @@
      */
     rc = kRdrProtect(pMod->pRdr, pThis->pvMapping, pMod->cSegments, pMod->aSegments, 1 /* unprotect */);
-    if (rc)
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -2530,5 +2519,5 @@
      */
     rc2 = kRdrProtect(pMod->pRdr, pThis->pvMapping, pMod->cSegments, pMod->aSegments, 0 /* protect */);
-    if (!rc && rc2)
+    if (RT_SUCCESS(rc) && RT_FAILURE(rc2)
         rc = rc2;
     return rc;
@@ -2540,6 +2529,6 @@
  * MH_OBJECT: Resolves undefined symbols (imports).
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
- * @param   pThis       The Mach-O module interpreter instance.
+ * @returns IPRT status code.
+ * @param   pThis           The Mach-O module interpreter instance.
  * @param   pfnGetImport    The callback for resolving an imported symbol.
  * @param   pvUser          User argument to the callback.
@@ -2549,11 +2538,10 @@
     const uint32_t cSyms = pThis->cSymbols;
     uint32_t iSym;
-    int rc;
 
     /*
      * Ensure that we've got the symbol table and section fixups handy.
      */
-    rc = kldrModMachOLoadObjSymTab(pThis);
-    if (rc)
+    int rc = kldrModMachOLoadObjSymTab(pThis);
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -2596,7 +2584,7 @@
 
                 /* Ask the user for an address to the symbol. */
-                if (rc)
+                if (RT_FAILURE_NP(rc))
                     rc = pfnGetImport(&pThis->Core, NULL /*pszModule*/, pszSymbol, iSym, &Value/*, &fKind*/, pvUser);
-                if (rc)
+                if (RT_FAILURE(rc))
                 {
                     /* weak reference? */
@@ -2655,7 +2643,7 @@
 
                 /* Ask the user for an address to the symbol. */
-                if (rc)
+                if (RT_FAILURE_NP(rc))
                     rc = pfnGetImport(&pThis->Core, NULL, pszSymbol, iSym, &Value, /*&fKind,*/ pvUser);
-                if (rc)
+                if (RT_FAILURE(rc))
                 {
                     /* weak reference? */
@@ -2688,6 +2676,6 @@
  * MH_OBJECT: Applies base relocations to a (unprotected) image mapping.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
- * @param   pThis       The Mach-O module interpreter instance.
+ * @returns IPRT status code.
+ * @param   pThis           The Mach-O module interpreter instance.
  * @param   pvMapping       The mapping to fixup.
  * @param   NewBaseAddress  The address to fixup the mapping to.
@@ -2696,13 +2684,9 @@
 static int  kldrModMachOObjDoFixups(PKLDRMODMACHO pThis, void *pvMapping, RTLDRADDR NewBaseAddress)
 {
-    uint32_t iSeg;
-    int rc;
-
-
     /*
      * Ensure that we've got the symbol table and section fixups handy.
      */
-    rc = kldrModMachOLoadObjSymTab(pThis);
-    if (rc)
+    int rc = kldrModMachOLoadObjSymTab(pThis);
+    if (RT_FAILURE(rc))
         return rc;
 
@@ -2710,13 +2694,11 @@
      * Iterate over the segments and their sections and apply fixups.
      */
-    for (iSeg = rc = 0; !rc && iSeg < pThis->cSegments; iSeg++)
+    rc = VINF_SUCCESS;
+    for (uint32_t iSeg = 0; RT_SUCCESS(rc) && iSeg < pThis->cSegments; iSeg++)
     {
         PKLDRMODMACHOSEG pSeg = &pThis->aSegments[iSeg];
-        uint32_t iSect;
-
-        for (iSect = 0; iSect < pSeg->cSections; iSect++)
+        for (uint32_t iSect = 0; iSect < pSeg->cSections; iSect++)
         {
             PKLDRMODMACHOSECT pSect = &pSeg->paSections[iSect];
-            uint8_t *pbSectBits;
 
             /* skip sections without fixups. */
@@ -2728,5 +2710,5 @@
             {
                 rc = kldrModMachOLoadFixups(pThis, pSect->offFixups, pSect->cFixups, &pSect->paFixups);
-                if (rc)
+                if (RT_FAILURE(rc))
                     break;
             }
@@ -2735,5 +2717,5 @@
              * Apply the fixups.
              */
-            pbSectBits = (uint8_t *)pvMapping + (uintptr_t)pSect->RVA;
+            uint8_t *pbSectBits = (uint8_t *)pvMapping + (uintptr_t)pSect->RVA;
             if (pThis->Hdr.magic == IMAGE_MACHO32_SIGNATURE) /** @todo this aint right. */
                 rc = kldrModMachOFixupSectionGeneric32Bit(pThis, pbSectBits, pSect,
@@ -2747,5 +2729,5 @@
             else
                 KLDRMODMACHO_FAILED_RETURN(VERR_LDRMACHO_TODO);
-            if (rc)
+            if (RT_FAILURE(rc))
                 break;
         }
@@ -2760,6 +2742,6 @@
  * as the host CPU.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
- * @param   pThis       The Mach-O module interpreter instance.
+ * @returns IPRT status code.
+ * @param   pThis           The Mach-O module interpreter instance.
  * @param   pbSectBits      Pointer to the section bits.
  * @param   pFixupSect      The section being fixed up.
@@ -2783,5 +2765,5 @@
     {
         rc = kldrModMachOMapVirginBits(pThis);
-        if (rc)
+        if (RT_FAILURE(rc))
             return rc;
         pbSectVirginBits = (const uint8_t *)pThis->pvBits + pFixupSect->offFile;
@@ -2954,5 +2936,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -2961,6 +2943,6 @@
  * Applies AMD64 fixups to a section.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
- * @param   pThis       The Mach-O module interpreter instance.
+ * @returns IPRT status code.
+ * @param   pThis           The Mach-O module interpreter instance.
  * @param   pbSectBits      Pointer to the section bits.
  * @param   pFixupSect      The section being fixed up.
@@ -2984,5 +2966,5 @@
     {
         rc = kldrModMachOMapVirginBits(pThis);
-        if (rc)
+        if (RT_FAILURE(rc))
             return rc;
         pbSectVirginBits = (const uint8_t *)pThis->pvBits + pFixupSect->offFile;
@@ -3270,5 +3252,5 @@
     }
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -3279,10 +3261,10 @@
  * The symbol table is pointed to by KLDRMODMACHO::pvaSymbols.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
+ * @returns IPRT status code.
  * @param   pThis       The Mach-O module interpreter instance.
  */
 static int  kldrModMachOLoadObjSymTab(PKLDRMODMACHO pThis)
 {
-    int rc = 0;
+    int rc = VINF_SUCCESS;
 
     if (    !pThis->pvaSymbols
@@ -3318,8 +3300,8 @@
                 /* read */
                 rc = pThis->Core.pReader->pfnRead(pThis->Core.pReader, pvSyms, cbSyms, pThis->offSymbols);
-                if (!rc && pThis->cchStrings)
+                if (RT_SUCCESS(rc) && pThis->cchStrings)
                     rc = pThis->Core.pReader->pfnRead(pThis->Core.pReader, pvStrings,
                                                           pThis->cchStrings, pThis->offStrings);
-                if (!rc)
+                if (RT_SUCCESS(rc))
                 {
                     pThis->pvaSymbols = pvSyms;
@@ -3352,5 +3334,5 @@
                     }
 
-                    return 0;
+                    return VINF_SUCCESS;
                 }
                 RTMemFree(pvStrings);
@@ -3370,6 +3352,6 @@
  * conversion if necessary.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
- * @param   pThis       The Mach-O module interpreter instance.
+ * @returns IPRT status code.
+ * @param   pThis           The Mach-O module interpreter instance.
  * @param   offFixups       The file offset of the fixups.
  * @param   cFixups         The number of fixups to load.
@@ -3380,5 +3362,4 @@
     macho_relocation_info_t *paFixups;
     size_t cbFixups;
-    int rc;
 
     /* allocate the memory. */
@@ -3390,6 +3371,6 @@
 
     /* read the fixups. */
-    rc = pThis->Core.pReader->pfnRead(pThis->Core.pReader, paFixups, cbFixups, offFixups);
-    if (!rc)
+    int rc = pThis->Core.pReader->pfnRead(pThis->Core.pReader, paFixups, cbFixups, offFixups);
+    if (RT_SUCCESS(rc))
     {
         *ppaFixups = paFixups;
@@ -3417,10 +3398,10 @@
  * Maps the virgin file bits into memory if not already done.
  *
- * @returns 0 on success, non-zero kLdr status code on failure.
+ * @returns IPRT status code.
  * @param   pThis       The Mach-O module interpreter instance.
  */
 static int kldrModMachOMapVirginBits(PKLDRMODMACHO pThis)
 {
-    int rc = 0;
+    int rc = VINF_SUCCESS;
     if (!pThis->pvBits)
         rc = pThis->Core.pReader->pfnMap(pThis->Core.pReader, &pThis->pvBits);
@@ -3437,5 +3418,5 @@
     RT_NOREF(pvMapping);
     RT_NOREF(uHandle);
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -3448,5 +3429,5 @@
     RT_NOREF(pvMapping);
     RT_NOREF(uHandle);
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -3460,5 +3441,5 @@
     RT_NOREF(uHandle);
     RT_NOREF(fAttachingOrDetaching);
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -3469,5 +3450,5 @@
  * @interface_method_impl{RTLDROPS,pfnGetImageSize}
  */
-static size_t rtldrMachO_GetImageSize(PRTLDRMODINTERNAL pMod)
+static DECLCALLBACK(size_t) rtldrMachO_GetImageSize(PRTLDRMODINTERNAL pMod)
 {
     PKLDRMODMACHO pThis = RT_FROM_MEMBER(pMod, KLDRMODMACHO, Core);
@@ -3504,8 +3485,8 @@
             continue;
         int rc = pThis->Core.pReader->pfnRead(pThis->Core.pReader,
-                                                  (uint8_t *)pvBits + pThis->aSegments[i].SegInfo.RVA,
-                                                  pThis->aSegments[i].SegInfo.cbFile,
-                                                  pThis->aSegments[i].SegInfo.offFile);
-        if (rc)
+                                              (uint8_t *)pvBits + pThis->aSegments[i].SegInfo.RVA,
+                                              pThis->aSegments[i].SegInfo.cbFile,
+                                              pThis->aSegments[i].SegInfo.offFile);
+        if (RT_FAILURE(rc))
             return rc;
     }
@@ -3534,5 +3515,5 @@
     {
         rc = kldrModMachOObjDoImports(pThis, NewBaseAddress, pfnGetImport, pvUser);
-        if (!rc)
+        if (RT_SUCCESS(rc))
             rc = kldrModMachOObjDoFixups(pThis, pvBits, NewBaseAddress);
 
@@ -3542,5 +3523,5 @@
     /*{
         rc = kldrModMachODoFixups(pThis, pvBits, NewBaseAddress, OldBaseAddress, pfnGetImport, pvUser);
-        if (!rc)
+        if (RT_SUCCESS(rc))
             rc = kldrModMachODoImports(pThis, pvBits, pfnGetImport, pvUser);
     }*/
@@ -3550,5 +3531,5 @@
      * segment when present.
      */
-    if (!rc && pThis->fMakeGot)
+    if (RT_SUCCESS(rc) && pThis->fMakeGot)
         rc = kldrModMachOMakeGOT(pThis, pvBits, NewBaseAddress);
 
@@ -3657,5 +3638,5 @@
         }
     }
-    return 0;
+    return VINF_SUCCESS;
 }
 
@@ -3670,6 +3651,5 @@
     for (uint32_t iSeg = 0; iSeg < cSegments; iSeg++)
     {
-        RTLDRSEG Seg = pThis->aSegments[iSeg].SegInfo;
-        int rc = pfnCallback(pMod, &Seg, pvUser);
+        int rc = pfnCallback(pMod, &pThis->aSegments[iSeg].SegInfo, pvUser);
         if (rc != VINF_SUCCESS)
             return rc;
@@ -3779,10 +3759,6 @@
 
     /** @todo May have to apply fixups here. */
-    if (iDbgInfo == iDbgInfo)
+    if (iDbgInfo < pThis->cSections)
         return pThis->Core.pReader->pfnRead(pThis->Core.pReader, pvBuf, cb, off);
-    if (iDbgInfo < pThis->cSections)
-    {
-        return pThis->Core.pReader->pfnRead(pThis->Core.pReader, pvBuf, cb, off);
-    }
     return VERR_OUT_OF_RANGE;
 }
@@ -3840,5 +3816,5 @@
     rtldrMachO_SegOffsetToRva,
     rtldrMachO_RvaToSegOffset,
-    NULL,
+    rtldrMachO_ReadDbgInfo,
     rtldrMachO_QueryProp,
     NULL /*pfnVerifySignature*/,
@@ -3872,5 +3848,5 @@
             pThis->Core.u32Magic = RTLDRMOD_MAGIC;
             *phLdrMod = &pThis->Core;
-            return 0;
+            return VINF_SUCCESS;
         }
         rc = VERR_LDR_ARCH_MISMATCH;
@@ -3909,5 +3885,5 @@
     {
         fat_arch_t FatEntry;
-        int rc = pReader->pfnRead(pReader, &FatEntry, sizeof(FatEntry), offEntry);
+        rc = pReader->pfnRead(pReader, &FatEntry, sizeof(FatEntry), offEntry);
         if (RT_FAILURE(rc))
             return RTErrInfoSetF(pErrInfo, rc, "Read error at offset 0: %Rrc", rc);
