Commit 647b3a8
committed
Fix: Added copilots suggestions
**Major Changes:**
1. **Window Subclassing System Overhaul (Comments [1](ramensoftware#2267 (comment)), [10](ramensoftware#2267 (comment)
- Replaced `SetWindowLongPtrW` with `WindhawkUtils::SetWindowSubclassFromAnyThread` for all window subclassing
- Updated subclass callbacks to use the standard `DWORD_PTR` refData parameter (matches `SetWindowSubclass`/WindhawkUtils expectations)
- Removed fallback ListView subclassing (SHELLDLL_DefView handles input properly)
- Added proper cleanup with `RemoveWindowSubclassFromAnyThread` in WM_NCDESTROY handlers
- Updated function signatures to use `DefSubclassProc` instead of `CallWindowProcW`
2. **Process Isolation (Comments [4](ramensoftware#2267 (comment)), [6](ramensoftware#2267 (comment)
- Added `IsWindowInCurrentProcess()` helper function
- Now verifies ListView and ShellView belong to current explorer.exe process
- Added a process check for `SHELLDLL_DefView` under Progman; if not current-process, falls back to WorkerW search
- Prevents the mod from affecting other explorer processes
3. **Settings API Fixes (Comments [2](ramensoftware#2267 (comment)), [3](ramensoftware#2267 (comment)
- Fixed `Wh_GetIntSetting` calls to use single argument (removed incorrect TRUE parameter)
- Added `Wh_FreeStringSetting` to properly free string memory
- Changed settings structure to nested `modifierKeys` object (matches Windhawk patterns)
4. **Initialization Improvements (Comments [7](ramensoftware#2267 (comment)), [8](ramensoftware#2267 (comment)
- Removed `Sleep(2000)` hack from `Wh_ModAfterInit`
- Removed unnecessary `bInitialized` flag
- Added `EnsureValidListView()` helper for dynamic ListView validation
- ListView now re-discovered on-demand if window becomes invalid
- After settings changes, re-discovers shell/ListView handles and refreshes visibility state before re-establishing subclasses (hotkeys keep working)
5. **Code Cleanup (Comments [5](ramensoftware#2267 (comment)), [9](ramensoftware#2267 (comment)
- Removed redundant `RestoreIconsToVisible` call from `Wh_ModBeforeUninit` (already in Wh_ModUninit)
- Added null checks and proper error handling throughout
- Added `ToUpperCase()` helper for case-insensitive key matching
- WM_CHAR handling now requires Ctrl when configured and respects Alt, preventing false positives from control codes
**Additional Improvements:**
- Added `<commctrl.h>` and `<windhawk_utils.h>` includes
- Added `--optimize=0 --debug` compiler options
- Enhanced documentation in readme with modifier key details
- Better logging and error messages throughout1 parent 72fd67c commit 647b3a8
1 file changed
Lines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
| |||
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
254 | | - | |
| 258 | + | |
255 | 259 | | |
256 | 260 | | |
257 | 261 | | |
| |||
264 | 268 | | |
265 | 269 | | |
266 | 270 | | |
267 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
268 | 277 | | |
269 | 278 | | |
270 | 279 | | |
271 | 280 | | |
272 | 281 | | |
| 282 | + | |
273 | 283 | | |
274 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
275 | 287 | | |
276 | 288 | | |
277 | 289 | | |
| |||
289 | 301 | | |
290 | 302 | | |
291 | 303 | | |
292 | | - | |
| 304 | + | |
293 | 305 | | |
294 | 306 | | |
295 | 307 | | |
| |||
309 | 321 | | |
310 | 322 | | |
311 | 323 | | |
312 | | - | |
| 324 | + | |
313 | 325 | | |
314 | 326 | | |
315 | 327 | | |
| |||
545 | 557 | | |
546 | 558 | | |
547 | 559 | | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
548 | 570 | | |
549 | 571 | | |
550 | 572 | | |
| |||
0 commit comments