I'm trying to call CoCreateInstance(...) via a 64-bit Java library:
org.eclipse.swt.internal.ole.win32.COM. The DLL I'm trying to hook into is a DLL for Visual SourceSafe. The point of the project is to port a VSS plugin (http://sourceforge.net/projects/vssplugin/) made for 32-bit Eclipse to 64-bit Eclipse.
The call works fine when I use the 64-bit version of org.eclipse.swt.internal.ole.win32.COM, but with the 32-bit version, the call fails. The call is being used like this:
private void init(GUID guid) {
long[] ppv = new long[1];
int result = <span style="text-decoration:underline">COM.CoCreateInstance(guid, 0, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER | COM.CLSCTX_LOCAL_SERVER,
COM.IIDIDispatch, ppv)</span>;
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
init(new OleAutomation(new IDispatch(ppv[0])));
}
The call fails and returns -2147221164, which I guess is some kind of error code specifying that the corresponding registry entry can't be found.
Some things I've tried include:
- This registry hack: http://www.gfi.com/blog/32bit-object-64bit-environment/
- Unregistering/Registering the DLL with 32-bit and 64-bit versions of
regsvr32.exe
Does anyone have advice on this?