|
阅读:2552回复:2
有谁深入研安过firefox,知道 c++源码的主入口函数是什么呢?启动参数...
有谁学过firefox C++部分的代码, 主入口函数是不是在mozilla/browser/app下面的文件里,还有,比如 -p -no -remote 这些参数是怎么通过shell传进去的?
我也在调查,望大侠们给点指点。 |
|
|
1楼#
发布于:2009-12-10 09:56
我觉得你只要找到main函数之类的,就能够找到有用的线索了,我没有研究过Firefox的代码,但C/C++应该差不多是这样的结构与过程的
|
|
|
|
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;
}
差不多应该是这里了,你应该是已经找对了,哈哈 |
|
|