Index: trunk/src/VBox/Runtime/r0drv/darwin/dbgkrnlinfo-r0drv-darwin.cpp
===================================================================
--- trunk/src/VBox/Runtime/r0drv/darwin/dbgkrnlinfo-r0drv-darwin.cpp	(revision 58774)
+++ trunk/src/VBox/Runtime/r0drv/darwin/dbgkrnlinfo-r0drv-darwin.cpp	(revision 58800)
@@ -1161,5 +1161,5 @@
 
 
-RTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *pszStructure,
+RTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *pszModule, const char *pszStructure,
                                          const char *pszMember, size_t *poffMember)
 {
Index: trunk/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c	(revision 58774)
+++ trunk/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c	(revision 58800)
@@ -135,4 +135,31 @@
 
 
+/**
+ * Helper for opening the specified kernel module.
+ *
+ * @param pszModule         The name of the module.
+ * @param pMod              Where to store the module handle.
+ * @param pCtf              Where to store the CTF handle.
+ *
+ * @returns Pointer to the CTF structure for the module.
+ */
+static int rtR0DbgKrnlInfoModRetainEx(const char *pszModule, modctl_t **ppMod, ctf_file_t **ppCtf)
+{
+    char *pszMod = RTStrDup(pszModule);
+    if (RT_LIKELY(pszMod))
+    {
+        int rc = rtR0DbgKrnlInfoModRetain(pszMod, ppMod, ppCtf);
+        RTStrFree(pszMod);
+        if (RT_SUCCESS(rc))
+        {
+            AssertPtrReturn(*ppMod, VERR_INTERNAL_ERROR_2);
+            AssertPtrReturn(*ppCtf, VERR_INTERNAL_ERROR_3);
+        }
+        return rc;
+    }
+    return VERR_NO_MEMORY;
+}
+
+
 RTR0DECL(int) RTR0DbgKrnlInfoOpen(PRTDBGKRNLINFO phKrnlInfo, uint32_t fFlags)
 {
@@ -198,5 +225,5 @@
 
 
-RTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *pszStructure,
+RTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *pszModule, const char *pszStructure,
                                          const char *pszMember, size_t *poffMember)
 {
@@ -210,17 +237,35 @@
         RT_ASSERT_PREEMPTIBLE();
 
+    ctf_file_t *pCtf = NULL;
+    modctl_t   *pMod = NULL;
+    if (!pszModule)
+    {
+        pCtf = pThis->pGenUnixCTF;
+        pMod = pThis->pGenUnixMod;
+    }
+    else
+    {
+        int rc2 = rtR0DbgKrnlInfoModRetainEx(pszModule, &pMod, &pCtf);
+        if (RT_FAILURE(rc2))
+            return rc2;
+        Assert(pMod);
+        Assert(pCtf);
+    }
+
     int rc = VERR_NOT_FOUND;
-    ctf_id_t TypeIdent = ctf_lookup_by_name(pThis->pGenUnixCTF, pszStructure);
+    ctf_id_t TypeIdent = ctf_lookup_by_name(pCtf, pszStructure);
     if (TypeIdent != CTF_ERR)
     {
         ctf_membinfo_t MemberInfo;
         RT_ZERO(MemberInfo);
-        if (ctf_member_info(pThis->pGenUnixCTF, TypeIdent, pszMember, &MemberInfo) != CTF_ERR)
+        if (ctf_member_info(pCtf, TypeIdent, pszMember, &MemberInfo) != CTF_ERR)
         {
             *poffMember = (MemberInfo.ctm_offset >> 3);
-            return VINF_SUCCESS;
-        }
-    }
-
+            rc = VINF_SUCCESS;
+        }
+    }
+
+    if (pszModule)
+        rtR0DbgKrnlInfoModRelease(pMod, pCtf);
     return rc;
 }
@@ -258,26 +303,18 @@
         RT_ASSERT_PREEMPTIBLE();
 
-    modctl_t   *pMod;
-    ctf_file_t *pCtf;
+    modctl_t   *pMod = NULL;
+    ctf_file_t *pCtf = NULL;
     if (!pszModule)
     {
         pCtf = pThis->pGenUnixCTF;
         pMod = pThis->pGenUnixMod;
-        NOREF(pMod);
     }
     else
     {
-        char *pszMod = RTStrDup(pszModule);
-        if (RT_LIKELY(pszMod))
-        {
-            int rc = rtR0DbgKrnlInfoModRetain(pszMod, &pMod, &pCtf);
-            RTStrFree(pszMod);
-            if (RT_FAILURE(rc))
-                return VERR_MODULE_NOT_FOUND;
-            AssertPtrReturn(pMod, VERR_INTERNAL_ERROR_5);
-            AssertPtrReturn(pCtf, VERR_INTERNAL_ERROR_4);
-        }
-        else
-            return VERR_NO_MEMORY;
+        int rc2 = rtR0DbgKrnlInfoModRetainEx(pszModule, &pMod, &pCtf);
+        if (RT_FAILURE(rc2))
+            return rc2;
+        Assert(pMod);
+        Assert(pCtf);
     }
 
@@ -290,9 +327,8 @@
         {
             *pcbType = cbType;
-            if (pszModule)
-                rtR0DbgKrnlInfoModRelease(pMod, pCtf);
-            return VINF_SUCCESS;
-        }
-        rc = VERR_WRONG_TYPE;
+            rc = VINF_SUCCESS;
+        }
+        else
+            rc = VERR_WRONG_TYPE;
     }
 
Index: trunk/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
===================================================================
--- trunk/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c	(revision 58774)
+++ trunk/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c	(revision 58800)
@@ -118,5 +118,5 @@
          * Mandatory: Preemption offsets.
          */
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "cpu_t", "cpu_runrun", &g_offrtSolCpuPreempt);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "cpu_t", "cpu_runrun", &g_offrtSolCpuPreempt);
         if (RT_FAILURE(rc))
         {
@@ -125,5 +125,5 @@
         }
 
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "cpu_t", "cpu_kprunrun", &g_offrtSolCpuForceKernelPreempt);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "cpu_t", "cpu_kprunrun", &g_offrtSolCpuForceKernelPreempt);
         if (RT_FAILURE(rc))
         {
@@ -132,5 +132,5 @@
         }
 
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_preempt", &g_offrtSolThreadPreempt);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "kthread_t", "t_preempt", &g_offrtSolThreadPreempt);
         if (RT_FAILURE(rc))
         {
@@ -139,5 +139,5 @@
         }
 
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_did", &g_offrtSolThreadId);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "kthread_t", "t_did", &g_offrtSolThreadId);
         if (RT_FAILURE(rc))
         {
@@ -146,5 +146,5 @@
         }
 
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_intr", &g_offrtSolThreadIntrThread);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "kthread_t", "t_intr", &g_offrtSolThreadIntrThread);
         if (RT_FAILURE(rc))
         {
@@ -153,5 +153,5 @@
         }
 
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_lockp", &g_offrtSolThreadLock);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "kthread_t", "t_lockp", &g_offrtSolThreadLock);
         if (RT_FAILURE(rc))
         {
@@ -160,5 +160,5 @@
         }
 
-        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_procp", &g_offrtSolThreadProc);
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, NULL, "kthread_t", "t_procp", &g_offrtSolThreadProc);
         if (RT_FAILURE(rc))
         {
