Skip to content

Commit

Permalink
Supports longer "CommandLine"
Browse files Browse the repository at this point in the history
  • Loading branch information
Bush2021 committed Oct 16, 2023
1 parent f5de24b commit 67d1a8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ bool IsIniExist()
}

// 如果 ini 存在,从中读取 CommandLine;如果 ini 不存在,或者存在,但是 CommandLine 为空,则返回空字符串
// 改成最大 1024 个字符
std::wstring GetCrCommandLine()
{
if (IsIniExist())
{
std::wstring IniPath = GetAppDir() + L"\\chrome++.ini";
TCHAR CommandLineBuffer[MAX_PATH];
::GetPrivateProfileStringW(L"General", L"CommandLine", L"", CommandLineBuffer, MAX_PATH, IniPath.c_str());
TCHAR CommandLineBuffer[1024];
::GetPrivateProfileStringW(L"General", L"CommandLine", L"", CommandLineBuffer, 1024, IniPath.c_str());
return std::wstring(CommandLineBuffer);
}
else
Expand Down
6 changes: 4 additions & 2 deletions src/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::wstring GetCommand(LPWSTR param)
{
args.push_back(L"--portable");

args.push_back(L"--disable-features=RendererCodeIntegrity,FlashDeprecationWarning");
args.push_back(L"--disable-features=RendererCodeIntegrity");

// 获取命令行,然后追加参数
// 如果存在 = 号,参数会被识别成值
Expand All @@ -89,6 +89,8 @@ std::wstring GetCommand(LPWSTR param)
// 然后再把提取出来的部分从原有的字符串中删除,再 push_back 剩下的部分
// 重复上述过程,直到字符串中不再存在 = 号
// 这样就可以保证参数不会被识别成值了
// 似乎必须特殊处理等号,暂时不知道怎么一起处理
if (GetCrCommandLine().length() > 0)
{
auto cr_command_line = GetCrCommandLine();
std::wstring temp = cr_command_line;
Expand All @@ -115,7 +117,7 @@ std::wstring GetCommand(LPWSTR param)
}
}
}

// 单独处理剩余参数
while (true)
{
auto pos1 = temp.find(L"--");
Expand Down

0 comments on commit 67d1a8e

Please sign in to comment.