MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / GetCmdLine

Method GetCmdLine

WinSysCore/Processes.cpp:333–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333std::wstring Process::GetCmdLine(HANDLE hProcess) {
334 std::wstring cmdLine;
335 PEB peb;
336 if (!GetProcessPeb(hProcess, &peb))
337 return cmdLine;
338
339 RTL_USER_PROCESS_PARAMETERS processParams;
340 if (!::ReadProcessMemory(hProcess, peb.ProcessParameters, &processParams, sizeof(processParams), nullptr))
341 return cmdLine;
342
343 cmdLine.resize(processParams.CommandLine.Length / sizeof(WCHAR) + 1);
344 if (!::ReadProcessMemory(hProcess, processParams.CommandLine.Buffer, cmdLine.data(),
345 processParams.CommandLine.Length, nullptr))
346 return L"";
347
348 return cmdLine;
349}
350
351std::vector<std::pair<std::wstring, std::wstring>> Process::GetEnvironment(HANDLE hProcess) {
352 std::vector<std::pair<std::wstring, std::wstring>> env;

Callers

nothing calls this directly

Calls 1

GetProcessPebFunction · 0.70

Tested by

no test coverage detected