peihailong
小狐狸
小狐狸
  • UID30359
  • 注册日期2009-09-12
  • 最后登录2009-12-10
  • 发帖数5
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:2125回复:2

有谁深入研安过firefox,知道 c++源码的主入口函数是什么呢?启动参数...

楼主#
更多 发布于:2009-12-10 09:56
有谁学过firefox  C++部分的代码, 主入口函数是不是在mozilla/browser/app下面的文件里,还有,比如 -p   -no -remote 这些参数是怎么通过shell传进去的?

          我也在调查,望大侠们给点指点。
opentiss
千年狐狸
千年狐狸
  • UID16
  • 注册日期2004-11-21
  • 最后登录2024-02-23
  • 发帖数3371
  • 经验65枚
  • 威望1点
  • 贡献值34点
  • 好评度13点
  • 社区居民
  • 忠实会员
1楼#
发布于:2009-12-10 09:56
我觉得你只要找到main函数之类的,就能够找到有用的线索了,我没有研究过Firefox的代码,但C/C++应该差不多是这样的结构与过程的
Blogger
Give Up GitHub!

欢迎使用 Areditors

sntp -P no -r 210.72.145.44
opentiss
千年狐狸
千年狐狸
  • UID16
  • 注册日期2004-11-21
  • 最后登录2024-02-23
  • 发帖数3371
  • 经验65枚
  • 威望1点
  • 贡献值34点
  • 好评度13点
  • 社区居民
  • 忠实会员
2楼#
发布于:2009-12-10 09:56
文件:
mozilla-1.9.1/browser/app/nsBrowserApp.cpp

Firefox 3.5.5

start line 107:
int main(int argc, char* argv[])
{
  ScopedLogging log;

  nsCOMPtr<nsILocalFile> appini;
  nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
  if (NS_FAILED(rv)) {
    Output("Couldn't calculate the application directory.");
    return 255;
  }
  appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));

  // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
  // Note that -app must be the *first* argument.
  char *appEnv = nsnull;
  const char *appDataFile = PR_GetEnv("XUL_APP_FILE");
  if (appDataFile && *appDataFile) {
    rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
    if (NS_FAILED(rv)) {
      Output("Invalid path found: '%s'", appDataFile);
      return 255;
    }
  }
  else if (argc > 1 && IsArg(argv[1], "app")) {
    if (argc == 2) {
      Output("Incorrect number of arguments passed to -app");
      return 255;
    }

    rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini));
    if (NS_FAILED(rv)) {
      Output("application.ini path not recognized: '%s'", argv[2]);
      return 255;
    }

    appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
    PR_SetEnv(appEnv);
    argv[2] = argv[0];
    argv += 2;
    argc -= 2;
  }

  nsXREAppData *appData;
  rv = XRE_CreateAppData(appini, &appData);
  if (NS_FAILED(rv)) {
    Output("Couldn't read application.ini");
    return 255;
  }

  int result = XRE_main(argc, argv, appData);
  XRE_FreeAppData(appData);
  if (appEnv)
    PR_smprintf_free(appEnv);
  return result;
}

差不多应该是这里了,你应该是已经找对了,哈哈
Blogger
Give Up GitHub!

欢迎使用 Areditors

sntp -P no -r 210.72.145.44
游客

返回顶部