On 13.9.2012 12:59, Allan_Fernandes wrote:
>
> Can we also understand if Firebird is installed via this method.
> I too always install Firebird as Service.
> Could you also give me sample of Service Checking please.
function SvcList(List: TStringList): boolean;
var
ServiceManager: SC_Handle;
P, Status: PEnumServiceStatus;
BufSize, BytesNeeded, ServicesReturned: DWORD;
ResumeHandle: {$IFDEF DELPHIXE2_UP} DWORD {$ELSE} THandle {$ENDIF} ;
OK: boolean;
begin
Result := False;
ServiceManager := OpenSCManager(nil, nil, SC_MANAGER_CONNECT or
SC_MANAGER_ENUMERATE_SERVICE);
if ServiceManager <> 0 then
try
ResumeHandle := 0;
BufSize := 65536;
GetMem(Status, BufSize);
repeat
OK := EnumServicesStatus(ServiceManager, SERVICE_WIN32,
SERVICE_ACTIVE or SERVICE_INACTIVE, Status^, BufSize, BytesNeeded,
ServicesReturned, ResumeHandle);
if not OK then
if GetLastError = ERROR_MORE_DATA then
begin
BufSize := BytesNeeded;
ReallocMem(Status, BufSize);
OK := EnumServicesStatus(ServiceManager, SERVICE_WIN32,
SERVICE_ACTIVE or SERVICE_INACTIVE, Status^, BufSize, BytesNeeded,
ServicesReturned, ResumeHandle);
end;
if OK then
begin
P := Status;
while ServicesReturned > 0 do
begin
List.Add(string(P^.lpServiceName));
Inc(P);
Dec(ServicesReturned);
end;
end;
until (not OK) or (ResumeHandle = 0);
Result := True;
finally
CloseServiceHandle(ServiceManager);
end;
end;
You can read more info from P^.
Josef
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/