module.c (e372d74d) | module.c (faaf15b6) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 59 unchanged lines hidden (view full) --- 68 69oslModule SAL_CALL osl_loadAsciiModule(const sal_Char *pszModuleName, sal_Int32 nRtldMode) 70{ 71 char drive[_MAX_DRIVE], dir[_MAX_DIR]; 72 char fname[_MAX_FNAME], ext[_MAX_EXT]; 73 char buffer[PATH_MAX]; 74 char* dot; 75 void* hModule; | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 59 unchanged lines hidden (view full) --- 68 69oslModule SAL_CALL osl_loadAsciiModule(const sal_Char *pszModuleName, sal_Int32 nRtldMode) 70{ 71 char drive[_MAX_DRIVE], dir[_MAX_DIR]; 72 char fname[_MAX_FNAME], ext[_MAX_EXT]; 73 char buffer[PATH_MAX]; 74 char* dot; 75 void* hModule; |
76 oslModule pModule = NULL; | |
77 78 if (!pszModuleName) 79 return NULL; 80 81 // 21/02/2006 YD dll names must be 8.3: since .uno.dll files 82 // have hardcoded names, I'm truncating names here and also in 83 // the build system 84 _splitpath (pszModuleName, drive, dir, fname, ext); --- 9 unchanged lines hidden (view full) --- 94 while( dir[0] == '\\') 95 strcpy( dir, dir+1); 96 } 97 _makepath( buffer, drive, dir, fname, ext); 98 99#if OSL_DEBUG_LEVEL>1 100 debug_printf("osl_loadModule module %s", buffer); 101#endif | 76 77 if (!pszModuleName) 78 return NULL; 79 80 // 21/02/2006 YD dll names must be 8.3: since .uno.dll files 81 // have hardcoded names, I'm truncating names here and also in 82 // the build system 83 _splitpath (pszModuleName, drive, dir, fname, ext); --- 9 unchanged lines hidden (view full) --- 93 while( dir[0] == '\\') 94 strcpy( dir, dir+1); 95 } 96 _makepath( buffer, drive, dir, fname, ext); 97 98#if OSL_DEBUG_LEVEL>1 99 debug_printf("osl_loadModule module %s", buffer); 100#endif |
102 | 101 |
103 hModule = dlopen( buffer, RTLD_LOCAL); 104 if (hModule != NULL) | 102 hModule = dlopen( buffer, RTLD_LOCAL); 103 if (hModule != NULL) |
105 pModule = (oslModule)hModule; 106 else 107 { 108 sal_Char szError[ PATH_MAX*2 ]; 109 sprintf( szError, "Module: %s;\n error: %s;\n\n" 110 "Please contact technical support and report above informations.\n\n", 111 buffer, dlerror() ); | 104 return (oslModule)hModule; 105 106 // do not show in case rc=2 ENOENT, we must parse dlerror 107 // string to detect it 108 char* err = dlerror(); 109 if (!err) 110 return NULL; 111 112 if (strstr( err, "rc=2") != NULL) 113 return NULL; 114 115 sal_Char szError[ PATH_MAX*2 ]; 116 sprintf( szError, "Module: %s;\n error: %s;\n\n" 117 "Please contact technical support and report above informations.\n\n", 118 buffer, err); |
112#if OSL_DEBUG_LEVEL>0 | 119#if OSL_DEBUG_LEVEL>0 |
113 debug_printf("osl_loadModule error %s", szError); | 120 debug_printf("osl_loadModule error %s", szError); |
114#endif | 121#endif |
115 | 122 |
116#if (OSL_DEBUG_LEVEL==0) || !defined(OSL_DEBUG_LEVEL) | 123#if (OSL_DEBUG_LEVEL==0) || !defined(OSL_DEBUG_LEVEL) |
117 WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, 118 szError, "Critical error: DosLoadModule failed", 119 0, MB_ERROR | MB_OK | MB_MOVEABLE); | 124 WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, 125 szError, "Critical error: DosLoadModule failed", 126 0, MB_ERROR | MB_OK | MB_MOVEABLE); |
120#endif | 127#endif |
121 } | |
122 | 128 |
123 return pModule; | 129 return NULL; |
124} 125 126/*****************************************************************************/ 127/* osl_getModuleHandle */ 128/*****************************************************************************/ 129 130sal_Bool SAL_CALL 131osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult) --- 162 unchanged lines hidden --- | 130} 131 132/*****************************************************************************/ 133/* osl_getModuleHandle */ 134/*****************************************************************************/ 135 136sal_Bool SAL_CALL 137osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult) --- 162 unchanged lines hidden --- |