External SIGSEGV Exception
Original Reporter info from Mantis: laz_d
-
Reporter name:
Original Reporter info from Mantis: laz_d
- Reporter name:
Description:
If ServiceName is like 'somename' there will be no External SIGSEGV Exception.
If ServiceName is like 'somename' + #0, there will be External SIGSEGV Exception.
If ServiceName is like 'somename' + #0 + #0, there will be no External SIGSEGV Exception.
....
Im running Lazarus 0.9.30.1 win32 on Win7 x64.
Steps to reproduce:
procedure StartOrStopService(var ServiceName: WideString; Start:Boolean);
var
SvcStatus : TServiceStatus;
SCMHandle : SC_HANDLE;
QryResult : THandle;
Access : DWORD;
SvcArg : PWideChar;
begin
SCMHandle:=0;
QryResult:=0;
SvcArg:=nil;
try
try
begin
try
SCMHandle:= OpenSCManagerW(nil, nil, SC_MANAGER_ALL_ACCESS);
if SCMHandle=0 then Exit;
if Start then Access:=SERVICE_START or SERVICE_PAUSE_CONTINUE else Access:=SERVICE_STOP;
QryResult:= OpenServiceW(SCMHandle, @ServiceName[1],Access);
if QryResult=0 then Exit;
if Start then
begin
StartServiceW(QryResult,0,SvcArg);
ControlService(QryResult, SERVICE_CONTROL_CONTINUE, SvcStatus);
end
else ControlService(QryResult, SERVICE_CONTROL_STOP, SvcStatus);
except
end;
end;
except
end;
finally
try
if QryResult>0 then CloseServiceHandle(QryResult);
except
end;
try
if SCMHandle>0 then CloseServiceHandle(SCMHandle);
except
end;
end;
end;
Mantis conversion info:
- Mantis ID: 19527
- OS: Windows
- OS Build: 7
- Platform: x64
- Version: 2.4.3