createservice 安装服务后 无法启动,哪位大侠不吝赐教(100分)

  • 主题发起人 主题发起人 kiths
  • 开始时间 开始时间
K

kiths

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TSupervise.MyInstallService;
var Svc,error_code: Integer;
hSCM: SC_HANDLE;
sFileName:String;
begin
sFileName:=ParamStr(0);
hSCM:= OpenSCManager(nil, nil, SC_MANAGER_CREATE_SERVICE);
if hSCM=0 then exit;
Svc := CreateService(hSCM,
'Test',
'Test',
SERVICE_ALL_ACCESS,
$00000110,
SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL,
PChar(sFileName),
nil,
nil,
nil,
nil,
nil);
if Svc = 0 then
RaiseLastOSError;
CloseServiceHandle(Svc);
CloseServiceHandle(hSCM);
 
帮帮忙拉
 
求求你们拉
 
hSCM,hSCS:SC_HANDLE;
hSCM:=nil;
hSCS:=nil;
hSCM=OpenSCManager(nil,nil,SC_MANAGER_ALL_ACCESS);
hSCS=CreateService(hSCM,'test','test',SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,SERVICE_AUTO_START,SERVICE_ERROR_IGNORE,FileName,
nil,nil,nil,nil,nil);
 
接受答案了.
 
后退
顶部