Built-in messaging with .NET application on Windows

I followed the documentation of natural messages to the best of my ability, but I can not get my native .NET application to even start working on Windows. When searching for more information, I noticed that some things are undocumented and unclear.

First, the documentation does not mention the requirement to add "nativeMessaging" permission. After that I got a little more; Chrome actually mentions a β€œNew Background App Added” in a popup popup.

However, the following code is immediately disabled, regardless of what I tried.

var port = chrome.runtime.connectNative( ... );
port.onDisconnect.addListener(
    function()
    {
        console.log( "Disconnected" );
    } );

Based on my attempts to debug this thing, I have a few questions:

  • On Windows, when does Chrome try to load manifests from NativeMessagingHosts into the registry? In other words, should you restart Chrome when the value changes, or just restart the extension in? "chrome: // extensions /"
  • Absolute path in the registry, how to format it? . I saw people pointing only to "\\\\" slashes when path separators work. Do I need to use quotation marks?
  • Is there a way to get more information about what is going wrong? For testing purposes, I renamed the registry key to see if I could get another error (assuming it could not load it would notify me of this). Instead, "onDisconnect" is still called.
  • , , ? ( , , , ...)

, , , .

+4
1

, , . / , . , , ; Chrome (34.0.1847.116 ), , , , - .

, , , .

1. Windows, Chrome NativeMessagingHosts ?

, "" , "chrome://extensions/", . , reload, .

2. , ?

:

C:\Users\Bleh\Some\Path Even With \\\someManifestFile.json

  • .
  • , .: O. "C:\Some \\\ Very Weird\Path".
  • ". json" .
  • .

3. , ?

, Chromium, , , , API.

4. ? , :

"": "C:\\Program Files\\My \\chrome_native_messaging_host.exe"

  • .
  • .
+2

Source: https://habr.com/ru/post/1535743/


All Articles