views:

18

answers:

0

I have registered a COM Context menu DLL (to display Explorer Context Menus) in a Windows7 machine. In the DLL, I have checked whether a service is running in my system. The service is running under 'Local System Account'.

I have checked the service status by OpenSCManager and QueryServiceStatus. It seems to work in XP without any issue. But in Windows7, sometimes I get 'Access Denied' error and some times I get the wrong result... (eg, Service is running but it shows status as service is stopped.) I am not sure how to check this in Windows7.

I have also checked whether my exe is running by

HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);

but this is also not working in Windows7 when I am running as Service.

Could anyone update me how to check whether the Service is running through DLL?

Note: The DLL is loaded by Explorer.