How to deal with the DLL-Import Error "onecoreuap\inetcore\urlmon\zones\zoneidentifier.cxx(359)\urlmon.dll! [...] 80070002" in the context of JNI?

2


I am trying to build a JNI-Wrapper for UIAComWrapper.dll to be able to automate Windows-Code using Java-Calls. Unfortunately, if I only try to include my C#-Dlls, which includes Wrapped Automation-Calls (directly linked to UIAComWrapper.dll), it prints out the following error:

onecoreuap\inetcore\urlmon\zones\zoneidentifier.cxx(359)\urlmon.dll!00007FFFAC5005D0: (caller: 00007FFFAC50010D) ReturnHr(1) tid(1b18) 80070002 Das System kann die angegebene Datei nicht finden.

Why I assume that this error causes my problem with JNI? Because the exception information prints me out the following (excerpt only):

siginfo: ExceptionCode=0xe0434352, ExceptionInformation=0xffffffff80070002 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x00007fffa4870000

It's the same stack address as stated in the first error message box (80070002).

I created the following Header-File to access my DLL:

#pragma once
#using <mscorlib.dll>
#include <iostream>
#using <SharpAutomation.dll>

using namespace std;

class BridgeCredentialFactory
{
public:

    // Provide .NET interop and garbage collecting to the pointer.
    static CredentialHandler::HandlerTypes::GenericCredentialHandler^ getCredentialHandlerFor(CredentialHandler::Maps::Browser browser) {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = CredentialHandler::CredentialFactory::getCredentialHandlerFor(browser);
        return handler;
    }
};

class BridgeGenericCredentialHandler {
public:

    CredentialHandler::Maps::Browser b;

    BridgeGenericCredentialHandler(CredentialHandler::Maps::Browser browser) {
        b = browser;
    }

    void enterUsername(System::String^ username) {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);

        handler->enterUsername(username);
    }

    void enterPassword(System::String^ username) {
        System::String^ mystring = username;
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);

        handler->enterPassword(mystring);
    }

    void enterCredentials(System::String^ username, System::String^ password) {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);

        handler->enterCredentials(username, password);
    }

    void clickLogin() {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);
        handler->clickLogin();
    }

    void clickCancel() {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);
        handler->clickCancel();
    }

    bool windowExists() {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);
        System::Console::WriteLine(getBrowserType());
        return handler->windowExists();
    }

    CredentialHandler::Maps::Browser getBrowserType() {
        CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = resolveInterface(b);
        return handler->getBrowserType();
    }

private:
    CredentialHandler::HandlerTypes::GenericCredentialHandler^ resolveInterface(CredentialHandler::Maps::Browser browser) {
        switch (browser)
        {
        case CredentialHandler::Maps::Browser::Chrome:
            return gcnew CredentialHandler::HandlerTypes::ChromeCredentialHandler();
            break;

        case CredentialHandler::Maps::Browser::Firefox:
            return gcnew CredentialHandler::HandlerTypes::FirefoxCredentialHandler();
            break;

        case CredentialHandler::Maps::Browser::Edge:
        case CredentialHandler::Maps::Browser::InternetExplorer:
            return gcnew CredentialHandler::HandlerTypes::InternetExplorerCredentialHandler();
            break;

        default:
            return gcnew CredentialHandler::HandlerTypes::ChromeCredentialHandler(); //ToDo noch nicht wie gewünscht
            break;
        }
    }
};

I checked the type of my assemblies, everything is set to x64. The only thing I could imagine to be the source of error is an inexpertly integration of the DLL-file. If my assumption is right, I would be very grateful to get teached by any of you.

I googled for days, so I would be surprised, if you could only send me a helpful link (if you found something anyway, I'd be very happy to benefit; I love surprises).

Could anyone please help me resolving this issue? In case you need anything else to be able to contribute, please let me know :)


Some more code as requested:

The call starts with:

CredentialHandler::HandlerTypes::GenericCredentialHandler^ handler = BridgeCredentialFactory::getCredentialHandlerFor(CredentialHandler::Maps::Browser::Chrome);
    handler->enterUsername("Test");

Here we call the method enterUsername, which is used in the particular handler. This executes a C#-Method enterUsername():

 public void enterUsername(String username)
        {
            if (windowExists())
            {
                Mouse.MoveTo(CredentialsHandler.Utils.GetCenterPointFrom(EnterCredentials.InpUsername));
                Mouse.Click(MouseButton.Left);
                Keyboard.Type(username);
            }
        }

Code isn't clean yet and will be enhanced after solving this issue, promise ;)

c#
c++
dll
java-native-interface
.net-4.7.1
asked on Stack Overflow Apr 2, 2019 by Kitzng • edited Apr 2, 2019 by Kitzng

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0