sb120: #i110944# jpipe.dll wrapper around jpipx.dll
This commit is contained in:
@@ -58,30 +58,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster {
|
||||
static public final boolean DEBUG = false;
|
||||
|
||||
static {
|
||||
// preload shared libraries whichs import lips are linked to jpipe
|
||||
if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
|
||||
{
|
||||
try {
|
||||
NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "msvcr71");
|
||||
} catch (Throwable e){} // loading twice would fail
|
||||
|
||||
try {
|
||||
NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "msvcr70");
|
||||
} catch (Throwable e){} // loading twice would fail
|
||||
|
||||
try {
|
||||
NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "uwinapi");
|
||||
} catch (Throwable e){} // loading twice would fail
|
||||
|
||||
try {
|
||||
NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "sal3");
|
||||
} catch (Throwable e){} // loading twice would fail
|
||||
}
|
||||
|
||||
// load shared library for JNI code
|
||||
try {
|
||||
NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "jpipe");
|
||||
} catch (Throwable e){} // loading twice would fail
|
||||
NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "jpipe");
|
||||
}
|
||||
|
||||
protected String _aDescription;
|
||||
|
@@ -15,4 +15,5 @@ ju jurt\com\sun\star\comp\connections nmake - all ju_con ju_co_loader NULL
|
||||
ju jurt\com\sun\star\comp\servicemanager nmake - all ju_servman NULL
|
||||
ju jurt\com\sun\star\comp\urlresolver nmake - all ju_urlres ju_co_loader NULL
|
||||
ju jurt\source\pipe nmake - all ju_src_pipe NULL
|
||||
ju jurt\source\pipe\wrapper nmake - w ju_src_pipe_wrapper NULL
|
||||
ju jurt\util nmake - all ju_ut ju_brid_jrm ju_co_bfactr ju_con ju_con_sock ju_con_pipe ju_cssl_uno ju_env_java ju_prot_urp ju_servman ju_urlres ju_src_pipe ju_libutil ju_uno NULL
|
||||
|
@@ -1,5 +1,6 @@
|
||||
..\%__SRC%\class\jurt.jar %_DEST%\bin%_EXT%\jurt.jar
|
||||
..\%__SRC%\bin\jpipe*.dll %_DEST%\bin%_EXT%\jpipe*.dll
|
||||
..\%__SRC%\bin\jpipe.dll %_DEST%\bin%_EXT%\jpipe.dll
|
||||
..\%__SRC%\bin\jpipx.dll %_DEST%\bin%_EXT%\jpipx.dll
|
||||
..\%__SRC%\lib\libjpipe*.so %_DEST%\lib%_EXT%\libjpipe*.so
|
||||
..\%__SRC%\lib\libjpipe*.dylib %_DEST%\lib%_EXT%\libjpipe*.dylib
|
||||
|
||||
|
@@ -25,10 +25,20 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "jni.h"
|
||||
#include "osl/security.h"
|
||||
#include <osl/pipe.h>
|
||||
|
||||
#include "com_sun_star_lib_connections_pipe_PipeConnection.h"
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* exception macros */
|
||||
@@ -100,7 +110,12 @@ static rtl_uString * jstring2ustring(JNIEnv * env, jstring jstr)
|
||||
* Method: connect
|
||||
* Signature: (Lcom/sun/star/beans/NativeService;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI
|
||||
SAL_DLLPUBLIC_EXPORT void
|
||||
#if defined WNT
|
||||
PipeConnection_create
|
||||
#else
|
||||
JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI
|
||||
#endif
|
||||
(JNIEnv * env, jobject obj_this, jstring name)
|
||||
{
|
||||
enum {
|
||||
@@ -234,7 +249,12 @@ JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_cre
|
||||
* Method: closeJNI
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI
|
||||
SAL_DLLPUBLIC_EXPORT void
|
||||
#if defined WNT
|
||||
PipeConnection_close
|
||||
#else
|
||||
JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI
|
||||
#endif
|
||||
(JNIEnv * env, jobject obj_this)
|
||||
{
|
||||
enum {
|
||||
@@ -315,7 +335,12 @@ JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_clo
|
||||
* Method: readJNI
|
||||
* Signature: ([[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI
|
||||
SAL_DLLPUBLIC_EXPORT jint
|
||||
#if defined WNT
|
||||
PipeConnection_read
|
||||
#else
|
||||
JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI
|
||||
#endif
|
||||
(JNIEnv * env, jobject obj_this, jobjectArray buffer, jint len)
|
||||
{
|
||||
enum {
|
||||
@@ -430,7 +455,12 @@ JNIEXPORT jint JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_rea
|
||||
* Method: writeJNI
|
||||
* Signature: ([B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI
|
||||
SAL_DLLPUBLIC_EXPORT void
|
||||
#if defined WNT
|
||||
PipeConnection_write
|
||||
#else
|
||||
JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI
|
||||
#endif
|
||||
(JNIEnv * env, jobject obj_this, jbyteArray buffer)
|
||||
{
|
||||
enum {
|
||||
@@ -522,7 +552,12 @@ JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_wri
|
||||
* Method: flushJNI
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_flushJNI
|
||||
SAL_DLLPUBLIC_EXPORT void
|
||||
#if defined WNT
|
||||
PipeConnection_flush
|
||||
#else
|
||||
JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_flushJNI
|
||||
#endif
|
||||
(JNIEnv * env, jobject obj_this)
|
||||
{
|
||||
(void) env; /* not used */
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_sun_star_connections_pipe_PipeConnection */
|
||||
|
||||
#ifndef _Included_com_sun_star_lib_connections_pipe_PipeConnection_h
|
||||
#define _Included_com_sun_star_lib_connections_pipe_PipeConnection_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_sun_star_lib_connections_pipe_PipeConnection
|
||||
* Method: connect
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_sun_star_lib_connections_pipe_PipeConnection
|
||||
* Method: readJNI
|
||||
* Signature: ([[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI
|
||||
(JNIEnv *, jobject, jobjectArray, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sun_star_lib_connections_pipe_PipeConnection
|
||||
* Method: writeJNI
|
||||
* Signature: ([B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI
|
||||
(JNIEnv *, jobject, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: com_sun_star_lib_connections_pipe_PipeConnection
|
||||
* Method: flushJNI
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_flushJNI
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sun_star_lib_connections_pipe_PipeConnection
|
||||
* Method: closeJNI
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -1,5 +0,0 @@
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_flushJNI
|
@@ -1,39 +1,57 @@
|
||||
PRJ=..$/..
|
||||
#*************************************************************************
|
||||
#
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
#
|
||||
# OpenOffice.org - a multi-platform office productivity suite
|
||||
#
|
||||
# This file is part of OpenOffice.org.
|
||||
#
|
||||
# OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License version 3
|
||||
# only, as published by the Free Software Foundation.
|
||||
#
|
||||
# OpenOffice.org is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License version 3 for more details
|
||||
# (a copy is included in the LICENSE file that accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# version 3 along with OpenOffice.org. If not, see
|
||||
# <http://www.openoffice.org/license.html>
|
||||
# for a copy of the LGPLv3 License.
|
||||
#
|
||||
#***********************************************************************/
|
||||
|
||||
PRJNAME=jurt
|
||||
TARGET=jpipe
|
||||
ENABLE_EXCEPTIONS=TRUE
|
||||
PRJ = ../..
|
||||
PRJNAME = jurt
|
||||
TARGET = jpipe
|
||||
|
||||
#?
|
||||
NO_DEFAULT_STL=TRUE
|
||||
NO_BSYMBOLIC=TRUE
|
||||
USE_DEFFILE=TRUE
|
||||
NO_DEFAULT_STL = TRUE
|
||||
VISIBILITY_HIDDEN = TRUE
|
||||
|
||||
# --- Settings -----------------------------------------------------
|
||||
.INCLUDE: settings.mk
|
||||
|
||||
.INCLUDE : settings.mk
|
||||
.IF "$(OS)" == "WNT"
|
||||
SHL1TARGET = jpipx
|
||||
.ELSE
|
||||
SHL1TARGET = jpipe
|
||||
.END
|
||||
|
||||
.IF "$(SOLAR_JAVA)"==""
|
||||
nojava:
|
||||
@echo "Not building jurt because Java is disabled"
|
||||
.ENDIF
|
||||
SHL1CODETYPE = C
|
||||
SHL1IMPLIB = i$(SHL1TARGET)
|
||||
SHL1OBJS = $(SLO)/com_sun_star_lib_connections_pipe_PipeConnection.obj
|
||||
SHL1RPATH = URELIB
|
||||
SHL1STDLIBS = $(SALLIB)
|
||||
SHL1USE_EXPORTS = name
|
||||
DEF1NAME = $(SHL1TARGET)
|
||||
|
||||
# --- Files --------------------------------------------------------
|
||||
SLOFILES = $(SHL1OBJS)
|
||||
|
||||
SLOFILES = \
|
||||
$(SLO)$/com_sun_star_lib_connections_pipe_PipeConnection.obj
|
||||
|
||||
SHL1TARGET=$(TARGET)
|
||||
SHL1LIBS=$(SLB)$/$(TARGET).lib
|
||||
SHL1STDLIBS=$(SALLIB)
|
||||
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
|
||||
SHL1RPATH=URELIB
|
||||
|
||||
DEF1NAME=$(SHL1TARGET)
|
||||
DEF1EXPORTFILE=$(TARGET).dxp
|
||||
DEF1DES=jurtpipe
|
||||
|
||||
# --- Targets ------------------------------------------------------
|
||||
|
||||
.INCLUDE : target.mk
|
||||
.IF "$(SOLAR_JAVA)" == ""
|
||||
nothing .PHONY :
|
||||
.END
|
||||
|
||||
.INCLUDE: target.mk
|
||||
|
52
jurt/source/pipe/wrapper/makefile.mk
Normal file
52
jurt/source/pipe/wrapper/makefile.mk
Normal file
@@ -0,0 +1,52 @@
|
||||
#*************************************************************************
|
||||
#
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
#
|
||||
# OpenOffice.org - a multi-platform office productivity suite
|
||||
#
|
||||
# This file is part of OpenOffice.org.
|
||||
#
|
||||
# OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License version 3
|
||||
# only, as published by the Free Software Foundation.
|
||||
#
|
||||
# OpenOffice.org is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License version 3 for more details
|
||||
# (a copy is included in the LICENSE file that accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# version 3 along with OpenOffice.org. If not, see
|
||||
# <http://www.openoffice.org/license.html>
|
||||
# for a copy of the LGPLv3 License.
|
||||
#
|
||||
#***********************************************************************/
|
||||
|
||||
PRJ = ../../..
|
||||
PRJNAME = jurt
|
||||
TARGET = wrapper
|
||||
|
||||
NO_DEFAULT_STL = TRUE
|
||||
UWINAPILIB =
|
||||
VISIBILITY_HIDDEN = TRUE
|
||||
|
||||
.INCLUDE: settings.mk
|
||||
|
||||
SHL1CODETYPE = C
|
||||
SHL1IMPLIB = i$(SHL1TARGET)
|
||||
SHL1OBJS = $(SLO)/wrapper.obj
|
||||
SHL1RPATH = URELIB
|
||||
SHL1TARGET = jpipe
|
||||
SHL1USE_EXPORTS = name
|
||||
DEF1NAME = $(SHL1TARGET)
|
||||
|
||||
SLOFILES = $(SHL1OBJS)
|
||||
|
||||
.IF "$(SOLAR_JAVA)" == ""
|
||||
nothing .PHONY :
|
||||
.END
|
||||
|
||||
.INCLUDE: target.mk
|
99
jurt/source/pipe/wrapper/wrapper.c
Normal file
99
jurt/source/pipe/wrapper/wrapper.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "sal/config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include "jni.h"
|
||||
#include "sal/types.h"
|
||||
|
||||
static HMODULE module;
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT void JNICALL
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI(
|
||||
JNIEnv * env, jobject obj_this, jstring name)
|
||||
{
|
||||
(*(void (*)(JNIEnv *, jobject, jstring))
|
||||
getFunction("PipeConnection_create"))(env, obj_this, name);
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT void JNICALL
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI(
|
||||
JNIEnv * env, jobject obj_this)
|
||||
{
|
||||
(*(void (*)(JNIEnv *, jobject))
|
||||
getFunction("PipeConnection_close"))(env, obj_this);
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT jint JNICALL
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI(
|
||||
JNIEnv * env, jobject obj_this, jobjectArray buffer, jint len)
|
||||
{
|
||||
return (*(jint (*)(JNIEnv *, jobject, jobjectArray, jint))
|
||||
getFunction("PipeConnection_read"))(env, obj_this, buffer, len);
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT void JNICALL
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI(
|
||||
JNIEnv * env, jobject obj_this, jbyteArray buffer)
|
||||
{
|
||||
(*(void (*)(JNIEnv *, jobject, jbyteArray))
|
||||
getFunction("PipeConnection_write"))(env, obj_this, buffer);
|
||||
}
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT void JNICALL
|
||||
Java_com_sun_star_lib_connections_pipe_PipeConnection_flushJNI(
|
||||
JNIEnv * env, jobject obj_this)
|
||||
{
|
||||
(*(void (*)(JNIEnv *, jobject))
|
||||
getFunction("PipeConnection_flush"))(env, obj_this);
|
||||
}
|
@@ -141,6 +141,7 @@ Program Files\URE\bin\unsafe_uno_uno.dll [private]
|
||||
Program Files\URE\bin\affine_uno_uno.dll [private]
|
||||
Program Files\URE\bin\log_uno_uno.dll [private]
|
||||
Program Files\URE\bin\jpipe.dll [private]
|
||||
Program Files\URE\bin\jpipeint.dll [private]
|
||||
Program Files\URE\bin\juh.dll [private]
|
||||
Program Files\URE\bin\juhx.dll [private]
|
||||
Program Files\URE\bin\acceptor.uno.dll [private]
|
||||
|
Reference in New Issue
Block a user