Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISearchQueryHelper::get_ConnectionString unexpected conversion type: 2 #87

Open
basinilya opened this issue Oct 27, 2022 · 0 comments
Open

Comments

@basinilya
Copy link

basinilya commented Oct 27, 2022

I want to use Windows Search from java.
I checked out the master branch 1e690b8, built the project (unit tests crash JVM) and copied the jars args4j-2.0.8.jar, com4j-2.2-SNAPSHOT.jar,tlbimp-2.2-SNAPSHOT.jar to my lib/

Then I generated the java classes (there were some warnings):

java -jar ./lib/tlbimp-2.2-SNAPSHOT.jar -o ./src -p org.useindexer "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\SearchAPI.tlb"

and created the Main class:

package org.useindexer;
public class Main {
    public static void main(final String[] args) {
        final ISearchManager searchManager = ClassFactory.createCSearchManager();
        final ISearchCatalogManager searchCatalogManager = searchManager.getCatalog("SystemIndex");
        final ISearchQueryHelper queryHelper = searchCatalogManager.getQueryHelper();
        final String connectionString = queryHelper.connectionString();
    }
}

Calling the getter connectionString() fails with:

Exception in thread "main" com4j.ComException: unexpected conversion type: 2 : .\invoke.cpp:470
	at com4j.Wrapper.invoke(Wrapper.java:187)
	at com.sun.proxy.$Proxy7.connectionString(Unknown Source)
	at org.useindexer.Main.main(Main.java:9)
Caused by: com4j.ComException: unexpected conversion type: 2 : .\invoke.cpp:470
	at com4j.Native.invoke(Native Method)
	at com4j.StandardComMethod.invoke(StandardComMethod.java:35)
	at com4j.Wrapper$InvocationThunk.call(Wrapper.java:356)
	at com4j.Task.invoke(Task.java:50)
	at com4j.ComThread.run0(ComThread.java:172)
	at com4j.ComThread.run(ComThread.java:153)

Here's the generated getter:

  @VTID(3)
  @ReturnValue(type=NativeType.Unicode)
  java.lang.String connectionString();

P.S. mvn package:

Running OutByteBufTest
Hello, World!
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec
Running VariantTest
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc35854dbd, pid=8788, tid=0x0000000000001318
#
# JRE version: OpenJDK Runtime Environment (8.0_181-b13) (build 1.8.0_181-1-ojdkbuild-b13)
# Java VM: OpenJDK 64-Bit Server VM (25.181-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [OLEAUT32.dll+0x94dbd]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\haltura\com4j\test\hs_err_pid8788.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Results :

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0

tlbimp output:

C:\haltura\indexer\useindexer>java -jar ./lib/tlbimp-2.2-SNAPSHOT.jar -o ./src -p org.useindexer "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\SearchAPI.tlb"
Generating definitions from SearchAPILib
Unable to handle the type tag_inner_PROPVARIANT
  method GetParameter
  interface ISearchCatalogManager
Unable to handle the type tag_inner_PROPVARIANT
  method SetParameter
  interface ISearchCatalogManager
Unable to handle the type _ULARGE_INTEGER
  method RemoteSeek
  interface IStream
Unable to handle the type _ULARGE_INTEGER
  method SetSize
  interface IStream
Unable to handle the type _ULARGE_INTEGER
  method RemoteCopyTo
  interface IStream
Unable to handle the type _ULARGE_INTEGER
  method LockRegion
  interface IStream
Unable to handle the type _ULARGE_INTEGER
  method UnlockRegion
  interface IStream
Unable to handle the type tagSTATSTG
  method Stat
  interface IStream
Unable to handle the type tagRemSNB
  method OpenStorage
  interface IStorage
Unable to handle the type tagRemSNB
  method RemoteCopyTo
  interface IStorage
Unable to handle the type _FILETIME
  method SetElementTimes
  interface IStorage
Unable to handle the type tagSTATSTG
  method Stat
  interface IStorage
Unable to handle the type tagSTATSTG
  method RemoteNext
  interface IEnumSTATSTG
Unable to handle the type tagTYPEATTR
  method RemoteGetTypeAttr
  interface ITypeInfo
Unable to handle the type tagFUNCDESC
  method RemoteGetFuncDesc
  interface ITypeInfo
Unable to handle the type tagVARDESC
  method RemoteGetVarDesc
  interface ITypeInfo
Unable to handle the type tagFUNCDESC
  method RemoteBind
  interface ITypeComp
Unable to handle the type tagTLIBATTR
  method RemoteGetLibAttr
  interface ITypeLib
Unable to handle the type _SEARCH_ITEM_PERSISTENT_CHANGE
  method OnItemsChanged
  interface ISearchPersistentItemsChangedSink
Unable to handle the type _SEARCH_ITEM_CHANGE
  method OnChange
  interface ISearchViewChangedSink
Unable to handle the type _SEARCH_ITEM_INDEXING_STATUS
  method OnItemIndexedStatusChange
  interface ISearchNotifyInlineSite
Unable to handle the type LPWSTR*
  method RemoteNext
  interface IEnumString
Unable to handle the type _tagpropertykey
  method WriteProperties
  interface ISearchQueryHelper
Unable to handle the type _SEARCH_ITEM_CHANGE
  method OnItemsChanged
  interface ISearchItemsChangedSink
Unable to handle the type tag_inner_PROPVARIANT
  method GetParameter
  interface ISearchManager
Unable to handle the type tag_inner_PROPVARIANT
  method SetParameter
  interface ISearchManager
Unable to handle the type _FILTERED_DATA_SOURCES
  method LoadIFilter
  interface ILoadFilter
Unable to handle the type ushort**
  method LoadIFilterFromStorage
  interface ILoadFilter
Unable to handle the type _FILTERED_DATA_SOURCES
  method LoadIFilterFromStream
  interface ILoadFilter
Unable to handle the type tagFULLPROPSPEC
  method Init
  interface IFilter
Unable to handle the type tagSTAT_CHUNK
  method GetChunk
  interface IFilter
Unable to handle the type tag_inner_PROPVARIANT
  method GetValue
  interface IFilter
Unable to handle the type tagFILTERREGION
  method BindRegion
  interface IFilter
Unable to handle the type _FILTERED_DATA_SOURCES
  method LoadIFilterWithPrivateComActivation
  interface ILoadFilterWithPrivateComActivation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant