儲存庫 vbox 的更動 34959
- 時間撮記:
- 2010-12-10 下午03:17:31 (14 年 以前)
- svn:sync-xref-src-repo-rev:
- 68779
- 位置:
- trunk
- 檔案:
-
- 修改 14 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/VBox/sup.h
r34241 r34959 1036 1036 * 1037 1037 * @returns iprt status code. 1038 * @param pszFilename Image filename. This must have a path. 1039 * @param phLdrMod Where to store the handle to the loaded module. 1040 */ 1041 SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod); 1038 * @param pszFilename Image filename. This must have a path. 1039 * @param phLdrMod Where to store the handle to the loaded module. 1040 * @param pszError Where to return error message on failure. 1041 * @param cbError The size of the error buffer. 1042 */ 1043 SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError); 1042 1044 1043 1045 /** … … 1051 1053 * @param pszFilename Image filename. 1052 1054 * @param phLdrMod Where to store the handle to the loaded module. 1053 */ 1054 SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod); 1055 * @param pszError Where to return error message on failure. 1056 * @param cbError The size of the error buffer. 1057 */ 1058 SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError); 1055 1059 1056 1060 /** -
trunk/include/iprt/ldr.h
r33540 r34959 73 73 */ 74 74 RTDECL(int) RTLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod); 75 76 /** 77 * Loads a dynamic load library (/shared object) image file using native 78 * OS facilities. 79 * 80 * The filename will be appended the default DLL/SO extension of 81 * the platform if it have been omitted. This means that it's not 82 * possible to load DLLs/SOs with no extension using this interface, 83 * but that's not a bad tradeoff. 84 * 85 * If no path is specified in the filename, the OS will usually search it's library 86 * path to find the image file. 87 * 88 * @returns iprt status code. 89 * @param pszFilename Image filename. 90 * @param phLdrMod Where to store the handle to the loader module. 91 * @param pszError Where to store an error message on failure. Optional. 92 * @param cbError The size of the buffer pointed to by @a pszError. 93 */ 94 RTDECL(int) RTLdrLoadEx(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError); 75 95 76 96 /** -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r34839 r34959 831 831 if (fFFMPEG) 832 832 { 833 int rrc = VINF_SUCCESS, rcc = S_OK; 833 HRESULT rcc = S_OK; 834 int rrc = VINF_SUCCESS; 835 char szErr[8192]; 834 836 835 837 Log2(("VBoxHeadless: loading VBoxFFmpegFB shared library\n")); 836 rrc = SUPR3HardenedLdrLoadAppPriv("VBoxFFmpegFB", &hLdrFFmpegFB );838 rrc = SUPR3HardenedLdrLoadAppPriv("VBoxFFmpegFB", &hLdrFFmpegFB, szErr, sizeof(szErr)); 837 839 838 840 if (RT_SUCCESS(rrc)) … … 845 847 } 846 848 else 847 LogError("Failed to load the video capture extension\n", rrc); 849 LogError("Failed to load the video capture extension\n", rrc); /** @todo stupid function, no formatting options. */ 848 850 if (RT_SUCCESS(rrc)) 849 851 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r34947 r34959 5094 5094 if (mDbgEnabled) 5095 5095 { 5096 int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg); 5096 char szErr[8192]; 5097 szErr[0] = '\0'; 5098 int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg, szErr, sizeof(szErr)); 5097 5099 if (RT_FAILURE(vrc)) 5098 5100 { 5099 5101 mhVBoxDbg = NIL_RTLDRMOD; 5100 5102 mDbgAutoShow = mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false; 5101 LogRel(("Failed to load VBoxDbg, rc=%Rrc \n", vrc));5103 LogRel(("Failed to load VBoxDbg, rc=%Rrc - %s\n", vrc, szErr)); 5102 5104 } 5103 5105 } -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r34241 r34959 2083 2083 * @param pszFilename The full file name. 2084 2084 * @param phLdrMod Where to store the handle to the loaded module. 2085 * @param pszError Where to return the loader error. Optional. 2086 * @param cbError The size of the buffer pointed to by @a pszError. 2085 2087 */ 2086 static int supR3HardenedLdrLoadIt(const char *pszFilename, PRTLDRMOD phLdrMod )2088 static int supR3HardenedLdrLoadIt(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError) 2087 2089 { 2088 2090 #ifdef VBOX_WITH_HARDENING … … 2101 2103 * Try load it. 2102 2104 */ 2103 return RTLdrLoad (pszFilename, phLdrMod);2104 } 2105 2106 2107 SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod )2105 return RTLdrLoadEx(pszFilename, phLdrMod, pszError, cbError); 2106 } 2107 2108 2109 SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError) 2108 2110 { 2109 2111 /* 2110 2112 * Validate input. 2111 2113 */ 2112 AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER); 2113 AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER); 2114 if (!pszError) 2115 AssertReturn(!cbError, VERR_INVALID_PARAMETER); 2116 else 2117 { 2118 AssertPtrReturn(pszError, VERR_INVALID_POINTER); 2119 if (cbError) 2120 *pszError = '\0'; 2121 else 2122 pszError = NULL; 2123 } 2124 AssertPtrReturn(pszFilename, VERR_INVALID_POINTER); 2125 AssertPtrReturn(phLdrMod, VERR_INVALID_POINTER); 2114 2126 *phLdrMod = NIL_RTLDRMOD; 2115 2127 AssertReturn(RTPathHavePath(pszFilename), VERR_INVALID_PARAMETER); … … 2133 2145 * Pass it on to the common library loader. 2134 2146 */ 2135 return supR3HardenedLdrLoadIt(pszFilename, phLdrMod );2136 } 2137 2138 2139 SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod )2140 { 2141 LogFlow(("SUPR3HardenedLdrLoadAppPriv: pszFilename=%p:{%s} phLdrMod=%p \n", pszFilename, pszFilename, phLdrMod));2147 return supR3HardenedLdrLoadIt(pszFilename, phLdrMod, pszError, cbError); 2148 } 2149 2150 2151 SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError) 2152 { 2153 LogFlow(("SUPR3HardenedLdrLoadAppPriv: pszFilename=%p:{%s} phLdrMod=%p pszError=%p cbError=%zu\n", pszFilename, pszFilename, phLdrMod, pszError, cbError)); 2142 2154 2143 2155 /* 2144 2156 * Validate input. 2145 2157 */ 2158 if (!pszError) 2159 AssertReturn(!cbError, VERR_INVALID_PARAMETER); 2160 else 2161 { 2162 AssertPtrReturn(pszError, VERR_INVALID_POINTER); 2163 if (cbError) 2164 *pszError = '\0'; 2165 else 2166 pszError = NULL; 2167 } 2146 2168 AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER); 2147 2169 *phLdrMod = NIL_RTLDRMOD; … … 2185 2207 * Pass it on to SUPR3HardenedLdrLoad. 2186 2208 */ 2187 rc = SUPR3HardenedLdrLoad(szPath, phLdrMod );2209 rc = SUPR3HardenedLdrLoad(szPath, phLdrMod, pszError, cbError); 2188 2210 2189 2211 LogFlow(("SUPR3HardenedLdrLoadAppPriv: returns %Rrc\n", rc)); … … 2222 2244 * Try load it. 2223 2245 */ 2224 rc = RTLdrLoad(pszFilename, phLdrMod); 2225 if (RT_FAILURE(rc)) 2226 RTStrPrintf(pszErr, cbErr, "RTLdrLoad returned %Rrc", rc); 2227 return rc; 2246 return RTLdrLoadEx(pszFilename, phLdrMod, pszErr, cbErr); 2228 2247 } 2229 2248 -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r34940 r34959 1663 1663 const char *pszName; 1664 1664 void **ppvAddress; 1665 1665 1666 1666 } AuthEntryInfo; 1667 1667 AuthEntryInfo entries[] = … … 2323 2323 rc = SUPR3HardenedLdrLoadPlugIn(pszLibraryName, &mVRDPLibrary, szErr, sizeof(szErr)); 2324 2324 else 2325 rc = SUPR3HardenedLdrLoadAppPriv(pszLibraryName, &mVRDPLibrary );2325 rc = SUPR3HardenedLdrLoadAppPriv(pszLibraryName, &mVRDPLibrary, szErr, sizeof(szErr)); 2326 2326 if (RT_SUCCESS(rc)) 2327 2327 { -
trunk/src/VBox/Main/ExtPackManagerImpl.cpp
r34954 r34959 1163 1163 if (fIsNative) 1164 1164 { 1165 vrc = RTLdrLoad(m->strMainModPath.c_str(), &m->hMainMod); 1165 char szError[8192]; 1166 vrc = RTLdrLoadEx(m->strMainModPath.c_str(), &m->hMainMod, szError, sizeof(szError)); 1166 1167 if (RT_FAILURE(vrc)) 1167 1168 { 1168 1169 m->hMainMod = NIL_RTLDRMOD; 1169 m->strWhyUnusable.printf(tr("Failed to locate load the main module ('%s'): %Rrc "),1170 m->strMainModPath.c_str(), vrc );1170 m->strWhyUnusable.printf(tr("Failed to locate load the main module ('%s'): %Rrc - %s"), 1171 m->strMainModPath.c_str(), vrc, szError); 1171 1172 return; 1172 1173 } -
trunk/src/VBox/Main/hgcm/HGCM.cpp
r33540 r34959 262 262 } 263 263 264 int rc = SUPR3HardenedLdrLoadAppPriv (m_pszSvcLibrary, &m_hLdrMod); 264 char szErr[8192]; 265 szErr[0] = '\0'; 266 int rc = SUPR3HardenedLdrLoadAppPriv (m_pszSvcLibrary, &m_hLdrMod, szErr, sizeof(szErr)); 265 267 266 268 if (RT_SUCCESS(rc)) … … 317 319 else 318 320 { 319 LogRel(("HGCM: Failed to load the service library: [%s], rc = %Rrc. The service will be not available.\n", m_pszSvcLibrary, rc)); 321 LogRel(("HGCM: Failed to load the service library: [%s], rc = %Rrc - %s. The service will be not available.\n", 322 m_pszSvcLibrary, rc, szErr)); 320 323 m_hLdrMod = NIL_RTLDRMOD; 321 324 } -
trunk/src/VBox/Runtime/common/ldr/ldrNative.cpp
r28800 r34959 96 96 RTDECL(int) RTLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod) 97 97 { 98 LogFlow(("RTLdrLoad: pszFilename=%p:{%s} phLdrMod=%p\n", pszFilename, pszFilename, phLdrMod)); 99 100 /* 101 * validate input. 102 */ 103 AssertMsgReturn(VALID_PTR(pszFilename), ("pszFilename=%p\n", pszFilename), VERR_INVALID_PARAMETER); 104 AssertMsgReturn(VALID_PTR(phLdrMod), ("phLdrMod=%p\n", phLdrMod), VERR_INVALID_PARAMETER); 98 return RTLdrLoadEx(pszFilename, phLdrMod, NULL, 0); 99 } 100 RT_EXPORT_SYMBOL(RTLdrLoad); 101 102 103 RTDECL(int) RTLdrLoadEx(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError) 104 { 105 LogFlow(("RTLdrLoadEx: pszFilename=%p:{%s} phLdrMod=%p pszError=%p cbError=%zu\n", pszFilename, pszFilename, phLdrMod, pszError, cbError)); 106 107 /* 108 * Validate and massage the input. 109 */ 110 if (!pszError) 111 AssertReturn(!cbError, VERR_INVALID_PARAMETER); 112 else 113 { 114 AssertPtrReturn(pszError, VERR_INVALID_POINTER); 115 if (cbError) 116 *pszError = '\0'; 117 else 118 pszError = NULL; 119 } 120 AssertPtrReturn(pszFilename, VERR_INVALID_POINTER); 121 AssertPtrReturn(phLdrMod, VERR_INVALID_POINTER); 105 122 106 123 /* … … 119 136 * Attempt to open the module. 120 137 */ 121 rc = rtldrNativeLoad(pszFilename, &pMod->hNative );138 rc = rtldrNativeLoad(pszFilename, &pMod->hNative, pszError, cbError); 122 139 if (RT_SUCCESS(rc)) 123 140 { … … 126 143 return rc; 127 144 } 145 128 146 RTMemFree(pMod); 129 147 } 148 else if (cbError) 149 RTStrPrintf(pszError, cbError, "Failed to allocate %zu bytes for the module handle", sizeof(*pMod)); 130 150 *phLdrMod = NIL_RTLDRMOD; 131 151 LogFlow(("RTLdrLoad: returns %Rrc\n", rc)); 132 152 return rc; 133 153 } 134 RT_EXPORT_SYMBOL(RTLdrLoad );154 RT_EXPORT_SYMBOL(RTLdrLoadEx); 135 155 136 156 -
trunk/src/VBox/Runtime/include/internal/ldr.h
r28800 r34959 365 365 * @param pszFilename The image filename. 366 366 * @param phHandle Where to store the module handle on success. 367 */ 368 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle); 367 * @param pszError Where to store the error message. Optional. 368 * @param cbError The size of the error message buffer. 369 */ 370 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, char *pszError, size_t cbError); 369 371 370 372 int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod); -
trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
r28800 r34959 41 41 42 42 43 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle )43 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, char *pszError, size_t cbError) 44 44 { 45 45 /* … … 69 69 * Attempt load. 70 70 */ 71 72 71 void *pvMod = dlopen(pszFilename, RTLD_NOW | RTLD_LOCAL); 73 72 if (pvMod) … … 76 75 return VINF_SUCCESS; 77 76 } 78 LogRel(("rtldrNativeLoad: dlopen('%s', RTLD_NOW | RTLD_LOCAL) failed: %s\n", pszFilename, dlerror())); 77 78 const char *pszDlError = dlerror(); 79 if (pszError) 80 RTStrCopy(pszError, cbError, pszDlError); 81 LogRel(("rtldrNativeLoad: dlopen('%s', RTLD_NOW | RTLD_LOCAL) failed: %s\n", pszFilename, pszDlError)); 79 82 return VERR_FILE_NOT_FOUND; 80 83 } -
trunk/src/VBox/Runtime/r3/win/ldrNative-win.cpp
r28800 r34959 39 39 40 40 41 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle )41 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, char *pszError, size_t cbError) 42 42 { 43 43 Assert(sizeof(*phHandle) >= sizeof(HMODULE)); … … 67 67 } 68 68 69 return RTErrConvertFromWin32(GetLastError()); 69 /* 70 * Try figure why it failed to load. 71 */ 72 DWORD dwErr = GetLastError(dwErr); 73 int rc = RTErrConvertFromWin32(dwErr); 74 if (cbError) 75 RTStrPrintf(pszError, cbError, "GetLastError=%u", dwErr); 76 return rc; 70 77 } 71 78 -
trunk/src/VBox/Storage/VD.cpp
r34509 r34959 2129 2129 } 2130 2130 2131 rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin );2131 rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin, NULL, 0); 2132 2132 if (RT_SUCCESS(rc)) 2133 2133 { … … 2253 2253 } 2254 2254 2255 rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin );2255 rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin, NULL, 0); 2256 2256 if (RT_SUCCESS(rc)) 2257 2257 { -
trunk/src/recompiler/VBoxREMWrapper.cpp
r33540 r34959 1983 1983 if (g_ModVMM != NIL_RTLDRMOD) 1984 1984 { 1985 rc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &g_ModVMM );1985 rc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &g_ModVMM, NULL, 0); 1986 1986 AssertRCReturn(rc, rc); 1987 1987 for (size_t i = 0; i < RT_ELEMENTS(g_aVMMImports); i++) … … 2097 2097 if (g_ModVMM == NIL_RTLDRMOD) 2098 2098 { 2099 rc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &g_ModVMM );2099 rc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &g_ModVMM, NULL, 0); 2100 2100 AssertRCReturn(rc, false); 2101 2101 } … … 2133 2133 */ 2134 2134 const char *pszModule = remIs64bitEnabled(pVM) ? "VBoxREM64" : "VBoxREM32"; 2135 int rc = SUPR3HardenedLdrLoadAppPriv(pszModule, &g_ModREM2 );2135 int rc = SUPR3HardenedLdrLoadAppPriv(pszModule, &g_ModREM2, NULL, 0); 2136 2136 if (RT_SUCCESS(rc)) 2137 2137 {
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器