MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / open_target_process

Method open_target_process

source/MaaWin32ControlUnit/Input/MessageInput.cpp:561–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559}
560
561void MessageInput::open_target_process()
562{
563 if (target_process_handle_ || !hwnd_) {
564 return;
565 }
566
567 DWORD pid = 0;
568 GetWindowThreadProcessId(hwnd_, &pid);
569 if (!pid) {
570 LogWarn << "GetWindowThreadProcessId returned 0" << VAR(hwnd_) << VAR(GetLastError());
571 return;
572 }
573
574 target_process_handle_ = OpenProcess(PROCESS_SUSPEND_RESUME, FALSE, pid);
575 if (!target_process_handle_) {
576 LogWarn << "OpenProcess failed" << VAR(pid) << VAR(GetLastError());
577 return;
578 }
579
580 NtDllHolder::load_library(L"ntdll.dll");
581}
582
583void MessageInput::close_target_process()
584{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected