-
Notifications
You must be signed in to change notification settings - Fork 0
/
ockunique.pas
47 lines (39 loc) · 1022 Bytes
/
ockunique.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
unit OckUnique;
{$mode delphi}
interface
uses
Classes, SysUtils,
{$IFDEF WIN32}
Windows,
DSiWin32,
// JwaWinnt,
// jwawinbase,
JwaWindows,
{$ENDIF WIN32}
oslog,
osprocesses;
function CheckUnique(out InfoMessage:string):boolean;
implementation
function CheckUnique(out InfoMessage: string): boolean;
begin
{ is opsiclientd running? }
if numberOfProcessInstances('opsiclientd') < 1 then
begin
LogDatei.log('opsiclientd is not running - so we abort', LLCritical);
LogDatei.Close;
LogDatei.Free;
InfoMessage := 'opsiclientd is not running - so we abort';
Result := False;
end
else
{ is opsiclientkiosk already running? }
if numberOfProcessInstances(ExtractFileName(ParamStr(0))) > 1 then
begin
LogDatei.log('An other instance of this program is running - so we abort', LLCritical);
LogDatei.Close;
LogDatei.Free;
InfoMessage := 'An other instance of this program is running - so we abort';
Result := False;
end;
end;
end.