SF 3377279

- Placed JacobVersion.properties into ${release.dir.java.meta.inf} instead of the current folder;
- com/jacob/test/safearray/SafeArrayBasicTest.java is compiled separately, because it is in UTF-16 encoding
- Added initializing Variant used to retrieve the next value from IEnum because some implemenations call VariantClear on it before setting a new value
- Changed _WIN32_WINNT to 0x0500 to fix build with VS2010
- Fixed the leak in Java_com_jacob_com_Variant_putVariantNoParam
- Added Dispatch.Method to the invoke flags to call _NewEnum. There are some nonconforming legacy implementations that expose _NewEnum as a method.
This commit is contained in:
clay_shooter
2011-10-01 22:33:38 +00:00
parent cbfc548c6f
commit 003671fb90
7 changed files with 108 additions and 27 deletions

View File

@@ -57,6 +57,14 @@ Java_com_jacob_com_EnumVariant_Next(JNIEnv* env, jobject _this, jobjectArray var
return 0;
VARIANT* sink = (VARIANT*)CoTaskMemAlloc(count * sizeof(VARIANT));
// SF 3377279
// Added initializing Variant used to retrieve the next value from IEnum
// because some implemenations call VariantClear on it before setting a new value
for (ULONG i = 0; i < count; ++i)
{
VariantInit(sink + i);
}
ULONG fetchCount = 0;
HRESULT hr = self->Next(count, sink, &fetchCount);

View File

@@ -31,8 +31,10 @@
#ifndef STRICT
#define STRICT
#endif
// SF 3377279 Changed _WIN32_WINNT to 0x0500 to fix build with VS2010
// 0x400 is NT or later 0x500 is windows 2000 or later. we could go higher
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#define _WIN32_WINNT 0x0500
#endif
//#define _ATL_APARTMENT_THREADED
#include <windows.h>

View File

@@ -967,6 +967,8 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNoParam
{
VARIANT *v = extractVariant(env, _this);
if (v) {
// SF 3377279 clear variable to fix leak
VariantClear(v);
V_VT(v) = VT_ERROR;
V_ERROR(v) = DISP_E_PARAMNOTFOUND;
}