Chrome native messaging on windows Chrome native messaging on windows google-chrome google-chrome

Chrome native messaging on windows


I also struggled with this issue on Windows, but was able to get it work. Try the following:

Regarding the registry (mine on the HKLM, but HKCU should be OK) you should use double backslash. Here is my .reg file:

[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\tcchrome.native.handler]@="G:\\\ExtChrome\\\Extension\\\Native\\\manifest.json"
  1. Keep the name of the native process with lowercase letters and only 3 parts - meaning com.google.chrome. It sounds weird but this is how it is working for me...
  2. Put the exe and the manifest in the same folder, so that path will be "native-messaging-example-host.exe" - In this case I am sure because I tested it.

Here is my manifest for example:

{    "name": "chrome.native.handler",    "description": "BlaBla helper process",    "path": "chrome.native.handler.exe",    "type": "stdio",    "allowed_origins": [    "chrome-extension://eoknpfoeckmeidbmbfoklejkppcnlfdm/"    ]}

BTW, you are not handling the response right. You are supposed to send the message length in "native byte order" - what you are doing will not work for larger messages. Instead you can do something like:

cout.write((char*)&resSize, 4);cout.write(responseBuf, resSize);

Hope this helps