| 145 | } |
| 146 | |
| 147 | std::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 | |
| 166 | std::wstring Process::GetUserName() const { |
| 167 | wil::unique_handle hToken; |
no outgoing calls
no test coverage detected