microsoft / microsoft/wil

Warnings when building a WDK driver with code analysis ON

Open
#501 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
3k
Forks
300
Avg merge
19h 12m
Merged PRs (30d)
1

Description

Building a driver with WDK 10.0.22000 and code analysis ON produces several warnings:

C:\work\repos\core.mono_repo\core.driver\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\resource.h(6793): warning C28157: The IRQL in 'spinLockSavedIrql' was never restored.
C:\work\repos\core.mono_repo\core.driver\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\resource.h(6819): warning C28158: No IRQL was saved into 'return'.
C:\work\repos\core.mono_repo\core.driver\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\resource.h(6961): warning C28167: The function 'acquire_fast_mutex' changes the IRQL and does not restore the IRQL before it exits. It should be annotated to reflect the change or the IRQL should be restored. IRQL was last set to 1 at line 6963.
C:\work\repos\core.mono_repo\core.driver\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\resource.h(6969): warning C28167: The function 'try_acquire_fast_mutex' changes the IRQL and does not restore the IRQL before it exits. It should be annotated to reflect the change or the IRQL should be restored. IRQL was last set to 1 at line 6971.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the WDK 10.0.22000 build with code analysis enabled and inspect the reported locations in packages/Microsoft.Windows.ImplementationLibrary.1.0.240803.1/include/wil/resource.h, especially lines 6793, 6819, 6961, and 6969. Compare the IRQL annotations and analysis behavior around those functions; done means the driver build no longer emits these warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.