Make CEF use separate executable to launch subprocesses (C++/Windows)
<p>I am trying to modify the "cefsimple" example from the Chromium Embedded Framework (<a href="https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial" rel="nofollow noreferrer">https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial</a>), so that it uses a <strong>separate executable</strong> in order to launch its sub-processes on Windows.</p>

<p>However, this is not working as expected and it crashes every time on the call to <strong>CefInitialize</strong> in the main process, before any window pops up or any subprocess is launched. Call stack:</p>

<pre><code>    chrome_elf.dll!00007ffaa7fc1cfd()   
    chrome_elf.dll!00007ffaa7fba5fc()   
    chrome_elf.dll!00007ffaa7fb9c9b()   
    libcef.dll!00007ffa88dae13c()   
    libcef.dll!00007ffa882fc146()   
&gt;   cefsimple.exe!CefInitialize(const CefMainArgs &amp; args, const CefStructBase&lt;CefSettingsTraits&gt; &amp; settings, CefRefPtr&lt;CefApp&gt; * application, void * windows_sandbox_info)  Line 201 + 0xb4 bytes   C++
</code></pre>

<p><strong>Using</strong>: CEF version 3.2883.1539, 64-bit, C++, VS 2015, Windows 10.</p>

<p><strong>My solution</strong>:
I added another target (cefsimpleHelper.exe) in the CMakeLists, and used these instructions as a reference to modify the source code:
<a href="https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage#markdown-header-separate-sub-process-executable" rel="nofollow noreferrer">https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage#markdown-header-separate-sub-process-executable</a></p>

<p><strong>cefsimple_win.cc:</strong> <em>(entry point of the main executable)</em></p>

<pre><code>int APIENTRY wWinMain(HINSTANCE hInstance,
                      HINSTANCE hPrevInstance,
                      LPTSTR    lpCmdLine,
                      int       nCmdShow)
{
  UNREFERENCED_PARAMETER(hPrevInstance);
  UNREFERENCED_PARAMETER(lpCmdLine);

  CefEnableHighDPISupport();
  CefMainArgs main_args(hInstance);

  CefSettings settings;
  settings.no_sandbox = true;
  CefString(&amp;settings.browser_subprocess_path).FromASCII("cefsimpleHelper.exe");

  CefRefPtr&lt;SimpleApp&gt; app(new SimpleApp);

  CefInitialize(main_args, settings, app.get(), NULL);
  CefRunMessageLoop();
  CefShutdown();

  return 0;
}
</code></pre>

<p><strong>process_helper_win.cc:</strong> <em>(entry point for the sub-process launcher)</em></p>

<pre><code>int APIENTRY wWinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPTSTR    lpCmdLine,
    int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    CefMainArgs main_args(hInstance);
    CefRefPtr&lt;SimpleApp&gt; app(new SimpleApp);
    return CefExecuteProcess(main_args, app.get(), nullptr);
}
</code></pre>

<p>Any ideas what might be the problem?</p>