microsoft / microsoft/wil

Registry Watcher does not work for Windows 7 environment

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

Nobody has claimed this yet.

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

Description

When trying to use Registry Watchers for Windows 7, the application crashes when initializing an registry watcher.
During the code analyzing it was noticed that the flag REG_NOTIFY_THREAD_AGNOSTIC is used during the initialization in the Registry.h with the Windows API RegNotifyChangeKeyValue.

However, according to Microsoft's MSDN, the flag is only available for Windows 8.

--> https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regnotifychangekeyvalue

REG_NOTIFY_THREAD_AGNOSTIC0x10000000L 

Indicates that the lifetime of the registration must not be tied to the lifetime of the thread issuing the RegNotifyChangeKeyValue call.

Note  This flag value is only supported in Windows 8 and later.

Lines of code in registry.h

RETURN_IF_WIN32_ERROR(RegNotifyChangeKeyValue(watcherState->m_keyToWatch.get(),
                watcherState->m_isRecursive, REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_THREAD_AGNOSTIC,
                watcherState->m_eventHandle.get(), TRUE));

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 Registry.h at the RegNotifyChangeKeyValue call and compare the REG_NOTIFY_THREAD_AGNOSTIC usage with the linked Microsoft documentation. Check how registry watcher initialization behaves on Windows 7 and verify that a watcher no longer crashes there while preserving supported behavior on newer Windows versions.

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.