MCPcopy Create free account
hub / github.com/0xJs/RedTeaming_CheatSheet / main

Function main

coding/projects/Windows_Security/elevate/elevate.cpp:5–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <string>
4
5int main(int argc, const wchar_t* argv[])
6{
7 if (argc < 2) {
8 printf("Usage: elevate <executable> [arguments] ... \n");
9 return 0;
10 }
11
12 std::wstring params;
13 for (int i = 2; i < argc; i++) {
14 params += argv[i];
15 params += L" ";
16 }
17
18 HINSTANCE hInstDll = ::ShellExecute(nullptr, L"runas", argv[1], params.c_str(), nullptr, SW_SHOWDEFAULT);
19 if (HandleToLong(hInstDll) < 32) {
20 printf("Error launching process (%u)\n", ::GetLastError());
21 }
22 return 0;
23}
24

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected