| 3 | #include <string> |
| 4 | |
| 5 | int 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 |
nothing calls this directly
no outgoing calls
no test coverage detected