microsoft / microsoft/wil

wil/resource.h conditionally enables unique_key using different logic than winreg.h

Open
#470 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The support for wil::unique_hkey in wil/resource.h is conditionally enabled based on WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) here.

This is out of sync with what protects RegCloseKey() and HKEY. See line 237 in winreg.h in the Windows SDK.

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)

This means if you don't build with WINAPI_FAMILY defined as WINAPI_FAMILY_DESKTOP_APP you don't get wil::uniquey_hkey.

This caused problems for a shared library that wil::unique_hkey that needs to be consumed by UWP style apps.

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

Start in include/wil/resource.h around line 4903 and compare its unique_hkey guard with the RegCloseKey/HKEY guard at line 237 of the Windows SDK's winreg.h. Confirm the conditional behavior for non-desktop app families, then verify that the resulting guard matches the SDK behavior and exposes wil::unique_hkey to the affected UWP-style consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.