Commit 61b482b
authored
fix(windows): handle hwnd==0 gracefully for UAC/secure desktop (#118)
When the foreground window handle is 0 (e.g. during UAC prompts,
lock screen, or secure desktop), Win32 API calls like OpenProcess
fail with "The parameter is incorrect" (error 87). This caused
continuous error spam in logs.
Fix:
- Return None early when hwnd==0, letting heartbeat_loop skip the
poll cycle (it already handles None gracefully)
- Wrap WMI fallback in try/except so if both win32api and WMI fail
for elevated processes, we degrade to "unknown" instead of crashing
Fixes #901 parent e202578 commit 61b482b
1 file changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
0 commit comments