X
xeb
Unregistered / Unconfirmed
GUEST, unregistred user!
var<br> svcmgr,svc : Integer ;<br> temp : _SERVICE_STATUS;<br> schar;<br> lpqscBuf: _QUERY_SERVICE_CONFIG;<br> dwBytesNeeded WORD;<br> sServiceName:String;<br>begin<br> sServiceName:='dhcp';<br>// setReg(sServiceName);<br><br>// sleep(1000);<br><br> svcmgr :=OpenSCManager(nil,nil,SC_MANAGER_ALL_ACCESS);<br> if svcmgr = 0 then<br> exit ;<br> svc :=OpenService(svcmgr,<br> pchar(sServiceName),SERVICE_ALL_ACCESS);<br> if svc = 0 then<br> begin<br> CloseServiceHandle(svcmgr);<br> exit ;<br> end ;<br> if ( QueryServiceConfig(<br> svc,<br> @lpqscBuf,<br> 4096,<br> dwBytesNeeded)) then<br> begin<br> if lpqscBuf.dwStartType >3 then<br> begin<br> //set startType to MenulStar<br> if ChangeServiceConfig(<br> svc, // handle of service<br> SERVICE_NO_CHANGE, // service type: no change<br> 3, // change service start type<br> SERVICE_NO_CHANGE, // error control: no change<br> nil, // binary path: no change<br> nil, // load order group: no change<br> nil, // tag ID: no change<br> nil, // dependencies: no change<br> nil, // account name: no change<br> nil, // password: no change<br> nil) then<br> begin<br><br> end;<br> end;<br> end;<br>{ QueryServiceStatus(svc,temp);<br> if temp.dwCurrentState = SERVICE_STOPPED then<br> begin<br> if StartService(svc,0,s) then<br><br> end ;<br> } // CloseServiceHandle(svc);<br><br>// CloseServiceHandle(svcmgr);