Add support for starting NaCl win64 process if nacl64.exe is in the version d... (issue668130)

115 views
Skip to first unread message

greg...@google.com

unread,
Mar 5, 2010, 12:26:08 PM3/5/10
to hu...@chromium.org, chromium...@chromium.org, native-cli...@googlegroups.com, ben...@chromium.org
Reviewers: huanr,

Description:
Add support for starting NaCl win64 process if nacl64.exe is in the version
directory.
We now assume that nacl64.exe is in the same directory as chrome.dll (and
not as
chrome.exe as we assumed before).

BUG=28176
TEST=none

Please review this at http://codereview.chromium.org/668130

SVN Base: svn://chrome-svn/chrome/trunk/src/

Affected files:
M chrome/browser/nacl_host/nacl_broker_host.cc


Index: chrome/browser/nacl_host/nacl_broker_host.cc
===================================================================
--- chrome/browser/nacl_host/nacl_broker_host.cc (revision 40698)
+++ chrome/browser/nacl_host/nacl_broker_host.cc (working copy)
@@ -4,6 +4,8 @@

#include "chrome/browser/nacl_host/nacl_broker_host.h"

+#include "shlwapi.h"
+
#include "base/command_line.h"
#include "ipc/ipc_switches.h"
#include "chrome/browser/browser_process.h"
@@ -13,6 +15,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/nacl_cmd_line.h"
#include "chrome/common/nacl_messages.h"
+#include "chrome/installer/util/util_constants.h"

NaClBrokerHost::NaClBrokerHost(
ResourceDispatcherHost* resource_dispatcher_host)
@@ -33,13 +36,21 @@
if (!CreateChannel())
return false;

- // Create the path to the nacl broker/loader executable.
- FilePath exe_path = GetChildPath(false);
- if (exe_path.empty())
+ TCHAR path[MAX_PATH];
+ HMODULE chrome_dll_handle = GetModuleHandle(installer_util::kChromeDll);
+ if (chrome_dll_handle == NULL)
return false;

- FilePath nacl_path = exe_path.DirName().Append(chrome::kNaClAppName);
- CommandLine* cmd_line = new CommandLine(nacl_path);
+ DWORD res = GetModuleFileName(chrome_dll_handle, path, MAX_PATH);
+ if (0 == res)
+ return false;
+
+ if (!PathRemoveFileSpec(path) || !PathAppend(path, chrome::kNaClAppName))
+ return false;
+
+ CommandLine* cmd_line = new CommandLine(CommandLine::ARGUMENTS_ONLY);
+ cmd_line->ParseFromString(path);
+
nacl::CopyNaClCommandLineArguments(cmd_line);

cmd_line->AppendSwitchWithValue(switches::kProcessType,


hu...@chromium.org

unread,
Mar 5, 2010, 1:08:57 PM3/5/10
to greg...@google.com, chromium...@chromium.org, native-cli...@googlegroups.com, ben...@chromium.org

http://codereview.chromium.org/668130/diff/5/6
File chrome/browser/nacl_host/nacl_broker_host.cc (right):

http://codereview.chromium.org/668130/diff/5/6#newcode53
chrome/browser/nacl_host/nacl_broker_host.cc:53:
looks like this code is called in chrome.dll? you can use
PathService::Get(base::FILE_MODULE, &module_path)

http://codereview.chromium.org/668130

greg...@google.com

unread,
Mar 5, 2010, 3:17:28 PM3/5/10
to hu...@chromium.org, chromium...@chromium.org, native-cli...@googlegroups.com, ben...@chromium.org
On 2010/03/05 18:08:57, huanr wrote:
> http://codereview.chromium.org/668130/diff/5/6
> File chrome/browser/nacl_host/nacl_broker_host.cc (right):

> http://codereview.chromium.org/668130/diff/5/6#newcode53
> chrome/browser/nacl_host/nacl_broker_host.cc:53:
> looks like this code is called in chrome.dll? you can use
> PathService::Get(base::FILE_MODULE, &module_path)

Done. Thanks for the tip.


http://codereview.chromium.org/668130

hu...@chromium.org

unread,
Mar 5, 2010, 5:45:40 PM3/5/10
to greg...@google.com, chromium...@chromium.org, native-cli...@googlegroups.com, ben...@chromium.org
Reply all
Reply to author
Forward
0 new messages