Skip to content

fix(dgw): reject null event source handles - #1972

Draft
Benoît Cortier (CBenoit) wants to merge 1 commit into
masterfrom
cbenoit-fix-event-log-handle
Draft

fix(dgw): reject null event source handles#1972
Benoît Cortier (CBenoit) wants to merge 1 commit into
masterfrom
cbenoit-fix-event-log-handle

Conversation

@CBenoit

Copy link
Copy Markdown
Member

Treats the null handle returned by RegisterEventSourceW as a registration failure, preventing invalid event source handles from being retained and used for Windows Event Log writes.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

Treat the null handle returned by RegisterEventSourceW as a registration failure. This prevents invalid event source handles from being retained and used for Windows Event Log writes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@CBenoit
Benoît Cortier (CBenoit) requested a balanced review from Copilot September 4, 2026 18:21
@CBenoit

Copy link
Copy Markdown
Member Author

Implementation notes:

  • Added a focused predicate for the RegisterEventSourceW failure sentinel.
  • Preserved the existing Arc ownership, Drop behavior, and immediate registration error path.
  • Added a regression proving that NULL, not INVALID_HANDLE_VALUE, denotes failure.

Local validation:

  • cargo +nightly fmt --all
  • cargo test -p sysevent-winevent
  • cargo clippy --workspace --tests -- -D warnings
  • cargo test --workspace reached one unrelated, reproducible WindowsApps ACL failure in now-package-broker; 249 tests in that crate passed before the failure.

Note

LLM-assisted content (no human feedback).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The fix and regression coverage are focused, with no unresolved issues.

Pull request overview

Corrects Windows Event Log registration failure detection to match the Win32 API contract.

Changes:

  • Rejects null handles returned by RegisterEventSourceW.
  • Adds regression coverage for handle sentinel behavior.
File summaries
File Description
crates/sysevent-winevent/src/lib.rs Corrects handle validation and adds a focused unit test.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants