D
dcsdcs
Unregistered / Unconfirmed
GUEST, unregistred user!
怎样利用程序停止TermService服务(用ControlService停不掉)
欢迎大家探讨
我的程序可以停大部分的。
var
tmpsmg,tmpsvc:integer;
st:TServiceStatus;
pCHAR;
begin
tmpsmg:=OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
tmpsvc:=OpenService(tmpsmg, PChar(servicename), SERVICE_ALL_ACCESS);
ControlService(tmpsvc,1,st);
repeat
Sleep(50);
until (QueryServiceStatus(tmpsvc,st) and
(WaitFor[controltype]=st.dwCurrentState));
CloseServiceHandle(tmpsvc);
CloseServiceHandle(tmpsmg);
end;
欢迎大家探讨
我的程序可以停大部分的。
var
tmpsmg,tmpsvc:integer;
st:TServiceStatus;
pCHAR;
begin
tmpsmg:=OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
tmpsvc:=OpenService(tmpsmg, PChar(servicename), SERVICE_ALL_ACCESS);
ControlService(tmpsvc,1,st);
repeat
Sleep(50);
until (QueryServiceStatus(tmpsvc,st) and
(WaitFor[controltype]=st.dwCurrentState));
CloseServiceHandle(tmpsvc);
CloseServiceHandle(tmpsmg);
end;