Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions dll/kernel32/processthreadsapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,22 @@ BOOL WINAPI CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECU

bool useSearchPath = lpApplicationName == nullptr;
std::string application;
std::string commandLine = lpCommandLine ? lpCommandLine : "";
if (lpApplicationName) {
application = lpApplicationName;
std::string commandLine = "";
bool findNewApp = false;

if (lpCommandLine) {
commandLine = lpCommandLine;

std::string toRemove = "cmd.exe /c ";
size_t pos = commandLine.find(toRemove);
if (pos != std::string::npos) {
commandLine.erase(pos, toRemove.length());
findNewApp = true;
}
}

if (lpApplicationName && !findNewApp) {
application = lpApplicationName;
} else {
std::vector<std::string> arguments = wibo::splitCommandLine(commandLine.c_str());
if (arguments.empty()) {
Expand Down
Loading