1
{******************************************************************************}
3
{ Lan Manager Service API interface Unit for Object Pascal }
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
6
{ Corporation. All Rights Reserved. }
8
{ The original file is: lmsvc.h, released November 2001. The original Pascal }
9
{ code is: LmSvc.pas, released Februari 2002. The initial developer of the }
10
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
13
{ Marcel van Brakel. All Rights Reserved. }
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
17
{ You may retrieve the latest version of this file at the Project JEDI }
18
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
20
{ The contents of this file are used with permission, subject to the Mozilla }
21
{ Public License Version 1.1 (the "License"); you may not use this file except }
22
{ in compliance with the License. You may obtain a copy of the License at }
23
{ http://www.mozilla.org/MPL/MPL-1.1.html }
25
{ Software distributed under the License is distributed on an "AS IS" basis, }
26
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
27
{ the specific language governing rights and limitations under the License. }
29
{ Alternatively, the contents of this file may be used under the terms of the }
30
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
31
{ provisions of the LGPL License are applicable instead of those above. }
32
{ If you wish to allow use of your version of this file only under the terms }
33
{ of the LGPL License and not to allow others to use your version of this file }
34
{ under the MPL, indicate your decision by deleting the provisions above and }
35
{ replace them with the notice and other provisions required by the LGPL }
36
{ License. If you do not delete the provisions above, a recipient may use }
37
{ your version of this file under either the MPL or the LGPL License. }
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
41
{******************************************************************************}
43
// $Id: jwalmsvc.pas,v 1.1 2005/04/04 07:56:10 marco Exp $
50
{$HPPEMIT '#include "lmsvc.h"'}
58
JwaLmCons, JwaWinType;
65
LPSERVICE_INFO_0 = ^SERVICE_INFO_0;
66
{$EXTERNALSYM LPSERVICE_INFO_0}
67
PSERVICE_INFO_0 = ^SERVICE_INFO_0;
68
{$EXTERNALSYM PSERVICE_INFO_0}
69
_SERVICE_INFO_0 = record
72
{$EXTERNALSYM _SERVICE_INFO_0}
73
SERVICE_INFO_0 = _SERVICE_INFO_0;
74
{$EXTERNALSYM SERVICE_INFO_0}
75
TServiceInfo0 = SERVICE_INFO_0;
76
PServiceInfo0 = PSERVICE_INFO_0;
78
LPSERVICE_INFO_1 = ^SERVICE_INFO_1;
79
{$EXTERNALSYM LPSERVICE_INFO_1}
80
PSERVICE_INFO_1 = ^SERVICE_INFO_1;
81
{$EXTERNALSYM PSERVICE_INFO_1}
82
_SERVICE_INFO_1 = record
88
{$EXTERNALSYM _SERVICE_INFO_1}
89
SERVICE_INFO_1 = _SERVICE_INFO_1;
90
{$EXTERNALSYM SERVICE_INFO_1}
91
TServiceInfo1 = SERVICE_INFO_1;
92
PServiceInfo1 = PSERVICE_INFO_1;
94
LPSERVICE_INFO_2 = ^SERVICE_INFO_2;
95
{$EXTERNALSYM LPSERVICE_INFO_2}
96
PSERVICE_INFO_2 = ^SERVICE_INFO_2;
97
{$EXTERNALSYM PSERVICE_INFO_2}
98
_SERVICE_INFO_2 = record
104
svci2_specific_error: DWORD;
105
svci2_display_name: LPWSTR;
107
{$EXTERNALSYM _SERVICE_INFO_2}
108
SERVICE_INFO_2 = _SERVICE_INFO_2;
109
{$EXTERNALSYM SERVICE_INFO_2}
110
TServiceInfo2 = SERVICE_INFO_2;
111
PServiceInfo2 = PSERVICE_INFO_2;
114
// Function Prototypes
117
function NetServiceControl(servername, service: LPCWSTR; opcode: DWORD; arg: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
118
{$EXTERNALSYM NetServiceControl}
120
function NetServiceEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
121
{$EXTERNALSYM NetServiceEnum}
123
function NetServiceGetInfo(servername, service: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
124
{$EXTERNALSYM NetServiceGetInfo}
126
function NetServiceInstall(servername, service: LPCWSTR; argc: DWORD; argv: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
127
{$EXTERNALSYM NetServiceInstall}
130
// Special Values and Constants
134
// Bitmask and bit values for svci1_status, and svci2_status
135
// fields. For each "subfield", there is a mask defined,
136
// and a number of constants representing the value
137
// obtained by doing (status & mask).
140
// Bits 0,1 -- general status
143
SERVICE_INSTALL_STATE = $03;
144
{$EXTERNALSYM SERVICE_INSTALL_STATE}
145
SERVICE_UNINSTALLED = $00;
146
{$EXTERNALSYM SERVICE_UNINSTALLED}
147
SERVICE_INSTALL_PENDING = $01;
148
{$EXTERNALSYM SERVICE_INSTALL_PENDING}
149
SERVICE_UNINSTALL_PENDING = $02;
150
{$EXTERNALSYM SERVICE_UNINSTALL_PENDING}
151
SERVICE_INSTALLED = $03;
152
{$EXTERNALSYM SERVICE_INSTALLED}
154
// Bits 2,3 -- paused/active status
156
SERVICE_PAUSE_STATE = $0C;
157
{$EXTERNALSYM SERVICE_PAUSE_STATE}
158
LM20_SERVICE_ACTIVE = $00;
159
{$EXTERNALSYM LM20_SERVICE_ACTIVE}
160
LM20_SERVICE_CONTINUE_PENDING = $04;
161
{$EXTERNALSYM LM20_SERVICE_CONTINUE_PENDING}
162
LM20_SERVICE_PAUSE_PENDING = $08;
163
{$EXTERNALSYM LM20_SERVICE_PAUSE_PENDING}
164
LM20_SERVICE_PAUSED = $0C;
165
{$EXTERNALSYM LM20_SERVICE_PAUSED}
167
// Bit 4 -- uninstallable indication
169
SERVICE_NOT_UNINSTALLABLE = $00;
170
{$EXTERNALSYM SERVICE_NOT_UNINSTALLABLE}
171
SERVICE_UNINSTALLABLE = $10;
172
{$EXTERNALSYM SERVICE_UNINSTALLABLE}
174
// Bit 5 -- pausable indication
176
SERVICE_NOT_PAUSABLE = $00;
177
{$EXTERNALSYM SERVICE_NOT_PAUSABLE}
178
SERVICE_PAUSABLE = $20;
179
{$EXTERNALSYM SERVICE_PAUSABLE}
181
// Workstation service only:
182
// Bits 8,9,10 -- redirection paused/active
184
SERVICE_REDIR_PAUSED = $700;
185
{$EXTERNALSYM SERVICE_REDIR_PAUSED}
186
SERVICE_REDIR_DISK_PAUSED = $100;
187
{$EXTERNALSYM SERVICE_REDIR_DISK_PAUSED}
188
SERVICE_REDIR_PRINT_PAUSED = $200;
189
{$EXTERNALSYM SERVICE_REDIR_PRINT_PAUSED}
190
SERVICE_REDIR_COMM_PAUSED = $400;
191
{$EXTERNALSYM SERVICE_REDIR_COMM_PAUSED}
194
// Additional standard LAN Manager for MS-DOS services
197
SERVICE_DOS_ENCRYPTION = WideString('ENCRYPT');
198
{$EXTERNALSYM SERVICE_DOS_ENCRYPTION}
201
// NetServiceControl opcodes.
204
SERVICE_CTRL_INTERROGATE = 0;
205
{$EXTERNALSYM SERVICE_CTRL_INTERROGATE}
206
SERVICE_CTRL_PAUSE = 1;
207
{$EXTERNALSYM SERVICE_CTRL_PAUSE}
208
SERVICE_CTRL_CONTINUE = 2;
209
{$EXTERNALSYM SERVICE_CTRL_CONTINUE}
210
SERVICE_CTRL_UNINSTALL = 3;
211
{$EXTERNALSYM SERVICE_CTRL_UNINSTALL}
214
// Workstation service only: Bits used in the "arg" parameter
215
// to NetServiceControl in conjunction with the opcode
216
// SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
217
// continue redirection.
220
SERVICE_CTRL_REDIR_DISK = $1;
221
{$EXTERNALSYM SERVICE_CTRL_REDIR_DISK}
222
SERVICE_CTRL_REDIR_PRINT = $2;
223
{$EXTERNALSYM SERVICE_CTRL_REDIR_PRINT}
224
SERVICE_CTRL_REDIR_COMM = $4;
225
{$EXTERNALSYM SERVICE_CTRL_REDIR_COMM}
228
// Values for svci1_code, and svci2_code when status
229
// of the service is SERVICE_INSTALL_PENDING or
230
// SERVICE_UNINSTALL_PENDING.
231
// A service can optionally provide a hint to the installer
232
// that the install is proceeding and how long to wait
233
// (in 0.1 second increments) before querying status again.
236
SERVICE_IP_NO_HINT = $0;
237
{$EXTERNALSYM SERVICE_IP_NO_HINT}
238
SERVICE_CCP_NO_HINT = $0;
239
{$EXTERNALSYM SERVICE_CCP_NO_HINT}
241
SERVICE_IP_QUERY_HINT = $10000;
242
{$EXTERNALSYM SERVICE_IP_QUERY_HINT}
243
SERVICE_CCP_QUERY_HINT = $10000;
244
{$EXTERNALSYM SERVICE_CCP_QUERY_HINT}
247
// Mask for install proceeding checkpoint number
250
SERVICE_IP_CHKPT_NUM = $0FF;
251
{$EXTERNALSYM SERVICE_IP_CHKPT_NUM}
252
SERVICE_CCP_CHKPT_NUM = $0FF;
253
{$EXTERNALSYM SERVICE_CCP_CHKPT_NUM}
256
// Mask for wait time hint before querying again
259
SERVICE_IP_WAIT_TIME = $0FF00;
260
{$EXTERNALSYM SERVICE_IP_WAIT_TIME}
261
SERVICE_CCP_WAIT_TIME = $0FF00;
262
{$EXTERNALSYM SERVICE_CCP_WAIT_TIME}
265
// Shift count for building wait time _code values
268
SERVICE_IP_WAITTIME_SHIFT = 8;
269
{$EXTERNALSYM SERVICE_IP_WAITTIME_SHIFT}
270
SERVICE_NTIP_WAITTIME_SHIFT = 12;
271
{$EXTERNALSYM SERVICE_NTIP_WAITTIME_SHIFT}
274
// Mask used for upper and lower portions of wait hint time.
277
UPPER_HINT_MASK = $0000FF00;
278
{$EXTERNALSYM UPPER_HINT_MASK}
279
LOWER_HINT_MASK = $000000FF;
280
{$EXTERNALSYM LOWER_HINT_MASK}
281
UPPER_GET_HINT_MASK = $0FF00000;
282
{$EXTERNALSYM UPPER_GET_HINT_MASK}
283
LOWER_GET_HINT_MASK = $0000FF00;
284
{$EXTERNALSYM LOWER_GET_HINT_MASK}
285
SERVICE_NT_MAXTIME = $0000FFFF;
286
{$EXTERNALSYM SERVICE_NT_MAXTIME}
287
SERVICE_RESRV_MASK = $0001FFFF;
288
{$EXTERNALSYM SERVICE_RESRV_MASK}
289
SERVICE_MAXTIME = $000000FF;
290
{$EXTERNALSYM SERVICE_MAXTIME}
293
// SERVICE_BASE is the base of service error codes,
294
// chosen to avoid conflict with OS, redirector,
295
// netapi, and errlog codes.
297
// Don't change the comments following the manifest constants without
298
// understanding how mapmsg works.
302
{$EXTERNALSYM SERVICE_BASE}
303
SERVICE_UIC_NORMAL = 0;
304
{$EXTERNALSYM SERVICE_UIC_NORMAL}
307
* Uninstall codes, to be used in high byte of 'code' on final NetStatus,
308
* which sets the status to UNINSTALLED.
311
SERVICE_UIC_BADPARMVAL = SERVICE_BASE + 1;
312
{$EXTERNALSYM SERVICE_UIC_BADPARMVAL}
315
* The Registry or the information you just typed includes an illegal
319
SERVICE_UIC_MISSPARM = SERVICE_BASE + 2;
320
{$EXTERNALSYM SERVICE_UIC_MISSPARM}
323
* The required parameter was not provided on the command
324
* line or in the configuration file.
327
SERVICE_UIC_UNKPARM = SERVICE_BASE + 3;
328
{$EXTERNALSYM SERVICE_UIC_UNKPARM}
331
* LAN Manager does not recognize "%1" as a valid option.
334
SERVICE_UIC_RESOURCE = SERVICE_BASE + 4;
335
{$EXTERNALSYM SERVICE_UIC_RESOURCE}
338
* A request for resource could not be satisfied.
341
SERVICE_UIC_CONFIG = SERVICE_BASE + 5;
342
{$EXTERNALSYM SERVICE_UIC_CONFIG}
345
* A problem exists with the system configuration.
348
SERVICE_UIC_SYSTEM = SERVICE_BASE + 6;
349
{$EXTERNALSYM SERVICE_UIC_SYSTEM}
352
* A system error has occurred.
355
SERVICE_UIC_INTERNAL = SERVICE_BASE + 7;
356
{$EXTERNALSYM SERVICE_UIC_INTERNAL}
359
* An internal consistency error has occurred.
362
SERVICE_UIC_AMBIGPARM = SERVICE_BASE + 8;
363
{$EXTERNALSYM SERVICE_UIC_AMBIGPARM}
366
* The configuration file or the command line has an ambiguous option.
369
SERVICE_UIC_DUPPARM = SERVICE_BASE + 9;
370
{$EXTERNALSYM SERVICE_UIC_DUPPARM}
373
* The configuration file or the command line has a duplicate parameter.
376
SERVICE_UIC_KILL = SERVICE_BASE + 10;
377
{$EXTERNALSYM SERVICE_UIC_KILL}
380
* The service did not respond to control and was stopped with
381
* the DosKillProc function.
384
SERVICE_UIC_EXEC = SERVICE_BASE + 11;
385
{$EXTERNALSYM SERVICE_UIC_EXEC}
388
* An error occurred when attempting to run the service program.
391
SERVICE_UIC_SUBSERV = SERVICE_BASE + 12;
392
{$EXTERNALSYM SERVICE_UIC_SUBSERV}
395
* The sub-service failed to start.
398
SERVICE_UIC_CONFLPARM = SERVICE_BASE + 13;
399
{$EXTERNALSYM SERVICE_UIC_CONFLPARM}
402
* There is a conflict in the value or use of these options: %1.
405
SERVICE_UIC_FILE = SERVICE_BASE + 14;
406
{$EXTERNALSYM SERVICE_UIC_FILE}
409
* There is a problem with the file.
420
SERVICE_UIC_M_NULL = 0;
421
{$EXTERNALSYM SERVICE_UIC_M_NULL}
427
SERVICE_UIC_M_MEMORY = SERVICE_BASE + 20; // memory
428
{$EXTERNALSYM SERVICE_UIC_M_MEMORY}
429
SERVICE_UIC_M_DISK = SERVICE_BASE + 21; // disk space
430
{$EXTERNALSYM SERVICE_UIC_M_DISK}
431
SERVICE_UIC_M_THREADS = SERVICE_BASE + 22; // thread
432
{$EXTERNALSYM SERVICE_UIC_M_THREADS}
433
SERVICE_UIC_M_PROCESSES = SERVICE_BASE + 23; // process
434
{$EXTERNALSYM SERVICE_UIC_M_PROCESSES}
444
SERVICE_UIC_M_SECURITY = SERVICE_BASE + 24;
445
{$EXTERNALSYM SERVICE_UIC_M_SECURITY}
447
{* Security Failure. %0 *}
449
SERVICE_UIC_M_LANROOT = SERVICE_BASE + 25;
450
{$EXTERNALSYM SERVICE_UIC_M_LANROOT}
453
* Bad or missing LAN Manager root directory.
456
SERVICE_UIC_M_REDIR = SERVICE_BASE + 26;
457
{$EXTERNALSYM SERVICE_UIC_M_REDIR}
460
* The network software is not installed.
463
SERVICE_UIC_M_SERVER = SERVICE_BASE + 27;
464
{$EXTERNALSYM SERVICE_UIC_M_SERVER}
467
* The server is not started.
470
SERVICE_UIC_M_SEC_FILE_ERR = SERVICE_BASE + 28;
471
{$EXTERNALSYM SERVICE_UIC_M_SEC_FILE_ERR}
474
* The server cannot access the user accounts database (NET.ACC).
477
SERVICE_UIC_M_FILES = SERVICE_BASE + 29;
478
{$EXTERNALSYM SERVICE_UIC_M_FILES}
481
* Incompatible files are installed in the LANMAN tree.
484
SERVICE_UIC_M_LOGS = SERVICE_BASE + 30;
485
{$EXTERNALSYM SERVICE_UIC_M_LOGS}
488
* The LANMAN\LOGS directory is invalid.
491
SERVICE_UIC_M_LANGROUP = SERVICE_BASE + 31;
492
{$EXTERNALSYM SERVICE_UIC_M_LANGROUP}
495
* The domain specified could not be used.
498
SERVICE_UIC_M_MSGNAME = SERVICE_BASE + 32;
499
{$EXTERNALSYM SERVICE_UIC_M_MSGNAME}
502
* The computer name is being used as a message alias on another computer.
505
SERVICE_UIC_M_ANNOUNCE = SERVICE_BASE + 33;
506
{$EXTERNALSYM SERVICE_UIC_M_ANNOUNCE}
509
* The announcement of the server name failed.
512
SERVICE_UIC_M_UAS = SERVICE_BASE + 34;
513
{$EXTERNALSYM SERVICE_UIC_M_UAS}
516
* The user accounts database is not configured correctly.
519
SERVICE_UIC_M_SERVER_SEC_ERR = SERVICE_BASE + 35;
520
{$EXTERNALSYM SERVICE_UIC_M_SERVER_SEC_ERR}
523
* The server is not running with user-level security.
526
SERVICE_UIC_M_WKSTA = SERVICE_BASE + 37;
527
{$EXTERNALSYM SERVICE_UIC_M_WKSTA}
530
* The workstation is not configured properly.
533
SERVICE_UIC_M_ERRLOG = SERVICE_BASE + 38;
534
{$EXTERNALSYM SERVICE_UIC_M_ERRLOG}
537
* View your error log for details.
540
SERVICE_UIC_M_FILE_UW = SERVICE_BASE + 39;
541
{$EXTERNALSYM SERVICE_UIC_M_FILE_UW}
544
* Unable to write to this file.
547
SERVICE_UIC_M_ADDPAK = SERVICE_BASE + 40;
548
{$EXTERNALSYM SERVICE_UIC_M_ADDPAK}
551
* ADDPAK file is corrupted. Delete LANMAN\NETPROG\ADDPAK.SER
552
* and reapply all ADDPAKs.
555
SERVICE_UIC_M_LAZY = SERVICE_BASE + 41;
556
{$EXTERNALSYM SERVICE_UIC_M_LAZY}
559
* The LM386 server cannot be started because CACHE.EXE is not running.
562
SERVICE_UIC_M_UAS_MACHINE_ACCT = SERVICE_BASE + 42;
563
{$EXTERNALSYM SERVICE_UIC_M_UAS_MACHINE_ACCT}
566
* There is no account for this computer in the security database.
569
SERVICE_UIC_M_UAS_SERVERS_NMEMB = SERVICE_BASE + 43;
570
{$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NMEMB}
573
* This computer is not a member of the group SERVERS.
576
SERVICE_UIC_M_UAS_SERVERS_NOGRP = SERVICE_BASE + 44;
577
{$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NOGRP}
580
* The group SERVERS is not present in the local security database.
583
SERVICE_UIC_M_UAS_INVALID_ROLE = SERVICE_BASE + 45;
584
{$EXTERNALSYM SERVICE_UIC_M_UAS_INVALID_ROLE}
587
* This computer is configured as a member of a workgroup, not as
588
* a member of a domain. The Netlogon service does not need to run in this
592
SERVICE_UIC_M_NETLOGON_NO_DC = SERVICE_BASE + 46;
593
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_NO_DC}
596
* The primary Domain Controller for this domain could not be located.
599
SERVICE_UIC_M_NETLOGON_DC_CFLCT = SERVICE_BASE + 47;
600
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_DC_CFLCT}
603
* This computer is configured to be the primary domain controller of its domain.
604
* However, the computer %1 is currently claiming to be the primary domain controller
608
SERVICE_UIC_M_NETLOGON_AUTH = SERVICE_BASE + 48;
609
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_AUTH}
612
* The service failed to authenticate with the primary domain controller.
615
SERVICE_UIC_M_UAS_PROLOG = SERVICE_BASE + 49;
616
{$EXTERNALSYM SERVICE_UIC_M_UAS_PROLOG}
619
* There is a problem with the security database creation date or serial number.
622
SERVICE2_BASE = 5600;
623
{$EXTERNALSYM SERVICE2_BASE}
625
{* new SEVICE_UIC messages go here *}
627
SERVICE_UIC_M_NETLOGON_MPATH = SERVICE2_BASE + 0;
628
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_MPATH}
631
* Could not share the User or Script path.
634
SERVICE_UIC_M_LSA_MACHINE_ACCT = SERVICE2_BASE + 1;
635
{$EXTERNALSYM SERVICE_UIC_M_LSA_MACHINE_ACCT}
638
* The password for this computer is not found in the local security
642
SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE + 2;
643
{$EXTERNALSYM SERVICE_UIC_M_DATABASE_ERROR}
646
* An internal error occurred while accessing the computer's
647
* local or network security database.
655
// Commonly used Macros:
658
function SERVICE_IP_CODE(tt, nn: LONG): LONG;
659
{$EXTERNALSYM SERVICE_IP_CODE}
661
function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
662
{$EXTERNALSYM SERVICE_CCP_CODE}
664
function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
665
{$EXTERNALSYM SERVICE_UIC_CODE}
668
// This macro takes a wait hint (tt) which can have a maximum value of
669
// 0xFFFF and puts it into the service status code field.
670
// 0x0FF1FFnn (where nn is the checkpoint information).
673
function SERVICE_NT_CCP_CODE(tt, nn: LONG): LONG;
674
{$EXTERNALSYM SERVICE_NT_CCP_CODE}
677
// This macro takes a status code field, and strips out the wait hint
678
// from the upper and lower sections.
679
// 0x0FF1FFnn results in 0x0000FFFF.
682
function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
683
{$EXTERNALSYM SERVICE_NT_WAIT_GET}
687
// #define SERVICE_IP_CODE(tt,nn) ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
689
function SERVICE_IP_CODE(tt, nn: LONG): LONG;
691
Result := SERVICE_IP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
694
// #define SERVICE_CCP_CODE(tt,nn) ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
696
function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
698
Result := SERVICE_CCP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
701
// #define SERVICE_UIC_CODE(cc,mm) ((long)(((long)cc<<16)|(long)(unsigned short)mm))
703
function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
705
Result := (cc shl 16) or WORD(mm);
708
// #define SERVICE_NT_CCP_CODE(tt,nn) \
710
// ((long)SERVICE_CCP_QUERY_HINT) | \
712
// (((tt)&LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT) | \
713
// (((tt)&UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT) \
716
function SERVICE_NT_CCP_CODE(tt, nn: Longint): Longint;
718
Result := SERVICE_CCP_QUERY_HINT or nn or ((tt and LOWER_HINT_MASK) shl SERVICE_IP_WAITTIME_SHIFT) or ((tt and UPPER_HINT_MASK) shl SERVICE_NTIP_WAITTIME_SHIFT);
721
// #define SERVICE_NT_WAIT_GET(code) \
723
// (((code) & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT) | \
724
// (((code) & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT) \
727
function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
729
Result := ((code and UPPER_GET_HINT_MASK) shr SERVICE_NTIP_WAITTIME_SHIFT) or ((code and LOWER_GET_HINT_MASK) shr SERVICE_IP_WAITTIME_SHIFT);
732
{$IFDEF DYNAMIC_LINK}
735
_NetServiceControl: Pointer;
737
function NetServiceControl;
739
GetProcedureAddress(_NetServiceControl, netapi32, 'NetServiceControl');
743
JMP [_NetServiceControl]
748
_NetServiceEnum: Pointer;
750
function NetServiceEnum;
752
GetProcedureAddress(_NetServiceEnum, netapi32, 'NetServiceEnum');
756
JMP [_NetServiceEnum]
761
_NetServiceGetInfo: Pointer;
763
function NetServiceGetInfo;
765
GetProcedureAddress(_NetServiceGetInfo, netapi32, 'NetServiceGetInfo');
769
JMP [_NetServiceGetInfo]
774
_NetServiceInstall: Pointer;
776
function NetServiceInstall;
778
GetProcedureAddress(_NetServiceInstall, netapi32, 'NetServiceInstall');
782
JMP [_NetServiceInstall]
788
function NetServiceControl; external netapi32 name 'NetServiceControl';
789
function NetServiceEnum; external netapi32 name 'NetServiceEnum';
790
function NetServiceGetInfo; external netapi32 name 'NetServiceGetInfo';
791
function NetServiceInstall; external netapi32 name 'NetServiceInstall';
793
{$ENDIF DYNAMIC_LINK}
1
{******************************************************************************}
3
{ Lan Manager Service API interface Unit for Object Pascal }
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
6
{ Corporation. All Rights Reserved. }
8
{ The original file is: lmsvc.h, released November 2001. The original Pascal }
9
{ code is: LmSvc.pas, released Februari 2002. The initial developer of the }
10
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
13
{ Marcel van Brakel. All Rights Reserved. }
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
17
{ You may retrieve the latest version of this file at the Project JEDI }
18
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
20
{ The contents of this file are used with permission, subject to the Mozilla }
21
{ Public License Version 1.1 (the "License"); you may not use this file except }
22
{ in compliance with the License. You may obtain a copy of the License at }
23
{ http://www.mozilla.org/MPL/MPL-1.1.html }
25
{ Software distributed under the License is distributed on an "AS IS" basis, }
26
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
27
{ the specific language governing rights and limitations under the License. }
29
{ Alternatively, the contents of this file may be used under the terms of the }
30
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
31
{ provisions of the LGPL License are applicable instead of those above. }
32
{ If you wish to allow use of your version of this file only under the terms }
33
{ of the LGPL License and not to allow others to use your version of this file }
34
{ under the MPL, indicate your decision by deleting the provisions above and }
35
{ replace them with the notice and other provisions required by the LGPL }
36
{ License. If you do not delete the provisions above, a recipient may use }
37
{ your version of this file under either the MPL or the LGPL License. }
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
41
{******************************************************************************}
49
{$HPPEMIT '#include "lmsvc.h"'}
57
JwaLmCons, JwaWinType;
64
LPSERVICE_INFO_0 = ^SERVICE_INFO_0;
65
{$EXTERNALSYM LPSERVICE_INFO_0}
66
PSERVICE_INFO_0 = ^SERVICE_INFO_0;
67
{$EXTERNALSYM PSERVICE_INFO_0}
68
_SERVICE_INFO_0 = record
71
{$EXTERNALSYM _SERVICE_INFO_0}
72
SERVICE_INFO_0 = _SERVICE_INFO_0;
73
{$EXTERNALSYM SERVICE_INFO_0}
74
TServiceInfo0 = SERVICE_INFO_0;
75
PServiceInfo0 = PSERVICE_INFO_0;
77
LPSERVICE_INFO_1 = ^SERVICE_INFO_1;
78
{$EXTERNALSYM LPSERVICE_INFO_1}
79
PSERVICE_INFO_1 = ^SERVICE_INFO_1;
80
{$EXTERNALSYM PSERVICE_INFO_1}
81
_SERVICE_INFO_1 = record
87
{$EXTERNALSYM _SERVICE_INFO_1}
88
SERVICE_INFO_1 = _SERVICE_INFO_1;
89
{$EXTERNALSYM SERVICE_INFO_1}
90
TServiceInfo1 = SERVICE_INFO_1;
91
PServiceInfo1 = PSERVICE_INFO_1;
93
LPSERVICE_INFO_2 = ^SERVICE_INFO_2;
94
{$EXTERNALSYM LPSERVICE_INFO_2}
95
PSERVICE_INFO_2 = ^SERVICE_INFO_2;
96
{$EXTERNALSYM PSERVICE_INFO_2}
97
_SERVICE_INFO_2 = record
103
svci2_specific_error: DWORD;
104
svci2_display_name: LPWSTR;
106
{$EXTERNALSYM _SERVICE_INFO_2}
107
SERVICE_INFO_2 = _SERVICE_INFO_2;
108
{$EXTERNALSYM SERVICE_INFO_2}
109
TServiceInfo2 = SERVICE_INFO_2;
110
PServiceInfo2 = PSERVICE_INFO_2;
113
// Function Prototypes
116
function NetServiceControl(servername, service: LPCWSTR; opcode: DWORD; arg: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
117
{$EXTERNALSYM NetServiceControl}
119
function NetServiceEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
120
{$EXTERNALSYM NetServiceEnum}
122
function NetServiceGetInfo(servername, service: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
123
{$EXTERNALSYM NetServiceGetInfo}
125
function NetServiceInstall(servername, service: LPCWSTR; argc: DWORD; argv: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
126
{$EXTERNALSYM NetServiceInstall}
129
// Special Values and Constants
133
// Bitmask and bit values for svci1_status, and svci2_status
134
// fields. For each "subfield", there is a mask defined,
135
// and a number of constants representing the value
136
// obtained by doing (status & mask).
139
// Bits 0,1 -- general status
142
SERVICE_INSTALL_STATE = $03;
143
{$EXTERNALSYM SERVICE_INSTALL_STATE}
144
SERVICE_UNINSTALLED = $00;
145
{$EXTERNALSYM SERVICE_UNINSTALLED}
146
SERVICE_INSTALL_PENDING = $01;
147
{$EXTERNALSYM SERVICE_INSTALL_PENDING}
148
SERVICE_UNINSTALL_PENDING = $02;
149
{$EXTERNALSYM SERVICE_UNINSTALL_PENDING}
150
SERVICE_INSTALLED = $03;
151
{$EXTERNALSYM SERVICE_INSTALLED}
153
// Bits 2,3 -- paused/active status
155
SERVICE_PAUSE_STATE = $0C;
156
{$EXTERNALSYM SERVICE_PAUSE_STATE}
157
LM20_SERVICE_ACTIVE = $00;
158
{$EXTERNALSYM LM20_SERVICE_ACTIVE}
159
LM20_SERVICE_CONTINUE_PENDING = $04;
160
{$EXTERNALSYM LM20_SERVICE_CONTINUE_PENDING}
161
LM20_SERVICE_PAUSE_PENDING = $08;
162
{$EXTERNALSYM LM20_SERVICE_PAUSE_PENDING}
163
LM20_SERVICE_PAUSED = $0C;
164
{$EXTERNALSYM LM20_SERVICE_PAUSED}
166
// Bit 4 -- uninstallable indication
168
SERVICE_NOT_UNINSTALLABLE = $00;
169
{$EXTERNALSYM SERVICE_NOT_UNINSTALLABLE}
170
SERVICE_UNINSTALLABLE = $10;
171
{$EXTERNALSYM SERVICE_UNINSTALLABLE}
173
// Bit 5 -- pausable indication
175
SERVICE_NOT_PAUSABLE = $00;
176
{$EXTERNALSYM SERVICE_NOT_PAUSABLE}
177
SERVICE_PAUSABLE = $20;
178
{$EXTERNALSYM SERVICE_PAUSABLE}
180
// Workstation service only:
181
// Bits 8,9,10 -- redirection paused/active
183
SERVICE_REDIR_PAUSED = $700;
184
{$EXTERNALSYM SERVICE_REDIR_PAUSED}
185
SERVICE_REDIR_DISK_PAUSED = $100;
186
{$EXTERNALSYM SERVICE_REDIR_DISK_PAUSED}
187
SERVICE_REDIR_PRINT_PAUSED = $200;
188
{$EXTERNALSYM SERVICE_REDIR_PRINT_PAUSED}
189
SERVICE_REDIR_COMM_PAUSED = $400;
190
{$EXTERNALSYM SERVICE_REDIR_COMM_PAUSED}
193
// Additional standard LAN Manager for MS-DOS services
196
SERVICE_DOS_ENCRYPTION = WideString('ENCRYPT');
197
{$EXTERNALSYM SERVICE_DOS_ENCRYPTION}
200
// NetServiceControl opcodes.
203
SERVICE_CTRL_INTERROGATE = 0;
204
{$EXTERNALSYM SERVICE_CTRL_INTERROGATE}
205
SERVICE_CTRL_PAUSE = 1;
206
{$EXTERNALSYM SERVICE_CTRL_PAUSE}
207
SERVICE_CTRL_CONTINUE = 2;
208
{$EXTERNALSYM SERVICE_CTRL_CONTINUE}
209
SERVICE_CTRL_UNINSTALL = 3;
210
{$EXTERNALSYM SERVICE_CTRL_UNINSTALL}
213
// Workstation service only: Bits used in the "arg" parameter
214
// to NetServiceControl in conjunction with the opcode
215
// SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
216
// continue redirection.
219
SERVICE_CTRL_REDIR_DISK = $1;
220
{$EXTERNALSYM SERVICE_CTRL_REDIR_DISK}
221
SERVICE_CTRL_REDIR_PRINT = $2;
222
{$EXTERNALSYM SERVICE_CTRL_REDIR_PRINT}
223
SERVICE_CTRL_REDIR_COMM = $4;
224
{$EXTERNALSYM SERVICE_CTRL_REDIR_COMM}
227
// Values for svci1_code, and svci2_code when status
228
// of the service is SERVICE_INSTALL_PENDING or
229
// SERVICE_UNINSTALL_PENDING.
230
// A service can optionally provide a hint to the installer
231
// that the install is proceeding and how long to wait
232
// (in 0.1 second increments) before querying status again.
235
SERVICE_IP_NO_HINT = $0;
236
{$EXTERNALSYM SERVICE_IP_NO_HINT}
237
SERVICE_CCP_NO_HINT = $0;
238
{$EXTERNALSYM SERVICE_CCP_NO_HINT}
240
SERVICE_IP_QUERY_HINT = $10000;
241
{$EXTERNALSYM SERVICE_IP_QUERY_HINT}
242
SERVICE_CCP_QUERY_HINT = $10000;
243
{$EXTERNALSYM SERVICE_CCP_QUERY_HINT}
246
// Mask for install proceeding checkpoint number
249
SERVICE_IP_CHKPT_NUM = $0FF;
250
{$EXTERNALSYM SERVICE_IP_CHKPT_NUM}
251
SERVICE_CCP_CHKPT_NUM = $0FF;
252
{$EXTERNALSYM SERVICE_CCP_CHKPT_NUM}
255
// Mask for wait time hint before querying again
258
SERVICE_IP_WAIT_TIME = $0FF00;
259
{$EXTERNALSYM SERVICE_IP_WAIT_TIME}
260
SERVICE_CCP_WAIT_TIME = $0FF00;
261
{$EXTERNALSYM SERVICE_CCP_WAIT_TIME}
264
// Shift count for building wait time _code values
267
SERVICE_IP_WAITTIME_SHIFT = 8;
268
{$EXTERNALSYM SERVICE_IP_WAITTIME_SHIFT}
269
SERVICE_NTIP_WAITTIME_SHIFT = 12;
270
{$EXTERNALSYM SERVICE_NTIP_WAITTIME_SHIFT}
273
// Mask used for upper and lower portions of wait hint time.
276
UPPER_HINT_MASK = $0000FF00;
277
{$EXTERNALSYM UPPER_HINT_MASK}
278
LOWER_HINT_MASK = $000000FF;
279
{$EXTERNALSYM LOWER_HINT_MASK}
280
UPPER_GET_HINT_MASK = $0FF00000;
281
{$EXTERNALSYM UPPER_GET_HINT_MASK}
282
LOWER_GET_HINT_MASK = $0000FF00;
283
{$EXTERNALSYM LOWER_GET_HINT_MASK}
284
SERVICE_NT_MAXTIME = $0000FFFF;
285
{$EXTERNALSYM SERVICE_NT_MAXTIME}
286
SERVICE_RESRV_MASK = $0001FFFF;
287
{$EXTERNALSYM SERVICE_RESRV_MASK}
288
SERVICE_MAXTIME = $000000FF;
289
{$EXTERNALSYM SERVICE_MAXTIME}
292
// SERVICE_BASE is the base of service error codes,
293
// chosen to avoid conflict with OS, redirector,
294
// netapi, and errlog codes.
296
// Don't change the comments following the manifest constants without
297
// understanding how mapmsg works.
301
{$EXTERNALSYM SERVICE_BASE}
302
SERVICE_UIC_NORMAL = 0;
303
{$EXTERNALSYM SERVICE_UIC_NORMAL}
306
* Uninstall codes, to be used in high byte of 'code' on final NetStatus,
307
* which sets the status to UNINSTALLED.
310
SERVICE_UIC_BADPARMVAL = SERVICE_BASE + 1;
311
{$EXTERNALSYM SERVICE_UIC_BADPARMVAL}
314
* The Registry or the information you just typed includes an illegal
318
SERVICE_UIC_MISSPARM = SERVICE_BASE + 2;
319
{$EXTERNALSYM SERVICE_UIC_MISSPARM}
322
* The required parameter was not provided on the command
323
* line or in the configuration file.
326
SERVICE_UIC_UNKPARM = SERVICE_BASE + 3;
327
{$EXTERNALSYM SERVICE_UIC_UNKPARM}
330
* LAN Manager does not recognize "%1" as a valid option.
333
SERVICE_UIC_RESOURCE = SERVICE_BASE + 4;
334
{$EXTERNALSYM SERVICE_UIC_RESOURCE}
337
* A request for resource could not be satisfied.
340
SERVICE_UIC_CONFIG = SERVICE_BASE + 5;
341
{$EXTERNALSYM SERVICE_UIC_CONFIG}
344
* A problem exists with the system configuration.
347
SERVICE_UIC_SYSTEM = SERVICE_BASE + 6;
348
{$EXTERNALSYM SERVICE_UIC_SYSTEM}
351
* A system error has occurred.
354
SERVICE_UIC_INTERNAL = SERVICE_BASE + 7;
355
{$EXTERNALSYM SERVICE_UIC_INTERNAL}
358
* An internal consistency error has occurred.
361
SERVICE_UIC_AMBIGPARM = SERVICE_BASE + 8;
362
{$EXTERNALSYM SERVICE_UIC_AMBIGPARM}
365
* The configuration file or the command line has an ambiguous option.
368
SERVICE_UIC_DUPPARM = SERVICE_BASE + 9;
369
{$EXTERNALSYM SERVICE_UIC_DUPPARM}
372
* The configuration file or the command line has a duplicate parameter.
375
SERVICE_UIC_KILL = SERVICE_BASE + 10;
376
{$EXTERNALSYM SERVICE_UIC_KILL}
379
* The service did not respond to control and was stopped with
380
* the DosKillProc function.
383
SERVICE_UIC_EXEC = SERVICE_BASE + 11;
384
{$EXTERNALSYM SERVICE_UIC_EXEC}
387
* An error occurred when attempting to run the service program.
390
SERVICE_UIC_SUBSERV = SERVICE_BASE + 12;
391
{$EXTERNALSYM SERVICE_UIC_SUBSERV}
394
* The sub-service failed to start.
397
SERVICE_UIC_CONFLPARM = SERVICE_BASE + 13;
398
{$EXTERNALSYM SERVICE_UIC_CONFLPARM}
401
* There is a conflict in the value or use of these options: %1.
404
SERVICE_UIC_FILE = SERVICE_BASE + 14;
405
{$EXTERNALSYM SERVICE_UIC_FILE}
408
* There is a problem with the file.
419
SERVICE_UIC_M_NULL = 0;
420
{$EXTERNALSYM SERVICE_UIC_M_NULL}
426
SERVICE_UIC_M_MEMORY = SERVICE_BASE + 20; // memory
427
{$EXTERNALSYM SERVICE_UIC_M_MEMORY}
428
SERVICE_UIC_M_DISK = SERVICE_BASE + 21; // disk space
429
{$EXTERNALSYM SERVICE_UIC_M_DISK}
430
SERVICE_UIC_M_THREADS = SERVICE_BASE + 22; // thread
431
{$EXTERNALSYM SERVICE_UIC_M_THREADS}
432
SERVICE_UIC_M_PROCESSES = SERVICE_BASE + 23; // process
433
{$EXTERNALSYM SERVICE_UIC_M_PROCESSES}
443
SERVICE_UIC_M_SECURITY = SERVICE_BASE + 24;
444
{$EXTERNALSYM SERVICE_UIC_M_SECURITY}
446
{* Security Failure. %0 *}
448
SERVICE_UIC_M_LANROOT = SERVICE_BASE + 25;
449
{$EXTERNALSYM SERVICE_UIC_M_LANROOT}
452
* Bad or missing LAN Manager root directory.
455
SERVICE_UIC_M_REDIR = SERVICE_BASE + 26;
456
{$EXTERNALSYM SERVICE_UIC_M_REDIR}
459
* The network software is not installed.
462
SERVICE_UIC_M_SERVER = SERVICE_BASE + 27;
463
{$EXTERNALSYM SERVICE_UIC_M_SERVER}
466
* The server is not started.
469
SERVICE_UIC_M_SEC_FILE_ERR = SERVICE_BASE + 28;
470
{$EXTERNALSYM SERVICE_UIC_M_SEC_FILE_ERR}
473
* The server cannot access the user accounts database (NET.ACC).
476
SERVICE_UIC_M_FILES = SERVICE_BASE + 29;
477
{$EXTERNALSYM SERVICE_UIC_M_FILES}
480
* Incompatible files are installed in the LANMAN tree.
483
SERVICE_UIC_M_LOGS = SERVICE_BASE + 30;
484
{$EXTERNALSYM SERVICE_UIC_M_LOGS}
487
* The LANMAN\LOGS directory is invalid.
490
SERVICE_UIC_M_LANGROUP = SERVICE_BASE + 31;
491
{$EXTERNALSYM SERVICE_UIC_M_LANGROUP}
494
* The domain specified could not be used.
497
SERVICE_UIC_M_MSGNAME = SERVICE_BASE + 32;
498
{$EXTERNALSYM SERVICE_UIC_M_MSGNAME}
501
* The computer name is being used as a message alias on another computer.
504
SERVICE_UIC_M_ANNOUNCE = SERVICE_BASE + 33;
505
{$EXTERNALSYM SERVICE_UIC_M_ANNOUNCE}
508
* The announcement of the server name failed.
511
SERVICE_UIC_M_UAS = SERVICE_BASE + 34;
512
{$EXTERNALSYM SERVICE_UIC_M_UAS}
515
* The user accounts database is not configured correctly.
518
SERVICE_UIC_M_SERVER_SEC_ERR = SERVICE_BASE + 35;
519
{$EXTERNALSYM SERVICE_UIC_M_SERVER_SEC_ERR}
522
* The server is not running with user-level security.
525
SERVICE_UIC_M_WKSTA = SERVICE_BASE + 37;
526
{$EXTERNALSYM SERVICE_UIC_M_WKSTA}
529
* The workstation is not configured properly.
532
SERVICE_UIC_M_ERRLOG = SERVICE_BASE + 38;
533
{$EXTERNALSYM SERVICE_UIC_M_ERRLOG}
536
* View your error log for details.
539
SERVICE_UIC_M_FILE_UW = SERVICE_BASE + 39;
540
{$EXTERNALSYM SERVICE_UIC_M_FILE_UW}
543
* Unable to write to this file.
546
SERVICE_UIC_M_ADDPAK = SERVICE_BASE + 40;
547
{$EXTERNALSYM SERVICE_UIC_M_ADDPAK}
550
* ADDPAK file is corrupted. Delete LANMAN\NETPROG\ADDPAK.SER
551
* and reapply all ADDPAKs.
554
SERVICE_UIC_M_LAZY = SERVICE_BASE + 41;
555
{$EXTERNALSYM SERVICE_UIC_M_LAZY}
558
* The LM386 server cannot be started because CACHE.EXE is not running.
561
SERVICE_UIC_M_UAS_MACHINE_ACCT = SERVICE_BASE + 42;
562
{$EXTERNALSYM SERVICE_UIC_M_UAS_MACHINE_ACCT}
565
* There is no account for this computer in the security database.
568
SERVICE_UIC_M_UAS_SERVERS_NMEMB = SERVICE_BASE + 43;
569
{$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NMEMB}
572
* This computer is not a member of the group SERVERS.
575
SERVICE_UIC_M_UAS_SERVERS_NOGRP = SERVICE_BASE + 44;
576
{$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NOGRP}
579
* The group SERVERS is not present in the local security database.
582
SERVICE_UIC_M_UAS_INVALID_ROLE = SERVICE_BASE + 45;
583
{$EXTERNALSYM SERVICE_UIC_M_UAS_INVALID_ROLE}
586
* This computer is configured as a member of a workgroup, not as
587
* a member of a domain. The Netlogon service does not need to run in this
591
SERVICE_UIC_M_NETLOGON_NO_DC = SERVICE_BASE + 46;
592
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_NO_DC}
595
* The primary Domain Controller for this domain could not be located.
598
SERVICE_UIC_M_NETLOGON_DC_CFLCT = SERVICE_BASE + 47;
599
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_DC_CFLCT}
602
* This computer is configured to be the primary domain controller of its domain.
603
* However, the computer %1 is currently claiming to be the primary domain controller
607
SERVICE_UIC_M_NETLOGON_AUTH = SERVICE_BASE + 48;
608
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_AUTH}
611
* The service failed to authenticate with the primary domain controller.
614
SERVICE_UIC_M_UAS_PROLOG = SERVICE_BASE + 49;
615
{$EXTERNALSYM SERVICE_UIC_M_UAS_PROLOG}
618
* There is a problem with the security database creation date or serial number.
621
SERVICE2_BASE = 5600;
622
{$EXTERNALSYM SERVICE2_BASE}
624
{* new SEVICE_UIC messages go here *}
626
SERVICE_UIC_M_NETLOGON_MPATH = SERVICE2_BASE + 0;
627
{$EXTERNALSYM SERVICE_UIC_M_NETLOGON_MPATH}
630
* Could not share the User or Script path.
633
SERVICE_UIC_M_LSA_MACHINE_ACCT = SERVICE2_BASE + 1;
634
{$EXTERNALSYM SERVICE_UIC_M_LSA_MACHINE_ACCT}
637
* The password for this computer is not found in the local security
641
SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE + 2;
642
{$EXTERNALSYM SERVICE_UIC_M_DATABASE_ERROR}
645
* An internal error occurred while accessing the computer's
646
* local or network security database.
654
// Commonly used Macros:
657
function SERVICE_IP_CODE(tt, nn: LONG): LONG;
658
{$EXTERNALSYM SERVICE_IP_CODE}
660
function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
661
{$EXTERNALSYM SERVICE_CCP_CODE}
663
function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
664
{$EXTERNALSYM SERVICE_UIC_CODE}
667
// This macro takes a wait hint (tt) which can have a maximum value of
668
// 0xFFFF and puts it into the service status code field.
669
// 0x0FF1FFnn (where nn is the checkpoint information).
672
function SERVICE_NT_CCP_CODE(tt, nn: LONG): LONG;
673
{$EXTERNALSYM SERVICE_NT_CCP_CODE}
676
// This macro takes a status code field, and strips out the wait hint
677
// from the upper and lower sections.
678
// 0x0FF1FFnn results in 0x0000FFFF.
681
function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
682
{$EXTERNALSYM SERVICE_NT_WAIT_GET}
686
// #define SERVICE_IP_CODE(tt,nn) ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
688
function SERVICE_IP_CODE(tt, nn: LONG): LONG;
690
Result := SERVICE_IP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
693
// #define SERVICE_CCP_CODE(tt,nn) ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
695
function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
697
Result := SERVICE_CCP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
700
// #define SERVICE_UIC_CODE(cc,mm) ((long)(((long)cc<<16)|(long)(unsigned short)mm))
702
function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
704
Result := (cc shl 16) or WORD(mm);
707
// #define SERVICE_NT_CCP_CODE(tt,nn) \
709
// ((long)SERVICE_CCP_QUERY_HINT) | \
711
// (((tt)&LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT) | \
712
// (((tt)&UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT) \
715
function SERVICE_NT_CCP_CODE(tt, nn: Longint): Longint;
717
Result := SERVICE_CCP_QUERY_HINT or nn or ((tt and LOWER_HINT_MASK) shl SERVICE_IP_WAITTIME_SHIFT) or ((tt and UPPER_HINT_MASK) shl SERVICE_NTIP_WAITTIME_SHIFT);
720
// #define SERVICE_NT_WAIT_GET(code) \
722
// (((code) & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT) | \
723
// (((code) & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT) \
726
function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
728
Result := ((code and UPPER_GET_HINT_MASK) shr SERVICE_NTIP_WAITTIME_SHIFT) or ((code and LOWER_GET_HINT_MASK) shr SERVICE_IP_WAITTIME_SHIFT);
731
{$IFDEF DYNAMIC_LINK}
734
_NetServiceControl: Pointer;
736
function NetServiceControl;
738
GetProcedureAddress(_NetServiceControl, netapi32, 'NetServiceControl');
742
JMP [_NetServiceControl]
747
_NetServiceEnum: Pointer;
749
function NetServiceEnum;
751
GetProcedureAddress(_NetServiceEnum, netapi32, 'NetServiceEnum');
755
JMP [_NetServiceEnum]
760
_NetServiceGetInfo: Pointer;
762
function NetServiceGetInfo;
764
GetProcedureAddress(_NetServiceGetInfo, netapi32, 'NetServiceGetInfo');
768
JMP [_NetServiceGetInfo]
773
_NetServiceInstall: Pointer;
775
function NetServiceInstall;
777
GetProcedureAddress(_NetServiceInstall, netapi32, 'NetServiceInstall');
781
JMP [_NetServiceInstall]
787
function NetServiceControl; external netapi32 name 'NetServiceControl';
788
function NetServiceEnum; external netapi32 name 'NetServiceEnum';
789
function NetServiceGetInfo; external netapi32 name 'NetServiceGetInfo';
790
function NetServiceInstall; external netapi32 name 'NetServiceInstall';
792
{$ENDIF DYNAMIC_LINK}