-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeTmSv95.dpr
57 lines (49 loc) · 1.54 KB
/
NeTmSv95.dpr
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
48
49
50
51
52
53
54
55
56
57
program NeTmSv95;
uses
Windows,
SysUtils,
IsWinNt,
Dialogs,
NetTimeThread in 'NetTimeThread.pas',
ConfigObj in 'ConfigObj.pas',
Svc95Main in 'Svc95Main.pas',
mutex in 'mutex.pas',
NetTimeCommon in 'NetTimeCommon.pas';
{$R *.RES}
type
TRegSvcFunc = function(dwProcessID, dwType: DWord) : DWord; stdcall;
var
RegisterServiceProcess: TRegSvcFunc;
procedure MapRSPFunc;
var
lib: THandle;
begin
lib := LoadLibrary('kernel32.dll'); // if this fails, we're done for
if lib = 0 then
raise exception.create('Cannot load kernel32.dll!!! Man the lifeboats');
RegisterServiceProcess := GetProcAddress(lib,'RegisterServiceProcess');
if @RegisterServiceProcess = nil then
raise exception.create('Cannot map RegisterServiceProcess from kernel32.dll - are you sure this is Windows 95/98/ME?');
end;
begin
if not GetExclusivity(ExNameServer) then
begin
ShowMessage('Cannot load NetTime server: Another server is already running');
exit;
end;
if IsWindowsNT then
begin
if MessageDlg('This program is intended as a Windows 95/98 service. On '+
'Windows NT or 2000, you should install the NT service instead. '+
'Running this should not cause any problems, but it will run as an '+
'application, not a service. Do you want to run this program anyway?',
mtWarning,[mbYes,mbNo],0) = idNo then
abort;
end
else if not ((ParamCount = 1) and (uppercase(ParamStr(1)) = '/NOSERVICE')) then
begin
MapRSPFunc;
RegisterServiceProcess(0,1);
end;
ServiceMain;
end.