Skip to content

COMBindingBaseObject should use COMUtils#checkRC() #646

@matthiasblaesing

Description

@matthiasblaesing

@SevenOf9Sleeper rightly noticed, that the error message generated by subclasses of COMBindingBaseObject generate misleading messages - one offending place:

        // This is line 128
        } else {
            hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, dwClsContext,
                    IDispatch.IID_IDISPATCH, this.pDispatch);
        }

        if (COMUtils.FAILED(hr)) {
            throw new COMException("COM object with ProgID '" + progId
                    + "' and CLSID " + clsid.toGuidString()
                    + " not registered properly!");
        }

In the sample ComUtils#checkRC would have yielded:

com.sun.jna.platform.win32.COM.COMException: CoInitialize wurde nicht aufgerufen.(HRESULT: 800401f0) (puArgErr=)

English translation: "CoInitialize was not called" which would have pointed to the real problem instead of implying a registry problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions