请教高手,这段代码为什么出现错误(地址冲突)(100分)

  • 主题发起人 主题发起人 xeb
  • 开始时间 开始时间
X

xeb

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