Event Processing for Registry-based Policy
If your application uses registry-based policy settings, it should read the settings when the user starts the application and when the system refreshes policy. When a policy refresh occurs, the best practice is to immediately update an application so that it reflects any changes to policy settings.
[!Caution]
When reading policy information from the registry. Another application can update policy while your application is reading the registry.
To ensure that policy is not updated while you are reading the registry, call the EnterCriticalPolicySection function to obtain ownership of the policy section. When you have finished reading the registry, call the LeaveCriticalPolicySection function to release ownership of the policy section, so other applications can resume updating policy. If the policy section is not released within 10 minutes, the system will force a release of the policy section.
For more information about monitoring policy events, see Policy Events.