lok.vikram
February 26th, 2009, 07:27 AM
The code below works fine we run from VC project or running the exe directly, but
when i run after installing as windows service RegOpenKeyEx returns ERROR_ACCESS_DENIED
i m running it as admin login.
lRet=RegConnectRegistry (str.c_str (),
HKEY_LOCAL_MACHINE,
&hRemoteKey);
if (lRet!=ERROR_SUCCESS)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("\n%p"), ACE_TEXT ("Connection to Remote "
"Computer Failed")));
ACE_DEBUG_LOG ((LM_ERROR, ACE_TEXT ("%T (%t): Connection to Remote "
"Computer Failed. In getting Drive Info from Registry in PSTStagging::GetDriveInfo\n")));
return -1;
}
i hace used these function for setting previlage like SE_RESTORE_NAME,SE_BACKUP_NAME
OpenProcessToken
LookupPrivilegeValue
AdjustTokenPrivileges
but still its failing
Please suggest
lRet = RegOpenKeyEx (hRemoteKey,
TEXT("SYSTEM\\MountedDevices\\"),
0L,
KEY_READ ,
&hKey);
when i run after installing as windows service RegOpenKeyEx returns ERROR_ACCESS_DENIED
i m running it as admin login.
lRet=RegConnectRegistry (str.c_str (),
HKEY_LOCAL_MACHINE,
&hRemoteKey);
if (lRet!=ERROR_SUCCESS)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("\n%p"), ACE_TEXT ("Connection to Remote "
"Computer Failed")));
ACE_DEBUG_LOG ((LM_ERROR, ACE_TEXT ("%T (%t): Connection to Remote "
"Computer Failed. In getting Drive Info from Registry in PSTStagging::GetDriveInfo\n")));
return -1;
}
i hace used these function for setting previlage like SE_RESTORE_NAME,SE_BACKUP_NAME
OpenProcessToken
LookupPrivilegeValue
AdjustTokenPrivileges
but still its failing
Please suggest
lRet = RegOpenKeyEx (hRemoteKey,
TEXT("SYSTEM\\MountedDevices\\"),
0L,
KEY_READ ,
&hKey);