Changeset 6953 in vbox for trunk/src/VBox/Frontends/VBoxBFE
- Timestamp:
- Feb 14, 2008 2:35:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/HGCM.cpp
r6793 r6953 30 30 #include <iprt/critsect.h> 31 31 #include <iprt/asm.h> 32 #include <iprt/param.h> 33 #include <iprt/path.h> 32 34 #include <iprt/ldr.h> 33 35 #include <iprt/string.h> … … 231 233 232 234 235 static int loadLibrary (const char *pszName, PRTLDRMOD phLdrMod) 236 { 237 /* Load the specified library. 238 * If the full path is specified, only this path is used. 239 * If only library name is specified, then try to load it from: 240 * - RTPathAppPrivateArch 241 * - RTPathSharedLibs 242 * - default system LIBPATH. 243 */ 244 int rc = VINF_SUCCESS; 245 246 if (RTPathHavePath (pszName)) 247 { 248 /* Path specified, respect it. */ 249 rc = RTLdrLoad (pszName, phLdrMod); 250 } 251 else 252 { 253 if (strlen (pszName) >= RTPATH_MAX) 254 { 255 return VERR_FILENAME_TOO_LONG; 256 } 257 258 /* Try default locations. */ 259 char szBase[RTPATH_MAX]; 260 261 /* Get the appropriate base path. */ 262 int i; 263 for (i = 0; i < 3; i++) 264 { 265 if (i == 0) 266 { 267 rc = RTPathAppPrivateArch(szBase, sizeof (szBase)); 268 } 269 else if (i == 1) 270 { 271 rc = RTPathSharedLibs(szBase, sizeof (szBase)); 272 } 273 else 274 { 275 szBase[0] = 0; 276 rc = VINF_SUCCESS; 277 } 278 279 if (RT_SUCCESS(rc)) 280 { 281 char szPath[RTPATH_MAX]; 282 283 /* szPath = pszBase + pszName */ 284 if (szBase[0] != 0) 285 { 286 rc = RTPathAbsEx (szBase, pszName, szPath, sizeof (szPath)); 287 } 288 else 289 { 290 strcpy (szPath, pszName); 291 } 292 293 if (RT_SUCCESS(rc)) 294 { 295 rc = RTLdrLoad (szPath, phLdrMod); 296 297 if (RT_SUCCESS(rc)) 298 { 299 /* Successfully loaded a library. */ 300 break; 301 } 302 } 303 } 304 } 305 } 306 307 return rc; 308 } 233 309 234 310 /** Helper function to load a local service DLL. … … 247 323 int rc = VINF_SUCCESS; 248 324 249 rc = RTLdrLoad(m_pszSvcLibrary, &m_hLdrMod);325 rc = loadLibrary (m_pszSvcLibrary, &m_hLdrMod); 250 326 251 327 if (VBOX_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.