| 25 | } |
| 26 | |
| 27 | void WindowSpawnHandler::Handle( |
| 28 | HWINEVENTHOOK hook, DWORD event, HWND hWnd, |
| 29 | LONG idObject, LONG idChild, |
| 30 | DWORD dwEventThread, DWORD dwmsEventTime) |
| 31 | { |
| 32 | if (GlobalPolicy::VCheck(v::procwatch)) { |
| 33 | RECT r{}; |
| 34 | GetWindowRect(hWnd, &r); |
| 35 | pmlog_(Level::Verbose).note(std::format("win-spawn-event | pid:{:5} hwd:{:8x} own:{:8x} vis:{} siz:{} nam:{}", |
| 36 | pid, |
| 37 | reinterpret_cast<uintptr_t>(hWnd), |
| 38 | reinterpret_cast<uintptr_t>(GetWindow(hWnd, GW_OWNER)), |
| 39 | IsWindowVisible(hWnd), |
| 40 | win::RectToDims(r).GetArea(), |
| 41 | ::pmon::util::str::ToNarrow(win::GetWindowTitle(hWnd)) |
| 42 | )); |
| 43 | } |
| 44 | |
| 45 | // filter to only windows without an owner window |
| 46 | // window could have died between creation and when we get around to handling |
| 47 | // so check handle validity first |
| 48 | if (idObject == OBJID_WINDOW && IsWindow(hWnd) && GetWindow(hWnd, GW_OWNER) == nullptr) { |
| 49 | if (RECT r; GetWindowRect(hWnd, &r)) { |
| 50 | // filter to window with dimensions |
| 51 | if (r.right - r.left > 0) { |
| 52 | pOverlay->RegisterWindowSpawn(pid, hWnd, r); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
nothing calls this directly
no test coverage detected