Failed to access registry keys while the server is rebooting
Operating system: Windows 2003 server
The Following is the issue that iam facing while accessing Windows Registry:
we use a service which sets values to a few keys in HKLM\SYSTEM\CurrentControlSet\Services\Test\Parameters\Control
during the start of application. When we reboot the system, the service deletes the values associated with those keys before it gets stopped. So that, when the server comes up after reboot, it will not read the old values.
The problem is, during the start of the application, all keys are getting created properly, but, during reboot, when the service
is trying to access the registry to reset the values, all the Registry API calls( RegOpenKey, RegCreateKeyEx etc..) are failing with windows error 19( ERROR_WRITE_PROTECT).
NOTE: The service has full Domain and Local administrator rights and full control over the registry.
Even a GetComputerName() API is returning 0 with GetLastError 19(ERROR_WRITE_PROTECT).
From the event logs, we observed that there are a few entries logged having Event ID: 1517 which means:
"Windows saved user MGMT-XHA\svcbhaslm registry while an application or service was still using the registry during log off.
The memory used by the user's registry has not been freed. The registry will be unloaded when it is no longer in use."
This is often caused by services running as a user account, try configuring the services to run in either the LocalService or NetworkService account."
Later we installed UPHClean on the server and did a reboot and found the server frozen while rebooting. We did a hard reset to restart the server.
UPHClean logged the following entry into the event viewer:
The following handles in user profile hive MGMT-XHA\svcbhaslm (S-1-5-21-3690111373-1527127378-4234617882-1903) have been closed because
they were preventing the profile from unloading successfully: