Use the Correct Access Mask When Opening a Registry Key

[This is preliminary documentation and subject to change.]

Recommendation   (Designed for Microsoft® Windows® Logo)

Instead of opening a registry key with KEY_ALL_ACCESS, use KEY_READ if all you need to do is read the key, or use KEY_WRITE if you need to change its value.

Remarks

By applying this recommendation, you cooperate better with other processes that may need access to the key. In a complex managed enterprise environment, this can be important.