Subject inno setup
Author Robert F. Tulloch
Hi:

Working on inno setup script for IB. I am very concerned that these
identities
are very different with FB. I assume that if I switch to FB I will
have to redo this all.
There is no guardian with FB??

//Functions
function InitializeSetup(): Boolean;
begin
if ((FindWindowA('IB_Server', 'InterBase Server') > 0) or
(FindWindowA('IB_Guard', 'InterBase Guardian') > 0)) then
begin
MsgBox('The Interbase Server is already running. It ' +
'must be shut down and uninstalled before ' +
'proceeding with a new installation', mbError,MB_OK);
Result := False;
Exit;
end
else
Result := True;
end;

function InstallService(Default : String): String;
var
hWnd : integer;
hSCManager, hService : SC_HANDLE;
Success, ErrorCode : Integer;
DirName, GuardPathName, ServerPathName : String;
Tag : Integer;
ArgVec : String;

begin
DirName := ChangeDirConst('{pf}');
GuardPathName := DirName + '\Borland\Interbase\bin\ibguard.exe
-s';
ServerPathName := DirName +
'\Borland\Interbase\bin\ibservice.exe -s -g';
Tag := 0;
ArgVec := '';
hWnd := StrToInt(ChangeDirConst('{wizardhwnd}'), 0);
hSCManager := OpenSCManagerA('', '', SC_MANAGER_ALL_ACCESS);
if hscManager<>0 then
begin
hService := CreateServiceA(hSCManager,
'InterBaseGuardian',
'InterBase Guardian',
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS or
SERVICE_INTERACTIVE_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL,
GuardPathName,
'',
Tag,
'',
'',
'');
if (not hService > 0) then
begin
MsgBox('The setup process failed to create the IB
Guardian Service. ' + SysErrorMessage(GetLastError()), mbError,MB_OK);
CloseServiceHandle(hSCManager);
Result := 'F';
Exit;
end
else
begin
CloseServiceHandle(hService);
hService := CreateServiceA(hSCManager,
'InterBaseServer',
'InterBase Server',
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS or
SERVICE_INTERACTIVE_PROCESS,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
ServerPathName,
'',
Tag,
'',
'',
'');
if (not hService > 0) then
begin
MsgBox('The setup process failed to create the IB
Server Service. ' + SysErrorMessage(GetLastError()), mbError,MB_OK);
CloseServiceHandle(hSCManager);
Result := 'F';
Exit;
end
else
begin
CloseServiceHandle(hService);
//Break in here
hService := OpenServiceA(hSCManager,
'InterBaseGuardian',
SERVICE_START);
if (not hService > 0) then
begin
MsgBox('The setup process failed to open the IB
Guardian Service. ' + SysErrorMessage(GetLastError()), mbError,MB_OK);
CloseServiceHandle(hSCManager);
Result := 'F';
Exit;
end
else
begin
if (NOT StartServiceA(hService, 0, ArgVec)) then
begin
MsgBox('The setup process failed to start the
IB Guardian Service. ' + SysErrorMessage(GetLastError()),
mbError,MB_OK);
CloseServiceHandle(hService);
CloseServiceHandle(hSCManager);
Result := 'F';
Exit;
end
else
MessageBox(hWnd, 'The setup process started the
IB Guardian Service.', 'MessageBoxA', MB_OK or MB_ICONINFORMATION)
end;
//Break out here
end;
end;
end
else
begin
MsgBox('The setup process failed to attach to the Service
Manager. ' + SysErrorMessage(GetLastError()), mbError,MB_OK);
Result := 'F';
Exit;
end;
Result := 'T';
end;