Merging B-1_9_1 back to head

This commit is contained in:
clay_shooter
2005-10-24 22:59:25 +00:00
parent d61eac5a7a
commit 5f8e69d7e2
75 changed files with 3179 additions and 1163 deletions

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "stdafx.h"
#include <objbase.h>

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class com_jacob_com_ComThread */

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "stdafx.h"
#include <objbase.h>
@@ -53,6 +43,12 @@ IDispatch *extractDispatch(JNIEnv *env, jobject arg)
return v;
}
/**
* This method finds an interface rooted on the passed in dispatch object.
* This creates a new Dispatch object so it is NOT reliable
* in the event callback thread of a JWS client where the root class loader
* does not have com.jacob.com.Dispatch in its classpath
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface
(JNIEnv *env, jobject _this, jstring _iid)
{
@@ -79,8 +75,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface
}
jclass autoClass = env->FindClass("com/jacob/com/Dispatch");
jmethodID autoCons =
env->GetMethodID(autoClass, "<init>", "(I)V");
jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(I)V");
// construct a Dispatch object to return
// I am copying the pointer to java
// jacob-msg 1817 - SF 1053871 : QueryInterface already called AddRef!!

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class Dispatch */

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "DispatchEvents.h"
#include "EventProxy.h"
@@ -74,7 +64,7 @@ void putProxy(JNIEnv *env, jobject arg, EventProxy *ep)
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
(JNIEnv *env,
jobject _this, jobject src,
jobject sink, jobject protoVariant,
jobject sink,
jstring _progid)
{
USES_CONVERSION;
@@ -111,7 +101,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
//DWORD dwEventCookie;
if (SUCCEEDED(hr))
{
EventProxy *ep = new EventProxy(env, sink, protoVariant, pCP, eventIID, mNames, mIDs, n_EventMethods);
EventProxy *ep = new EventProxy(env, sink, pCP, eventIID, mNames, mIDs, n_EventMethods);
// need to store ep on _this, in case it gets collected
putProxy(env, _this, ep);
} else {
@@ -125,9 +115,9 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
* Signature: (LDispatch;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init
(JNIEnv *env, jobject _this, jobject src, jobject sink, jobject protoVariant)
(JNIEnv *env, jobject _this, jobject src, jobject sink)
{
Java_com_jacob_com_DispatchEvents_init2(env,_this,src,sink, protoVariant, NULL);
Java_com_jacob_com_DispatchEvents_init2(env,_this,src,sink, NULL);
}
/*

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class DispatchEvents */
@@ -13,7 +31,7 @@ extern "C" {
* Signature: (LDispatch;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init
(JNIEnv *, jobject, jobject, jobject, jobject);
(JNIEnv *, jobject, jobject, jobject);
/*
* Class: DispatchEvents
@@ -21,7 +39,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init
* Signature: (LDispatch;Ljava/lang/Object;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
(JNIEnv *, jobject, jobject, jobject, jobject, jstring);
(JNIEnv *, jobject, jobject, jobject, jstring);
/*
* Class: DispatchEvents

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "stdafx.h"
#include <objbase.h>

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class com_jacob_com_DispatchProxy */

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "stdafx.h"
#include <objbase.h>

View File

@@ -1,4 +1,21 @@
/* Header for class EnumVariant
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _Included_EnumVariant
#define _Included_EnumVariant

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "EventProxy.h"
#include "Variant.h"
@@ -33,7 +23,6 @@
// hook myself up as a listener for delegate
EventProxy::EventProxy(JNIEnv *env,
jobject aSinkObj,
jobject aVariantObj,
CComPtr<IConnectionPoint> pConn,
IID eid,
CComBSTR mName[],
@@ -42,15 +31,12 @@ EventProxy::EventProxy(JNIEnv *env,
// initialize some variables
m_cRef(0), pCP(pConn),
eventIID(eid), MethNum(mNum), MethName(mName),
MethID(mID), JMethID(NULL),
javaSinkClass(NULL)
MethID(mID)
{
// don't really need the variant object but we keep a reference
// anyway
javaSinkObj = env->NewGlobalRef(aSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
javaVariantObj = env->NewGlobalRef(aVariantObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// we need this to attach to the event invocation thread
env->GetJavaVM(&jvm);
@@ -58,28 +44,6 @@ EventProxy::EventProxy(JNIEnv *env,
AddRef();
HRESULT hr = pCP->Advise(this, &dwEventCookie);
if (SUCCEEDED(hr)) {
// create a mapping from the DISPID's to jmethodID's by using
// the method names I extracted from the classinfo
JMethID = new jmethodID[MethNum];
javaSinkClass = env->GetObjectClass(javaSinkObj);
if (javaSinkClass == NULL){ printf("can't figure out java sink class"); }
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
const char *method;
for(int i=0;i<MethNum;i++)
{
// look for a method with the specified name, that takes an
// array of variants and return void
USES_CONVERSION;
method = W2A((OLECHAR *)MethName[i]);
JMethID[i] = env->GetMethodID(javaSinkClass, method, "([Lcom/jacob/com/Variant;)V");
// need to clear exceptions because GetMethodID above may fail
// if the user didn't implement all the methods
env->ExceptionClear();
}
} else {
ThrowComFail(env, "Advise failed", hr);
}
@@ -92,8 +56,10 @@ EventProxy::~EventProxy()
JNIEnv *env;
// attach to the current running thread
#ifdef JNI_VERSION_1_2
printf("using version 1.2 API\n");
jvm->AttachCurrentThread((void **)&env, jvm);
#else
printf("not using version 1.2 API\n");
jvm->AttachCurrentThread((void**)&env, NULL);
#endif
@@ -103,7 +69,6 @@ EventProxy::~EventProxy()
if (MethNum) {
delete [] MethName;
delete [] MethID;
if (JMethID) delete [] JMethID;
}
// detach from thread
jvm->DetachCurrentThread();
@@ -138,22 +103,18 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
{
//Visual C++ 6.0 recognized this as an unused variable
//HRESULT hr;
jmethodID meth = 0;
const char *eventMethodName;
JNIEnv *env = NULL;
// map dispID to jmethodID
for(int i=0;i<MethNum;i++)
{
if (MethID[i] == dispID) { meth = JMethID[i]; break; }
if (MethID[i] == dispID) {
USES_CONVERSION;
eventMethodName = W2A((OLECHAR *)MethName[i]);
}
}
if (!meth)
{
// user did not implement this method
return S_OK;
}
if (DISPATCH_METHOD & wFlags)
{
// attach to the current running thread
@@ -163,43 +124,41 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
jvm->AttachCurrentThread((void**)&env, NULL);
#endif
if (!eventMethodName)
{
ThrowComFail(env, "Event method received was not defined as part of callback interface", -1);
// user did not implement this method
return S_OK;
}
// get variant class
jclass vClass = NULL;
// do this in a JACOB 1.8 backwards compatable way
// this succeeds if the class was loaded from the bootstrap class loader
//vClass = env->FindClass("com/jacob/com/Variant");
// this is guarenteed to work so there really isn't any need for the line above
// but I don't want to bust anything so we leave it in
// the following code exists to support launchers like JWS where jacob isn't
// in the system classloader so we wouldn't be able to create a variant class
if (vClass == NULL){
// there will be a stored up exception if FindClass failed so lets clear it
if (env->ExceptionOccurred()) { env->ExceptionClear(); }
//printf("using variant class passed in via constructor\n");
jclass javaVariantClass = env->GetObjectClass(javaVariantObj);
if (javaVariantClass == NULL){ printf("can't figure out java Variant class"); }
// find the class of the InvocationHandler
jclass javaSinkClass = env->GetObjectClass(javaSinkObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
vClass = javaVariantClass;
if (vClass == NULL){
printf("This application is probably running from a launcher where system class loader knows not Jacob\n");
printf("And for some reason we couldn't find the variant class from the passed in variant\n");
}
}
// how many params
int num = pDispParams->cArgs;
// and the constructor
jmethodID vCons = env->GetMethodID(vClass, "<init>", "()V");
jmethodID invokeMethod = env->GetMethodID(javaSinkClass, "invoke",
"(Ljava/lang/String;[Lcom/jacob/com/Variant;)V");
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
jstring eventMethodNameAsString = env->NewStringUTF(eventMethodName);
// now do what we need for the variant
jmethodID getVariantMethod =
env->GetMethodID(javaSinkClass, "getVariant", "()Lcom/jacob/com/Variant;");
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
jobject aVariantObj = env->CallObjectMethod(javaSinkObj, getVariantMethod);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
jclass variantClass = env->GetObjectClass(aVariantObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// create the variant parameter array
// how many params
int numVariantParams = pDispParams->cArgs;
// make an array of them
jobjectArray varr = env->NewObjectArray(num, vClass, 0);
jobjectArray varr = env->NewObjectArray(numVariantParams, variantClass, 0);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
int i,j;
for(i=num-1,j=0;i>=0;i--,j++)
for(i=numVariantParams-1,j=0;i>=0;i--,j++)
{
// construct a java variant holder
jobject arg = env->NewObject(vClass, vCons);
jobject arg = env->CallObjectMethod(javaSinkObj, getVariantMethod);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// get the empty variant from it
VARIANT *va = extractVariant(env, arg);
@@ -210,13 +169,15 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
env->DeleteLocalRef(arg);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
}
// call the method
env->CallVoidMethod(javaSinkObj, meth, varr);
env->CallVoidMethod(javaSinkObj, invokeMethod,
eventMethodNameAsString, varr);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// don't need the first variant we created to get the class
env->DeleteLocalRef(aVariantObj);
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
// Begin code from Jiffie team that copies parameters back from java to COM
for(i=num-1,j=0;i>=0;i--,j++)
for(i=numVariantParams-1,j=0;i>=0;i--,j++)
{
jobject arg = env->GetObjectArrayElement(varr, j);
VARIANT *java = extractVariant(env, arg);

View File

@@ -1,38 +1,21 @@
/*
* Copyright (c) 1999 Dan Adler, 315 E72 St. NY, NY, 10021, USA.
* mailto:danadler@rcn.com. All rights reserved.
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Redistribution of the JACOB software is not permitted as part of any
* commercial product that is targeted primarily at Java developers.
* Such products include, but are not limited to: Java virtual machines,
* integrated development environments, code libraries, and application
* server products. Licensing terms for such distribution may be
* obtained from the copyright holder.
* This library 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 for more details.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
#include <windows.h>
@@ -54,25 +37,21 @@
class EventProxy : public IDispatch
{
private:
LONG m_cRef;
LONG m_cRef; // a reference counter
CComPtr<IConnectionPoint> pCP; // the connection point
DWORD dwEventCookie; // connection point cookie
jobject javaSinkObj; // the java object to delegate calls
jclass javaSinkClass; // the java class of the object
jobject javaVariantObj; // a variant object passed in so we can find Variant later
IID eventIID; // the interface iid passed in
int MethNum;
int MethNum; // number of methods in the callback interface
CComBSTR *MethName; // Array of method names
DISPID *MethID; // Array of method ids
jmethodID *JMethID; // Array of java method ids
JavaVM *jvm; // The java vm we are running
DISPID *MethID; // Array of method ids, used to match invokations to method names
JavaVM *jvm; // The java vm we are running
public:
// constuct with a global JNI ref to a sink object
// to which we will delegate event callbacks
EventProxy(JNIEnv *jenv,
jobject aSinkObj,
jobject aVariantObj,
CComPtr<IConnectionPoint> pConn,
IID eventIID,
CComBSTR *mName,
@@ -89,8 +68,11 @@ public:
STDMETHODIMP_(ULONG) Release(void)
{
LONG res = InterlockedDecrement(&m_cRef);
if (res == 0) delete this;
if (res == 0) {
delete this;
}
return res;
}
STDMETHODIMP QueryInterface(REFIID rid, void **ppv);

View File

@@ -1,17 +0,0 @@
To build, run:
nmake -f makefile
The following are hardcoded into the makefile, so you may have to
change it. I developed this with the C++ compiler and ATL version
that ship with VC++ 6.0, so I'm not sure if different versions will
work.
I have compiled this against JDK 1.1.6 and 1.2.2 as well as Microsoft
SDK for Java 3.2 as the JDK setting.
DEST_DIR is a destination directory into which to copy the final DLL.
JDK = d:\j2sdk1.4.2_06
DEST_DIR = d:\jacob
MSDEVDIR = d:\apps\\"Microsoft Visual Studio"\VC98

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "stdafx.h"
#include <objbase.h>

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class STA */

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "SafeArray.h"
// Win32 support for Ole Automation
@@ -1598,6 +1588,11 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDoubles
* Class: SafeArray
* Method: getString
* Signature: (I)Ljava/lang/String;
*
* There is supposed to be a leak in here, SourceForge 1224219
* that should be fixed with a call to
* "StrFree, Release or VariantClear to release the memory"
* waiting on the actual patch the submitter used before modifying this
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString__I
(JNIEnv *env, jobject _this, jint idx)
@@ -2439,4 +2434,506 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariants
}
}
/* PLEASE NOTE THE LINE:
jint *jIndices = env->GetIntArrayElements(indices, NULL);
which I added to replace "long idx[2] = {i,j};" from the 2D case.
Not sure if this is correct. Also, check that I am doing the null test and
dimension test correctly.
*/
#define GETNDCODE(varType, varAccess, jtyp) \
SAFEARRAY *sa = extractSA(env, _this); \
if (!sa) { \
ThrowComFail(env, "safearray object corrupted", -1); \
return NULL; \
} \
jint *jIndices = env->GetIntArrayElements(indices, NULL); \
if (!jIndices) { \
ThrowComFail(env, "null indices array", -1); \
return NULL; \
} \
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { \
ThrowComFail(env, "safearray and indices array have different dimensions", -1); \
return NULL; \
} \
VARTYPE vt; \
SafeArrayGetVartype(sa, &vt); \
if (vt == VT_VARIANT) { \
VARIANT v; \
VariantInit(&v); \
SafeArrayGetElement(sa, jIndices, (void*) &v); \
if (FAILED(VariantChangeType(&v, &v, 0, varType))) { \
ThrowComFail(env, "VariantChangeType failed", -1); \
return NULL; \
} \
return (jtyp)varAccess(&v); \
} else if (vt == varType) { \
jtyp jc; \
SafeArrayGetElement(sa, jIndices, (void*) &jc); \
return jc; \
} else { \
return NULL; \
}
//---------------------------------
/* PLEASE NOTE THE LINE:
jint *jIndices = env->GetIntArrayElements(indices, NULL);
which I added to replace "long idx[2] = {i,j};" from the 2D case.
Not sure if this is correct. Also, check that I am doing the null test and
dimension test correctly.
*/
#define SETNDCODE(varType, varAccess) \
SAFEARRAY *sa = extractSA(env, _this); \
if (!sa) { \
ThrowComFail(env, "safearray object corrupted", -1); \
return; \
} \
jint *jIndices = env->GetIntArrayElements(indices, NULL); \
if (!jIndices) { \
ThrowComFail(env, "null indices array", -1); \
return; \
} \
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { \
ThrowComFail(env, "safearray and indices array have different dimensions", -1); \
return; \
} \
VARTYPE vt; \
SafeArrayGetVartype(sa, &vt); \
if (vt == VT_VARIANT) { \
VARIANT v; \
VariantInit(&v); \
V_VT(&v) = varType; \
varAccess(&v) = c; \
SafeArrayPutElement(sa,jIndices,&v); \
} else if (vt == varType) { \
SafeArrayPutElement(sa, jIndices,&c); \
} else { \
ThrowComFail(env, "safearray type mismatch", -1); \
}
/*
* Class: com_jacob_com_SafeArray
* Method: getVariant
* Signature: ([I)Lcom/jacob/com/Variant;
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
SAFEARRAY *psa = extractSA(env, _this);
if (!psa) {
ThrowComFail(env, "safearray object corrupted", -1);
return NULL;
}
VARTYPE vt;
SafeArrayGetVartype(psa, &vt);
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
jint *jIndices = env->GetIntArrayElements(indices, NULL);
if (!jIndices) {
ThrowComFail(env, "null indices array", -1);
return NULL;
}
if (SafeArrayGetDim(psa) != env->GetArrayLength(indices)) {
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
return NULL;
}
// prepare a new return value
jclass variantClass = env->FindClass("com/jacob/com/Variant");
jmethodID variantCons =
env->GetMethodID(variantClass, "<init>", "()V");
// construct a variant to return
jobject newVariant = env->NewObject(variantClass, variantCons);
// get the VARIANT from the newVariant
VARIANT *v = extractVariant(env, newVariant);
if (vt == VT_VARIANT) {
SafeArrayGetElement(psa, jIndices, v);
} else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) {
IDispatch *disp;
SafeArrayGetElement(psa, jIndices, (void *)&disp);
VariantClear(v); // whatever was there before
V_VT(v) = VT_DISPATCH;
V_DISPATCH(v) = disp;
// I am handing the pointer to COM
disp->AddRef();
} else {
ThrowComFail(env, "safearray type is not variant/dispatch", -1);
}
return newVariant;
}
/*
* Class: com_jacob_com_SafeArray
* Method: setVariant
* Signature: ([ILcom/jacob/com/Variant;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant___3ILcom_jacob_com_Variant_2
(JNIEnv *env, jobject _this, jintArray indices, jobject s)
{
SAFEARRAY *sa = extractSA(env, _this);
if (!sa) {
ThrowComFail(env, "safearray object corrupted", -1);
return;
}
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
jint *jIndices = env->GetIntArrayElements(indices, NULL);
if (!jIndices) {
ThrowComFail(env, "null indices array", -1);
return;
}
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
return;
}
VARTYPE vt;
SafeArrayGetVartype(sa, &vt);
if (vt == VT_VARIANT) {
VARIANT *v = extractVariant(env, s);
SafeArrayPutElement(sa, jIndices, v);
} else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) {
VARIANT *v = extractVariant(env, s);
if (V_VT(v) != VT_DISPATCH) {
ThrowComFail(env, "variant is not dispatch", -1);
return;
}
IDispatch *disp = V_DISPATCH(v);
SafeArrayPutElement(sa, jIndices, disp);
} else {
ThrowComFail(env, "safearray type is not variant/dispatch", -1);
}
}
/*
* Class: com_jacob_com_SafeArray
* Method: getChar
* Signature: ([I)C
*/
JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
GETNDCODE(VT_UI2, V_UI2, jchar)
}
/*
* Class: com_jacob_com_SafeArray
* Method: setChar
* Signature: ([IC)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar___3IC
(JNIEnv *env, jobject _this, jintArray indices, jchar c)
{
SETNDCODE(VT_UI2, V_UI2);
}
/*
* Class: com_jacob_com_SafeArray
* Method: getInt
* Signature: ([I)I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
GETNDCODE(VT_I4, V_I4, jint)
}
/*
* Class: com_jacob_com_SafeArray
* Method: setInt
* Signature: ([II)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt___3II
(JNIEnv *env, jobject _this, jintArray indices, jint c)
{
SETNDCODE(VT_I4, V_I4);
}
/*
* Class: com_jacob_com_SafeArray
* Method: getShort
* Signature: ([I)S
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
GETNDCODE(VT_I2, V_I2, jshort)
}
/*
* Class: com_jacob_com_SafeArray
* Method: setShort
* Signature: ([IS)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort___3IS
(JNIEnv *env, jobject _this, jintArray indices, jshort c)
{
SETNDCODE(VT_I2, V_I2);
}
/*
* Class: com_jacob_com_SafeArray
* Method: getDouble
* Signature: ([I)D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
GETNDCODE(VT_R8, V_R8, jdouble)
}
/*
* Class: com_jacob_com_SafeArray
* Method: setDouble
* Signature: ([ID)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble___3ID
(JNIEnv *env, jobject _this, jintArray indices, jdouble c)
{
SETNDCODE(VT_R8, V_R8);
}
/*
* Class: com_jacob_com_SafeArray
* Method: getString
* Signature: ([I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
SAFEARRAY *psa = extractSA(env, _this);
if (!psa) {
ThrowComFail(env, "safearray object corrupted", -1); \
return NULL;
}
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
jint *jIndices = env->GetIntArrayElements(indices, NULL);
if (!jIndices) {
ThrowComFail(env, "null indices array", -1);
return NULL;
}
if (SafeArrayGetDim(psa) != env->GetArrayLength(indices)) {
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
return NULL;
}
VARTYPE vt;
SafeArrayGetVartype(psa, &vt);
if (vt == VT_VARIANT) {
VARIANT v;
VariantInit(&v);
SafeArrayGetElement(psa, jIndices, &v);
if (FAILED(VariantChangeType(&v, &v, 0, VT_BSTR))) {
return NULL;
}
BSTR bs = V_BSTR(&v);
jstring js = env->NewString(bs, SysStringLen(bs));
return js;
} else if (vt == VT_BSTR) {
BSTR bs = NULL;
SafeArrayGetElement(psa, jIndices, &bs);
jstring js = env->NewString(bs, SysStringLen(bs));
return js;
}
ThrowComFail(env, "safearray cannot get string", 0);
return NULL;
}
/*
* Class: com_jacob_com_SafeArray
* Method: setString
* Signature: ([ILjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString___3ILjava_lang_String_2
(JNIEnv *env, jobject _this, jintArray indices, jstring s)
{
SAFEARRAY *sa = extractSA(env, _this);
if (!sa) {
ThrowComFail(env, "safearray object corrupted", -1);
return;
}
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
jint *jIndices = env->GetIntArrayElements(indices, NULL);
if (!jIndices) {
ThrowComFail(env, "null indices array", -1);
return;
}
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
return;
}
VARTYPE vt;
SafeArrayGetVartype(sa, &vt);
if (vt == VT_VARIANT) {
VARIANT v;
VariantInit(&v);
const char *str = env->GetStringUTFChars(s, NULL);
CComBSTR bs(str);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = bs.Copy();
SafeArrayPutElement(sa, jIndices,&v);
env->ReleaseStringUTFChars(s, str);
VariantClear(&v);
} else if (vt == VT_BSTR) {
const char *str = env->GetStringUTFChars(s, NULL);
CComBSTR bs(str);
SafeArrayPutElement(sa, jIndices,bs.Detach());
env->ReleaseStringUTFChars(s, str);
} else {
ThrowComFail(env, "safearray cannot set string", 0);
}
}
/*
* Class: com_jacob_com_SafeArray
* Method: getByte
* Signature: ([I)B
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
GETNDCODE(VT_UI1, V_UI1, jbyte)
}
/*
* Class: com_jacob_com_SafeArray
* Method: setByte
* Signature: ([IB)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte___3IB
(JNIEnv *env, jobject _this, jintArray indices, jbyte c)
{
SETNDCODE(VT_UI1, V_UI1);
}
/*
* Class: com_jacob_com_SafeArray
* Method: getFloat
* Signature: ([I)F
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
GETNDCODE(VT_R4, V_R4, jfloat)
}
/*
* Class: com_jacob_com_SafeArray
* Method: setFloat
* Signature: ([IF)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat___3IF
(JNIEnv *env, jobject _this, jintArray indices, jfloat c)
{
SETNDCODE(VT_R4, V_R4);
}
/*
* Class: com_jacob_com_SafeArray
* Method: getBoolean
* Signature: ([I)Z
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean___3I
(JNIEnv *env, jobject _this, jintArray indices)
{
// code is inline because of size mismatch
SAFEARRAY *sa = extractSA(env, _this);
if (!sa) {
ThrowComFail(env, "safearray object corrupted", -1);
return NULL;
}
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
jint *jIndices = env->GetIntArrayElements(indices, NULL);
if (!jIndices) {
ThrowComFail(env, "null indices array", -1);
return NULL;
}
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
return NULL;
}
VARTYPE vt;
SafeArrayGetVartype(sa, &vt);
if (vt == VT_VARIANT) {
VARIANT v;
VariantInit(&v);
SafeArrayGetElement(sa, jIndices, (void*) &v);
if (FAILED(VariantChangeType(&v, &v, 0, VT_BOOL))) {
ThrowComFail(env, "safearray change type failed", -1);
return NULL;
}
jboolean jb = V_BOOL(&v) == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE;
return jb;
} else if (vt == VT_BOOL) {
VARIANT_BOOL vb;
SafeArrayGetElement(sa, jIndices, (void*) &vb);
jboolean jb = vb == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE;
return jb;
} else {
return NULL;
}
}
/*
* Class: com_jacob_com_SafeArray
* Method: setBoolean
* Signature: ([IZ)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean___3IZ
(JNIEnv *env, jobject _this, jintArray indices, jboolean c)
{
// code is inline because of size mismatch
SAFEARRAY *sa = extractSA(env, _this);
if (!sa) {
ThrowComFail(env, "safearray object corrupted", -1);
return;
}
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
jint *jIndices = env->GetIntArrayElements(indices, NULL);
if (!jIndices) {
ThrowComFail(env, "null indices array", -1);
return;
}
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
return;
}
VARTYPE vt;
SafeArrayGetVartype(sa, &vt);
if (vt == VT_VARIANT) {
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_BOOL;
V_BOOL(&v) = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE;
SafeArrayPutElement(sa,jIndices,&v);
} else if (vt == VT_BOOL) {
VARIANT_BOOL vb = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE;
SafeArrayPutElement(sa,jIndices,&vb);
} else {
ThrowComFail(env, "safearray type mismatch", -1);
}
}
}

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class com_jacob_com_SafeArray */
@@ -7,6 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: buildVersion */
/* Inaccessible static: buildDate */
/* Inaccessible static: DEBUG */
/* Inaccessible static: class_00024com_00024jacob_00024com_00024JacobObject */
/*
* Class: com_jacob_com_SafeArray
* Method: init
@@ -42,7 +64,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getvt
/*
* Class: com_jacob_com_SafeArray
* Method: reinit
* Signature: (Lcom_jacob_com_SafeArray;)V
* Signature: (Lcom/jacob/com/SafeArray;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_reinit
(JNIEnv *, jobject, jobject);
@@ -178,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromBooleanArray
/*
* Class: com_jacob_com_SafeArray
* Method: fromVariantArray
* Signature: ([LVariant;)V
* Signature: ([Lcom/jacob/com/Variant;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromVariantArray
(JNIEnv *, jobject, jobjectArray);
@@ -250,7 +272,7 @@ JNIEXPORT jbooleanArray JNICALL Java_com_jacob_com_SafeArray_toBooleanArray
/*
* Class: com_jacob_com_SafeArray
* Method: toVariantArray
* Signature: ()[LVariant;
* Signature: ()[Lcom/jacob/com/Variant;
*/
JNIEXPORT jobjectArray JNICALL Java_com_jacob_com_SafeArray_toVariantArray
(JNIEnv *, jobject);
@@ -642,7 +664,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBooleans
/*
* Class: com_jacob_com_SafeArray
* Method: getVariant
* Signature: (I)LVariant;
* Signature: (I)Lcom/jacob/com/Variant;
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__I
(JNIEnv *, jobject, jint);
@@ -650,7 +672,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__I
/*
* Class: com_jacob_com_SafeArray
* Method: getVariant
* Signature: (II)LVariant;
* Signature: (II)Lcom/jacob/com/Variant;
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__II
(JNIEnv *, jobject, jint, jint);
@@ -674,7 +696,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant__IILcom_jacob_com
/*
* Class: com_jacob_com_SafeArray
* Method: getVariants
* Signature: (II[LVariant;I)V
* Signature: (II[Lcom/jacob/com/Variant;I)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getVariants
(JNIEnv *, jobject, jint, jint, jobjectArray, jint);
@@ -682,11 +704,155 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getVariants
/*
* Class: com_jacob_com_SafeArray
* Method: setVariants
* Signature: (II[LVariant;I)V
* Signature: (II[Lcom/jacob/com/Variant;I)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariants
(JNIEnv *, jobject, jint, jint, jobjectArray, jint);
/*
* Class: com_jacob_com_SafeArray
* Method: getVariant
* Signature: ([I)Lcom/jacob/com/Variant;
*/
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setVariant
* Signature: ([ILcom/jacob/com/Variant;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant___3ILcom_jacob_com_Variant_2
(JNIEnv *, jobject, jintArray, jobject);
/*
* Class: com_jacob_com_SafeArray
* Method: getChar
* Signature: ([I)C
*/
JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setChar
* Signature: ([IC)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar___3IC
(JNIEnv *, jobject, jintArray, jchar);
/*
* Class: com_jacob_com_SafeArray
* Method: getInt
* Signature: ([I)I
*/
JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setInt
* Signature: ([II)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt___3II
(JNIEnv *, jobject, jintArray, jint);
/*
* Class: com_jacob_com_SafeArray
* Method: getShort
* Signature: ([I)S
*/
JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setShort
* Signature: ([IS)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort___3IS
(JNIEnv *, jobject, jintArray, jshort);
/*
* Class: com_jacob_com_SafeArray
* Method: getDouble
* Signature: ([I)D
*/
JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setDouble
* Signature: ([ID)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble___3ID
(JNIEnv *, jobject, jintArray, jdouble);
/*
* Class: com_jacob_com_SafeArray
* Method: getString
* Signature: ([I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setString
* Signature: ([ILjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString___3ILjava_lang_String_2
(JNIEnv *, jobject, jintArray, jstring);
/*
* Class: com_jacob_com_SafeArray
* Method: getByte
* Signature: ([I)B
*/
JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setByte
* Signature: ([IB)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte___3IB
(JNIEnv *, jobject, jintArray, jbyte);
/*
* Class: com_jacob_com_SafeArray
* Method: getFloat
* Signature: ([I)F
*/
JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setFloat
* Signature: ([IF)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat___3IF
(JNIEnv *, jobject, jintArray, jfloat);
/*
* Class: com_jacob_com_SafeArray
* Method: getBoolean
* Signature: ([I)Z
*/
JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean___3I
(JNIEnv *, jobject, jintArray);
/*
* Class: com_jacob_com_SafeArray
* Method: setBoolean
* Signature: ([IZ)V
*/
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean___3IZ
(JNIEnv *, jobject, jintArray, jboolean);
#ifdef __cplusplus
}
#endif

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header

View File

@@ -1,3 +1,22 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "stdafx.h"
#include "Variant.h"
@@ -379,7 +369,12 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putStringRef
VariantClear(v); // whatever was there before
const jchar *cStr = env->GetStringChars(s,NULL);
CComBSTR bs(cStr);
// SF 1314116
// DBeck: 2005-09-23: changed CComBSTR c-tor to accept
// Unicode string (no terminating NULL) provided by GetStringChars
const jsize numChars = env->GetStringLength(s);
//CComBSTR bs(cStr);
CComBSTR bs( numChars, cStr );
BSTR *pbs = (BSTR *)CoTaskMemAlloc(sizeof(BSTR));
bs.CopyTo(pbs);
@@ -882,7 +877,12 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putString
V_VT(v) = VT_BSTR;
const jchar *cStr = env->GetStringChars(s,NULL);
CComBSTR bs(cStr);
// SF 1314116
// DBeck: 2005-09-23: changed CComBSTR c-tor to accept
// Unicode string (no terminating NULL) provided by GetStringChars
const jsize numChars = env->GetStringLength(s);
//CComBSTR bs(cStr);
CComBSTR bs( numChars, cStr );
V_VT(v) = VT_BSTR;
V_BSTR(v) = bs.Copy();

View File

@@ -1,4 +1,22 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <jni.h>
/* Header for class com_jacob_com_Variant */

View File

@@ -1,49 +0,0 @@
JDK = c:\j2sdk1.4.2_07
MSDEVDIR = c:\\"Microsoft Visual Studio"\VC98
JDK_INC = -I$(JDK)\include -I$(JDK)\include\win32
JDK_LIB = $(JDK)\lib\jvm.lib
MS_INC = -I$(MSDEVDIR)\Include -I$(MSDEVDIR)\ATL\Include
SYS_LIB = oleaut32.lib ole32.lib uuid.lib kernel32.lib shell32.lib user32.lib
OPT = /O2
CC = $(MSDEVDIR)\bin\cl $(OPT) $(JDK_INC) $(MS_INC)
OBJFILES = stdafx.obj util.obj EventProxy.obj Variant.obj Dispatch.obj SafeArray.obj DispatchEvents.obj ComThread.obj EnumVariant.obj STA.obj DispatchProxy.obj
all: jacob.dll
jacob.dll: $(OBJFILES)
$(MSDEVDIR)\bin\link /dll /out:jacob.dll $(OBJFILES) $(JDK_LIB) $(SYS_LIB)
stdafx.obj: stdafx.cpp *.h
$(CC) -c stdafx.cpp
util.obj: util.cpp *.h
$(CC) -c util.cpp
EventProxy.obj: EventProxy.cpp *.h
$(CC) -c EventProxy.cpp
Variant.obj: Variant.cpp *.h
$(CC) -c Variant.cpp
Dispatch.obj: Dispatch.cpp *.h
$(CC) -c Dispatch.cpp
SafeArray.obj: SafeArray.cpp *.h
$(CC) -c SafeArray.cpp
DispatchEvents.obj: DispatchEvents.cpp *.h
$(CC) -c DispatchEvents.cpp
ComThread.obj: ComThread.cpp *.h
$(CC) -c ComThread.cpp
EnumVariant.obj: EnumVariant.cpp *.h
$(CC) -c EnumVariant.cpp
STA.obj: STA.cpp *.h
$(CC) -c STA.cpp
DispatchProxy.obj: DispatchProxy.cpp *.h
$(CC) -c DispatchProxy.cpp

View File

@@ -1,31 +1,21 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the JACOB software.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "Dispatch.h"
// Win32 support for Ole Automation

View File

@@ -1,3 +1,22 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at www.sourceforge.net/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <objbase.h>
extern "C" {
VARIANT *extractVariant(JNIEnv *env, jobject arg);