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

Method GetCommandLine

WinSysCore/Processes.cpp:147–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147std::wstring Process::GetCommandLine() const {
148 if (::IsWindows8OrGreater()) {
149 ULONG size = 8192;
150 auto buffer = std::make_unique<BYTE[]>(size);
151 auto status = ::NtQueryInformationProcess(_handle.get(), ProcessCommandLineInformation, buffer.get(), size, &size);
152 if (NT_SUCCESS(status)) {
153 auto str = (UNICODE_STRING*)buffer.get();
154 return std::wstring(str->Buffer, str->Length / sizeof(WCHAR));
155 }
156 if (status == STATUS_INVALID_INFO_CLASS) {
157 return L"";
158 }
159 }
160 else {
161 return GetCmdLine(_handle.get());
162 }
163 return L"";
164}
165
166std::wstring Process::GetUserName() const {
167 wil::unique_handle hToken;

Callers 4

InitProcessMethod · 0.80
OnCopyMethod · 0.80
ProcessInfoEx.cppFile · 0.80
ParseTableEntryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected