Commit d486d52
Fix device cleanup to run on device disable
The cleanup callback was incorrectly registered on the driver object
instead of the device object. This meant that when disabling the device
in Device Manager, FrameworkArgbEvtDriverContextCleanup was never called
(it only runs on driver unload, not device disable).
Additionally, the driver cleanup was calling GetDeviceContext() on a
WDFDRIVER object, which is incorrect - that function is for WDFDEVICE.
Changes:
- Add FrameworkArgbEvtDeviceCleanup callback for device-level cleanup
- Register it on the device attributes in FrameworkArgbCreateDevice
- Move EC handle cleanup from driver to device cleanup
- Keep only WPP tracing cleanup in driver cleanup
This fixes issues when disabling the device while Windows Dynamic
Lighting is using it (timer keeps firing, reboot popup, etc).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 907af91 commit d486d52
3 files changed
+42
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
| |||
735 | 736 | | |
736 | 737 | | |
737 | 738 | | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
| |||
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | | - | |
160 | | - | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 163 | | |
173 | 164 | | |
174 | 165 | | |
| |||
177 | 168 | | |
178 | 169 | | |
179 | 170 | | |
| 171 | + | |
| 172 | + | |
180 | 173 | | |
0 commit comments