Author: damjan Date: Wed Nov 11 17:16:25 2015 New Revision: 1713895 URL: http://svn.apache.org/viewvc?rev=1713895&view=rev Log: r1712824 withdrawn by committer.
Modified: openoffice/trunk/main/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c openoffice/trunk/main/jurt/source/pipe/wrapper/wrapper.c Modified: openoffice/trunk/main/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c URL: http://svn.apache.org/viewvc/openoffice/trunk/main/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c?rev=1713895&r1=1713894&r2=1713895&view=diff ============================================================================== --- openoffice/trunk/main/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c (original) +++ openoffice/trunk/main/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c Wed Nov 11 17:16:25 2015 @@ -25,15 +25,15 @@ #include "osl/security.h" #include <osl/pipe.h> -/* On Windows, jpipe.dll must not have static dependencies on any other URE DLLs - (sal3.dll, uwinapi.dll), as Java System.LoadLibrary could otherwise not load - it. Therefore, on Windows, this code goes into a jpipx.dll that the jpipe.dll - wrapper loads with LoadLibraryEx(LOAD_WITH_ALTERED_SEARCH_PATH). - The function names in this wrapped code are truncated from the long JNICALL - names, as JNICALL causes some "@N" with different numeric values for - N (and probably different across 32 and 64 bit) to be added to the symbol - names, which the calls to GetProcAddress in wrapper/wrapper.c would otherwise - have to take into account. +/* On Windows, jpipe.dll must not have dependencies on any other URE DLLs, as + Java System.LoadLibrary could otherwise not load it. Therefore, on Windows, + this code goes into a jpipx.dll that the jpipe.dll wrapper loads with + LoadLibraryEx(LOAD_WITH_ALTERED_SEARCH_PATH). The function names in this + wrapped code are truncated from the long JNICALL names, as JNICALL causes + some "@N" with different numeric values for N (and probably different across + 32 and 64 bit) to be added to the symbol names, which the calls to + GetProcAddress in wrapper/wrapper.c would otheriwse have to take into + account. */ /*****************************************************************************/ Modified: openoffice/trunk/main/jurt/source/pipe/wrapper/wrapper.c URL: http://svn.apache.org/viewvc/openoffice/trunk/main/jurt/source/pipe/wrapper/wrapper.c?rev=1713895&r1=1713894&r2=1713895&view=diff ============================================================================== --- openoffice/trunk/main/jurt/source/pipe/wrapper/wrapper.c (original) +++ openoffice/trunk/main/jurt/source/pipe/wrapper/wrapper.c Wed Nov 11 17:16:25 2015 @@ -30,50 +30,27 @@ #include "jni.h" #include "sal/types.h" +static HMODULE module; -static HMODULE module = NULL; -static HINSTANCE hInstDLL = NULL; -static CRITICAL_SECTION CriticalSection; - -void InitWrapper(void) { - #define MAXPATH 512 - wchar_t path[MAXPATH]; - DWORD size; - - size = GetModuleFileNameW(hInstDLL, path, MAXPATH); - if (size == 0) { - abort(); - } - path[size - 5] = L'x'; /* ...\jpipe.dll -> ...\jpipx.dll */ - module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if (module == NULL) { - abort(); - } -} - -static FARPROC getFunction(char const * name) -{ - { - EnterCriticalSection(&CriticalSection); - - if(module == NULL) - InitWrapper(); - - LeaveCriticalSection(&CriticalSection); - } - +static FARPROC getFunction(char const * name) { return GetProcAddress(module, name); } BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { (void) lpvReserved; - - if (fdwReason == DLL_PROCESS_ATTACH) - { - InitializeCriticalSection(&CriticalSection); - hInstDLL = hinstDLL; + if (fdwReason == DLL_PROCESS_ATTACH) { + wchar_t path[32767]; + DWORD size; + size = GetModuleFileNameW(hinstDLL, path, 32767); + if (size == 0) { + return FALSE; + } + path[size - 5] = L'x'; /* ...\jpipe.dll -> ...\jpipx.dll */ + module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (module == NULL) { + return FALSE; + } } - return TRUE; }