| 559 | } |
| 560 | |
| 561 | void 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 | |
| 583 | void MessageInput::close_target_process() |
| 584 | { |
nothing calls this directly
no outgoing calls
no test coverage detected