Controlling a service on remote machine

Controlling a service on remote machine

Post by shoe » Fri, 09 Mar 2007 08:58:19


I am sending a control code to a remote service(within a LAN)using
controlservice() api but it is giving error "Access Denied". Please Help
Thanks

DWORD
Ret=WNetAddConnection2(&NetResource,"123","administrator",CONNECT_INTERACTIV
E);
//ok
SERVICE_STATUS ServiceStatus;
SC_HANDLE
hScm=OpenSCManager(NetResource.lpRemoteName,SERVICES_ACTIVE_DATABASE,SC_MANA
GER_ALL_ACCESS);
//ok
SC_HANDLE hService=OpenService(hScm,"clipsrv",SC_MANAGER_ALL_ACCESS);
//ok
Ret=ControlService(hService,SERVICE_CONTROL_CONTINUE,&ServiceStatus);
//failed