/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/source/StNetApi.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/source/StNetApi.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 260330 byte(s)
Added tpsystools component
1 // Upgraded to Delphi 2009: Sebastian Zierer
2
3 (* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is TurboPower SysTools
17 *
18 * The Initial Developer of the Original Code is
19 * TurboPower Software
20 *
21 * Portions created by the Initial Developer are Copyright (C) 1996-2002
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * ***** END LICENSE BLOCK ***** *)
27
28 {*********************************************************}
29 {* SysTools: StNetAPI.pas 4.04 *}
30 {*********************************************************}
31 {* SysTools: Network API Defines *}
32 {*********************************************************}
33
34 {$I StDefine.inc}
35
36 {$H+} {Huge strings}
37
38 unit StNetAPI;
39
40 interface
41
42 uses
43 Windows, StBase;
44
45 {-------------------- LMERR.H------------------------------------------------}
46 const
47 NERR_SUCCESS = 0; {Success}
48
49 { NERR_BASE is the base of error codes from network utilities, }
50 { chosen to avoid conflict with system and redirector error codes. }
51 { 2100 is a value that has been assigned to us by system. }
52
53 NERR_BASE = 2100;
54
55 { INTERNAL_ONLY }
56
57 { ***********WARNING **************** }
58 { *See the comment in lmcons.h for * }
59 { *info on the allocation of errors * }
60 { *********************************** }
61
62 { ***********WARNING **************** }
63 { *The range 2750-2799 has been * }
64 { *allocated to the IBM LAN Server * }
65 { *********************************** }
66
67 { ***********WARNING **************** }
68 { *The range 2900-2999 has been * }
69 { *reserved for Microsoft OEMs * }
70 { *********************************** }
71
72 { END_INTERNAL }
73
74 { UNUSED BASE+0 }
75 { UNUSED BASE+1 }
76
77 NERR_NetNotStarted = (NERR_BASE+2); { The workstation driver is not installed. }
78 NERR_UnknownServer = (NERR_BASE+3); { The server could not be located. }
79 NERR_ShareMem = (NERR_BASE+4); { An internal error occurred. The network cannot access a shared memory segment. }
80
81 NERR_NoNetworkResource = (NERR_BASE+5); { A network resource shortage occurred. }
82 NERR_RemoteOnly = (NERR_BASE+6); { This operation is not supported on workstations. }
83 NERR_DevNotRedirected = (NERR_BASE+7); { The device is not connected. }
84
85 { UNUSED BASE+8 }
86 { UNUSED BASE+9 }
87 { UNUSED BASE+10 }
88 { UNUSED BASE+11 }
89 { UNUSED BASE+12 }
90 { UNUSED BASE+13 }
91
92 NERR_ServerNotStarted = (NERR_BASE+14); { The Server service is not started. }
93 NERR_ItemNotFound = (NERR_BASE+15); { The queue is empty. }
94 NERR_UnknownDevDir = (NERR_BASE+16); { The device or directory does not exist. }
95 NERR_RedirectedPath = (NERR_BASE+17); { The operation is invalid on a redirected resource. }
96 NERR_DuplicateShare = (NERR_BASE+18); { The name has already been shared. }
97 NERR_NoRoom = (NERR_BASE+19); { The server is currently out of the requested resource. }
98
99 { UNUSED BASE+20 }
100
101 NERR_TooManyItems = (NERR_BASE+21); { Requested addition of items exceeds the maximum allowed. */ }
102 NERR_InvalidMaxUsers = (NERR_BASE+22); { The Peer service supports only two simultaneous users. */ }
103 NERR_BufTooSmall = (NERR_BASE+23); { The API return buffer is too small. }
104
105 { UNUSED BASE+24 }
106 { UNUSED BASE+25 }
107 { UNUSED BASE+26 }
108
109 NERR_RemoteErr = (NERR_BASE+27); { A remote API error occurred. }
110
111 { UNUSED BASE+28 }
112 { UNUSED BASE+29 }
113 { UNUSED BASE+30 }
114
115 NERR_LanmanIniError = (NERR_BASE+31); { An error occurred when opening or reading the configuration file. }
116
117 { UNUSED BASE+32 }
118 { UNUSED BASE+33 }
119 { UNUSED BASE+34 }
120 { UNUSED BASE+35 }
121
122 NERR_NetworkError = (NERR_BASE+36); { A general network error occurred. }
123 NERR_WkstaInconsistentState = (NERR_BASE+37); { The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service. }
124 NERR_WkstaNotStarted = (NERR_BASE+38); { The Workstation service has not been started. }
125 NERR_BrowserNotStarted = (NERR_BASE+39); { The requested information is not available. }
126 NERR_InternalError = (NERR_BASE+40); { An internal Windows NT error occurred. }
127 NERR_BadTransactConfig = (NERR_BASE+41); { The server is not configured for transactions. }
128 NERR_InvalidAPI = (NERR_BASE+42); { The requested API is not supported on the remote server. }
129 NERR_BadEventName = (NERR_BASE+43); { The event name is invalid. }
130 NERR_DupNameReboot = (NERR_BASE+44); { The computer name already exists on the network. Change it and restart the computer. }
131
132 { Config API related (Error codes from BASE+45 to BASE+49) }
133
134 { UNUSED BASE+45 }
135
136 NERR_CfgCompNotFound = (NERR_BASE+46); { The specified component could not be found in the configuration information. }
137 NERR_CfgParamNotFound = (NERR_BASE+47); { The specified parameter could not be found in the configuration information. }
138 NERR_LineTooLong = (NERR_BASE+49); { A line in the configuration file is too long. }
139
140 { Spooler API related (Error codes from BASE+50 to BASE+79) }
141
142 NERR_QNotFound = (NERR_BASE+50); { The printer does not exist. }
143 NERR_JobNotFound = (NERR_BASE+51); { The print job does not exist. }
144 NERR_DestNotFound = (NERR_BASE+52); { The printer destination cannot be found. }
145 NERR_DestExists = (NERR_BASE+53); { The printer destination already exists. }
146 NERR_QExists = (NERR_BASE+54); { The printer queue already exists. }
147 NERR_QNoRoom = (NERR_BASE+55); { No more printers can be added. }
148 NERR_JobNoRoom = (NERR_BASE+56); { No more print jobs can be added. }
149 NERR_DestNoRoom = (NERR_BASE+57); { No more printer destinations can be added. }
150 NERR_DestIdle = (NERR_BASE+58); { This printer destination is idle and cannot accept control operations. }
151 NERR_DestInvalidOp = (NERR_BASE+59); { This printer destination request contains an invalid control function. }
152 NERR_ProcNoRespond = (NERR_BASE+60); { The print processor is not responding. }
153 NERR_SpoolerNotLoaded = (NERR_BASE+61); { The spooler is not running. }
154 NERR_DestInvalidState = (NERR_BASE+62); { This operation cannot be performed on the print destination in its current state. }
155 NERR_QInvalidState = (NERR_BASE+63); { This operation cannot be performed on the printer queue in its current state. }
156 NERR_JobInvalidState = (NERR_BASE+64); { This operation cannot be performed on the print job in its current state. }
157 NERR_SpoolNoMemory = (NERR_BASE+65); { A spooler memory allocation failure occurred. }
158 NERR_DriverNotFound = (NERR_BASE+66); { The device driver does not exist. }
159 NERR_DataTypeInvalid = (NERR_BASE+67); { The data type is not supported by the print processor. }
160 NERR_ProcNotFound = (NERR_BASE+68); { The print processor is not installed. }
161
162 { Service API related (Error codes from BASE+80 to BASE+99) }
163
164 NERR_ServiceTableLocked = (NERR_BASE+80); { The service database is locked. }
165 NERR_ServiceTableFull = (NERR_BASE+81); { The service table is full. }
166 NERR_ServiceInstalled = (NERR_BASE+82); { The requested service has already been started. }
167 NERR_ServiceEntryLocked = (NERR_BASE+83); { The service does not respond to control actions. }
168 NERR_ServiceNotInstalled= (NERR_BASE+84); { The service has not been started. }
169 NERR_BadServiceName = (NERR_BASE+85); { The service name is invalid. }
170 NERR_ServiceCtlTimeout = (NERR_BASE+86); { The service is not responding to the control function. }
171 NERR_ServiceCtlBusy = (NERR_BASE+87); { The service control is busy. }
172 NERR_BadServiceProgName = (NERR_BASE+88); { The configuration file contains an invalid service program name. }
173 NERR_ServiceNotCtrl = (NERR_BASE+89); { The service could not be controlled in its present state. }
174 NERR_ServiceKillProc = (NERR_BASE+90); { The service ended abnormally. }
175 NERR_ServiceCtlNotValid = (NERR_BASE+91); { The requested pause or stop is not valid for this service. }
176 NERR_NotInDispatchTbl = (NERR_BASE+92); { The service control dispatcher could not find the service name in the dispatch table. }
177 NERR_BadControlRecv = (NERR_BASE+93); { The service control dispatcher pipe read failed. }
178 NERR_ServiceNotStarting = (NERR_BASE+94); { A thread for the new service could not be created. }
179
180 { Wksta and Logon API related (Error codes from BASE+100 to BASE+118) }
181
182 NERR_AlreadyLoggedOn = (NERR_BASE+100); { This workstation is already logged on to the local-area network. }
183 NERR_NotLoggedOn = (NERR_BASE+101); { The workstation is not logged on to the local-area network. }
184 NERR_BadUsername = (NERR_BASE+102); { The user name or group name parameter is invalid. }
185 NERR_BadPassword = (NERR_BASE+103); { The password parameter is invalid. }
186 NERR_UnableToAddName_W = (NERR_BASE+104); { @W The logon processor did not add the message alias. }
187 NERR_UnableToAddName_F = (NERR_BASE+105); { The logon processor did not add the message alias. }
188 NERR_UnableToDelName_W = (NERR_BASE+106); { @W The logoff processor did not delete the message alias. }
189 NERR_UnableToDelName_F = (NERR_BASE+107); { The logoff processor did not delete the message alias. }
190
191 { UNUSED BASE+108 }
192
193 NERR_LogonsPaused = (NERR_BASE+109); { Network logons are paused. }
194 NERR_LogonServerConflict= (NERR_BASE+110); { A centralized logon-server conflict occurred. }
195 NERR_LogonNoUserPath = (NERR_BASE+111); { The server is configured without a valid user path. }
196 NERR_LogonScriptError = (NERR_BASE+112); { An error occurred while loading or running the logon script. }
197
198 { UNUSED BASE+113 }
199
200 NERR_StandaloneLogon = (NERR_BASE+114); { The logon server was not specified. Your computer will be logged on as STANDALONE. }
201 NERR_LogonServerNotFound= (NERR_BASE+115); { The logon server could not be found. }
202 NERR_LogonDomainExists = (NERR_BASE+116); { There is already a logon domain for this computer. }
203 NERR_NonValidatedLogon = (NERR_BASE+117); { The logon server could not validate the logon. }
204
205 { ACF API related (access, user, group) (Error codes from BASE+119 to BASE+149) }
206
207 NERR_ACFNotFound = (NERR_BASE+119); { The security database could not be found. }
208 NERR_GroupNotFound = (NERR_BASE+120); { The group name could not be found. }
209 NERR_UserNotFound = (NERR_BASE+121); { The user name could not be found. }
210 NERR_ResourceNotFound = (NERR_BASE+122); { The resource name could not be found. }
211 NERR_GroupExists = (NERR_BASE+123); { The group already exists. }
212 NERR_UserExists = (NERR_BASE+124); { The user account already exists. }
213 NERR_ResourceExists = (NERR_BASE+125); { The resource permission list already exists. }
214 NERR_NotPrimary = (NERR_BASE+126); { This operation is only allowed on the primary domain controller of the domain. }
215 NERR_ACFNotLoaded = (NERR_BASE+127); { The security database has not been started. }
216 NERR_ACFNoRoom = (NERR_BASE+128); { There are too many names in the user accounts database. }
217 NERR_ACFFileIOFail = (NERR_BASE+129); { A disk I/O failure occurred. }
218 NERR_ACFTooManyLists = (NERR_BASE+130); { The limit of 64 entries per resource was exceeded. }
219 NERR_UserLogon = (NERR_BASE+131); { Deleting a user with a session is not allowed. }
220 NERR_ACFNoParent = (NERR_BASE+132); { The parent directory could not be located. }
221 NERR_CanNotGrowSegment = (NERR_BASE+133); { Unable to add to the security database session cache segment. }
222 NERR_SpeGroupOp = (NERR_BASE+134); { This operation is not allowed on this special group. }
223 NERR_NotInCache = (NERR_BASE+135); { This user is not cached in user accounts database session cache. }
224 NERR_UserInGroup = (NERR_BASE+136); { The user already belongs to this group. }
225 NERR_UserNotInGroup = (NERR_BASE+137); { The user does not belong to this group. }
226 NERR_AccountUndefined = (NERR_BASE+138); { This user account is undefined. }
227 NERR_AccountExpired = (NERR_BASE+139); { This user account has expired. }
228 NERR_InvalidWorkstation = (NERR_BASE+140); { The user is not allowed to log on from this workstation. }
229 NERR_InvalidLogonHours = (NERR_BASE+141); { The user is not allowed to log on at this time. }
230 NERR_PasswordExpired = (NERR_BASE+142); { The password of this user has expired. }
231 NERR_PasswordCantChange = (NERR_BASE+143); { The password of this user cannot change. }
232 NERR_PasswordHistConflict=(NERR_BASE+144); { This password cannot be used now. }
233 NERR_PasswordTooShort = (NERR_BASE+145); { The password is shorter than required. }
234 NERR_PasswordTooRecent = (NERR_BASE+146); { The password of this user is too recent to change. }
235 NERR_InvalidDatabase = (NERR_BASE+147); { The security database is corrupted. }
236 NERR_DatabaseUpToDate = (NERR_BASE+148); { No updates are necessary to this replicant network/local security database. }
237 NERR_SyncRequired = (NERR_BASE+149); { This replicant database is outdated; synchronization is required. }
238
239 { Use API related (Error codes from BASE+150 to BASE+169) }
240
241 NERR_UseNotFound = (NERR_BASE+150); { The network connection could not be found. }
242 NERR_BadAsgType = (NERR_BASE+151); { This asg_type is invalid. }
243 NERR_DeviceIsShared = (NERR_BASE+152); { This device is currently being shared. }
244
245 { Message Server related (Error codes BASE+170 to BASE+209) }
246
247 NERR_NoComputerName = (NERR_BASE+170); { The computer name could not be added as a message alias. The name may already exist on the network. }
248 NERR_MsgAlreadyStarted = (NERR_BASE+171); { The Messenger service is already started. }
249 NERR_MsgInitFailed = (NERR_BASE+172); { The Messenger service failed to start. }
250 NERR_NameNotFound = (NERR_BASE+173); { The message alias could not be found on the network. }
251 NERR_AlreadyForwarded = (NERR_BASE+174); { This message alias has already been forwarded. }
252 NERR_AddForwarded = (NERR_BASE+175); { This message alias has been added but is still forwarded. }
253 NERR_AlreadyExists = (NERR_BASE+176); { This message alias already exists locally. }
254 NERR_TooManyNames = (NERR_BASE+177); { The maximum number of added message aliases has been exceeded. }
255 NERR_DelComputerName = (NERR_BASE+178); { The computer name could not be deleted. }
256 NERR_LocalForward = (NERR_BASE+179); { Messages cannot be forwarded back to the same workstation. }
257 NERR_GrpMsgProcessor = (NERR_BASE+180); { An error occurred in the domain message processor. }
258 NERR_PausedRemote = (NERR_BASE+181); { The message was sent, but the recipient has paused the Messenger service. }
259 NERR_BadReceive = (NERR_BASE+182); { The message was sent but not received. }
260 NERR_NameInUse = (NERR_BASE+183); { The message alias is currently in use. Try again later. }
261 NERR_MsgNotStarted = (NERR_BASE+184); { The Messenger service has not been started. }
262 NERR_NotLocalName = (NERR_BASE+185); { The name is not on the local computer. }
263 NERR_NoForwardName = (NERR_BASE+186); { The forwarded message alias could not be found on the network. }
264 NERR_RemoteFull = (NERR_BASE+187); { The message alias table on the remote station is full. }
265 NERR_NameNotForwarded = (NERR_BASE+188); { Messages for this alias are not currently being forwarded. }
266 NERR_TruncatedBroadcast = (NERR_BASE+189); { The broadcast message was truncated. }
267 NERR_InvalidDevice = (NERR_BASE+194); { This is an invalid device name. }
268 NERR_WriteFault = (NERR_BASE+195); { A write fault occurred. }
269
270 { UNUSED BASE+196 }
271
272 NERR_DuplicateName = (NERR_BASE+197); { A duplicate message alias exists on the network. }
273 NERR_DeleteLater = (NERR_BASE+198); { @W This message alias will be deleted later. }
274 NERR_IncompleteDel = (NERR_BASE+199); { The message alias was not successfully deleted from all networks. }
275 NERR_MultipleNets = (NERR_BASE+200); { This operation is not supported on computers with multiple networks. }
276
277 { Server API related (Error codes BASE+210 to BASE+229) }
278
279 NERR_NetNameNotFound = (NERR_BASE+210); { This shared resource does not exist. }
280 NERR_DeviceNotShared = (NERR_BASE+211); { This device is not shared. }
281 NERR_ClientNameNotFound = (NERR_BASE+212); { A session does not exist with that computer name. }
282 NERR_FileIdNotFound = (NERR_BASE+214); { There is not an open file with that identification number. }
283 NERR_ExecFailure = (NERR_BASE+215); { A failure occurred when executing a remote administration command. }
284 NERR_TmpFile = (NERR_BASE+216); { A failure occurred when opening a remote temporary file. }
285 NERR_TooMuchData = (NERR_BASE+217); { The data returned from a remote administration command has been truncated to 64K. }
286 NERR_DeviceShareConflict= (NERR_BASE+218); { This device cannot be shared as both a spooled and a non-spooled resource. }
287 NERR_BrowserTableIncomplete= (NERR_BASE+219); { The information in the list of servers may be incorrect. }
288 NERR_NotLocalDomain = (NERR_BASE+220); { The computer is not active in this domain. }
289
290 { CharDev API related (Error codes BASE+230 to BASE+249) }
291
292 { UNUSED BASE+230 }
293
294 NERR_DevInvalidOpCode = (NERR_BASE+231); { The operation is invalid for this device. }
295 NERR_DevNotFound = (NERR_BASE+232); { This device cannot be shared. }
296 NERR_DevNotOpen = (NERR_BASE+233); { This device was not open. }
297 NERR_BadQueueDevString = (NERR_BASE+234); { This device name list is invalid. }
298 NERR_BadQueuePriority = (NERR_BASE+235); { The queue priority is invalid. }
299 NERR_NoCommDevs = (NERR_BASE+237); { There are no shared communication devices. }
300 NERR_QueueNotFound = (NERR_BASE+238); { The queue you specified does not exist. }
301 NERR_BadDevString = (NERR_BASE+240); { This list of devices is invalid. }
302 NERR_BadDev = (NERR_BASE+241); { The requested device is invalid. }
303 NERR_InUseBySpooler = (NERR_BASE+242); { This device is already in use by the spooler. }
304 NERR_CommDevInUse = (NERR_BASE+243); { This device is already in use as a communication device. }
305
306 { NetICanonicalize and NetIType and NetIMakeLMFileName }
307 { NetIListCanon and NetINameCheck }
308 { (Error codes BASE+250 to BASE+269) }
309
310 NERR_InvalidComputer = (NERR_BASE+251); { This computer name is invalid. }
311
312 { UNUSED BASE+252 }
313 { UNUSED BASE+253 }
314
315 NERR_MaxLenExceeded = (NERR_BASE+254); { The string and prefix specified are too long. }
316
317 { UNUSED BASE+255 }
318
319 NERR_BadComponent = (NERR_BASE+256); { This path component is invalid. }
320 NERR_CantType = (NERR_BASE+257); { Could not determine the type of input. }
321
322 { UNUSED BASE+258 }
323 { UNUSED BASE+259 }
324
325 NERR_TooManyEntries = (NERR_BASE+262); { The buffer for types is not big enough. }
326
327 { NetProfile (Error codes BASE+270 to BASE+276) }
328
329 NERR_ProfileFileTooBig = (NERR_BASE+270); { Profile files cannot exceed 64K. }
330 NERR_ProfileOffset = (NERR_BASE+271); { The start offset is out of range. }
331 NERR_ProfileCleanup = (NERR_BASE+272); { The system cannot delete current connections to network resources. }
332 NERR_ProfileUnknownCmd = (NERR_BASE+273); { The system was unable to parse the command line in this file. }
333 NERR_ProfileLoadErr = (NERR_BASE+274); { An error occurred while loading the profile file. }
334 NERR_ProfileSaveErr = (NERR_BASE+275); { @W Errors occurred while saving the profile file. The profile was partially saved. }
335
336 { NetAudit and NetErrorLog (Error codes BASE+277 to BASE+279) }
337
338 NERR_LogOverflow = (NERR_BASE+277); { Log file %1 is full. }
339 NERR_LogFileChanged = (NERR_BASE+278); { This log file has changed between reads. }
340 NERR_LogFileCorrupt = (NERR_BASE+279); { Log file %1 is corrupt. }
341
342 { NetRemote (Error codes BASE+280 to BASE+299) }
343
344 NERR_SourceIsDir = (NERR_BASE+280); { The source path cannot be a directory. }
345 NERR_BadSource = (NERR_BASE+281); { The source path is illegal. }
346 NERR_BadDest = (NERR_BASE+282); { The destination path is illegal. }
347 NERR_DifferentServers = (NERR_BASE+283); { The source and destination paths are on different servers. }
348
349 { UNUSED BASE+284 }
350
351 NERR_RunSrvPaused = (NERR_BASE+285); { The Run server you requested is paused. }
352
353 { UNUSED BASE+286 }
354 { UNUSED BASE+287 }
355 { UNUSED BASE+288 }
356
357 NERR_ErrCommRunSrv = (NERR_BASE+289); { An error occurred when communicating with a Run server. }
358
359 { UNUSED BASE+290 }
360
361 NERR_ErrorExecingGhost = (NERR_BASE+291); { An error occurred when starting a background process. }
362 NERR_ShareNotFound = (NERR_BASE+292); { The shared resource you are connected to could not be found. }
363
364 { UNUSED BASE+293 }
365 { UNUSED BASE+294 }
366
367 { NetWksta.sys (redir) returned error codes. (NERR_BASE + (300-329)) }
368
369 NERR_InvalidLana = (NERR_BASE+300); { The LAN adapter number is invalid. }
370 NERR_OpenFiles = (NERR_BASE+301); { There are open files on the connection. }
371 NERR_ActiveConns = (NERR_BASE+302); { Active connections still exist. }
372 NERR_BadPasswordCore = (NERR_BASE+303); { This share name or password is invalid. }
373 NERR_DevInUse = (NERR_BASE+304); { The device is being accessed by an active process. }
374 NERR_LocalDrive = (NERR_BASE+305); { The drive letter is in use locally. }
375
376 { Alert error codes. (NERR_BASE + (330-339)) }
377
378 NERR_AlertExists = (NERR_BASE+330); { The specified client is already registered for the specified event. }
379 NERR_TooManyAlerts = (NERR_BASE+331); { The alert table is full. }
380 NERR_NoSuchAlert = (NERR_BASE+332); { An invalid or nonexistent alert name was raised. }
381 NERR_BadRecipient = (NERR_BASE+333); { The alert recipient is invalid. }
382 NERR_AcctLimitExceeded = (NERR_BASE+334); { A user's session with this server has been deleted }
383 { because the user's logon hours are no longer valid. }
384
385 { Additional Error and Audit log codes. (NERR_BASE +(340-343)) }
386
387 NERR_InvalidLogSeek = (NERR_BASE+340); { The log file does not contain the requested record number. }
388
389 { UNUSED BASE+341 }
390 { UNUSED BASE+342 }
391 { UNUSED BASE+343 }
392
393 { Additional UAS and NETLOGON codes (NERR_BASE +(350-359)) }
394
395 NERR_BadUasConfig = (NERR_BASE+350); { The user accounts database is not configured correctly. }
396 NERR_InvalidUASOp = (NERR_BASE+351); { This operation is not permitted when the Netlogon service is running. }
397 NERR_LastAdmin = (NERR_BASE+352); { This operation is not allowed on the last administrative account. }
398 NERR_DCNotFound = (NERR_BASE+353); { Could not find domain controller for this domain. }
399 NERR_LogonTrackingError = (NERR_BASE+354); { Could not set logon information for this user. }
400 NERR_NetlogonNotStarted = (NERR_BASE+355); { The Netlogon service has not been started. }
401 NERR_CanNotGrowUASFile = (NERR_BASE+356); { Unable to add to the user accounts database. }
402 NERR_TimeDiffAtDC = (NERR_BASE+357); { This server's clock is not synchronized with the primary domain controller's clock. }
403 NERR_PasswordMismatch = (NERR_BASE+358); { A password mismatch has been detected. }
404
405 { Server Integration error codes. (NERR_BASE +(360-369)) }
406
407 NERR_NoSuchServer = (NERR_BASE+360); { The server identification does not specify a valid server. }
408 NERR_NoSuchSession = (NERR_BASE+361); { The session identification does not specify a valid session. }
409 NERR_NoSuchConnection = (NERR_BASE+362); { The connection identification does not specify a valid connection. }
410 NERR_TooManyServers = (NERR_BASE+363); { There is no space for another entry in the table of available servers. }
411 NERR_TooManySessions = (NERR_BASE+364); { The server has reached the maximum number of sessions it supports. }
412 NERR_TooManyConnections = (NERR_BASE+365); { The server has reached the maximum number of connections it supports. }
413 NERR_TooManyFiles = (NERR_BASE+366); { The server cannot open more files because it has reached its maximum number. }
414 NERR_NoAlternateServers = (NERR_BASE+367); { There are no alternate servers registered on this server. }
415
416 { UNUSED BASE+368 }
417 { UNUSED BASE+369 }
418
419 NERR_TryDownLevel = (NERR_BASE+370); { Try down-level (remote admin protocol) version of API instead. }
420
421 { UPS error codes. (NERR_BASE + (380-384)) }
422
423 NERR_UPSDriverNotStarted= (NERR_BASE+380); { The UPS driver could not be accessed by the UPS service. }
424 NERR_UPSInvalidConfig = (NERR_BASE+381); { The UPS service is not configured correctly. }
425 NERR_UPSInvalidCommPort = (NERR_BASE+382); { The UPS service could not access the specified Comm Port. }
426 NERR_UPSSignalAsserted = (NERR_BASE+383); { The UPS indicated a line fail or low battery situation. Service not started. }
427 NERR_UPSShutdownFailed = (NERR_BASE+384); { The UPS service failed to perform a system shut down. }
428
429 { Remoteboot error codes. (NERR_BASE + (400-419)) }
430 { Error codes 400 - 405 are used by RPLBOOT.SYS. }
431 { Error codes 403, 407 - 416 are used by RPLLOADR.COM, }
432 { Error code 417 is the alerter message of REMOTEBOOT (RPLSERVR.EXE). }
433 { Error code 418 is for when REMOTEBOOT can't start }
434 { Error code 419 is for a disallowed 2nd rpl connection }
435
436 NERR_BadDosRetCode = (NERR_BASE+400); { The program below returned an MS-DOS error code: }
437 NERR_ProgNeedsExtraMem = (NERR_BASE+401); { The program below needs more memory: }
438 NERR_BadDosFunction = (NERR_BASE+402); { The program below called an unsupported MS-DOS function: }
439 NERR_RemoteBootFailed = (NERR_BASE+403); { The workstation failed to boot. }
440 NERR_BadFileCheckSum = (NERR_BASE+404); { The file below is corrupt. }
441 NERR_NoRplBootSystem = (NERR_BASE+405); { No loader is specified in the boot-block definition file. }
442 NERR_RplLoadrNetBiosErr = (NERR_BASE+406); { NetBIOS returned an error: The NCB and SMB are dumped above. }
443 NERR_RplLoadrDiskErr = (NERR_BASE+407); { A disk I/O error occurred. }
444 NERR_ImageParamErr = (NERR_BASE+408); { Image parameter substitution failed. }
445 NERR_TooManyImageParams = (NERR_BASE+409); { Too many image parameters cross disk sector boundaries. }
446 NERR_NonDosFloppyUsed = (NERR_BASE+410); { The image was not generated from an MS-DOS diskette formatted with /S. }
447 NERR_RplBootRestart = (NERR_BASE+411); { Remote boot will be restarted later. }
448 NERR_RplSrvrCallFailed = (NERR_BASE+412); { The call to the Remoteboot server failed. }
449 NERR_CantConnectRplSrvr = (NERR_BASE+413); { Cannot connect to the Remoteboot server. }
450 NERR_CantOpenImageFile = (NERR_BASE+414); { Cannot open image file on the Remoteboot server. }
451 NERR_CallingRplSrvr = (NERR_BASE+415); { Connecting to the Remoteboot server... }
452 NERR_StartingRplBoot = (NERR_BASE+416); { Connecting to the Remoteboot server... }
453 NERR_RplBootServiceTerm = (NERR_BASE+417); { Remote boot service was stopped; check the error log for the cause of the problem. }
454 NERR_RplBootStartFailed = (NERR_BASE+418); { Remote boot startup failed; check the error log for the cause of the problem. }
455 NERR_RPL_CONNECTED = (NERR_BASE+419); { A second connection to a Remoteboot resource is not allowed. }
456
457 { FTADMIN API error codes (NERR_BASE + (425-434)) }
458 { (Currently not used in NT) }
459
460 { Browser service API error codes (NERR_BASE + (450-475)) }
461
462 NERR_BrowserConfiguredToNotRun= (NERR_BASE+450); { * The browser service was configured with MaintainServerList=No. }
463
464 { Additional Remoteboot error codes. (NERR_BASE + (510-550)) }
465
466 NERR_RplNoAdaptersStarted = (NERR_BASE+510); { Service failed to start since none of the network adapters started with this service. }
467 NERR_RplBadRegistry = (NERR_BASE+511); { Service failed to start due to bad startup information in the registry. }
468 NERR_RplBadDatabase = (NERR_BASE+512); { Service failed to start because its database is absent or corrupt. }
469 NERR_RplRplfilesShare = (NERR_BASE+513); { Service failed to start because RPLFILES share is absent. }
470 NERR_RplNotRplServer = (NERR_BASE+514); { Service failed to start because RPLUSER group is absent. }
471 NERR_RplCannotEnum = (NERR_BASE+515); { Cannot enumerate service records. }
472 NERR_RplWkstaInfoCorrupted = (NERR_BASE+516); { Workstation record information has been corrupted. }
473 NERR_RplWkstaNotFound = (NERR_BASE+517); { Workstation record was not found. }
474 NERR_RplWkstaNameUnavailable = (NERR_BASE+518); { Workstation name is in use by some other workstation. }
475 NERR_RplProfileInfoCorrupted = (NERR_BASE+519); { Profile record information has been corrupted. }
476 NERR_RplProfileNotFound = (NERR_BASE+520); { Profile record was not found. }
477 NERR_RplProfileNameUnavailable = (NERR_BASE+521); { Profile name is in use by some other profile. }
478 NERR_RplProfileNotEmpty = (NERR_BASE+522); { There are workstations using this profile. }
479 NERR_RplConfigInfoCorrupted = (NERR_BASE+523); { Configuration record information has been corrupted. }
480 NERR_RplConfigNotFound = (NERR_BASE+524); { Configuration record was not found. }
481 NERR_RplAdapterInfoCorrupted = (NERR_BASE+525); { Adapter id record information has been corrupted. }
482 NERR_RplInternal = (NERR_BASE+526); { An internal service error has occured. }
483 NERR_RplVendorInfoCorrupted = (NERR_BASE+527); { Vendor id record information has been corrupted. }
484 NERR_RplBootInfoCorrupted = (NERR_BASE+528); { Boot block record information has been corrupted. }
485 NERR_RplWkstaNeedsUserAcct = (NERR_BASE+529); { The user account for this workstation record is missing. }
486 NERR_RplNeedsRPLUSERAcct = (NERR_BASE+530); { The RPLUSER local group could not be found. }
487 NERR_RplBootNotFound = (NERR_BASE+531); { Boot block record was not found. }
488 NERR_RplIncompatibleProfile = (NERR_BASE+532); { Chosen profile is incompatible with this workstation. }
489 NERR_RplAdapterNameUnavailable = (NERR_BASE+533); { Chosen network adapter id is in use by some other workstation. }
490 NERR_RplConfigNotEmpty = (NERR_BASE+534); { There are profiles using this configuration. }
491 NERR_RplBootInUse = (NERR_BASE+535); { There are workstations, profiles or configurations using this boot block. }
492 NERR_RplBackupDatabase = (NERR_BASE+536); { Service failed to backup remoteboot database. }
493 NERR_RplAdapterNotFound = (NERR_BASE+537); { Adapter record was not found. }
494 NERR_RplVendorNotFound = (NERR_BASE+538); { Vendor record was not found. }
495 NERR_RplVendorNameUnavailable = (NERR_BASE+539); { Vendor name is in use by some other vendor record. }
496 NERR_RplBootNameUnavailable = (NERR_BASE+540); { (boot name, vendor id) is in use by some other boot block record. }
497 NERR_RplConfigNameUnavailable = (NERR_BASE+541); { Configuration name is in use by some other configuration. }
498
499 { INTERNAL_ONLY }
500
501 { Dfs API error codes. (NERR_BASE + (560-590)) }
502
503 NERR_DfsInternalCorruption = (NERR_BASE+560); { The internal database maintained by the Dfs service is corrupt }
504 NERR_DfsVolumeDataCorrupt = (NERR_BASE+561); { One of the records in the internal Dfs database is corrupt }
505 NERR_DfsNoSuchVolume = (NERR_BASE+562); { There is no volume whose entry path matches the input Entry Path }
506 NERR_DfsVolumeAlreadyExists = (NERR_BASE+563); { A volume with the given name already exists }
507 NERR_DfsAlreadyShared = (NERR_BASE+564); { The server share specified is already shared in the Dfs }
508 NERR_DfsNoSuchShare = (NERR_BASE+565); { The indicated server share does not support the indicated Dfs volume }
509 NERR_DfsNotALeafVolume = (NERR_BASE+566); { The operation is not valid on a non-leaf volume }
510 NERR_DfsLeafVolume = (NERR_BASE+567); { The operation is not valid on a leaf volume }
511 NERR_DfsVolumeHasMultipleServers = (NERR_BASE+568); { The operation is ambiguous because the volume has multiple servers }
512 NERR_DfsCantCreateJunctionPoint= (NERR_BASE+569); { Unable to create a junction point }
513 NERR_DfsServerNotDfsAware = (NERR_BASE+570); { The server is not Dfs Aware }
514 NERR_DfsBadRenamePath = (NERR_BASE+571); { The specified rename target path is invalid }
515 NERR_DfsVolumeIsOffline = (NERR_BASE+572); { The specified Dfs volume is offline }
516 NERR_DfsNoSuchServer = (NERR_BASE+573); { The specified server is not a server for this volume }
517 NERR_DfsCyclicalName = (NERR_BASE+574); { A cycle in the Dfs name was detected }
518 NERR_DfsNotSupportedInServerDfs= (NERR_BASE+575); { The operation is not supported on a server-based Dfs }
519 NERR_DfsInternalError = (NERR_BASE+590); { Dfs internal error }
520
521 { ***********WARNING **************** }
522 { *The range 2750-2799 has been * }
523 { *allocated to the IBM LAN Server * }
524 { *********************************** }
525
526 { ***********WARNING **************** }
527 { *The range 2900-2999 has been * }
528 { *reserved for Microsoft OEMs * }
529 { *********************************** }
530
531 { END_INTERNAL* }
532
533 MAX_NERR = (NERR_BASE+899); { This is the last error in NERR range. }
534
535 { WARNING: Do not exceed MAX_NERR; values above this are used by }
536 { other error code ranges (errlog.h, service.h, apperr.h). }
537
538
539 {-------------------- LMCONS.H ----------------------------------------------}
540 const
541 CNLEN = 15; { Computer name length }
542 LM20_CNLEN = 15; { LM 2.0 Computer name length }
543 DNLEN = CNLEN; { Maximum domain name length }
544 LM20_DNLEN = LM20_CNLEN; { LM 2.0 Maximum domain name length }
545
546 UNCLEN = (CNLEN+2); { UNC computer name length }
547 LM20_UNCLEN = (LM20_CNLEN+2); { LM 2.0 UNC computer name length }
548
549 NNLEN = 80; { Net name length (share name) }
550 LM20_NNLEN = 12; { LM 2.0 Net name length }
551
552 RMLEN = (UNCLEN+1+NNLEN); { Max remote name length }
553 LM20_RMLEN = (LM20_UNCLEN+1+LM20_NNLEN); { LM 2.0 Max remote name length }
554
555 SNLEN = 80; { Service name length }
556 LM20_SNLEN = 15; { LM 2.0 Service name length }
557 STXTLEN = 256; { Service text length }
558 LM20_STXTLEN= 63; { LM 2.0 Service text length }
559
560 PATHLEN = 256; { Max. path (not including drive name) }
561 LM20_PATHLEN= 256; { LM 2.0 Max. path }
562
563 DEVLEN = 80; { Device name length }
564 LM20_DEVLEN = 8; { LM 2.0 Device name length }
565
566 EVLEN = 16; { Event name length }
567
568
569 { User, Group and Password lengths }
570
571
572 UNLEN = 256; { Maximum user name length }
573 LM20_UNLEN = 20; { LM 2.0 Maximum user name length }
574
575 GNLEN = UNLEN; { Group name }
576 LM20_GNLEN = LM20_UNLEN; { LM 2.0 Group name }
577
578 PWLEN = 256; { Maximum password length }
579 LM20_PWLEN = 14; { LM 2.0 Maximum password length }
580
581 SHPWLEN = 8; { Share password length (bytes) }
582
583 CLTYPE_LEN = 12; { Length of client type string }
584
585 MAXCOMMENTSZ = 256; { Multipurpose comment length }
586 LM20_MAXCOMMENTSZ = 48; { LM 2.0 Multipurpose comment length }
587
588 QNLEN = NNLEN; { Queue name maximum length }
589 LM20_QNLEN = LM20_NNLEN; { LM 2.0 Queue name maximum length }
590
591 { The ALERTSZ and MAXDEVENTRIES defines have not yet been NT'ized. }
592 { Whoever ports these components should change these values appropriately. }
593
594 ALERTSZ = 128; { size of alert string in server }
595 MAXDEVENTRIES = SizeOf(Integer)*8;{ Max number of device entries }
596
597 NETBIOS_NAME_LEN = 16; { NetBIOS net name (bytes) }
598
599 { Value to be used with APIs which have a "preferred maximum length" }
600 { parameter. This value indicates that the API should just allocate }
601 { "as much as it takes." }
602
603 MAX_PREFERRED_LENGTH = DWord(-1);
604
605 { Constants used with encryption }
606
607 CRYPT_KEY_LEN = 7;
608 CRYPT_TXT_LEN = 8;
609 ENCRYPTED_PWLEN = 16;
610 SESSION_PWLEN = 24;
611 SESSION_CRYPT_KLEN = 21;
612
613 { Value to be used with SetInfo calls to allow setting of all }
614 { settable parameters (parmnum zero option) }
615 PARMNUM_ALL = 0;
616
617 PARM_ERROR_UNKNOWN = DWord(-1);
618 PARM_ERROR_NONE = 0;
619 PARMNUM_BASE_INFOLEVEL = 1000;
620
621 { Message File Names }
622
623 MESSAGE_FILENAME = 'NETMSG';
624 OS2MSG_FILENAME = 'BASE';
625 HELP_MSG_FILENAME = 'NETH';
626
627 {**INTERNAL_ONLY }
628
629 { The backup message file named here is a duplicate of net.msg. It }
630 { is not shipped with the product, but is used at buildtime to }
631 { msgbind certain messages to netapi.dll and some of the services. }
632 { This allows for OEMs to modify the message text in net.msg and }
633 { have those changes show up. Only in case there is an error in }
634 { retrieving the messages from net.msg do we then get the bound }
635 { messages out of bak.msg (really out of the message segment). }
636
637 BACKUP_MSG_FILENAME = 'BAK.MSG';
638
639 {**END_INTERNAL }
640
641 { Keywords used in Function Prototypes }
642
643 type
644 NET_API_STATUS = DWord;
645 API_RET_TYPE = NET_API_STATUS; { Old value: do not use }
646
647 { The platform ID indicates the levels to use for platform-specific }
648 { information. }
649
650 const
651 PLATFORM_ID_DOS = 300;
652 PLATFORM_ID_OS2 = 400;
653 PLATFORM_ID_NT = 500;
654 PLATFORM_ID_OSF = 600;
655 PLATFORM_ID_VMS = 700;
656
657 { There message numbers assigned to different LANMAN components }
658 { are as defined below. }
659
660 { lmerr.h: 2100 - 2999 NERR_BASE }
661 { alertmsg.h: 3000 - 3049 ALERT_BASE }
662 { lmsvc.h: 3050 - 3099 SERVICE_BASE }
663 { lmerrlog.h: 3100 - 3299 ERRLOG_BASE }
664 { msgtext.h: 3300 - 3499 MTXT_BASE }
665 { apperr.h: 3500 - 3999 APPERR_BASE }
666 { apperrfs.h: 4000 - 4299 APPERRFS_BASE }
667 { apperr2.h: 4300 - 5299 APPERR2_BASE }
668 { ncberr.h: 5300 - 5499 NRCERR_BASE }
669 { alertmsg.h: 5500 - 5599 ALERT2_BASE }
670 { lmsvc.h: 5600 - 5699 SERVICE2_BASE }
671 { lmerrlog.h 5700 - 5799 ERRLOG2_BASE }
672
673 MIN_LANMAN_MESSAGE_ID = NERR_BASE;
674 MAX_LANMAN_MESSAGE_ID = 5799;
675
676 {-------------------- LMACCESS.H --------------------------------------------}
677 type
678 TNetUserAdd = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
679 TNetUserEnum = function(ServerName: LPCWSTR; Level, Filter: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
680 TNetUserGetInfo = function(ServerName, UserName: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
681 TNetUserSetInfo = function(ServerName, UserName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
682 TNetUserDel = function(ServerName, UserName: LPCWSTR): NET_API_STATUS; stdcall;
683 TNetUserGetGroups = function(ServerName, UserName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries : DWord): NET_API_STATUS; stdcall;
684 TNetUserSetGroups = function(ServerName, UserName: LPCWSTR; Level: DWord; Buffer: Pointer; NumEntries: DWord): NET_API_STATUS; stdcall;
685 TNetUserGetLocalGroups = function(ServerName, UserName: LPCWSTR; Level: DWord; Flags: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries : DWord): NET_API_STATUS; stdcall;
686 TNetUserModalsGet = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
687 TNetUserModalsSet = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
688 TNetUserChangePassword = function(DomainName, UserName, OldPassword, NewPassword: LPCWSTR): NET_API_STATUS; stdcall;
689
690 TNetGroupAdd = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
691 TNetGroupAddUser = function(ServerName, GroupName, UserName: LPCWSTR): NET_API_STATUS; stdcall;
692 TNetGroupEnum = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
693 TNetGroupGetInfo = function(ServerName, GroupName: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
694 TNetGroupSetInfo = function(ServerName, GroupName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
695 TNetGroupDel = function(ServerName, GroupName: LPCWSTR): NET_API_STATUS; stdcall;
696 TNetGroupDelUser = function(ServerName, GroupName, UserName: LPCWSTR): NET_API_STATUS; stdcall;
697 TNetGroupGetUsers = function(ServerName, GroupName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ResumeHandle: Pointer): NET_API_STATUS; stdcall;
698 TNetGroupSetUsers = function(ServerName, GroupName: LPCWSTR; Level: DWord; Buffer: Pointer; var TotalEntries : DWord): NET_API_STATUS; stdcall;
699
700 TNetLocalGroupAdd = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
701 TNetLocalGroupAddMember = function(ServerName, GroupName: LPCWSTR; MembersID: PSID): NET_API_STATUS; stdcall;
702 TNetLocalGroupEnum = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; var ResumeHandle: DWord): NET_API_STATUS; stdcall;
703 TNetLocalGroupGetInfo = function(ServerName, GroupName: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
704 TNetLocalGroupSetInfo = function(ServerName, GroupName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
705 TNetLocalGroupDel = function(ServerName, GroupName: LPCWSTR): NET_API_STATUS; stdcall;
706 TNetLocalGroupDelMember = function(ServerName, GroupName: LPCWSTR; MembersID: PSID): NET_API_STATUS; stdcall;
707 TNetLocalGroupGetMembers = function(ServerName, GroupName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ResumeHandle: Pointer): NET_API_STATUS; stdcall;
708 TNetLocalGroupSetMembers = function(ServerName, GroupName: LPCWSTR; Level: DWord; Buffer: Pointer; var TotalEntries: DWord): NET_API_STATUS; stdcall;
709 TNetLocalGroupAddMembers = function(ServerName, GroupName: LPCWSTR; Level: DWord; Buffer: Pointer; TotalEntries: DWord): NET_API_STATUS; stdcall;
710 TNetLocalGroupDelMembers = function(ServerName, GroupName: LPCWSTR; Level: DWord; Buffer: Pointer; TotalEntries: DWord): NET_API_STATUS; stdcall;
711
712 TNetQueryDisplayInformation = function(ServerName: LPCWSTR; Level, Index, EntriesRequested, PrefMaxLen: DWord; var ReturnedCount: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
713 TNetGetDisplayInformationIndex = function(ServerName: LPCWSTR; Level: DWord; Prefix: LPCWSTR; var Index: DWord): NET_API_STATUS; stdcall;
714
715 TNetAccessAdd = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
716 TNetAccessEnum = function(ServerName, BasePath: LPCWSTR; Recursive, Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
717 TNetAccessGetInfo = function(ServerName, Resource: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
718 TNetAccessSetInfo = function(ServerName, Resource: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
719 TNetAccessDel = function(ServerName, Resource: LPCWSTR): NET_API_STATUS; stdcall;
720 TNetAccessGetUserPerms = function(ServerName, UGname, Resource: LPCWSTR; var Perms: DWord): NET_API_STATUS; stdcall;
721
722 TNetGetDCName = function(ServerName, DomainName: LPCWSTR; var Buffer: Pointer): NET_API_STATUS; stdcall;
723 TNetGetAnyDCName = function(ServerName, DomainName: LPCWSTR; var Buffer: PByte): NET_API_STATUS; stdcall;
724 TI_NetLogonControl = function(ServerName: LPCWSTR; FunctionCode, QueryLevel: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
725 TI_NetLogonControl2 = function(ServerName: LPCWSTR; FunctionCode, QueryLevel: DWord; Data: Pointer; var Buffer: Pointer): NET_API_STATUS; stdcall;
726 TNetEnumerateTrustedDomains = function(ServerName: LPCWSTR; var Buffer: Pointer): LongInt; StdCall;
727
728 const
729 USER_POSIX_ID_PARMNUM = 1;
730 GROUP_POSIX_ID_PARMNUM = 1;
731
732 type
733 PUSER_INFO_0 = ^TUSER_INFO_0;
734 TUSER_INFO_0 = record
735 usri0_name : LPWSTR;
736 end;
737
738 PUSER_INFO_1 = ^TUSER_INFO_1;
739 TUSER_INFO_1 = record
740 usri1_name : LPWSTR;
741 usri1_password : LPWSTR{LPSTR};
742 usri1_password_age : DWord;
743 usri1_priv : DWord;
744 usri1_home_dir : LPWSTR;
745 usri1_comment : LPWSTR;
746 usri1_flags : DWord;
747 usri1_script_path : LPWSTR;
748 end;
749
750 PUSER_INFO_2 = ^TUSER_INFO_2;
751 TUSER_INFO_2 = record
752 usri2_name : LPWSTR;
753 usri2_password : LPWSTR;
754 usri2_password_age : DWord;
755 usri2_priv : DWord;
756 usri2_home_dir : LPWSTR;
757 usri2_comment : LPWSTR;
758 usri2_flags : DWord;
759 usri2_script_path : LPWSTR;
760 usri2_auth_flags : DWord;
761 usri2_full_name : LPWSTR;
762 usri2_usr_comment : LPWSTR;
763 usri2_parms : LPWSTR;
764 usri2_workstations : LPWSTR;
765 usri2_last_logon : DWord;
766 usri2_last_logoff : DWord;
767 usri2_acct_expires : DWord;
768 usri2_max_storage : DWord;
769 usri2_units_per_week : DWord;
770 usri2_logon_hours : PByte;
771 usri2_bad_pw_count : DWord;
772 usri2_num_logons : DWord;
773 usri2_logon_server : LPWSTR;
774 usri2_country_code : DWord;
775 usri2_code_page : DWord;
776 end;
777
778 PUSER_INFO_3 = ^TUSER_INFO_3;
779 TUSER_INFO_3 = record
780 usri3_name : LPWSTR;
781 usri3_password : LPWSTR;
782 usri3_password_age : DWord;
783 usri3_priv : DWord;
784 usri3_home_dir : LPWSTR;
785 usri3_comment : LPWSTR;
786 usri3_flags : DWord;
787 usri3_script_path : LPWSTR;
788 usri3_auth_flags : DWord;
789 usri3_full_name : LPWSTR;
790 usri3_usr_comment : LPWSTR;
791 usri3_parms : LPWSTR;
792 usri3_workstations : LPWSTR;
793 usri3_last_logon : DWord;
794 usri3_last_logoff : DWord;
795 usri3_acct_expires : DWord;
796 usri3_max_storage : DWord;
797 usri3_units_per_week : DWord;
798 usri3_logon_hours : Pointer;
799 usri3_bad_pw_count : DWord;
800 usri3_num_logons : DWord;
801 usri3_logon_server : LPWSTR;
802 usri3_country_code : DWord;
803 usri3_code_page : DWord;
804 usri3_user_id : DWord;
805 usri3_primary_group_id: DWord;
806 usri3_profile : LPWSTR;
807 usri3_home_dir_drive : LPWSTR;
808 usri3_password_expired: DWord;
809 end;
810
811 PUSER_INFO_10 = ^TUSER_INFO_10;
812 TUSER_INFO_10 = record
813 usri10_name : LPWSTR;
814 usri10_comment : LPWSTR;
815 usri10_usr_comment : LPWSTR;
816 usri10_full_name : LPWSTR;
817 end;
818
819 PUSER_INFO_11 = ^TUSER_INFO_11;
820 TUSER_INFO_11 = record
821 usri11_name : LPWSTR;
822 usri11_comment : LPWSTR;
823 usri11_usr_comment : LPWSTR;
824 usri11_full_name : LPWSTR;
825 usri11_priv : DWord;
826 usri11_auth_flags : DWord;
827 usri11_password_age : DWord;
828 usri11_home_dir : LPWSTR;
829 usri11_parms : LPWSTR;
830 usri11_last_logon : DWord;
831 usri11_last_logoff : DWord;
832 usri11_bad_pw_count : DWord;
833 usri11_num_logons : DWord;
834 usri11_logon_server : LPWSTR;
835 usri11_country_code : DWord;
836 usri11_workstations : LPWSTR;
837 usri11_max_storage : DWord;
838 usri11_units_per_week : DWord;
839 usri11_logon_hours : PByte;
840 usri11_code_page : DWord;
841 end;
842
843 PUSER_INFO_20 = ^TUSER_INFO_20;
844 TUSER_INFO_20 = record
845 usri20_name : LPWSTR;
846 usri20_full_name : LPWSTR;
847 usri20_comment : LPWSTR;
848 usri20_flags : DWord;
849 usri20_user_id : DWord;
850 end;
851
852 PUSER_INFO_21 = ^TUSER_INFO_21;
853 TUSER_INFO_21 = record
854 usri21_password : array[0..ENCRYPTED_PWLEN-1] of byte;
855 end;
856
857 PUSER_INFO_22 = ^TUSER_INFO_22;
858 TUSER_INFO_22 = record
859 usri22_name : LPWSTR;
860 usri22_password : array[0..ENCRYPTED_PWLEN-1] of byte;
861 usri22_password_age : DWord;
862 usri22_priv : DWord;
863 usri22_home_dir : LPWSTR;
864 usri22_comment : LPWSTR;
865 usri22_flags : DWord;
866 usri22_script_path : LPWSTR;
867 usri22_auth_flags : DWord;
868 usri22_full_name : LPWSTR;
869 usri22_usr_comment : LPWSTR;
870 usri22_parms : LPWSTR;
871 usri22_workstations : LPWSTR;
872 usri22_last_logon : DWord;
873 usri22_last_logoff : DWord;
874 usri22_acct_expires : DWord;
875 usri22_max_storage : DWord;
876 usri22_units_per_week : DWord;
877 usri22_logon_hours : PByte;
878 usri22_bad_pw_count : DWord;
879 usri22_num_logons : DWord;
880 usri22_logon_server : LPWSTR;
881 usri22_country_code : DWord;
882 usri22_code_page : DWord;
883 end;
884
885 PUSER_INFO_1003 = ^TUSER_INFO_1003;
886 TUSER_INFO_1003 = record
887 usri1003_password: LPWSTR;
888 end;
889
890 PUSER_INFO_1005 = ^TUSER_INFO_1005;
891 TUSER_INFO_1005 = record
892 usri1005_priv : DWord;
893 end;
894
895 PUSER_INFO_1006 = ^TUSER_INFO_1006;
896 TUSER_INFO_1006 = record
897 usri1006_home_dir: LPWSTR;
898 end;
899
900 PUSER_INFO_1007 = ^TUSER_INFO_1007;
901 TUSER_INFO_1007 = record
902 usri1007_comment : LPWSTR;
903 end;
904
905 PUSER_INFO_1008 = ^TUSER_INFO_1008;
906 TUSER_INFO_1008 = record
907 usri1008_flags: DWord;
908 end;
909
910 PUSER_INFO_1009 = ^TUSER_INFO_1009;
911 TUSER_INFO_1009 = record
912 usri1009_script_path: LPWSTR;
913 end;
914
915 PUSER_INFO_1010 = ^TUSER_INFO_1010;
916 TUSER_INFO_1010 = record
917 usri1010_auth_flags: DWord;
918 end;
919
920 PUSER_INFO_1011 = ^TUSER_INFO_1011;
921 TUSER_INFO_1011 = record
922 usri1011_full_name : LPWSTR;
923 end;
924
925 PUSER_INFO_1012 = ^TUSER_INFO_1012;
926 TUSER_INFO_1012 = record
927 usri1012_usr_comment : LPWSTR;
928 end;
929
930 PUSER_INFO_1013 = ^TUSER_INFO_1013;
931 TUSER_INFO_1013 = record
932 usri1013_parms : LPWSTR;
933 end;
934
935 PUSER_INFO_1014 = ^TUSER_INFO_1014;
936 TUSER_INFO_1014 = record
937 usri1014_workstations : LPWSTR;
938 end;
939
940 PUSER_INFO_1017 = ^TUSER_INFO_1017;
941 TUSER_INFO_1017 = record
942 usri1017_acct_expires : DWord;
943 end;
944
945 PUSER_INFO_1018 = ^TUSER_INFO_1018;
946 TUSER_INFO_1018 = record
947 usri1018_max_storage: DWord;
948 end;
949
950 PUSER_INFO_1020 = ^TUSER_INFO_1020;
951 TUSER_INFO_1020 = record
952 usri1020_units_per_week : DWord;
953 usri1020_logon_hours: PByte;
954 end;
955
956 PUSER_INFO_1023 = ^TUSER_INFO_1023;
957 TUSER_INFO_1023 = record
958 usri1023_logon_server : LPWSTR;
959 end;
960
961 PUSER_INFO_1024 = ^TUSER_INFO_1024;
962 TUSER_INFO_1024 = record
963 usri1024_country_code: DWord;
964 end;
965
966 PUSER_INFO_1025 = ^TUSER_INFO_1025;
967 TUSER_INFO_1025 = record
968 usri1025_code_page: DWord;
969 end;
970
971 PUSER_INFO_1051 = ^TUSER_INFO_1051;
972 TUSER_INFO_1051 = record
973 usri1051_primary_group_id: DWord;
974 end;
975
976 PUSER_INFO_1052 = ^TUSER_INFO_1052;
977 TUSER_INFO_1052 = record
978 usri1052_profile : LPWSTR;
979 end;
980
981 PUSER_INFO_1053 = ^TUSER_INFO_1053;
982 TUSER_INFO_1053 = record
983 usri1053_home_dir_drive : LPWSTR;
984 end;
985
986 PUSER_MODALS_INFO_0 = ^TUSER_MODALS_INFO_0;
987 TUSER_MODALS_INFO_0 = record
988 usrmod0_min_passwd_len : DWord;
989 usrmod0_max_passwd_age : DWord;
990 usrmod0_min_passwd_age : DWord;
991 usrmod0_force_logoff : DWord;
992 usrmod0_password_hist_len : DWord;
993 end;
994
995 PUSER_MODALS_INFO_1 = ^TUSER_MODALS_INFO_1;
996 TUSER_MODALS_INFO_1 = record
997 usrmod1_role : DWord;
998 usrmod1_primary : LPWSTR;
999 end;
1000
1001 PUSER_MODALS_INFO_2 = ^TUSER_MODALS_INFO_2;
1002 TUSER_MODALS_INFO_2 = record
1003 usrmod2_domain_name : LPWSTR;
1004 usrmod2_domain_id : PSID;
1005 end;
1006
1007 PUSER_MODALS_INFO_3 = ^TUSER_MODALS_INFO_3;
1008 TUSER_MODALS_INFO_3 = record
1009 usrmod3_lockout_duration : DWord;
1010 usrmod3_lockout_observation_window : DWord;
1011 usrmod3_lockout_threshold : DWord;
1012 end;
1013
1014 PUSER_MODALS_INFO_1001 = ^TUSER_MODALS_INFO_1001;
1015 TUSER_MODALS_INFO_1001 = record
1016 usrmod1001_min_passwd_len : DWord;
1017 end;
1018
1019 PUSER_MODALS_INFO_1002 = ^TUSER_MODALS_INFO_1002;
1020 TUSER_MODALS_INFO_1002 = record
1021 usrmod1002_max_passwd_age : DWord;
1022 end;
1023
1024 PUSER_MODALS_INFO_1003 = ^TUSER_MODALS_INFO_1003;
1025 TUSER_MODALS_INFO_1003 = record
1026 usrmod1003_min_passwd_age : DWord;
1027 end;
1028
1029 PUSER_MODALS_INFO_1004 = ^TUSER_MODALS_INFO_1004;
1030 TUSER_MODALS_INFO_1004 = record
1031 usrmod1004_force_logoff : DWord;
1032 end;
1033
1034 PUSER_MODALS_INFO_1005 = ^TUSER_MODALS_INFO_1005;
1035 TUSER_MODALS_INFO_1005 = record
1036 usrmod1005_password_hist_len : DWord;
1037 end;
1038
1039 PUSER_MODALS_INFO_1006 = ^TUSER_MODALS_INFO_1006;
1040 TUSER_MODALS_INFO_1006 = record
1041 usrmod1006_role : DWord;
1042 end;
1043
1044 PUSER_MODALS_INFO_1007 = ^TUSER_MODALS_INFO_1007;
1045 TUSER_MODALS_INFO_1007 = record
1046 usrmod1007_primary : LPWSTR;
1047 end;
1048
1049 const
1050 { Bit masks for field usriX_flags of USER_INFO_X (X = 0/1). }
1051 UF_SCRIPT = $0001;
1052 UF_ACCOUNTDISABLE = $0002;
1053 UF_HOMEDIR_REQUIRED = $0008;
1054 UF_LOCKOUT = $0010;
1055 UF_PASSWD_NOTREQD = $0020;
1056 UF_PASSWD_CANT_CHANGE = $0040;
1057
1058 { Account type bits as part of usri_flags. }
1059 UF_TEMP_DUPLICATE_ACCOUNT = $0100;
1060 UF_NORMAL_ACCOUNT = $0200;
1061 UF_INTERDOMAIN_TRUST_ACCOUNT = $0800;
1062 UF_WORKSTATION_TRUST_ACCOUNT = $1000;
1063 UF_SERVER_TRUST_ACCOUNT = $2000;
1064
1065 UF_MACHINE_ACCOUNT_MASK = (UF_INTERDOMAIN_TRUST_ACCOUNT or
1066 UF_WORKSTATION_TRUST_ACCOUNT or
1067 UF_SERVER_TRUST_ACCOUNT);
1068
1069 UF_ACCOUNT_TYPE_MASK = (UF_TEMP_DUPLICATE_ACCOUNT or
1070 UF_NORMAL_ACCOUNT or
1071 UF_INTERDOMAIN_TRUST_ACCOUNT or
1072 UF_WORKSTATION_TRUST_ACCOUNT or
1073 UF_SERVER_TRUST_ACCOUNT);
1074
1075 UF_DONT_EXPIRE_PASSWD = $10000;
1076 UF_MNS_LOGON_ACCOUNT = $20000;
1077
1078
1079 UF_SETTABLE_BITS = (UF_SCRIPT or
1080 UF_ACCOUNTDISABLE or
1081 UF_LOCKOUT or
1082 UF_HOMEDIR_REQUIRED or
1083 UF_PASSWD_NOTREQD or
1084 UF_PASSWD_CANT_CHANGE or
1085 UF_ACCOUNT_TYPE_MASK or
1086 UF_DONT_EXPIRE_PASSWD or
1087 UF_MNS_LOGON_ACCOUNT);
1088
1089 { bit masks for the NetUserEnum filter parameter. }
1090 FILTER_TEMP_DUPLICATE_ACCOUNT = $0001;
1091 FILTER_NORMAL_ACCOUNT = $0002;
1092 {FILTER_PROXY_ACCOUNT = $0004;}
1093 FILTER_INTERDOMAIN_TRUST_ACCOUNT = $0008;
1094 FILTER_WORKSTATION_TRUST_ACCOUNT = $0010;
1095 FILTER_SERVER_TRUST_ACCOUNT = $0020;
1096
1097 { bit masks for the NetUserGetLocalGroups flags }
1098 LG_INCLUDE_INDIRECT = $0001;
1099
1100 { Bit masks for field usri2_auth_flags of USER_INFO_2. }
1101 AF_OP_PRINT = $1;
1102 AF_OP_COMM = $2;
1103 AF_OP_SERVER = $4;
1104 AF_OP_ACCOUNTS = $8;
1105 AF_SETTABLE_BITS = (AF_OP_PRINT or AF_OP_COMM or
1106 AF_OP_SERVER or AF_OP_ACCOUNTS);
1107
1108 { UAS role manifests under NETLOGON }
1109 UAS_ROLE_STANDALONE = 0;
1110 UAS_ROLE_MEMBER = 1;
1111 UAS_ROLE_BACKUP = 2;
1112 UAS_ROLE_PRIMARY = 3;
1113
1114 { Values for ParmError for NetUserSetInfo. }
1115 USER_NAME_PARMNUM = 1;
1116 USER_PASSWORD_PARMNUM = 3;
1117 USER_PASSWORD_AGE_PARMNUM = 4;
1118 USER_PRIV_PARMNUM = 5;
1119 USER_HOME_DIR_PARMNUM = 6;
1120 USER_COMMENT_PARMNUM = 7;
1121 USER_FLAGS_PARMNUM = 8;
1122 USER_SCRIPT_PATH_PARMNUM = 9;
1123 USER_AUTH_FLAGS_PARMNUM = 10;
1124 USER_FULL_NAME_PARMNUM = 11;
1125 USER_USR_COMMENT_PARMNUM = 12;
1126 USER_PARMS_PARMNUM = 13;
1127 USER_WORKSTATIONS_PARMNUM = 14;
1128 USER_LAST_LOGON_PARMNUM = 15;
1129 USER_LAST_LOGOFF_PARMNUM = 16;
1130 USER_ACCT_EXPIRES_PARMNUM = 17;
1131 USER_MAX_STORAGE_PARMNUM = 18;
1132 USER_UNITS_PER_WEEK_PARMNUM = 19;
1133 USER_LOGON_HOURS_PARMNUM = 20;
1134 USER_PAD_PW_COUNT_PARMNUM = 21;
1135 USER_NUM_LOGONS_PARMNUM = 22;
1136 USER_LOGON_SERVER_PARMNUM = 23;
1137 USER_COUNTRY_CODE_PARMNUM = 24;
1138 USER_CODE_PAGE_PARMNUM = 25;
1139 USER_PRIMARY_GROUP_PARMNUM = 51;
1140 USER_PROFILE = 52;
1141 USER_PROFILE_PARMNUM = 52;
1142 USER_HOME_DIR_DRIVE_PARMNUM = 53;
1143
1144 { the new infolevel counterparts of the old info level + parmnum }
1145 USER_NAME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_NAME_PARMNUM);
1146 USER_PASSWORD_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_PARMNUM);
1147 USER_PASSWORD_AGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_AGE_PARMNUM);
1148 USER_PRIV_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_PRIV_PARMNUM);
1149 USER_HOME_DIR_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_PARMNUM);
1150 USER_COMMENT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_COMMENT_PARMNUM);
1151 USER_FLAGS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_FLAGS_PARMNUM);
1152 USER_SCRIPT_PATH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_SCRIPT_PATH_PARMNUM);
1153 USER_AUTH_FLAGS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_AUTH_FLAGS_PARMNUM);
1154 USER_FULL_NAME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_FULL_NAME_PARMNUM);
1155 USER_USR_COMMENT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_USR_COMMENT_PARMNUM);
1156 USER_PARMS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_PARMS_PARMNUM);
1157 USER_WORKSTATIONS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_WORKSTATIONS_PARMNUM);
1158 USER_LAST_LOGON_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGON_PARMNUM);
1159 USER_LAST_LOGOFF_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGOFF_PARMNUM);
1160 USER_ACCT_EXPIRES_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_ACCT_EXPIRES_PARMNUM);
1161 USER_MAX_STORAGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_MAX_STORAGE_PARMNUM);
1162 USER_UNITS_PER_WEEK_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_UNITS_PER_WEEK_PARMNUM);
1163 USER_LOGON_HOURS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_LOGON_HOURS_PARMNUM);
1164 USER_PAD_PW_COUNT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_PAD_PW_COUNT_PARMNUM);
1165 USER_NUM_LOGONS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_NUM_LOGONS_PARMNUM);
1166 USER_LOGON_SERVER_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_LOGON_SERVER_PARMNUM);
1167 USER_COUNTRY_CODE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_COUNTRY_CODE_PARMNUM);
1168 USER_CODE_PAGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_CODE_PAGE_PARMNUM);
1169 USER_PRIMARY_GROUP_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_PRIMARY_GROUP_PARMNUM);
1170 USER_POSIX_ID_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_POSIX_ID_PARMNUM);
1171 USER_HOME_DIR_DRIVE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_DRIVE_PARMNUM);
1172
1173 { For SetInfo call (parmnum 0) when password change not required }
1174 NULL_USERSETINFO_PASSWD = ' ';
1175
1176 TIMEQ_FOREVER = ULong(-1);
1177 USER_MAXSTORAGE_UNLIMITED = ULong(-1);
1178 USER_NO_LOGOFF = ULong(-1);
1179 UNITS_PER_DAY = 24;
1180 UNITS_PER_WEEK = UNITS_PER_DAY * 7;
1181
1182 { Privilege levels (USER_INFO_X field usriX_priv (X = 0/1)). }
1183 USER_PRIV_MASK = $3;
1184 USER_PRIV_GUEST = 0;
1185 USER_PRIV_USER = 1;
1186 USER_PRIV_ADMIN = 2;
1187
1188 { user modals related defaults }
1189 MAX_PASSWD_LEN = PWLEN;
1190 DEF_MIN_PWLEN = 6;
1191 DEF_PWUNIQUENESS = 5;
1192 DEF_MAX_PWHIST = 8;
1193
1194 DEF_MAX_PWAGE = TIMEQ_FOREVER; { forever }
1195 DEF_MIN_PWAGE = ULong(0); { 0 days }
1196 DEF_FORCE_LOGOFF = ULong($ffffffff); { never }
1197 DEF_MAX_BADPW = 0; { no limit }
1198 ONE_DAY = ULong(01*24*3600); { 01 day }
1199
1200 { User Logon Validation (codes returned) }
1201 VALIDATED_LOGON = 0;
1202 PASSWORD_EXPIRED = 2;
1203 NON_VALIDATED_LOGON = 3;
1204
1205 VALID_LOGOFF = 1;
1206
1207 { parmnum manifests for user modals }
1208 MODALS_MIN_PASSWD_LEN_PARMNUM = 1;
1209 MODALS_MAX_PASSWD_AGE_PARMNUM = 2;
1210 MODALS_MIN_PASSWD_AGE_PARMNUM = 3;
1211 MODALS_FORCE_LOGOFF_PARMNUM = 4;
1212 MODALS_PASSWD_HIST_LEN_PARMNUM = 5;
1213 MODALS_ROLE_PARMNUM = 6;
1214 MODALS_PRIMARY_PARMNUM = 7;
1215 MODALS_DOMAIN_NAME_PARMNUM = 8;
1216 MODALS_DOMAIN_ID_PARMNUM = 9;
1217 MODALS_LOCKOUT_DURATION_PARMNUM = 10;
1218 MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM = 11;
1219 MODALS_LOCKOUT_THRESHOLD_PARMNUM = 12;
1220
1221 { the new infolevel counterparts of the old info level + parmnum }
1222 MODALS_MIN_PASSWD_LEN_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_LEN_PARMNUM);
1223 MODALS_MAX_PASSWD_AGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_MAX_PASSWD_AGE_PARMNUM);
1224 MODALS_MIN_PASSWD_AGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_AGE_PARMNUM);
1225 MODALS_FORCE_LOGOFF_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_FORCE_LOGOFF_PARMNUM);
1226 MODALS_PASSWD_HIST_LEN_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_PASSWD_HIST_LEN_PARMNUM);
1227 MODALS_ROLE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_ROLE_PARMNUM);
1228 MODALS_PRIMARY_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_PRIMARY_PARMNUM);
1229 MODALS_DOMAIN_NAME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_NAME_PARMNUM);
1230 MODALS_DOMAIN_ID_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_ID_PARMNUM);
1231
1232 type
1233 PGROUP_INFO_0 = ^TGROUP_INFO_0;
1234 TGROUP_INFO_0 = record
1235 grpi0_name : LPWSTR;
1236 end;
1237
1238 PGROUP_INFO_1 = ^TGROUP_INFO_1;
1239 TGROUP_INFO_1 = record
1240 grpi1_name : LPWSTR;
1241 grpi1_comment : LPWSTR;
1242 end;
1243
1244 PGROUP_INFO_2 = ^TGROUP_INFO_2;
1245 TGROUP_INFO_2 = record
1246 grpi2_name : LPWSTR;
1247 grpi2_comment : LPWSTR;
1248 grpi2_group_id : DWord;
1249 grpi2_attributes : DWord;
1250 end;
1251
1252 PGROUP_INFO_1002 = ^TGROUP_INFO_1002;
1253 TGROUP_INFO_1002 = record
1254 grpi1002_comment : LPWSTR;
1255 end;
1256
1257 PGROUP_INFO_1005 = ^TGROUP_INFO_1005;
1258 TGROUP_INFO_1005 = record
1259 grpi1005_attributes : DWord;
1260 end;
1261
1262 PGROUP_USERS_INFO_0 = ^TGROUP_USERS_INFO_0;
1263 TGROUP_USERS_INFO_0 = record
1264 grui0_name : LPWSTR;
1265 end;
1266
1267 PGROUP_USERS_INFO_1 = ^TGROUP_USERS_INFO_1;
1268 TGROUP_USERS_INFO_1 = record
1269 grui1_name : LPWSTR;
1270 grui1_attributes : DWord;
1271 end;
1272
1273 { Special Values and Constants - Group }
1274 const
1275 GROUPIDMASK = $8000; { MSB set if uid refers to a group }
1276
1277 { Predefined group for all normal users, administrators and guests }
1278 { LOCAL is a special group for pinball local security. }
1279 GROUP_SPECIALGRP_USERS = 'USERS';
1280 GROUP_SPECIALGRP_ADMINS = 'ADMINS';
1281 GROUP_SPECIALGRP_GUESTS = 'GUESTS';
1282 GROUP_SPECIALGRP_LOCAL = 'LOCAL';
1283
1284 { parmnum manifests for SetInfo calls (only comment is settable) }
1285 GROUP_ALL_PARMNUM = 0;
1286 GROUP_NAME_PARMNUM = 1;
1287 GROUP_COMMENT_PARMNUM = 2;
1288 GROUP_ATTRIBUTES_PARMNUM = 3;
1289
1290 { the new infolevel counterparts of the old info level + parmnum }
1291 GROUP_ALL_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + GROUP_ALL_PARMNUM);
1292 GROUP_NAME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + GROUP_NAME_PARMNUM);
1293 GROUP_COMMENT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + GROUP_COMMENT_PARMNUM);
1294 GROUP_ATTRIBUTES_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + GROUP_ATTRIBUTES_PARMNUM);
1295 GROUP_POSIX_ID_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + GROUP_POSIX_ID_PARMNUM);
1296
1297 type
1298 PLOCALGROUP_INFO_0 = ^TLOCALGROUP_INFO_0;
1299 TLOCALGROUP_INFO_0 = record
1300 lgrpi0_name : LPWSTR;
1301 end;
1302
1303 PLOCALGROUP_INFO_1 = ^TLOCALGROUP_INFO_1;
1304 TLOCALGROUP_INFO_1 = record
1305 lgrpi1_name : LPWSTR;
1306 lgrpi1_comment : LPWSTR;
1307 end;
1308
1309 PLOCALGROUP_INFO_1002 = ^TLOCALGROUP_INFO_1002;
1310 TLOCALGROUP_INFO_1002 = record
1311 lgrpi1002_comment : LPWSTR;
1312 end;
1313
1314 PLOCALGROUP_MEMBERS_INFO_0 = ^TLOCALGROUP_MEMBERS_INFO_0;
1315 TLOCALGROUP_MEMBERS_INFO_0 = record
1316 lgrmi0_sid : PSID;
1317 end;
1318
1319 PLOCALGROUP_MEMBERS_INFO_1 = ^TLOCALGROUP_MEMBERS_INFO_1;
1320 TLOCALGROUP_MEMBERS_INFO_1 = record
1321 lgrmi1_sid : PSID;
1322 lgrmi1_sidusage : SID_NAME_USE;
1323 lgrmi1_name : LPWSTR;
1324 end;
1325
1326 PLOCALGROUP_MEMBERS_INFO_2 = ^TLOCALGROUP_MEMBERS_INFO_2;
1327 TLOCALGROUP_MEMBERS_INFO_2 = record
1328 lgrmi2_sid : PSID;
1329 lgrmi2_sidusage : SID_NAME_USE;
1330 lgrmi2_domainandname : LPWSTR;
1331 end;
1332
1333 PLOCALGROUP_MEMBERS_INFO_3 = ^TLOCALGROUP_MEMBERS_INFO_3;
1334 TLOCALGROUP_MEMBERS_INFO_3 = record
1335 lgrmi3_domainandname : LPWSTR;
1336 end;
1337
1338 PLOCALGROUP_USERS_INFO_0 = ^TLOCALGROUP_USERS_INFO_0;
1339 TLOCALGROUP_USERS_INFO_0 = record
1340 lgrui0_name : LPWSTR;
1341 end;
1342
1343 const
1344 LOCALGROUP_NAME_PARMNUM = 1;
1345 LOCALGROUP_COMMENT_PARMNUM = 2;
1346
1347 { QueryDisplayInformation levels }
1348 type
1349 PNET_DISPLAY_USER = ^TNET_DISPLAY_USER;
1350 TNET_DISPLAY_USER = record
1351 usri1_name : LPWSTR;
1352 usri1_comment : LPWSTR;
1353 usri1_flags : DWord;
1354 usri1_full_name : LPWSTR;
1355 usri1_user_id : DWord;
1356 usri1_next_index : DWord;
1357 end;
1358
1359 PNET_DISPLAY_MACHINE = ^TNET_DISPLAY_MACHINE;
1360 TNET_DISPLAY_MACHINE = record
1361 usri2_name : LPWSTR;
1362 usri2_comment : LPWSTR;
1363 usri2_flags : DWord;
1364 usri2_user_id : DWord;
1365 usri2_next_index : DWord;
1366 end;
1367
1368 PNET_DISPLAY_GROUP = ^TNET_DISPLAY_GROUP;
1369 TNET_DISPLAY_GROUP = record
1370 grpi3_name : LPWSTR;
1371 grpi3_comment : LPWSTR;
1372 grpi3_group_id : DWord;
1373 grpi3_attributes : DWord;
1374 grpi3_next_index : DWord;
1375 end;
1376
1377 { Data Structures - Access }
1378 PACCESS_INFO_0 = ^TACCESS_INFO_0;
1379 TACCESS_INFO_0 = record
1380 acc0_resource_name : LPWSTR;
1381 end;
1382
1383 PACCESS_INFO_1 = ^TACCESS_INFO_1;
1384 TACCESS_INFO_1 = record
1385 acc1_resource_name : LPWSTR;
1386 acc1_attr : DWord;
1387 acc1_count : DWord;
1388 end;
1389
1390 PACCESS_INFO_1002 = ^TACCESS_INFO_1002;
1391 TACCESS_INFO_1002 = record
1392 acc1002_attr : DWord;
1393 end;
1394
1395 PACCESS_LIST = ^TACCESS_LIST;
1396 TACCESS_LIST = record
1397 acl_ugname : LPWSTR;
1398 acl_access : DWord;
1399 end;
1400
1401 { Special Values and Constants - Access }
1402
1403 { Maximum number of permission entries for each resource. }
1404 const
1405 MAXPERMENTRIES = 64;
1406
1407
1408 { Bit values for the access permissions. ACCESS_ALL is a handy
1409 way to specify maximum permissions. These are used in
1410 acl_access field of access_list structures.
1411 }
1412 ACCESS_NONE = 0;
1413
1414 ACCESS_READ = $01;
1415 ACCESS_WRITE = $02;
1416 ACCESS_CREATE = $04;
1417 ACCESS_EXEC = $08;
1418 ACCESS_DELETE = $10;
1419 ACCESS_ATRIB = $20;
1420 ACCESS_PERM = $40;
1421
1422 ACCESS_ALL = (ACCESS_READ or
1423 ACCESS_WRITE or
1424 ACCESS_CREATE or
1425 ACCESS_EXEC or
1426 ACCESS_DELETE or
1427 ACCESS_ATRIB or
1428 ACCESS_PERM);
1429
1430
1431 ACCESS_GROUP = $8000;
1432
1433 { Bit values for the acc1_attr field of the ACCESS_INFO_1 structure. }
1434 ACCESS_AUDIT = $1;
1435
1436 ACCESS_SUCCESS_OPEN = $10;
1437 ACCESS_SUCCESS_WRITE = $20;
1438 ACCESS_SUCCESS_DELETE = $40;
1439 ACCESS_SUCCESS_ACL = $80;
1440 ACCESS_SUCCESS_MASK = $F0;
1441
1442 ACCESS_FAIL_OPEN = $100;
1443 ACCESS_FAIL_WRITE = $200;
1444 ACCESS_FAIL_DELETE = $400;
1445 ACCESS_FAIL_ACL = $800;
1446 ACCESS_FAIL_MASK = $F00;
1447
1448 ACCESS_FAIL_SHIFT = 4;
1449
1450 { Parmnum value for NetAccessSetInfo. }
1451 ACCESS_RESOURCE_NAME_PARMNUM = 1;
1452 ACCESS_ATTR_PARMNUM = 2;
1453 ACCESS_COUNT_PARMNUM = 3;
1454 ACCESS_ACCESS_LIST_PARMNUM = 4;
1455
1456 { the new infolevel counterparts of the old info level + parmnum }
1457 ACCESS_RESOURCE_NAME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + ACCESS_RESOURCE_NAME_PARMNUM);
1458 ACCESS_ATTR_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + ACCESS_ATTR_PARMNUM);
1459 ACCESS_COUNT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + ACCESS_COUNT_PARMNUM);
1460 ACCESS_ACCESS_LIST_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + ACCESS_ACCESS_LIST_PARMNUM);
1461
1462 {
1463 ACCESS_LETTERS defines a letter for each bit position in
1464 the acl_access field of struct access_list. Note that some
1465 bits have a corresponding letter of ' ' (space).
1466 }
1467 ACCESS_LETTERS = 'RWCXDAP ';
1468
1469 { FunctionCode values for I_NetLogonControl. }
1470 const
1471 NETLOGON_CONTROL_QUERY = 1; { No-op: just query }
1472 NETLOGON_CONTROL_REPLICATE = 2; { Force replicate on BDC }
1473 NETLOGON_CONTROL_SYNCHRONIZE = 3; { Force synchronize on BDC }
1474 NETLOGON_CONTROL_PDC_REPLICATE = 4; { Force PDC to broadcast change }
1475 NETLOGON_CONTROL_REDISCOVER = 5; { Force to re-discover trusted domain DCs }
1476 NETLOGON_CONTROL_TC_QUERY = 6; { Query status of specified trusted channel status }
1477 NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7; { Notify netlogon that a new transport has come online }
1478 NETLOGON_CONTROL_FIND_USER = 8; { Find named user in trusted domain }
1479
1480 { Debug function codes }
1481 NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL=$FFFB;
1482 NETLOGON_CONTROL_BACKUP_CHANGE_LOG = $FFFC;
1483 NETLOGON_CONTROL_TRUNCATE_LOG = $FFFD;
1484 NETLOGON_CONTROL_SET_DBFLAG = $FFFE;
1485 NETLOGON_CONTROL_BREAKPOINT = $FFFF;
1486
1487 { Query level 1 for I_NetLogonControl }
1488 type
1489 PNETLOGON_INFO_1 = ^TNETLOGON_INFO_1;
1490 TNETLOGON_INFO_1 = record
1491 netlog1_flags : DWord;
1492 netlog1_pdc_connection_status : NET_API_STATUS;
1493 end;
1494
1495 PNETLOGON_INFO_2 = ^TNETLOGON_INFO_2;
1496 TNETLOGON_INFO_2 = record
1497 netlog2_flags : DWord;
1498 netlog2_pdc_connection_status : NET_API_STATUS;
1499 {$ifdef MIDL_PASS}
1500 [string] wchar_t * netlog2_trusted_dc_name;
1501 {$else}
1502 netlog2_trusted_dc_name : LPWSTR;
1503 {$endif}
1504 netlog2_tc_connection_status : NET_API_STATUS;
1505 end;
1506
1507 PNETLOGON_INFO_3 = ^TNETLOGON_INFO_3;
1508 TNETLOGON_INFO_3 = record
1509 netlog3_flags : DWord;
1510 netlog3_logon_attempts : DWord;
1511 netlog3_reserved1 : DWord;
1512 netlog3_reserved2 : DWord;
1513 netlog3_reserved3 : DWord;
1514 netlog3_reserved4 : DWord;
1515 netlog3_reserved5 : DWord;
1516 end;
1517
1518 PNETLOGON_INFO_4 = ^TNETLOGON_INFO_4;
1519 TNETLOGON_INFO_4 = record
1520 {$IFDEF MIDL_PASS}
1521 [string] wchar_t * netlog4_trusted_dc_name;
1522 [string] wchar_t * netlog4_trusted_domain_name;
1523 {$ELSE}
1524 netlog4_trusted_dc_name : LPWSTR;
1525 netlog4_trusted_domain_name : LPWSTR;
1526 {$ENDIF}
1527 end;
1528
1529 { Values of netlog1_flags }
1530 const
1531 NETLOGON_REPLICATION_NEEDED = $01; { Database is out of date }
1532 NETLOGON_REPLICATION_IN_PROGRESS = $02; { Replication is happening now }
1533 NETLOGON_FULL_SYNC_REPLICATION = $04; { full sync replication required/progress }
1534 NETLOGON_REDO_NEEDED = $08; { Redo of previous replication needed }
1535
1536 {-------------------- LMALERT.H ---------------------------------------------}
1537 type
1538 TNetAlertRaise = function(AlertEventName: LPCWSTR; Buffer: Pointer; BufferSize: DWord): NET_API_STATUS; stdcall;
1539 TNetAlertRaiseEx = function(AlertEventName: LPCWSTR; VariableInfo: Pointer; VariableInfoSize: DWord; ServiceName: LPCWSTR): NET_API_STATUS; stdcall;
1540
1541 type
1542 PSTD_ALERT = ^TSTD_ALERT;
1543 TSTD_ALERT = record
1544 alrt_timestamp : DWord;
1545 alrt_eventname : array[0..EVLEN] of char;
1546 alrt_servicename : array[0..SNLEN] of char;
1547 end;
1548
1549 PADMIN_OTHER_INFO = ^TADMIN_OTHER_INFO;
1550 TADMIN_OTHER_INFO = record
1551 alrtad_errcode : DWord;
1552 alrtad_numstrings : DWord;
1553 end;
1554
1555 PERRLOG_OTHER_INFO = ^TERRLOG_OTHER_INFO;
1556 TERRLOG_OTHER_INFO = record
1557 alrter_errcode : DWord;
1558 alrter_offset : DWord;
1559 end;
1560
1561 PPRINT_OTHER_INFO = ^TPRINT_OTHER_INFO;
1562 TPRINT_OTHER_INFO = record
1563 alrtpr_jobid : DWord;
1564 alrtpr_status : DWord;
1565 alrtpr_submitted : DWord;
1566 alrtpr_size : DWord;
1567 end;
1568
1569 PUSER_OTHER_INFO = ^TUSER_OTHER_INFO;
1570 TUSER_OTHER_INFO = record
1571 alrtus_errcode : DWord;
1572 alrtus_numstrings : DWord;
1573 end;
1574
1575 { Name of mailslot to send alert notifications }
1576 const
1577 ALERTER_MAILSLOT = '\\.\MAILSLOT\Alerter';
1578
1579 (*
1580 The following macro gives a pointer to the other_info data.
1581 It takes an alert structure and returns a pointer to structure
1582 beyond the standard portion.
1583
1584 ALERT_OTHER_INFO(x) ((LPBYTE)(x) + sizeof(STD_ALERT))
1585
1586 The following macro gives a pointer to the variable-length data.
1587 It takes a pointer to one of the other-info structs and returns a
1588 pointer to the variable data portion.
1589
1590 ALERT_VAR_DATA(p) ((LPBYTE)(p) + sizeof(*p))
1591 *)
1592
1593 { Names of standard Microsoft-defined alert events. }
1594 ALERT_PRINT_EVENT = 'PRINTING';
1595 ALERT_MESSAGE_EVENT = 'MESSAGE';
1596 ALERT_ERRORLOG_EVENT = 'ERRORLOG';
1597 ALERT_ADMIN_EVENT = 'ADMIN';
1598 ALERT_USER_EVENT = 'USER';
1599
1600 { Bitmap masks for prjob_status field of PRINTJOB. }
1601 { 2-7 bits also used in device status }
1602 PRJOB_QSTATUS = $3; { Bits 0,1 }
1603 PRJOB_DEVSTATUS = $1fc; { 2-8 bits }
1604 PRJOB_COMPLETE = $4; { Bit 2 }
1605 PRJOB_INTERV = $8; { Bit 3 }
1606 PRJOB_ERROR = $10; { Bit 4 }
1607 PRJOB_DESTOFFLINE = $20; { Bit 5 }
1608 PRJOB_DESTPAUSED = $40; { Bit 6 }
1609 PRJOB_NOTIFY = $80; { Bit 7 }
1610 PRJOB_DESTNOPAPER = $100; { Bit 8 }
1611 PRJOB_DELETED = $8000;{ Bit 15 }
1612
1613 { Values of PRJOB_QSTATUS bits in prjob_status field of PRINTJOB. }
1614 PRJOB_QS_QUEUED = 0;
1615 PRJOB_QS_PAUSED = 1;
1616 PRJOB_QS_SPOOLING = 2;
1617 PRJOB_QS_PRINTING = 3;
1618
1619 {-------------------- LMSHARE.H ---------------------------------------------}
1620 type
1621 TNetShareAdd = function(ServerName: LPWSTR; Level: DWORD; Buffer: Pointer; var ParmErr: DWORD): NET_API_STATUS; stdcall;
1622 TNetShareEnum = function(ServerName: LPWSTR; Level: DWORD; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; var ResumeHandle: DWord): NET_API_STATUS; stdcall;
1623 TNetShareEnumSticky = function(ServerName: LPWSTR; Level: DWORD; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
1624 TNetShareGetInfo = function(ServerName, NetName: LPWSTR; Level: DWORD; var Buffer: Pointer): NET_API_STATUS; stdcall;
1625 TNetShareSetInfo = function(ServerName, NetName: LPWSTR; Level: DWORD; var Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
1626 TNetShareDel = function(ServerName, NetName: LPWSTR; Reserved: DWord): NET_API_STATUS; stdcall;
1627 TNetShareDelSticky = function(ServerName, NetName: LPWSTR; Reserved: DWord): NET_API_STATUS; stdcall;
1628 TNetShareCheck = function(ServerName, Device: LPWSTR; var ShareType: DWord): NET_API_STATUS; stdcall;
1629
1630 TNetSessionEnum = function(ServerName, UncClientName, UserName: LPWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
1631 TNetSessionDel = function(ServerName, UncClientName, UserName: LPWSTR): NET_API_STATUS; stdcall;
1632 TNetSessionGetInfo = function(ServerName, UncClientName, UserName: LPWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
1633
1634 TNetConnectionEnum = function(ServerName, Qualifier: LPWSTR; Level: DWord; var Buffer : Pointer; PrefMaxLen : DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
1635
1636 TNetFileClose = function(ServerName: LPWSTR; FileID: DWord): NET_API_STATUS; stdcall;
1637 TNetFileEnum = function(ServerName, BasePath, UserName: LPWSTR; Level: DWord; var Buffer: Pointer; PrefMexLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
1638 TNetFileGetInfo = function(ServerName: LPWSTR; FileID, Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
1639
1640 type
1641 PShare_Info_0 = ^TShare_Info_0;
1642 TShare_Info_0 = record
1643 shi0_netname: LPWSTR;
1644 end;
1645
1646 PShare_Info_1 = ^TShare_Info_1;
1647 TShare_Info_1 = record
1648 shi1_netname: LPWSTR;
1649 shi1_type: DWord;
1650 shi1_remark: LPWSTR;
1651 end;
1652
1653 PShare_Info_2 = ^TShare_Info_2;
1654 TShare_Info_2 = record
1655 shi2_netname: LPWSTR;
1656 shi2_type: DWord;
1657 shi2_remark: LPWSTR;
1658 shi2_permissions: DWord;
1659 shi2_max_uses: DWord;
1660 shi2_current_uses: DWord;
1661 shi2_path: LPWSTR;
1662 shi2_passwd: LPWSTR;
1663 end;
1664
1665 PShare_Info_501 = ^TShare_Info_501;
1666 TShare_Info_501 = record
1667 shi501_netname: LPWSTR;
1668 shi501_type: DWord;
1669 shi501_remark: LPWSTR;
1670 shi501_flags: DWord;
1671 end;
1672
1673 PShare_Info_502 = ^TShare_Info_502;
1674 TShare_Info_502 = record
1675 shi502_netname: LPWSTR;
1676 shi502_type: DWord;
1677 shi502_remark: LPWSTR;
1678 shi502_permissions: DWord;
1679 shi502_max_uses: DWord;
1680 shi502_current_uses: DWord;
1681 shi502_path: LPWSTR;
1682 shi502_passwd: LPWSTR;
1683 shi502_reserved: DWord;
1684 shi502_security_descriptor: PSECURITY_DESCRIPTOR;
1685 end;
1686
1687 PShare_Info_1004 = ^TShare_Info_1004;
1688 TShare_Info_1004 = record
1689 shi1004_remark: LPWSTR;
1690 end;
1691
1692 PShare_Info_1005 = ^TShare_Info_1005;
1693 TShare_Info_1005 = record
1694 shi1005_flags: DWord;
1695 end;
1696
1697 PShare_Info_1006 = ^TShare_Info_1006;
1698 TShare_Info_1006 = record
1699 shi1006_max_uses: DWord;
1700 end;
1701
1702 PShare_Info_1501 = ^TShare_Info_1501;
1703 TShare_Info_1501 = record
1704 shi1501_reserved: DWord;
1705 shi1501_security_descriptor: PSECURITY_DESCRIPTOR;
1706 end;
1707
1708 { Special Values and Constants - Share }
1709
1710 { Values for parm_err parameter. }
1711 const
1712 SHARE_NETNAME_PARMNUM = 1;
1713 SHARE_TYPE_PARMNUM = 3;
1714 SHARE_REMARK_PARMNUM = 4;
1715 SHARE_PERMISSIONS_PARMNUM = 5;
1716 SHARE_MAX_USES_PARMNUM = 6;
1717 SHARE_CURRENT_USES_PARMNUM = 7;
1718 SHARE_PATH_PARMNUM = 8;
1719 SHARE_PASSWD_PARMNUM = 9;
1720 SHARE_FILE_SD_PARMNUM = 501;
1721
1722 { Single-field infolevels for NetShareSetInfo. }
1723 SHARE_REMARK_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SHARE_REMARK_PARMNUM);
1724 SHARE_MAX_USES_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SHARE_MAX_USES_PARMNUM);
1725 SHARE_FILE_SD_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SHARE_FILE_SD_PARMNUM);
1726
1727 SHI1_NUM_ELEMENTS = 4;
1728 SHI2_NUM_ELEMENTS = 10;
1729
1730 { Share types (shi1_type and shi2_type fields). }
1731 STYPE_DISKTREE = 0;
1732 STYPE_PRINTQ = 1;
1733 STYPE_DEVICE = 2;
1734 STYPE_IPC = 3;
1735
1736 STYPE_SPECIAL = $80000000;
1737
1738 SHI_USES_UNLIMITED = DWord(-1);
1739
1740 { Flags values for the 501 and 1005 levels }
1741 SHI1005_FLAGS_DFS = $01; { Share is in the DFS }
1742 SHI1005_FLAGS_DFS_ROOT = $02; { Share is root of DFS}
1743
1744 CSC_MASK = $30; { Used to mask off the following states}
1745
1746 CSC_CACHE_MANUAL_REINT = $00; { No automatic file by file reintegration}
1747 CSC_CACHE_AUTO_REINT = $10; { File by file reintegration is OK}
1748 CSC_CACHE_VDO = $20; { no need to flow opens}
1749 CSC_CACHE_NONE = $30; { no CSC for this share}
1750
1751 { The subset of 1005 infolevel flags that can be set via the API }
1752 SHI1005_VALID_FLAGS_SET = CSC_MASK;
1753
1754 type
1755 PSession_Info_0 = ^TSession_Info_0;
1756 TSession_Info_0 = record
1757 sesi0_cname: LPWSTR; { client name (no backslashes) }
1758 end;
1759
1760 PSession_Info_1 = ^TSession_Info_1;
1761 TSession_Info_1 = record
1762 sesi1_cname: LPWSTR; { client name (no backslashes) }
1763 sesi1_username: LPWSTR;
1764 sesi1_num_opens: DWord;
1765 sesi1_time: DWord;
1766 sesi1_idle_time: DWord;
1767 sesi1_user_flags: DWord;
1768 end;
1769
1770 PSession_Info_2 = ^TSession_Info_2;
1771 TSession_Info_2 = record
1772 sesi2_cname: LPWSTR; { client name (no backslashes) }
1773 sesi2_username: LPWSTR;
1774 sesi2_num_opens: DWord;
1775 sesi2_time: DWord;
1776 sesi2_idle_time: DWord;
1777 sesi2_user_flags: DWord;
1778 sesi2_cltype_name: LPWSTR;
1779 end;
1780
1781 PSession_Info_10 = ^TSession_Info_10;
1782 TSession_Info_10 = record
1783 sesi10_cname: LPWSTR; { client name (no backslashes) }
1784 sesi10_username: LPWSTR;
1785 sesi10_time: DWord;
1786 sesi10_idle_time: DWord;
1787 end;
1788
1789 PSession_Info_502 = ^TSession_Info_502;
1790 TSession_Info_502 = record
1791 sesi502_cname: LPWSTR; { client name (no backslashes) }
1792 sesi502_username: LPWSTR;
1793 sesi502_num_opens: DWord;
1794 sesi502_time: DWord;
1795 sesi502_idle_time: DWord;
1796 sesi502_user_flags: DWord;
1797 sesi502_cltype_name: LPWSTR;
1798 sesi502_transport: LPWSTR;
1799 end;
1800
1801 { Special Values and Constants - Session }
1802
1803 { Bits defined in sesi1_user_flags. }
1804 const
1805 SESS_GUEST = $00000001; { session is logged on as a guest }
1806 SESS_NOENCRYPTION = $00000002; { session is not using encryption }
1807
1808 SESI1_NUM_ELEMENTS = 8;
1809 SESI2_NUM_ELEMENTS = 9;
1810
1811 type
1812 PConnection_Info_0 = ^TConnection_Info_0;
1813 TConnection_Info_0 = record
1814 coni0_id: DWord;
1815 end;
1816
1817 PConnection_Info_1 = ^TConnection_Info_1;
1818 TConnection_Info_1 = record
1819 coni1_id: DWord;
1820 coni1_type: DWord;
1821 coni1_num_opens: DWord;
1822 coni1_num_users: DWord;
1823 coni1_time: DWord;
1824 coni1_username: LPWSTR;
1825 coni1_netname: LPWSTR;
1826 end;
1827
1828 { File APIs are available at information levels 2 & 3 only. Levels 0 & }
1829 { 1 are not supported. }
1830 type
1831 PFile_Info_2 = ^TFile_Info_2;
1832 TFile_Info_2 = record
1833 fi2_id: DWord;
1834 end;
1835
1836 PFile_Info_3 = ^TFile_Info_3;
1837 TFile_Info_3 = record
1838 fi3_id: DWord;
1839 fi3_permissions: DWord;
1840 fi3_num_locks: DWord;
1841 fi3_pathname: LPWSTR;
1842 fi3_username: LPWSTR;
1843 end;
1844
1845 { Special Values and Constants - File }
1846
1847 { bit values for permissions }
1848 const
1849 PERM_FILE_READ = $1; { user has read access }
1850 PERM_FILE_WRITE = $2; { user has write access }
1851 PERM_FILE_CREATE = $4; { user has create access }
1852
1853 {-------------------- LMMSG.H -----------------------------------------------}
1854 type
1855 TNetMessageNameAdd = function(ServerName, MsgName: LPCWSTR): NET_API_STATUS; stdcall;
1856 TNetMessageNameEnum = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ResumeHandle: PDWord): NET_API_STATUS; stdcall;
1857 TNetMessageNameGetInfo = function(ServerName, MsgName: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
1858 TNetMessageNameDel = function(ServerName, MsgName: LPCWSTR): NET_API_STATUS; stdcall;
1859 TNetMessageBufferSend = function(ServerName, MsgName, FromName: LPCWSTR; Buffer: Pointer; BufferLen: DWord): NET_API_STATUS; stdcall;
1860
1861 type
1862 PMSG_INFO_0 = ^TMSG_INFO_0;
1863 TMSG_INFO_0 = record
1864 msgi0_name : LPWSTR;
1865 end;
1866
1867 PMSG_INFO_1 = ^TMSG_INFO_1;
1868 TMSG_INFO_1 = record
1869 msgi1_name : LPWSTR;
1870 msgi1_forward_flag : DWord;
1871 msgi1_forward : LPWSTR;
1872 end;
1873
1874 { Special Values and Constants }
1875
1876 { Values for msgi1_forward_flag. }
1877 const
1878 MSGNAME_NOT_FORWARDED = 0; { Name not forwarded }
1879 MSGNAME_FORWARDED_TO = $04; { Name forward to remote station }
1880 MSGNAME_FORWARDED_FROM = $10; { Name forwarded from remote station }
1881
1882 {-------------------- LMREMUTL.H --------------------------------------------}
1883 type
1884 TNetRemoteTOD = function(UncServerName: LPCWSTR; var Buffer: Pointer): NET_API_STATUS; stdcall;
1885 TNetRemoteComputerSupports = function(UncServerName: LPCWSTR; OptionsWanted: DWord; var OptionsSupported: DWord): NET_API_STATUS; stdcall;
1886
1887 T_TIME_OF_DAY_INFO = record
1888 tod_elapsedt : DWord;
1889 tod_msecs : DWord;
1890 tod_hours : DWord;
1891 tod_mins : DWord;
1892 tod_secs : DWord;
1893 tod_hunds : DWord;
1894 tod_timezone : LongInt;
1895 tod_tinterval : DWord;
1896 tod_day : DWord;
1897 tod_month : DWord;
1898 tod_year : DWord;
1899 tod_weekday : DWord;
1900 end;
1901
1902 { Special Values and Constants }
1903
1904 const
1905 { Mask bits for use with NetRemoteComputerSupports: }
1906 SUPPORTS_REMOTE_ADMIN_PROTOCOL = $00000002;
1907 SUPPORTS_RPC = $00000004;
1908 SUPPORTS_SAM_PROTOCOL = $00000008;
1909 SUPPORTS_UNICODE = $00000010;
1910 SUPPORTS_LOCAL = $00000020;
1911 SUPPORTS_ANY = $FFFFFFFF;
1912
1913
1914 {-------------------- LMSERVER.H --------------------------------------------}
1915 type
1916 TNetServerEnum = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ServerType: DWord; Domain: LPCWSTR; var ResumeHandle: DWord): NET_API_STATUS; stdcall;
1917 TNetServerEnumEx = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ServerType: DWord; Domain, FirstNameToReturn : LPWSTR): NET_API_STATUS; stdcall;
1918 TNetServerGetInfo = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
1919 TNetServerSetInfo = function(ServerName: LPCWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
1920 TNetServerDiskEnum = function(ServerName: LPCWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
1921 TNetServerComputerNameAdd = function(ServerName, EmulatedDomainName, EmulatedServerName: LPWSTR): NET_API_STATUS; stdcall;
1922 TNetServerComputerNameDel = function(ServerName, EmulatedServerName: LPWSTR): NET_API_STATUS; stdcall;
1923 TNetServerTransportAdd = function(ServerName: LPWSTR; Level: DWord; Buffer: Pointer): NET_API_STATUS; stdcall;
1924 TNetServerTransportAddEx = function(ServerName: LPWSTR; Level: DWord; Buffer: Pointer): NET_API_STATUS; stdcall;
1925 TNetServerTransportDel = function(ServerName: LPWSTR; Level: DWord; Buffer: Pointer): NET_API_STATUS; stdcall;
1926 TNetServerTransportEnum = function(ServerName: LPWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
1927
1928 type
1929 TSERVER_INFO_100 = record
1930 sv100_platform_id : DWord;
1931 sv100_name : LPWSTR;
1932 end;
1933
1934 TSERVER_INFO_101 = record
1935 sv101_platform_id : DWord;
1936 sv101_name : LPWSTR;
1937 sv101_version_major : DWord;
1938 sv101_version_minor : DWord;
1939 sv101_type : DWord;
1940 sv101_comment : LPWSTR;
1941 end;
1942
1943 TSERVER_INFO_102 = record
1944 sv102_platform_id : DWord;
1945 sv102_name : LPWSTR;
1946 sv102_version_major : DWord;
1947 sv102_version_minor : DWord;
1948 sv102_type : DWord;
1949 sv102_comment : LPWSTR;
1950 sv102_users : DWord;
1951 sv102_disc : LongInt;
1952 sv102_hidden : Bool;
1953 sv102_announce : DWord;
1954 sv102_anndelta : DWord;
1955 sv102_licenses : DWord;
1956 sv102_userpath : LPWSTR;
1957 end;
1958
1959 TSERVER_INFO_402 = record
1960 sv402_ulist_mtime : DWord;
1961 sv402_glist_mtime : DWord;
1962 sv402_alist_mtime : DWord;
1963 sv402_alerts : LPWSTR;
1964 sv402_security : DWord;
1965 sv402_numadmin : DWord;
1966 sv402_lanmask : DWord;
1967 sv402_guestacct : LPWSTR;
1968 sv402_chdevs : DWord;
1969 sv402_chdevq : DWord;
1970 sv402_chdevjobs : DWord;
1971 sv402_connections : DWord;
1972 sv402_shares : DWord;
1973 sv402_openfiles : DWord;
1974 sv402_sessopens : DWord;
1975 sv402_sessvcs : DWord;
1976 sv402_sessreqs : DWord;
1977 sv402_opensearch : DWord;
1978 sv402_activelocks : DWord;
1979 sv402_numreqbuf : DWord;
1980 sv402_sizreqbuf : DWord;
1981 sv402_numbigbuf : DWord;
1982 sv402_numfiletasks : DWord;
1983 sv402_alertsched : DWord;
1984 sv402_erroralert : DWord;
1985 sv402_logonalert : DWord;
1986 sv402_accessalert : DWord;
1987 sv402_diskalert : DWord;
1988 sv402_netioalert : DWord;
1989 sv402_maxauditsz : DWord;
1990 sv402_srvheuristics : LPWSTR;
1991 end;
1992
1993 TSERVER_INFO_403 = record
1994 sv403_ulist_mtime : DWord;
1995 sv403_glist_mtime : DWord;
1996 sv403_alist_mtime : DWord;
1997 sv403_alerts : LPWSTR;
1998 sv403_security : DWord;
1999 sv403_numadmin : DWord;
2000 sv403_lanmask : DWord;
2001 sv403_guestacct : LPWSTR;
2002 sv403_chdevs : DWord;
2003 sv403_chdevq : DWord;
2004 sv403_chdevjobs : DWord;
2005 sv403_connections : DWord;
2006 sv403_shares : DWord;
2007 sv403_openfiles : DWord;
2008 sv403_sessopens : DWord;
2009 sv403_sessvcs : DWord;
2010 sv403_sessreqs : DWord;
2011 sv403_opensearch : DWord;
2012 sv403_activelocks : DWord;
2013 sv403_numreqbuf : DWord;
2014 sv403_sizreqbuf : DWord;
2015 sv403_numbigbuf : DWord;
2016 sv403_numfiletasks : DWord;
2017 sv403_alertsched : DWord;
2018 sv403_erroralert : DWord;
2019 sv403_logonalert : DWord;
2020 sv403_accessalert : DWord;
2021 sv403_diskalert : DWord;
2022 sv403_netioalert : DWord;
2023 sv403_maxauditsz : DWord;
2024 sv403_srvheuristics : LPWSTR;
2025 sv403_auditedevents : DWord;
2026 sv403_autoprofile : DWord;
2027 sv403_autopath : LPWSTR;
2028 end;
2029
2030 TSERVER_INFO_502 = record
2031 sv502_sessopens : DWord;
2032 sv502_sessvcs : DWord;
2033 sv502_opensearch : DWord;
2034 sv502_sizreqbuf : DWord;
2035 sv502_initworkitems : DWord;
2036 sv502_maxworkitems : DWord;
2037 sv502_rawworkitems : DWord;
2038 sv502_irpstacksize : DWord;
2039 sv502_maxrawbuflen : DWord;
2040 sv502_sessusers : DWord;
2041 sv502_sessconns : DWord;
2042 sv502_maxpagedmemoryusage : DWord;
2043 sv502_maxnonpagedmemoryusage : DWord;
2044 sv502_enablesoftcompat : Bool;
2045 sv502_enableforcedlogoff : Bool;
2046 sv502_timesource : Bool;
2047 sv502_acceptdownlevelapis : Bool;
2048 sv502_lmannounce : Bool;
2049 end;
2050
2051 TSERVER_INFO_503 = record
2052 sv503_sessopens : DWord;
2053 sv503_sessvcs : DWord;
2054 sv503_opensearch : DWord;
2055 sv503_sizreqbuf : DWord;
2056 sv503_initworkitems : DWord;
2057 sv503_maxworkitems : DWord;
2058 sv503_rawworkitems : DWord;
2059 sv503_irpstacksize : DWord;
2060 sv503_maxrawbuflen : DWord;
2061 sv503_sessusers : DWord;
2062 sv503_sessconns : DWord;
2063 sv503_maxpagedmemoryusage : DWord;
2064 sv503_maxnonpagedmemoryusage : DWord;
2065 sv503_enablesoftcompat : Bool;
2066 sv503_enableforcedlogoff : Bool;
2067 sv503_timesource : Bool;
2068 sv503_acceptdownlevelapis : Bool;
2069 sv503_lmannounce : Bool;
2070 sv503_domain : LPWSTR;
2071 sv503_maxcopyreadlen : DWord;
2072 sv503_maxcopywritelen : DWord;
2073 sv503_minkeepsearch : DWord;
2074 sv503_maxkeepsearch : DWord;
2075 sv503_minkeepcomplsearch : DWord;
2076 sv503_maxkeepcomplsearch : DWord;
2077 sv503_threadcountadd : DWord;
2078 sv503_numblockthreads : DWord;
2079 sv503_scavtimeout : DWord;
2080 sv503_minrcvqueue : DWord;
2081 sv503_minfreeworkitems : DWord;
2082 sv503_xactmemsize : DWord;
2083 sv503_threadpriority : DWord;
2084 sv503_maxmpxct : DWord;
2085 sv503_oplockbreakwait : DWord;
2086 sv503_oplockbreakresponsewait : DWord;
2087 sv503_enableoplocks : Bool;
2088 sv503_enableoplockforceclose : Bool;
2089 sv503_enablefcbopens : Bool;
2090 sv503_enableraw : Bool;
2091 sv503_enablesharednetdrives : Bool;
2092 sv503_minfreeconnections : DWord;
2093 sv503_maxfreeconnections : DWord;
2094 end;
2095
2096 TSERVER_INFO_599 = record
2097 sv599_sessopens : DWord;
2098 sv599_sessvcs : DWord;
2099 sv599_opensearch : DWord;
2100 sv599_sizreqbuf : DWord;
2101 sv599_initworkitems : DWord;
2102 sv599_maxworkitems : DWord;
2103 sv599_rawworkitems : DWord;
2104 sv599_irpstacksize : DWord;
2105 sv599_maxrawbuflen : DWord;
2106 sv599_sessusers : DWord;
2107 sv599_sessconns : DWord;
2108 sv599_maxpagedmemoryusage : DWord;
2109 sv599_maxnonpagedmemoryusage : DWord;
2110 sv599_enablesoftcompat : Bool;
2111 sv599_enableforcedlogoff : Bool;
2112 sv599_timesource : Bool;
2113 sv599_acceptdownlevelapis : Bool;
2114 sv599_lmannounce : Bool;
2115 sv599_domain : LPWSTR;
2116 sv599_maxcopyreadlen : DWord;
2117 sv599_maxcopywritelen : DWord;
2118 sv599_minkeepsearch : DWord;
2119 sv599_maxkeepsearch : DWord;
2120 sv599_minkeepcomplsearch : DWord;
2121 sv599_maxkeepcomplsearch : DWord;
2122 sv599_threadcountadd : DWord;
2123 sv599_numblockthreads : DWord;
2124 sv599_scavtimeout : DWord;
2125 sv599_minrcvqueue : DWord;
2126 sv599_minfreeworkitems : DWord;
2127 sv599_xactmemsize : DWord;
2128 sv599_threadpriority : DWord;
2129 sv599_maxmpxct : DWord;
2130 sv599_oplockbreakwait : DWord;
2131 sv599_oplockbreakresponsewait : DWord;
2132 sv599_enableoplocks : Bool;
2133 sv599_enableoplockforceclose : Bool;
2134 sv599_enablefcbopens : Bool;
2135 sv599_enableraw : Bool;
2136 sv599_enablesharednetdrives : Bool;
2137 sv599_minfreeconnections : DWord;
2138 sv599_maxfreeconnections : DWord;
2139 sv599_initsesstable : DWord;
2140 sv599_initconntable : DWord;
2141 sv599_initfiletable : DWord;
2142 sv599_initsearchtable : DWord;
2143 sv599_alertschedule : DWord;
2144 sv599_errorthreshold : DWord;
2145 sv599_networkerrorthreshold : DWord;
2146 sv599_diskspacethreshold : DWord;
2147 sv599_reserved : DWord;
2148 sv599_maxlinkdelay : DWord;
2149 sv599_minlinkthroughput : DWord;
2150 sv599_linkinfovalidtime : DWord;
2151 sv599_scavqosinfoupdatetime : DWord;
2152 sv599_maxworkitemidletime : DWord;
2153 end;
2154
2155 TSERVER_INFO_598 = record
2156 sv598_maxrawworkitems : DWord;
2157 sv598_maxthreadsperqueue : DWord;
2158 sv598_producttype : DWord;
2159 sv598_serversize : DWord;
2160 sv598_connectionlessautodisc : DWord;
2161 sv598_sharingviolationretries : DWord;
2162 sv598_sharingviolationdelay : DWord;
2163 sv598_maxglobalopensearch : DWord;
2164 sv598_removeduplicatesearches : DWord;
2165 sv598_lockviolationoffset : DWord;
2166 sv598_lockviolationdelay : DWord;
2167 sv598_mdlreadswitchover : DWord;
2168 sv598_cachedopenlimit : DWord;
2169 sv598_otherqueueaffinity : DWord;
2170 sv598_restrictnullsessaccess : Bool;
2171 sv598_enablewfw311directipx : Bool;
2172 sv598_queuesamplesecs : DWord;
2173 sv598_balancecount : DWord;
2174 sv598_preferredaffinity : DWord;
2175 sv598_maxfreerfcbs : DWord;
2176 sv598_maxfreemfcbs : DWord;
2177 sv598_maxfreelfcbs : DWord;
2178 sv598_maxfreepagedpoolchunks : DWord;
2179 sv598_minpagedpoolchunksize : DWord;
2180 sv598_maxpagedpoolchunksize : DWord;
2181 sv598_sendsfrompreferredprocesso : Bool;
2182 sv598_cacheddirectorylimit : DWord;
2183 sv598_maxcopylength : DWord;
2184 sv598_enablebulktransfer : Bool;
2185 sv598_enablecompression : Bool;
2186 sv598_autosharewks : Bool;
2187 sv598_autoshareserver : Bool;
2188 end;
2189
2190 TSERVER_INFO_1005 = record
2191 sv1005_comment : LPWSTR;
2192 end;
2193
2194 TSERVER_INFO_1107 = record
2195 sv1107_users : DWord;
2196 end;
2197
2198 TSERVER_INFO_1010 = record
2199 sv1010_disc : LongInt;
2200 end;
2201
2202 TSERVER_INFO_1016 = record
2203 sv1016_hidden : Bool;
2204 end;
2205
2206 TSERVER_INFO_1017 = record
2207 sv1017_announce : DWord;
2208 end;
2209
2210 TSERVER_INFO_1018 = record
2211 sv1018_anndelta : DWord;
2212 end;
2213
2214 TSERVER_INFO_1501 = record
2215 sv1501_sessopens : DWord;
2216 end;
2217
2218 TSERVER_INFO_1502 = record
2219 sv1502_sessvcs : DWord;
2220 end;
2221
2222 TSERVER_INFO_1503 = record
2223 sv1503_opensearch : DWord;
2224 end;
2225
2226 TSERVER_INFO_1506 = record
2227 sv1506_maxworkitems : DWord;
2228 end;
2229
2230 TSERVER_INFO_1509 = record
2231 sv1509_maxrawbuflen : DWord;
2232 end;
2233
2234 TSERVER_INFO_1510 = record
2235 sv1510_sessusers : DWord;
2236 end;
2237
2238 TSERVER_INFO_1511 = record
2239 sv1511_sessconns : DWord;
2240 end;
2241
2242 TSERVER_INFO_1512 = record
2243 sv1512_maxnonpagedmemoryusage : DWord;
2244 end;
2245
2246 TSERVER_INFO_1513 = record
2247 sv1513_maxpagedmemoryusage : DWord;
2248 end;
2249
2250 TSERVER_INFO_1514 = record
2251 sv1514_enablesoftcompat : Bool;
2252 end;
2253
2254 TSERVER_INFO_1515 = record
2255 sv1515_enableforcedlogoff : Bool;
2256 end;
2257
2258 TSERVER_INFO_1516 = record
2259 sv1516_timesource : Bool;
2260 end;
2261
2262 TSERVER_INFO_1518 = record
2263 sv1518_lmannounce : Bool;
2264 end;
2265
2266 TSERVER_INFO_1520 = record
2267 sv1520_maxcopyreadlen : DWord;
2268 end;
2269
2270 TSERVER_INFO_1521 = record
2271 sv1521_maxcopywritelen : DWord;
2272 end;
2273
2274 TSERVER_INFO_1522 = record
2275 sv1522_minkeepsearch : DWord;
2276 end;
2277
2278 TSERVER_INFO_1523 = record
2279 sv1523_maxkeepsearch : DWord;
2280 end;
2281
2282 TSERVER_INFO_1524 = record
2283 sv1524_minkeepcomplsearch : DWord;
2284 end;
2285
2286 TSERVER_INFO_1525 = record
2287 sv1525_maxkeepcomplsearch : DWord;
2288 end;
2289
2290 TSERVER_INFO_1528 = record
2291 sv1528_scavtimeout : DWord;
2292 end;
2293
2294 TSERVER_INFO_1529 = record
2295 sv1529_minrcvqueue : DWord;
2296 end;
2297
2298 TSERVER_INFO_1530 = record
2299 sv1530_minfreeworkitems : DWord;
2300 end;
2301
2302 TSERVER_INFO_1533 = record
2303 sv1533_maxmpxct : DWord;
2304 end;
2305
2306 TSERVER_INFO_1534 = record
2307 sv1534_oplockbreakwait : DWord;
2308 end;
2309
2310 TSERVER_INFO_1535 = record
2311 sv1535_oplockbreakresponsewait : DWord;
2312 end;
2313
2314 TSERVER_INFO_1536 = record
2315 sv1536_enableoplocks : Bool;
2316 end;
2317
2318 TSERVER_INFO_1537 = record
2319 sv1537_enableoplockforceclose : Bool;
2320 end;
2321
2322 TSERVER_INFO_1538 = record
2323 sv1538_enablefcbopens : Bool;
2324 end;
2325
2326 TSERVER_INFO_1539 = record
2327 sv1539_enableraw : Bool;
2328 end;
2329
2330 TSERVER_INFO_1540 = record
2331 sv1540_enablesharednetdrives : Bool;
2332 end;
2333
2334 TSERVER_INFO_1541 = record
2335 sv1541_minfreeconnections : Bool;
2336 end;
2337
2338 TSERVER_INFO_1542 = record
2339 sv1542_maxfreeconnections : Bool;
2340 end;
2341
2342 TSERVER_INFO_1543 = record
2343 sv1543_initsesstable : DWord;
2344 end;
2345
2346 TSERVER_INFO_1544 = record
2347 sv1544_initconntable : DWord;
2348 end;
2349
2350 TSERVER_INFO_1545 = record
2351 sv1545_initfiletable : DWord;
2352 end;
2353
2354 TSERVER_INFO_1546 = record
2355 sv1546_initsearchtable : DWord;
2356 end;
2357
2358 TSERVER_INFO_1547 = record
2359 sv1547_alertschedule : DWord;
2360 end;
2361
2362 TSERVER_INFO_1548 = record
2363 sv1548_errorthreshold : DWord;
2364 end;
2365
2366 TSERVER_INFO_1549 = record
2367 sv1549_networkerrorthreshold : DWord;
2368 end;
2369
2370 TSERVER_INFO_1550 = record
2371 sv1550_diskspacethreshold : DWord;
2372 end;
2373
2374 TSERVER_INFO_1552 = record
2375 sv1552_maxlinkdelay : DWord;
2376 end;
2377
2378 TSERVER_INFO_1553 = record
2379 sv1553_minlinkthroughput : DWord;
2380 end;
2381
2382 TSERVER_INFO_1554 = record
2383 sv1554_linkinfovalidtime : DWord;
2384 end;
2385
2386 TSERVER_INFO_1555 = record
2387 sv1555_scavqosinfoupdatetime : DWord;
2388 end;
2389
2390 TSERVER_INFO_1556 = record
2391 sv1556_maxworkitemidletime : DWord;
2392 end;
2393
2394 TSERVER_INFO_1557 = record
2395 sv1557_maxrawworkitems : DWord;
2396 end;
2397
2398 TSERVER_INFO_1560 = record
2399 sv1560_producttype : DWord;
2400 end;
2401
2402 TSERVER_INFO_1561 = record
2403 sv1561_serversize : DWord;
2404 end;
2405
2406 TSERVER_INFO_1562 = record
2407 sv1562_connectionlessautodisc : DWord;
2408 end;
2409
2410 TSERVER_INFO_1563 = record
2411 sv1563_sharingviolationretries : DWord;
2412 end;
2413
2414 TSERVER_INFO_1564 = record
2415 sv1564_sharingviolationdelay : DWord;
2416 end;
2417
2418 TSERVER_INFO_1565 = record
2419 sv1565_maxglobalopensearch : DWord;
2420 end;
2421
2422 TSERVER_INFO_1566 = record
2423 sv1566_removeduplicatesearches : Bool;
2424 end;
2425
2426 TSERVER_INFO_1567 = record
2427 sv1567_lockviolationretries : DWord;
2428 end;
2429
2430 TSERVER_INFO_1568 = record
2431 sv1568_lockviolationoffset : DWord;
2432 end;
2433
2434 TSERVER_INFO_1569 = record
2435 sv1569_lockviolationdelay : DWord;
2436 end;
2437
2438 TSERVER_INFO_1570 = record
2439 sv1570_mdlreadswitchover : DWord;
2440 end;
2441
2442 TSERVER_INFO_1571 = record
2443 sv1571_cachedopenlimit : DWord;
2444 end;
2445
2446 TSERVER_INFO_1572 = record
2447 sv1572_criticalthreads : DWord;
2448 end;
2449
2450 TSERVER_INFO_1573 = record
2451 sv1573_restrictnullsessaccess : DWord;
2452 end;
2453
2454 TSERVER_INFO_1574 = record
2455 sv1574_enablewfw311directipx : DWord;
2456 end;
2457
2458 TSERVER_INFO_1575 = record
2459 sv1575_otherqueueaffinity : DWord;
2460 end;
2461
2462 TSERVER_INFO_1576 = record
2463 sv1576_queuesamplesecs : DWord;
2464 end;
2465
2466 TSERVER_INFO_1577 = record
2467 sv1577_balancecount : DWord;
2468 end;
2469
2470 TSERVER_INFO_1578 = record
2471 sv1578_preferredaffinity : DWord;
2472 end;
2473
2474 TSERVER_INFO_1579 = record
2475 sv1579_maxfreerfcbs : DWord;
2476 end;
2477
2478 TSERVER_INFO_1580 = record
2479 sv1580_maxfreemfcbs : DWord;
2480 end;
2481
2482 TSERVER_INFO_1581 = record
2483 sv1581_maxfreemlcbs : DWord;
2484 end;
2485
2486 TSERVER_INFO_1582 = record
2487 sv1582_maxfreepagedpoolchunks : DWord;
2488 end;
2489
2490 TSERVER_INFO_1583 = record
2491 sv1583_minpagedpoolchunksize : DWord;
2492 end;
2493
2494 TSERVER_INFO_1584 = record
2495 sv1584_maxpagedpoolchunksize : DWord;
2496 end;
2497
2498 TSERVER_INFO_1585 = record
2499 sv1585_sendsfrompreferredprocessor: Bool;
2500 end;
2501
2502 TSERVER_INFO_1586 = record
2503 sv1586_maxthreadsperqueue : DWord;
2504 end;
2505
2506 TSERVER_INFO_1587 = record
2507 sv1587_cacheddirectorylimit : DWord;
2508 end;
2509
2510 TSERVER_INFO_1588 = record
2511 sv1588_maxcopylength : DWord;
2512 end;
2513
2514 TSERVER_INFO_1589 = record
2515 sv1589_enablebulktransfer : DWord;
2516 end;
2517
2518 TSERVER_INFO_1590 = record
2519 sv1590_enablecompression : DWord;
2520 end;
2521
2522 TSERVER_INFO_1591 = record
2523 sv1591_autosharewks : DWord;
2524 end;
2525
2526 TSERVER_INFO_1592 = record
2527 sv1592_autoshareserver : DWord;
2528 end;
2529
2530 (*
2531 A special structure definition is required in order for this
2532 structure to work with RPC. The problem is that having addresslength
2533 indicate the number of bytes in address means that RPC must know the
2534 link between the two.
2535 *)
2536 TSERVER_TRANSPORT_INFO_0 = record
2537 svti0_numberofvcs : DWord;
2538 svti0_transportname : LPSTR;
2539 svti0_transportaddress : Pointer;
2540 svti0_transportaddresslength : DWord;
2541 svti0_networkaddress : LPWSTR;
2542 end;
2543
2544 TSERVER_TRANSPORT_INFO_1 = record
2545 svti1_numberofvcs : DWord;
2546 svti1_transportname : LPWSTR;
2547 svti1_transportaddress : Pointer;
2548 svti1_transportaddresslength : DWord;
2549 svti1_networkaddress : LPWSTR;
2550 svti1_domain : LPWSTR;
2551 end;
2552
2553 const
2554 { The platform ID indicates the levels to use for platform-specific information. }
2555 SV_PLATFORM_ID_OS2 = 400;
2556 SV_PLATFORM_ID_NT = 500;
2557
2558 { Mask to be applied to svX_version_major in order to obtain the major version number. }
2559 MAJOR_VERSION_MASK = $0F;
2560
2561 { Bit-mapped values for svX_type fields. X = 1, 2 or 3. }
2562 SV_TYPE_WORKSTATION = $00000001;
2563 SV_TYPE_SERVER = $00000002;
2564 SV_TYPE_SQLSERVER = $00000004;
2565 SV_TYPE_DOMAIN_CTRL = $00000008;
2566 SV_TYPE_DOMAIN_BAKCTRL = $00000010;
2567 SV_TYPE_TIME_SOURCE = $00000020;
2568 SV_TYPE_AFP = $00000040;
2569 SV_TYPE_NOVELL = $00000080;
2570 SV_TYPE_DOMAIN_MEMBER = $00000100;
2571 SV_TYPE_PRINTQ_SERVER = $00000200;
2572 SV_TYPE_DIALIN_SERVER = $00000400;
2573 SV_TYPE_XENIX_SERVER = $00000800;
2574 SV_TYPE_SERVER_UNIX = SV_TYPE_XENIX_SERVER;
2575 SV_TYPE_NT = $00001000;
2576 SV_TYPE_WFW = $00002000;
2577 SV_TYPE_SERVER_MFPN = $00004000;
2578 SV_TYPE_SERVER_NT = $00008000;
2579 SV_TYPE_POTENTIAL_BROWSER = $00010000;
2580 SV_TYPE_BACKUP_BROWSER = $00020000;
2581 SV_TYPE_MASTER_BROWSER = $00040000;
2582 SV_TYPE_DOMAIN_MASTER = $00080000;
2583 SV_TYPE_SERVER_OSF = $00100000;
2584 SV_TYPE_SERVER_VMS = $00200000;
2585 SV_TYPE_WINDOWS = $00400000;
2586 SV_TYPE_DFS = $00800000;
2587 SV_TYPE_CLUSTER_NT = $01000000;
2588 SV_TYPE_TERMINALSERVER = $02000000;
2589 SV_TYPE_DCE = $10000000;
2590 SV_TYPE_ALTERNATE_XPORT = $20000000;
2591 SV_TYPE_LOCAL_LIST_ONLY = $40000000;
2592 SV_TYPE_DOMAIN_ENUM = $80000000;
2593 SV_TYPE_ALL = $FFFFFFFF;
2594
2595 { Special value for sv102_disc that specifies infinite disconnect time. }
2596 SV_NODISC = (-1); { No autodisconnect timeout enforced }
2597
2598 { Values of svX_security field. X = 2 or 3. }
2599 SV_USERSECURITY = 1;
2600 SV_SHARESECURITY = 0;
2601
2602 { Values of svX_hidden field. X = 2 or 3. }
2603 SV_HIDDEN = 1;
2604 SV_VISIBLE = 0;
2605
2606 { Values for ParmError parameter to NetServerSetInfo. }
2607 SV_PLATFORM_ID_PARMNUM = 101;
2608 SV_NAME_PARMNUM = 102;
2609 SV_VERSION_MAJOR_PARMNUM = 103;
2610 SV_VERSION_MINOR_PARMNUM = 104;
2611 SV_TYPE_PARMNUM = 105;
2612 SV_COMMENT_PARMNUM = 5;
2613 SV_USERS_PARMNUM = 107;
2614 SV_DISC_PARMNUM = 10;
2615 SV_HIDDEN_PARMNUM = 16;
2616 SV_ANNOUNCE_PARMNUM = 17;
2617 SV_ANNDELTA_PARMNUM = 18;
2618 SV_USERPATH_PARMNUM = 112;
2619
2620 SV_ULIST_MTIME_PARMNUM = 401;
2621 SV_GLIST_MTIME_PARMNUM = 402;
2622 SV_ALIST_MTIME_PARMNUM = 403;
2623 SV_ALERTS_PARMNUM = 11;
2624 SV_SECURITY_PARMNUM = 405;
2625 SV_NUMADMIN_PARMNUM = 406;
2626 SV_LANMASK_PARMNUM = 407;
2627 SV_GUESTACC_PARMNUM = 408;
2628 SV_CHDEVQ_PARMNUM = 410;
2629 SV_CHDEVJOBS_PARMNUM = 411;
2630 SV_CONNECTIONS_PARMNUM = 412;
2631 SV_SHARES_PARMNUM = 413;
2632 SV_OPENFILES_PARMNUM = 414;
2633 SV_SESSREQS_PARMNUM = 417;
2634 SV_ACTIVELOCKS_PARMNUM = 419;
2635 SV_NUMREQBUF_PARMNUM = 420;
2636 SV_NUMBIGBUF_PARMNUM = 422;
2637 SV_NUMFILETASKS_PARMNUM = 423;
2638 SV_ALERTSCHED_PARMNUM = 37;
2639 SV_ERRORALERT_PARMNUM = 38;
2640 SV_LOGONALERT_PARMNUM = 39;
2641 SV_ACCESSALERT_PARMNUM = 40;
2642 SV_DISKALERT_PARMNUM = 41;
2643 SV_NETIOALERT_PARMNUM = 42;
2644 SV_MAXAUDITSZ_PARMNUM = 43;
2645 SV_SRVHEURISTICS_PARMNUM = 431;
2646
2647 SV_SESSOPENS_PARMNUM = 501;
2648 SV_SESSVCS_PARMNUM = 502;
2649 SV_OPENSEARCH_PARMNUM = 503;
2650 SV_SIZREQBUF_PARMNUM = 504;
2651 SV_INITWORKITEMS_PARMNUM = 505;
2652 SV_MAXWORKITEMS_PARMNUM = 506;
2653 SV_RAWWORKITEMS_PARMNUM = 507;
2654 SV_IRPSTACKSIZE_PARMNUM = 508;
2655 SV_MAXRAWBUFLEN_PARMNUM = 509;
2656 SV_SESSUSERS_PARMNUM = 510;
2657 SV_SESSCONNS_PARMNUM = 511;
2658 SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM = 512;
2659 SV_MAXPAGEDMEMORYUSAGE_PARMNUM = 513;
2660 SV_ENABLESOFTCOMPAT_PARMNUM = 514;
2661 SV_ENABLEFORCEDLOGOFF_PARMNUM = 515;
2662 SV_TIMESOURCE_PARMNUM = 516;
2663 SV_ACCEPTDOWNLEVELAPIS_PARMNUM = 517;
2664 SV_LMANNOUNCE_PARMNUM = 518;
2665 SV_DOMAIN_PARMNUM = 519;
2666 SV_MAXCOPYREADLEN_PARMNUM = 520;
2667 SV_MAXCOPYWRITELEN_PARMNUM = 521;
2668 SV_MINKEEPSEARCH_PARMNUM = 522;
2669 SV_MAXKEEPSEARCH_PARMNUM = 523;
2670 SV_MINKEEPCOMPLSEARCH_PARMNUM = 524;
2671 SV_MAXKEEPCOMPLSEARCH_PARMNUM = 525;
2672 SV_THREADCOUNTADD_PARMNUM = 526;
2673 SV_NUMBLOCKTHREADS_PARMNUM = 527;
2674 SV_SCAVTIMEOUT_PARMNUM = 528;
2675 SV_MINRCVQUEUE_PARMNUM = 529;
2676 SV_MINFREEWORKITEMS_PARMNUM = 530;
2677 SV_XACTMEMSIZE_PARMNUM = 531;
2678 SV_THREADPRIORITY_PARMNUM = 532;
2679 SV_MAXMPXCT_PARMNUM = 533;
2680 SV_OPLOCKBREAKWAIT_PARMNUM = 534;
2681 SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM = 535;
2682 SV_ENABLEOPLOCKS_PARMNUM = 536;
2683 SV_ENABLEOPLOCKFORCECLOSE_PARMNUM = 537;
2684 SV_ENABLEFCBOPENS_PARMNUM = 538;
2685 SV_ENABLERAW_PARMNUM = 539;
2686 SV_ENABLESHAREDNETDRIVES_PARMNUM = 540;
2687 SV_MINFREECONNECTIONS_PARMNUM = 541;
2688 SV_MAXFREECONNECTIONS_PARMNUM = 542;
2689 SV_INITSESSTABLE_PARMNUM = 543;
2690 SV_INITCONNTABLE_PARMNUM = 544;
2691 SV_INITFILETABLE_PARMNUM = 545;
2692 SV_INITSEARCHTABLE_PARMNUM = 546;
2693 SV_ALERTSCHEDULE_PARMNUM = 547;
2694 SV_ERRORTHRESHOLD_PARMNUM = 548;
2695 SV_NETWORKERRORTHRESHOLD_PARMNUM = 549;
2696 SV_DISKSPACETHRESHOLD_PARMNUM = 550;
2697 SV_MAXLINKDELAY_PARMNUM = 552;
2698 SV_MINLINKTHROUGHPUT_PARMNUM = 553;
2699 SV_LINKINFOVALIDTIME_PARMNUM = 554;
2700 SV_SCAVQOSINFOUPDATETIME_PARMNUM = 555;
2701 SV_MAXWORKITEMIDLETIME_PARMNUM = 556;
2702 SV_MAXRAWWORKITEMS_PARMNUM = 557;
2703 SV_PRODUCTTYPE_PARMNUM = 560;
2704 SV_SERVERSIZE_PARMNUM = 561;
2705 SV_CONNECTIONLESSAUTODISC_PARMNUM = 562;
2706 SV_SHARINGVIOLATIONRETRIES_PARMNUM = 563;
2707 SV_SHARINGVIOLATIONDELAY_PARMNUM = 564;
2708 SV_MAXGLOBALOPENSEARCH_PARMNUM = 565;
2709 SV_REMOVEDUPLICATESEARCHES_PARMNUM = 566;
2710 SV_LOCKVIOLATIONRETRIES_PARMNUM = 567;
2711 SV_LOCKVIOLATIONOFFSET_PARMNUM = 568;
2712 SV_LOCKVIOLATIONDELAY_PARMNUM = 569;
2713 SV_MDLREADSWITCHOVER_PARMNUM = 570;
2714 SV_CACHEDOPENLIMIT_PARMNUM = 571;
2715 SV_CRITICALTHREADS_PARMNUM = 572;
2716 SV_RESTRICTNULLSESSACCESS_PARMNUM = 573;
2717 SV_ENABLEWFW311DIRECTIPX_PARMNUM = 574;
2718 SV_OTHERQUEUEAFFINITY_PARMNUM = 575;
2719 SV_QUEUESAMPLESECS_PARMNUM = 576;
2720 SV_BALANCECOUNT_PARMNUM = 577;
2721 SV_PREFERREDAFFINITY_PARMNUM = 578;
2722 SV_MAXFREERFCBS_PARMNUM = 579;
2723 SV_MAXFREEMFCBS_PARMNUM = 580;
2724 SV_MAXFREELFCBS_PARMNUM = 581;
2725 SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM = 582;
2726 SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM = 583;
2727 SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM = 584;
2728 SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM = 585;
2729 SV_MAXTHREADSPERQUEUE_PARMNUM = 586;
2730 SV_CACHEDDIRECTORYLIMIT_PARMNUM = 587;
2731 SV_MAXCOPYLENGTH_PARMNUM = 588;
2732 SV_ENABLEBULKTRANSFER_PARMNUM = 589;
2733 SV_ENABLECOMPRESSION_PARMNUM = 590;
2734 SV_AUTOSHAREWKS_PARMNUM = 591;
2735 SV_AUTOSHARESERVER_PARMNUM = 592;
2736
2737 { Single-field infolevels for NetServerSetInfo. }
2738 SV_COMMENT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_COMMENT_PARMNUM);
2739 SV_USERS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_USERS_PARMNUM);
2740 SV_DISC_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_DISC_PARMNUM);
2741 SV_HIDDEN_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_HIDDEN_PARMNUM);
2742 SV_ANNOUNCE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ANNOUNCE_PARMNUM);
2743 SV_ANNDELTA_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ANNDELTA_PARMNUM);
2744 SV_SESSOPENS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SESSOPENS_PARMNUM);
2745 SV_SESSVCS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SESSVCS_PARMNUM);
2746 SV_OPENSEARCH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_OPENSEARCH_PARMNUM);
2747 SV_MAXWORKITEMS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXWORKITEMS_PARMNUM);
2748 SV_MAXRAWBUFLEN_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXRAWBUFLEN_PARMNUM);
2749 SV_SESSUSERS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SESSUSERS_PARMNUM);
2750 SV_SESSCONNS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SESSCONNS_PARMNUM);
2751 SV_MAXNONPAGEDMEMORYUSAGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM);
2752 SV_MAXPAGEDMEMORYUSAGE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXPAGEDMEMORYUSAGE_PARMNUM);
2753 SV_ENABLESOFTCOMPAT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLESOFTCOMPAT_PARMNUM);
2754 SV_ENABLEFORCEDLOGOFF_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLEFORCEDLOGOFF_PARMNUM);
2755 SV_TIMESOURCE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_TIMESOURCE_PARMNUM);
2756 SV_LMANNOUNCE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_LMANNOUNCE_PARMNUM);
2757 SV_MAXCOPYREADLEN_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYREADLEN_PARMNUM);
2758 SV_MAXCOPYWRITELEN_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYWRITELEN_PARMNUM);
2759 SV_MINKEEPSEARCH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINKEEPSEARCH_PARMNUM);
2760 SV_MAXKEEPSEARCH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXKEEPSEARCH_PARMNUM);
2761 SV_MINKEEPCOMPLSEARCH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINKEEPCOMPLSEARCH_PARMNUM);
2762 SV_MAXKEEPCOMPLSEARCH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXKEEPCOMPLSEARCH_PARMNUM);
2763 SV_SCAVTIMEOUT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SCAVTIMEOUT_PARMNUM);
2764 SV_MINRCVQUEUE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINRCVQUEUE_PARMNUM);
2765 SV_MINFREEWORKITEMS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINFREEWORKITEMS_PARMNUM);
2766 SV_MAXMPXCT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXMPXCT_PARMNUM);
2767 SV_OPLOCKBREAKWAIT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_OPLOCKBREAKWAIT_PARMNUM);
2768 SV_OPLOCKBREAKRESPONSEWAIT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM);
2769 SV_ENABLEOPLOCKS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLEOPLOCKS_PARMNUM);
2770 SV_ENABLEOPLOCKFORCECLOSE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLEOPLOCKFORCECLOSE_PARMNUM);
2771 SV_ENABLEFCBOPENS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLEFCBOPENS_PARMNUM);
2772 SV_ENABLERAW_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLERAW_PARMNUM);
2773 SV_ENABLESHAREDNETDRIVES_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLESHAREDNETDRIVES_PARMNUM);
2774 SV_MINFREECONNECTIONS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINFREECONNECTIONS_PARMNUM);
2775 SV_MAXFREECONNECTIONS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXFREECONNECTIONS_PARMNUM);
2776 SV_INITSESSTABLE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_INITSESSTABLE_PARMNUM);
2777 SV_INITCONNTABLE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_INITCONNTABLE_PARMNUM);
2778 SV_INITFILETABLE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_INITFILETABLE_PARMNUM);
2779 SV_INITSEARCHTABLE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_INITSEARCHTABLE_PARMNUM);
2780 SV_ALERTSCHEDULE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ALERTSCHEDULE_PARMNUM);
2781 SV_ERRORTHRESHOLD_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ERRORTHRESHOLD_PARMNUM);
2782 SV_NETWORKERRORTHRESHOLD_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_NETWORKERRORTHRESHOLD_PARMNUM);
2783 SV_DISKSPACETHRESHOLD_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_DISKSPACETHRESHOLD_PARMNUM);
2784 SV_MAXLINKDELAY_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXLINKDELAY_PARMNUM);
2785 SV_MINLINKTHROUGHPUT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINLINKTHROUGHPUT_PARMNUM);
2786 SV_LINKINFOVALIDTIME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_LINKINFOVALIDTIME_PARMNUM);
2787 SV_SCAVQOSINFOUPDATETIME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SCAVQOSINFOUPDATETIME_PARMNUM);
2788 SV_MAXWORKITEMIDLETIME_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXWORKITEMIDLETIME_PARMNUM);
2789 SV_MAXRAWWORKITEMS_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXRAWWORKITEMS_PARMNUM);
2790 SV_PRODUCTTYPE_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_PRODUCTTYPE_PARMNUM);
2791 SV_SERVERSIZE_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SERVERSIZE_PARMNUM);
2792 SV_CONNECTIONLESSAUTODISC_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_CONNECTIONLESSAUTODISC_PARMNUM);
2793 SV_SHARINGVIOLATIONRETRIES_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SHARINGVIOLATIONRETRIES_PARMNUM);
2794 SV_SHARINGVIOLATIONDELAY_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SHARINGVIOLATIONDELAY_PARMNUM);
2795 SV_MAXGLOBALOPENSEARCH_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXGLOBALOPENSEARCH_PARMNUM);
2796 SV_REMOVEDUPLICATESEARCHES_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_REMOVEDUPLICATESEARCHES_PARMNUM);
2797 SV_LOCKVIOLATIONRETRIES_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_LOCKVIOLATIONRETRIES_PARMNUM);
2798 SV_LOCKVIOLATIONOFFSET_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_LOCKVIOLATIONOFFSET_PARMNUM);
2799 SV_LOCKVIOLATIONDELAY_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_LOCKVIOLATIONDELAY_PARMNUM);
2800 SV_MDLREADSWITCHOVER_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MDLREADSWITCHOVER_PARMNUM);
2801 SV_CACHEDOPENLIMIT_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_CACHEDOPENLIMIT_PARMNUM);
2802 SV_CRITICALTHREADS_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_CRITICALTHREADS_PARMNUM);
2803 SV_RESTRICTNULLSESSACCESS_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_RESTRICTNULLSESSACCESS_PARMNUM);
2804 SV_ENABLEWFW311DIRECTIPX_INFOLOEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLEWFW311DIRECTIPX_PARMNUM);
2805 SV_OTHERQUEUEAFFINITY_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_OTHERQUEUEAFFINITY_PARMNUM);
2806 SV_QUEUESAMPLESECS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_QUEUESAMPLESECS_PARMNUM);
2807 SV_BALANCECOUNT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_BALANCECOUNT_PARMNUM);
2808 SV_PREFERREDAFFINITY_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_PREFERREDAFFINITY_PARMNUM);
2809 SV_MAXFREERFCBS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXFREERFCBS_PARMNUM);
2810 SV_MAXFREEMFCBS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXFREEMFCBS_PARMNUM);
2811 SV_MAXFREELFCBS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXFREELFCBS_PARMNUM);
2812 SV_MAXFREEPAGEDPOOLCHUNKS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM);
2813 SV_MINPAGEDPOOLCHUNKSIZE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM);
2814 SV_MAXPAGEDPOOLCHUNKSIZE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM);
2815 SV_SENDSFROMPREFERREDPROCESSOR_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM);
2816 SV_MAXTHREADSPERQUEUE_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXTHREADSPERQUEUE_PARMNUM);
2817 SV_CACHEDDIRECTORYLIMIT_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_CACHEDDIRECTORYLIMIT_PARMNUM);
2818 SV_MAXCOPYLENGTH_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYLENGTH_PARMNUM);
2819 SV_ENABLEBULKTRANSFER_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLEBULKTRANSFER_PARMNUM);
2820 SV_ENABLECOMPRESSION_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_ENABLECOMPRESSION_PARMNUM);
2821 SV_AUTOSHAREWKS_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_AUTOSHAREWKS_PARMNUM);
2822 SV_AUTOSHARESERVER_INFOLEVEL = (PARMNUM_BASE_INFOLEVEL + SV_AUTOSHARESERVER_PARMNUM);
2823
2824 SVI1_NUM_ELEMENTS = 5;
2825 SVI2_NUM_ELEMENTS = 40;
2826 SVI3_NUM_ELEMENTS = 44;
2827
2828 { Maxmimum length for command string to NetServerAdminCommand. }
2829 SV_MAX_CMD_LEN = PATHLEN;
2830
2831 { Masks describing AUTOPROFILE parameters }
2832 SW_AUTOPROF_LOAD_MASK = $1;
2833 SW_AUTOPROF_SAVE_MASK = $2;
2834
2835 { Max size of svX_srvheuristics. }
2836 SV_MAX_SRV_HEUR_LEN = 32; { Max heuristics info string length. }
2837
2838 { Equate for use with sv102_licenses. }
2839 SV_USERS_PER_LICENSE = 5;
2840
2841 {-------------------- LMUSE.H -----------------------------------------------}
2842 type
2843 TNetUseAdd = function(UncServerName: LPWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
2844 TNetUseDel = function(UncServerName, UseName: LPWSTR; ForceCond: DWord): NET_API_STATUS; stdcall;
2845 TNetUseEnum = function(UncServerName: LPWSTR; Level : DWord; var Buffer: Pointer; PrefMaxSize : DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
2846 TNetUseGetInfo = function(UncServerName, UseName: LPWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
2847
2848 {-------------------- LMWKSTA.H ---------------------------------------------}
2849 type
2850 TNetWkstaGetInfo = function(ServerName: LPWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
2851 TNetWkstaSetInfo = function(ServerName: LPWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
2852 TNetWkstaUserGetInfo = function(Reserved: LPWSTR; Level: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
2853 TNetWkstaUserSetInfo = function(ServerName: LPWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
2854 TNetWkstaUserEnum = function(ServerName: LPWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
2855 TNetWkstaTransportAdd = function(ServerName: LPWSTR; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS; stdcall;
2856 TNetWkstaTransportDel = function(ServerName, TransportName: LPWSTR; Ucond: DWord): NET_API_STATUS; stdcall;
2857 TNetWkstaTransportEnum = function(ServerName: LPWSTR; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS; stdcall;
2858
2859 {-------------------- LMAPIBUF.H --------------------------------------------}
2860 type
2861 TNetApiBufferAllocate = function(ByteCount: Cardinal; var Buffer: Pointer): NET_API_STATUS; stdcall;
2862 TNetApiBufferFree = function(Buffer: Pointer): NET_API_STATUS; stdcall;
2863 TNetApiBufferReallocate = function(OldBuffer: Pointer; NewByteCount : Cardinal; var NewBuffer: Pointer): NET_API_STATUS; stdcall;
2864 TNetApiBufferSize = function(Buffer: Pointer; var ByteCount: DWord): NET_API_STATUS; stdcall;
2865
2866 {-------------------- LMSTATS.H ---------------------------------------------}
2867 type
2868 TNetStatisticsGet = function(Server, Service: LPWSTR; Level, Options: DWord; var Buffer: Pointer): NET_API_STATUS; stdcall;
2869
2870 {-------------------- WINBASE.H ---------------------------------------------}
2871 type
2872 TGetSidIdentifierAuthority = function(SID: PSID): PSIDIdentifierAuthority; stdcall;
2873 TGetSidSubAuthority = function(SID: PSID; nSubAuthority: DWord): PDWord; stdcall;
2874 TGetSidSubAuthorityCount = function(SID: PSID): PByte; stdcall;
2875 TLookupAccountName = function(SystemName, AccountName: PChar; Sid: Pointer; var cbSid: DWord; DomainName: PChar; var cbDomainName: DWord; var peUse: DWord): Boolean; stdcall;
2876 TLookupAccountSid = function(SystemName: PChar; Sid: PSID; AccountName: PChar; var AccountLen: DWord; DomainName: PChar; var DomainLen; var peUse: DWord): Boolean; stdcall;
2877
2878 { ============================================================================}
2879 {LMACCESS}
2880 function StNetUserAdd(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2881 function StNetUserEnum(ServerName: string; Level, Filter: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2882 function StNetUserGetInfo(ServerName, UserName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2883 function StNetUserSetInfo(ServerName, UserName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2884 function StNetUserDel(ServerName, UserName: string): NET_API_STATUS;
2885 function StNetUserGetGroups(ServerName, UserName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord): NET_API_STATUS;
2886 function StNetUserSetGroups(ServerName, UserName: string; Level: DWord; Buffer: Pointer; NumEntries: DWord): NET_API_STATUS;
2887 function StNetUserGetLocalGroups(ServerName, UserName: string; Level: DWord; Flags: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries : DWord): NET_API_STATUS;
2888 function StNetUserModalsGet(ServerName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2889 function StNetUserModalsSet(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2890 function StNetUserChangePassword(DomainName, UserName, OldPassword, NewPassword: string): NET_API_STATUS;
2891
2892 function StNetGroupAdd(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2893 function StNetGroupAddUser(ServerName, GroupName, UserName: string): NET_API_STATUS;
2894 function StNetGroupEnum(ServerName: string; Level: DWord; Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2895 function StNetGroupGetInfo(ServerName, GroupName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2896 function StNetGroupSetInfo(ServerName, GroupName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2897 function StNetGroupDel(ServerName, GroupName: string): NET_API_STATUS;
2898 function StNetGroupDelUser(ServerName, GroupName, UserName: string): NET_API_STATUS;
2899 function StNetGroupGetUsers(ServerName, GroupName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ResumeHandle: Pointer): NET_API_STATUS;
2900 function StNetGroupSetUsers(ServerName, GroupName: string; Level: DWord; Buffer: Pointer; var TotalEntries : DWord): NET_API_STATUS;
2901
2902 function StNetLocalGroupAdd(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2903 function StNetLocalGroupAddMember(ServerName, GroupName: string; MembersID: PSID): NET_API_STATUS;
2904 function StNetLocalGroupEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; var ResumeHandle: DWord): NET_API_STATUS;
2905 function StNetLocalGroupGetInfo(ServerName, GroupName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2906 function StNetLocalGroupSetInfo(ServerName, GroupName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2907 function StNetLocalGroupDel(ServerName, GroupName: string): NET_API_STATUS;
2908 function StNetLocalGroupDelMember(ServerName, GroupName: string; MembersID: PSID): NET_API_STATUS;
2909 function StNetLocalGroupGetMembers(ServerName, GroupName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ResumeHandle: Pointer): NET_API_STATUS;
2910 function StNetLocalGroupSetMembers(ServerName, GroupName: string; Level: DWord; Buffer: Pointer; var TotalEntries: DWord): NET_API_STATUS;
2911 function StNetLocalGroupAddMembers(ServerName, GroupName: string; Level: DWord; Buffer: Pointer; TotalEntries: DWord): NET_API_STATUS;
2912 function StNetLocalGroupDelMembers(ServerName, GroupName: string; Level: DWord; Buffer: Pointer; TotalEntries: DWord): NET_API_STATUS;
2913
2914 function StNetQueryDisplayInformation(ServerName: string; Level, Index, EntriesRequested, PrefMaxLen: DWord; var ReturnedCount: DWord; var Buffer: Pointer): NET_API_STATUS;
2915 function StNetGetDisplayInformationIndex(ServerName: string; Level: DWord; Prefix: string; var Index: DWord): NET_API_STATUS;
2916
2917 function StNetAccessAdd(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2918 function StNetAccessEnum(ServerName, BasePath: string; Recursive, Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2919 function StNetAccessGetInfo(ServerName, Resource: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2920 function StNetAccessSetInfo(ServerName, Resource: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2921 function StNetAccessDel(ServerName, Resource: string): NET_API_STATUS;
2922 function StNetAccessGetUserPerms(ServerName, UGname, Resource: string; var Perms: DWord): NET_API_STATUS;
2923
2924 function StNetGetDCName(ServerName, DomainName: string; var Buffer: string): NET_API_STATUS;
2925 function StNetGetAnyDCName(ServerName, DomainName: string; var Buffer: string): NET_API_STATUS;
2926 function StI_NetLogonControl(ServerName: string; FunctionCode, QueryLevel: DWord; var Buffer: Pointer): NET_API_STATUS;
2927 function StI_NetLogonControl2(ServerName: string; FunctionCode, QueryLevel: DWord; Data: Pointer; var Buffer: Pointer): NET_API_STATUS;
2928 function StNetEnumerateTrustedDomains(ServerName: string; var Buffer: Pointer): NET_API_STATUS;
2929
2930 {LMALERT}
2931 function StNetAlertRaise(AlertEventName: string; Buffer: Pointer; BufferSize: DWord): NET_API_STATUS;
2932 function StNetAlertRaiseEx(AlertEventName: string; VariableInfo: Pointer; VariableInfoSize: DWord; ServiceName: string): NET_API_STATUS;
2933
2934 function StNetShareAdd(ServerName: string; Level: DWORD; Buffer: Pointer; var ParmErr: DWORD): NET_API_STATUS;
2935 function StNetShareEnum(ServerName: string; Level: DWORD; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; var ResumeHandle: DWord): NET_API_STATUS;
2936 function StNetShareEnumSticky(ServerName: string; Level: DWORD; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2937 function StNetShareGetInfo(ServerName, NetName: string; Level: DWORD; var Buffer: Pointer): NET_API_STATUS;
2938 function StNetShareSetInfo(ServerName, NetName: string; Level: DWORD; var Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2939 function StNetShareDel(ServerName, NetName: string; Reserved: DWord): NET_API_STATUS;
2940 function StNetShareDelSticky(ServerName, NetName: string; Reserved: DWord): NET_API_STATUS;
2941 function StNetShareCheck(ServerName, Device: string; var ShareType: DWord): NET_API_STATUS;
2942
2943 function StNetSessionEnum(ServerName, UncClientName, UserName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2944 function StNetSessionDel(ServerName, UncClientName, UserName: string): NET_API_STATUS;
2945 function StNetSessionGetInfo(ServerName, UncClientName, UserName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2946
2947 function StNetConnectionEnum(ServerName, Qualifier: string; Level: DWord; var Buffer : Pointer; PrefMaxLen : DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2948
2949 function StNetFileClose(ServerName: string; FileID: DWord): NET_API_STATUS;
2950 function StNetFileEnum(ServerName, BasePath, UserName: string; Level: DWord; var Buffer: Pointer; PrefMexLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2951 function StNetFileGetInfo(ServerName: string; FileID, Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2952
2953 {LMMSG}
2954 function StNetMessageNameAdd(ServerName, MsgName: string): NET_API_STATUS;
2955 function StNetMessageNameEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ResumeHandle: PDWord): NET_API_STATUS;
2956 function StNetMessageNameGetInfo(ServerName, MsgName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2957 function StNetMessageNameDel(ServerName, MsgName: string): NET_API_STATUS;
2958 function StNetMessageBufferSend(ServerName, MsgName, FromName: string; Buffer: Pointer; BufferLen: DWord): NET_API_STATUS;
2959
2960 {LMREMUTL}
2961 function StNetRemoteTOD(UncServerName: string; var Buffer: Pointer): NET_API_STATUS;
2962 function StNetRemoteComputerSupports(UncServerName: string; OptionsWanted: DWord; var OptionsSupported: DWord): NET_API_STATUS;
2963
2964 {LMSERVER}
2965 function StNetServerEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ServerType: DWord; Domain: string; var ResumeHandle: DWord): NET_API_STATUS;
2966 function StNetServerEnumEx(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord; ServerType: DWord; Domain, FirstNameToReturn : string): NET_API_STATUS;
2967 function StNetServerGetInfo(ServerName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2968 function StNetServerSetInfo(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2969 function StNetServerDiskEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2970 function StNetServerComputerNameAdd(ServerName, EmulatedDomainName, EmulatedServerName: string): NET_API_STATUS;
2971 function StNetServerComputerNameDel(ServerName, EmulatedServerName: string): NET_API_STATUS;
2972 function StNetServerTransportAdd(ServerName: string; Level: DWord; Buffer: Pointer): NET_API_STATUS;
2973 function StNetServerTransportAddEx(ServerName: WideString; Level: DWord; Buffer: Pointer): NET_API_STATUS;
2974 function StNetServerTransportDel(ServerName: string; Level: DWord; Buffer: Pointer): NET_API_STATUS;
2975 function StNetServerTransportEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2976
2977 {LMUSE}
2978 function StNetUseAdd(UncServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2979 function StNetUseDel(UncServerName, UseName: string; ForceCond: DWord): NET_API_STATUS;
2980 function StNetUseEnum(UncServerName: string; Level : DWord; var Buffer: Pointer; PrefMaxSize : DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2981 function StNetUseGetInfo(UncServerName, UseName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2982
2983 {LMWKSTA}
2984 function StNetWkstaGetInfo(ServerName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2985 function StNetWkstaSetInfo(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2986 function StNetWkstaUserGetInfo(Reserved: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
2987 function StNetWkstaUserSetInfo(Reserved: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2988 function StNetWkstaUserEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2989 function StNetWkstaTransportAdd(ServerName: string; Level: DWord; Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
2990 function StNetWkstaTransportDel(ServerName, TransportName: string; Ucond: DWord): NET_API_STATUS;
2991 function StNetWkstaTransportEnum(ServerName: string; Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead, TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
2992
2993 {LMAPIBUF}
2994 function StNetApiBufferAllocate(ByteCount: Cardinal; var Buffer: Pointer): NET_API_STATUS;
2995 function StNetApiBufferFree(Buffer: Pointer): NET_API_STATUS;
2996 function StNetApiBufferReallocate(OldBuffer: Pointer; NewByteCount : Cardinal; var NewBuffer: Pointer): NET_API_STATUS;
2997 function StNetApiBufferSize(Buffer: Pointer; var ByteCount: DWord): NET_API_STATUS;
2998
2999 {LMSTATS}
3000 function StNetStatisticsGet(ServerName, ServiceName: string; Level, Options: DWord; var Buffer: Pointer): NET_API_STATUS;
3001
3002 {WINBASE}
3003 function StGetSidIdentifierAuthority(Sid: PSID): PSIDIdentifierAuthority;
3004 function StGetSidSubAuthority(Sid: PSID; SubAuthority: DWord): DWord;
3005 function StGetSidSubAuthorityCount(SID: PSID): Byte;
3006 function StLookupAccountName(SystemName, AccountName: string; var Sid: Pointer; var SidLength: DWord; var DomainName: string; var peUse: DWord): Boolean;
3007 function StLookupAccountSid(SystemName: string; Sid: PSid; var AccountName, DomainName: string; var peUse: DWord): Boolean;
3008
3009
3010 type
3011 TLMWideChar = record
3012 Value : PWideChar;
3013 Length: DWord;
3014 end;
3015
3016 TNetDisplayUserArray = array[0..(MaxInt div SizeOf(TNET_DISPLAY_USER))-1] of TNET_DISPLAY_USER;
3017 TNetDisplayGroupArray = array[0..(MaxInt div SizeOf(TNET_DISPLAY_GROUP))-1] of TNET_DISPLAY_GROUP;
3018
3019 TUserInfo3Array = array[0..(MaxInt div SizeOf(TUSER_INFO_3))-1] of TUSER_INFO_3;
3020
3021 TLocalGroupInfo1Array = array[0..(MaxInt div SizeOf(TLOCALGROUP_INFO_1))-1] of TLOCALGROUP_INFO_1;
3022 TLocalGroupUsersInfo0Array = array[0..(MaxInt div SizeOf(TLOCALGROUP_USERS_INFO_0))-1] of TLOCALGROUP_USERS_INFO_0;
3023 TLocalGroupMembersInfo1Array = array[0..(MaxInt div SizeOf(TLOCALGROUP_MEMBERS_INFO_1))-1] of TLOCALGROUP_MEMBERS_INFO_1;
3024 TLocalGroupMembersInfo2Array = array[0..(MaxInt div SizeOf(TLOCALGROUP_MEMBERS_INFO_2))-1] of TLOCALGROUP_MEMBERS_INFO_2;
3025
3026 TGroupInfo1Array = array[0..(MaxInt div SizeOf(TGROUP_INFO_1))-1] of TGROUP_INFO_1;
3027 TGroupUsersInfo0Array = array[0..(MaxInt div SizeOf(TGROUP_USERS_INFO_0))-1] of TGROUP_USERS_INFO_0;
3028
3029 TShareInfo1Array = array[0..(MaxInt div SizeOf(TSHARE_INFO_1))-1] of TSHARE_INFO_1;
3030
3031 TMsgInfo0Array = array[0..(MaxInt div SizeOf(TMSG_INFO_0))-1] of TMSG_INFO_0;
3032
3033 procedure CvtToWideChar(const S: string; var WS: TLMWideChar);
3034 procedure CvtToWideCharLM(const S: string; var WS: TLMWideChar);
3035
3036 implementation
3037
3038 uses SysUtils, StUtils;
3039
3040 var
3041 {LMACCESS}
3042 _NetUserAdd : TNetUserAdd = nil;
3043 _NetUserEnum : TNetUserEnum = nil;
3044 _NetUserGetInfo : TNetUserGetInfo = nil;
3045 _NetUserSetInfo : TNetUserSetInfo = nil;
3046 _NetUserDel : TNetUserDel = nil;
3047 _NetUserGetGroups : TNetUserGetGroups = nil;
3048 _NetUserSetGroups : TNetUserSetGroups = nil;
3049 _NetUserGetLocalGroups : TNetUserGetLocalGroups = nil;
3050 _NetUserModalsGet : TNetUserModalsGet = nil;
3051 _NetUserModalsSet : TNetUserModalsSet = nil;
3052 _NetUserChangePassword : TNetUserChangePassword = nil;
3053
3054 _NetGroupAdd : TNetGroupAdd = nil;
3055 _NetGroupAddUser : TNetGroupAddUser = nil;
3056 _NetGroupEnum : TNetGroupEnum = nil;
3057 _NetGroupGetInfo : TNetGroupGetInfo = nil;
3058 _NetGroupSetInfo : TNetGroupSetInfo = nil;
3059 _NetGroupDel : TNetGroupDel = nil;
3060 _NetGroupDelUser : TNetGroupDelUser = nil;
3061 _NetGroupGetUsers : TNetGroupGetUsers = nil;
3062 _NetGroupSetUsers : TNetGroupSetUsers = nil;
3063
3064 _NetLocalGroupAdd : TNetLocalGroupAdd = nil;
3065 _NetLocalGroupAddMember : TNetLocalGroupAddMember = nil;
3066 _NetLocalGroupEnum : TNetLocalGroupEnum = nil;
3067 _NetLocalGroupGetInfo : TNetLocalGroupGetInfo = nil;
3068 _NetLocalGroupSetInfo : TNetLocalGroupSetInfo = nil;
3069 _NetLocalGroupDel : TNetLocalGroupDel = nil;
3070 _NetLocalGroupDelMember : TNetLocalGroupDelMember = nil;
3071 _NetLocalGroupGetMembers : TNetLocalGroupGetMembers = nil;
3072 _NetLocalGroupSetMembers : TNetLocalGroupSetMembers = nil;
3073 _NetLocalGroupAddMembers : TNetLocalGroupAddMembers = nil;
3074 _NetLocalGroupDelMembers : TNetLocalGroupDelMembers = nil;
3075
3076 _NetQueryDisplayInformation : TNetQueryDisplayInformation = nil;
3077 _NetGetDisplayInformationIndex : TNetGetDisplayInformationIndex = nil;
3078
3079 _NetAccessAdd : TNetAccessAdd = nil;
3080 _NetAccessEnum : TNetAccessEnum = nil;
3081 _NetAccessGetInfo : TNetAccessGetInfo = nil;
3082 _NetAccessSetInfo : TNetAccessSetInfo = nil;
3083 _NetAccessDel : TNetAccessDel = nil;
3084 _NetAccessGetUserPerms : TNetAccessGetUserPerms = nil;
3085
3086 _NetGetDCName : TNetGetDCName = nil;
3087 _NetGetAnyDCName : TNetGetAnyDCName = nil;
3088 _I_NetLogonControl : TI_NetLogonControl = nil;
3089 _I_NetLogonControl2 : TI_NetLogonControl2 = nil;
3090 _NetEnumerateTrustedDomains : TNetEnumerateTrustedDomains = nil;
3091
3092 {LMALERT}
3093 _NetAlertRaise : TNetAlertRaise = nil;
3094 _NetAlertRaiseEx : TNetAlertRaiseEx = nil;
3095
3096 {LMSHARE}
3097 _NetShareAdd : TNetShareAdd = nil;
3098 _NetShareEnum : TNetShareEnum = nil;
3099 _NetShareEnumSticky : TNetShareEnumSticky = nil;
3100 _NetShareGetInfo : TNetShareGetInfo = nil;
3101 _NetShareSetInfo : TNetShareSetInfo = nil;
3102 _NetShareDel : TNetShareDel = nil;
3103 _NetShareDelSticky : TNetShareDelSticky = nil;
3104 _NetShareCheck : TNetShareCheck = nil;
3105
3106 _NetSessionEnum : TNetSessionEnum = nil;
3107 _NetSessionDel : TNetSessionDel = nil;
3108 _NetSessionGetInfo : TNetSessionGetInfo = nil;
3109
3110 _NetConnectionEnum : TNetConnectionEnum = nil;
3111
3112 _NetFileClose : TNetFileClose = nil;
3113 _NetFileEnum : TNetFileEnum = nil;
3114 _NetFileGetInfo : TNetFileGetInfo = nil;
3115
3116 {LMMSG}
3117 _NetMessageNameAdd : TNetMessageNameAdd = nil;
3118 _NetMessageNameEnum : TNetMessageNameEnum = nil;
3119 _NetMessageNameGetInfo : TNetMessageNameGetInfo = nil;
3120 _NetMessageNameDel : TNetMessageNameDel = nil;
3121 _NetMessageBufferSend : TNetMessageBufferSend = nil;
3122
3123 {LMREMUTL}
3124 _NetRemoteTOD : TNetRemoteTOD = nil;
3125 _NetRemoteComputerSupports : TNetRemoteComputerSupports = nil;
3126
3127 {LMSERVER}
3128 _NetServerEnum : TNetServerEnum = nil;
3129 _NetServerEnumEx : TNetServerEnumEx = nil;
3130 _NetServerGetInfo : TNetServerGetInfo = nil;
3131 _NetServerSetInfo : TNetServerSetInfo = nil;
3132 _NetServerDiskEnum : TNetServerDiskEnum = nil;
3133 _NetServerComputerNameAdd : TNetServerComputerNameAdd = nil;
3134 _NetServerComputerNameDel : TNetServerComputerNameDel = nil;
3135 _NetServerTransportAdd : TNetServerTransportAdd = nil;
3136 _NetServerTransportAddEx : TNetServerTransportAddEx = nil;
3137 _NetServerTransportDel : TNetServerTransportDel = nil;
3138 _NetServerTransportEnum : TNetServerTransportEnum = nil;
3139
3140 {LMUSE}
3141 _NetUseAdd : TNetUseAdd = nil;
3142 _NetUseDel : TNetUseDel = nil;
3143 _NetUseEnum : TNetUseEnum = nil;
3144 _NetUseGetInfo : TNetUseGetInfo = nil;
3145
3146 {LMWKSTA}
3147 _NetWkstaGetInfo : TNetWkstaGetInfo = nil;
3148 _NetWkstaSetInfo : TNetWkstaSetInfo = nil;
3149 _NetWkstaUserGetInfo : TNetWkstaUserGetInfo = nil;
3150 _NetWkstaUserSetInfo : TNetWkstaUserSetInfo = nil;
3151 _NetWkstaUserEnum : TNetWkstaUserEnum = nil;
3152 _NetWkstaTransportAdd : TNetWkstaTransportAdd = nil;
3153 _NetWkstaTransportDel : TNetWkstaTransportDel = nil;
3154 _NetWkstaTransportEnum : TNetWkstaTransportEnum = nil;
3155
3156 {LMAPIBUF}
3157 _NetApiBufferAllocate : TNetApiBufferAllocate = nil;
3158 _NetApiBufferFree : TNetApiBufferFree = nil;
3159 _NetApiBufferReallocate : TNetApiBufferReallocate = nil;
3160 _NetApiBufferSize : TNetApiBufferSize = nil;
3161
3162 {LMSTATS}
3163 _NetStatisticsGet : TNetStatisticsGet = nil;
3164
3165 {WINBASE}
3166 _GetSidIdentifierAuthority : TGetSidIdentifierAuthority = nil;
3167 _GetSidSubAuthority : TGetSidSubAuthority = nil;
3168 _GetSidSubAuthorityCount : TGetSidSubAuthorityCount = nil;
3169 _LookupAccountName : TLookupAccountName = nil;
3170 _LookupAccountSid : TLookupAccountSid = nil;
3171
3172 var
3173 NETAPI32 : THandle = 0;
3174 ADVAPI32 : THandle = 0;
3175
3176 NETAPI32DLL : PChar = 'netapi32.dll';
3177 ADVAPI32DLL : PChar = 'advapi32.dll';
3178
3179 function IsNetApi32: Boolean;
3180 begin
3181 if NETAPI32 = 0 then
3182 NETAPI32 := LoadLibrary(NETAPI32DLL);
3183
3184 Result := (NETAPI32 <> 0);
3185 end;
3186
3187 function IsAdvApi32: Boolean;
3188 begin
3189 if ADVAPI32 = 0 then
3190 ADVAPI32 := LoadLibrary(ADVAPI32DLL);
3191
3192 Result := (ADVAPI32 <> 0);
3193 end;
3194
3195 function ServerUncName(Name: string): string;
3196 begin
3197 { NT 4 and 9x need it in a UNC form, but Windows 2000 does not (it can have dns names) }
3198 if (Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion < 5) then
3199 Result := '\\' + Name
3200 else
3201 Result := Name;
3202 end;
3203
3204 procedure CvtToWideChar(const S: string; var WS: TLMWideChar);
3205 var
3206 S1 : string;
3207 begin
3208 { Quick check to make sure that WS is not alreay allocated }
3209 if WS.Value <> nil then
3210 FreeMem(WS.Value, WS.Length);
3211
3212 S1 := Trim(S);
3213
3214 { Now get the new pointer and size }
3215 if Length(S1) > 0 then begin
3216 WS.Length := (Length(S1) + 1) * 2;
3217 GetMem(WS.Value, WS.Length);
3218 StringToWideChar(S1, WS.Value, WS.Length);
3219 end else begin
3220 WS.Length := 0;
3221 WS.Value := nil;
3222 end;
3223 end;
3224
3225 procedure CvtToWideCharLM(const S: string; var WS: TLMWideChar);
3226 var
3227 S1 : string;
3228 begin
3229 { Quick check to make sure that WS is not alreay allocated }
3230 if WS.Value <> nil then
3231 StNetApiBufferFree(WS.Value);
3232
3233 S1 := Trim(S);
3234
3235 { Now get the new pointer and size }
3236 WS.Length := (Length(S1) + 1) * 2;
3237 StNetApiBufferAllocate(WS.Length, Pointer(WS.Value));
3238 StringToWideChar(S1, WS.Value, WS.Length);
3239 end;
3240
3241
3242 {LMACCESS}
3243 function StNetUserAdd(ServerName: string; Level: DWord; Buffer: Pointer;
3244 var ParmErr: DWord): NET_API_STATUS;
3245 var
3246 S : TLMWideChar;
3247 begin
3248 Result := 0;
3249 if IsNetApi32 then begin
3250 if (@_NetUserAdd = nil) then
3251 @_NetUserAdd := GetProcAddress(NETAPI32, 'NetUserAdd');
3252
3253 if (@_NetUserAdd <> nil) then begin
3254 { determine if UNC identifiers needed }
3255 ServerName := ServerUncName(ServerName);
3256
3257 S.Value := nil;
3258 try
3259 { allocate the unicode server name }
3260 CvtToWideChar(ServerName, S);
3261
3262 { call the API }
3263 Result := _NetUserAdd(S.Value, Level, Buffer, ParmErr);
3264 finally
3265 FreeMem(S.Value, S.Length);
3266 end;
3267 end else
3268 RaiseStWin32Error(EStNetException, GetLastError);
3269 end else begin
3270 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3271 end;
3272 end;
3273
3274 function StNetUserEnum(ServerName: string; Level, Filter: DWord;
3275 var Buffer: Pointer; PrefMaxLen: DWord; var EntriesRead,
3276 TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
3277 var
3278 S : TLMWideChar;
3279 begin
3280 Result := 0;
3281 if IsNetApi32 then begin
3282 if (@_NetUserEnum = nil) then
3283 @_NetUserEnum := GetProcAddress(NETAPI32, 'NetUserEnum');
3284
3285 if (@_NetUserEnum <> nil) then begin
3286 { determine if UNC identifiers needed }
3287 ServerName := ServerUncName(ServerName);
3288
3289 S.Value := nil;
3290 try
3291 { allocate the unicode server name }
3292 CvtToWideChar(ServerName, S);
3293
3294 { call the API }
3295 Result := _NetUserEnum(S.Value, Level, Filter, Buffer, PrefMaxLen,
3296 EntriesRead, TotalEntries, ResumeHandle);
3297 finally
3298 FreeMem(S.Value, S.Length);
3299 end;
3300 end else
3301 RaiseStWin32Error(EStNetException, GetLastError);
3302 end else begin
3303 { EStNetException }
3304 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3305 end;
3306 end;
3307
3308 function StNetUserGetInfo(ServerName, UserName: string; Level: DWord;
3309 var Buffer: Pointer): NET_API_STATUS;
3310 var
3311 S, U : TLMWideChar;
3312 begin
3313 Result := 0;
3314 if IsNetApi32 then begin
3315 if (@_NetUserGetInfo = nil) then
3316 @_NetUserGetInfo := GetProcAddress(NETAPI32, 'NetUserGetInfo');
3317
3318 if (@_NetUserGetInfo <> nil) then begin
3319 { determine if UNC identifiers needed }
3320 ServerName := ServerUncName(ServerName);
3321
3322 S.Value := nil;
3323 U.Value := nil;
3324 try
3325 { allocate the unicode server name }
3326 CvtToWideChar(ServerName, S);
3327
3328 { allocate the unicode user name }
3329 CvtToWideChar(UserName, U);
3330
3331 { call the API }
3332 Result := _NetUserGetInfo(S.Value, U.Value, Level, Buffer);
3333 finally
3334 FreeMem(U.Value, U.Length);
3335 FreeMem(S.Value, S.Length);
3336 end;
3337 end else
3338 RaiseStWin32Error(EStNetException, GetLastError);
3339 end else begin
3340 { EStNetException }
3341 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3342 end;
3343 end;
3344
3345 function StNetUserSetInfo(ServerName, UserName: string; Level: DWord;
3346 Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
3347 var
3348 S, U : TLMWideChar;
3349 begin
3350 Result := 0;
3351 if IsNetApi32 then begin
3352 if (@_NetUserSetInfo = nil) then
3353 @_NetUserSetInfo := GetProcAddress(NETAPI32, 'NetUserSetInfo');
3354
3355 if (@_NetUserSetInfo <> nil) then begin
3356 { determine if UNC identifiers needed }
3357 ServerName := ServerUncName(ServerName);
3358
3359 S.Value := nil;
3360 U.Value := nil;
3361 try
3362 { allocate the unicode server name }
3363 CvtToWideChar(ServerName, S);
3364
3365 { allocate the unicode user name }
3366 CvtToWideChar(UserName, U);
3367
3368 { call the API }
3369 Result := _NetUserSetInfo(S.Value, U.Value, Level, Buffer, ParmErr);
3370 finally
3371 FreeMem(S.Value, S.Length);
3372 FreeMem(U.Value, U.Length);
3373 end;
3374 end else
3375 RaiseStWin32Error(EStNetException, GetLastError);
3376 end else begin
3377 { EStNetException }
3378 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3379 end;
3380 end;
3381
3382 function StNetUserDel(ServerName, UserName: string): NET_API_STATUS;
3383 var
3384 S, U : TLMWideChar;
3385 begin
3386 Result := 0;
3387 if IsNetApi32 then begin
3388 if (@_NetUserDel = nil) then
3389 @_NetUserDel := GetProcAddress(NETAPI32, 'NetUserDel');
3390
3391 if (@_NetUserDel <> nil) then begin
3392 { determine if UNC identifiers needed }
3393 ServerName := ServerUncName(ServerName);
3394
3395 S.Value := nil;
3396 U.Value := nil;
3397 try
3398 { allocate the unicode server name }
3399 CvtToWideChar(ServerName, S);
3400
3401 { allocate the unicode user name }
3402 CvtToWideChar(UserName, U);
3403
3404 { call the API }
3405 Result := _NetUserDel(S.Value, U.Value);
3406 finally
3407 FreeMem(S.Value, S.Length);
3408 FreeMem(U.Value, U.Length);
3409 end;
3410 end else
3411 RaiseStWin32Error(EStNetException, GetLastError);
3412 end else begin
3413 { EStNetException }
3414 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3415 end;
3416 end;
3417
3418 function StNetUserGetGroups(ServerName, UserName: string; Level: DWord;
3419 var Buffer: Pointer; PrefMaxLen: DWord;
3420 var EntriesRead, TotalEntries: DWord): NET_API_STATUS;
3421 var
3422 S, U : TLMWideChar;
3423 begin
3424 Result := 0;
3425 if IsNetApi32 then begin
3426 if (@_NetUserGetGroups = nil) then
3427 @_NetUserGetGroups := GetProcAddress(NETAPI32, 'NetUserGetGroups');
3428
3429 if (@_NetUserGetGroups <> nil) then begin
3430 { determine if UNC identifiers needed }
3431 ServerName := ServerUncName(ServerName);
3432
3433 S.Value := nil;
3434 U.Value := nil;
3435 try
3436 { allocate the unicode server name }
3437 CvtToWideChar(ServerName, S);
3438
3439 { allocate the unicode user name }
3440 CvtToWideChar(UserName, U);
3441
3442 { call the API }
3443 Result := _NetUserGetGroups(S.Value, U.Value, Level, Buffer,
3444 PrefMaxLen, EntriesRead, TotalEntries);
3445 finally
3446 FreeMem(S.Value, S.Length);
3447 FreeMem(U.value, U.Length);
3448 end;
3449 end else
3450 RaiseStWin32Error(EStNetException, GetLastError);
3451 end else begin
3452 { EStNetException }
3453 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3454 end;
3455 end;
3456
3457 function StNetUserSetGroups(ServerName, UserName: string; Level: DWord;
3458 Buffer: Pointer; NumEntries: DWord): NET_API_STATUS;
3459 var
3460 S, U : TLMWideChar;
3461 begin
3462 Result := 0;
3463 if IsNetApi32 then begin
3464 if (@_NetUserSetGroups = nil) then
3465 @_NetUserSetGroups := GetProcAddress(NETAPI32, 'NetUserSetGroups');
3466
3467 if (@_NetUserSetGroups <> nil) then begin
3468 { determine if UNC identifiers needed }
3469 ServerName := ServerUncName(ServerName);
3470
3471 S.Value := nil;
3472 U.Value := nil;
3473 try
3474 { allocate the unicode server name }
3475 CvtToWideChar(ServerName, S);
3476
3477 { allocate the unicode user name }
3478 CvtToWideChar(UserName, U);
3479
3480 { call the API }
3481 Result := _NetUserSetGroups(S.Value, U.Value, Level, Buffer, NumEntries);
3482 finally
3483 FreeMem(S.Value, S.Length);
3484 FreeMem(U.value, U.Length);
3485 end;
3486 end else
3487 RaiseStWin32Error(EStNetException, GetLastError);
3488 end else begin
3489 { EStNetException }
3490 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3491 end;
3492 end;
3493
3494 function StNetUserGetLocalGroups(ServerName, UserName: string; Level: DWord;
3495 Flags: DWord; var Buffer: Pointer;
3496 PrefMaxLen: DWord; var EntriesRead,
3497 TotalEntries : DWord): NET_API_STATUS;
3498 var
3499 S, U : TLMWideChar;
3500 begin
3501 Result := 0;
3502 if IsNetApi32 then begin
3503 if (@_NetUserGetLocalGroups = nil) then
3504 @_NetUserGetLocalGroups := GetProcAddress(NETAPI32, 'NetUserGetLocalGroups');
3505
3506 if (@_NetUserGetLocalGroups <> nil) then begin
3507 { determine if UNC identifiers needed }
3508 ServerName := ServerUncName(ServerName);
3509
3510 S.Value := nil;
3511 U.Value := nil;
3512 try
3513 { allocate the unicode server name }
3514 CvtToWideChar(ServerName, S);
3515
3516 { allocate the unicode user name }
3517 CvtToWideChar(UserName, U);
3518
3519 { call the API }
3520 Result := _NetUserGetLocalGroups(S.Value, U.Value, Level, Flags,
3521 Buffer, PrefMaxLen, EntriesRead,
3522 TotalEntries);
3523 finally
3524 FreeMem(S.Value, S.Length);
3525 FreeMem(U.value, U.Length);
3526 end;
3527 end else
3528 RaiseStWin32Error(EStNetException, GetLastError);
3529 end else begin
3530 { EStNetException }
3531 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3532 end;
3533 end;
3534
3535 function StNetUserModalsGet(ServerName: string; Level: DWord;
3536 var Buffer: Pointer): NET_API_STATUS;
3537 var
3538 S : TLMWideChar;
3539 begin
3540 Result := 0;
3541 if IsNetApi32 then begin
3542 if (@_NetUserModalsGet = nil) then
3543 @_NetUserModalsGet := GetProcAddress(NETAPI32, 'NetUserModalsGet');
3544
3545 if (@_NetUserModalsGet <> nil) then begin
3546 { determine if UNC identifiers needed }
3547 ServerName := ServerUncName(ServerName);
3548
3549 S.Value := nil;
3550 try
3551 { allocate the unicode server name }
3552 CvtToWideChar(ServerName, S);
3553
3554 { call the API }
3555 Result := _NetUserModalsGet(S.Value, Level, Buffer);
3556 finally
3557 FreeMem(S.Value, S.Length);
3558 end;
3559 end else
3560 RaiseStWin32Error(EStNetException, GetLastError);
3561 end else begin
3562 { EStNetException }
3563 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3564 end;
3565 end;
3566
3567 function StNetUserModalsSet(ServerName: string; Level: DWord;
3568 Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
3569 var
3570 S : TLMWideChar;
3571 begin
3572 Result := 0;
3573 if IsNetApi32 then begin
3574 if (@_NetUserModalsSet = nil) then
3575 @_NetUserModalsSet := GetProcAddress(NETAPI32, 'NetUserModalsSet');
3576
3577 if (@_NetUserModalsSet <> nil) then begin
3578 { determine if UNC identifiers needed }
3579 ServerName := ServerUncName(ServerName);
3580
3581 S.Value := nil;
3582 try
3583 { allocate the unicode server name }
3584 CvtToWideChar(ServerName, S);
3585
3586 { call the API }
3587 Result := _NetUserModalsSet(S.Value, Level, Buffer, ParmErr);
3588 finally
3589 FreeMem(S.Value, S.Length);
3590 end;
3591 end else
3592 RaiseStWin32Error(EStNetException, GetLastError);
3593 end else begin
3594 { EStNetException }
3595 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3596 end;
3597 end;
3598
3599 function StNetUserChangePassword(DomainName, UserName, OldPassword,
3600 NewPassword: string): NET_API_STATUS;
3601 var
3602 D, U, O, N : TLMWideChar;
3603 begin
3604 Result := 0;
3605 if IsNetApi32 then begin
3606 if (@_NetUserChangePassword = nil) then
3607 @_NetUserChangePassword := GetProcAddress(NETAPI32, 'NetUserChangePassword');
3608
3609 if (@_NetUserChangePassword <> nil) then begin
3610 { determine if UNC identifiers needed }
3611 DomainName := ServerUncName(DomainName);
3612
3613 D.Value := nil;
3614 U.Value := nil;
3615 O.Value := nil;
3616 N.Value := nil;
3617 try
3618 { allocate the unicode domain name }
3619 CvtToWideChar(DomainName, D);
3620
3621 { allocate the unicode user name }
3622 CvtToWideChar(UserName, U);
3623
3624 { allocate the unicode old password }
3625 CvtToWideChar(OldPassword, O);
3626
3627 { allocate the unicode new password }
3628 CvtToWideChar(NewPassword, N);
3629
3630 { call the API }
3631 Result := _NetUserChangePassword(D.Value, U.Value, O.Value, N.Value);
3632 finally
3633 FreeMem(D.Value, D.Length);
3634 FreeMem(U.Value, U.Length);
3635 FreeMem(O.Value, O.Length);
3636 FreeMem(N.Value, N.Length);
3637 end;
3638 end else
3639 RaiseStWin32Error(EStNetException, GetLastError);
3640 end else begin
3641 { EStNetException }
3642 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3643 end;
3644 end;
3645
3646
3647 function StNetGroupAdd(ServerName: string; Level: DWord; Buffer: Pointer;
3648 var ParmErr: DWord): NET_API_STATUS;
3649 var
3650 S : TLMWideChar;
3651 begin
3652 Result := 0;
3653 if IsNetApi32 then begin
3654 if (@_NetGroupAdd = nil) then
3655 @_NetGroupAdd := GetProcAddress(NETAPI32, 'NetGroupAdd');
3656
3657 if (@_NetGroupAdd <> nil) then begin
3658 { determine if UNC identifiers needed }
3659 ServerName := ServerUncName(ServerName);
3660
3661 S.Value := nil;
3662 try
3663 { allocate the unicode server name }
3664 CvtToWideChar(ServerName, S);
3665
3666 { call the API }
3667 Result := _NetGroupAdd(S.Value, Level, Buffer, ParmErr);
3668 finally
3669 FreeMem(S.Value, S.Length);
3670 end;
3671 end else
3672 RaiseStWin32Error(EStNetException, GetLastError);
3673 end else begin
3674 { EStNetException }
3675 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3676 end;
3677 end;
3678
3679 function StNetGroupAddUser(ServerName, GroupName, UserName: string): NET_API_STATUS;
3680 var
3681 S, G, U : TLMWideChar;
3682 begin
3683 Result := 0;
3684 if IsNetApi32 then begin
3685 if (@_NetGroupAddUser = nil) then
3686 @_NetGroupAddUser := GetProcAddress(NETAPI32, 'NetGroupAddUser');
3687
3688 if (@_NetGroupAddUser <> nil) then begin
3689 { determine if UNC identifiers needed }
3690 ServerName := ServerUncName(ServerName);
3691
3692 S.Value := nil;
3693 G.Value := nil;
3694 U.Value := nil;
3695 try
3696 { allocate the unicode server name }
3697 CvtToWideChar(ServerName, S);
3698
3699 { allocate the unicode group name }
3700 CvtToWideChar(GroupName, G);
3701
3702 { allocate the unicode user name }
3703 CvtToWideChar(UserName, U);
3704
3705 { call the API }
3706 Result := _NetGroupAddUser(S.Value, G.Value, U.Value);
3707 finally
3708 FreeMem(S.Value, S.Length);
3709 FreeMem(G.Value, G.Length);
3710 FreeMem(U.Value, U.Length);
3711 end;
3712 end else
3713 RaiseStWin32Error(EStNetException, GetLastError);
3714 end else begin
3715 { EStNetException }
3716 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3717 end;
3718 end;
3719
3720 function StNetGroupEnum(ServerName: string; Level: DWord; Buffer: Pointer;
3721 PrefMaxLen: DWord; var EntriesRead, TotalEntries,
3722 ResumeHandle: DWord): NET_API_STATUS;
3723 var
3724 S : TLMWideChar;
3725 begin
3726 Result := 0;
3727 if IsNetApi32 then begin
3728 if (@_NetGroupEnum = nil) then
3729 @_NetGroupEnum := GetProcAddress(NETAPI32, 'NetGroupEnum');
3730
3731 if (@_NetGroupEnum <> nil) then begin
3732 { determine if UNC identifiers needed }
3733 ServerName := ServerUncName(ServerName);
3734
3735 S.Value := nil;
3736 try
3737 { allocate the unicode server name }
3738 CvtToWideChar(ServerName, S);
3739
3740 { call the API }
3741 Result := _NetGroupEnum(S.Value, Level, Buffer, PrefMaxLen,
3742 EntriesRead, TotalEntries, ResumeHandle);
3743 finally
3744 FreeMem(S.Value, S.Length);
3745 end;
3746 end else
3747 RaiseStWin32Error(EStNetException, GetLastError);
3748 end else begin
3749 { EStNetException }
3750 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3751 end;
3752 end;
3753
3754 function StNetGroupGetInfo(ServerName, GroupName: string; Level: DWord;
3755 var Buffer: Pointer): NET_API_STATUS;
3756 var
3757 S, G : TLMWideChar;
3758 begin
3759 Result := 0;
3760 if IsNetApi32 then begin
3761 if (@_NetGroupGetInfo = nil) then
3762 @_NetGroupGetInfo := GetProcAddress(NETAPI32, 'NetGroupGetInfo');
3763
3764 if (@_NetGroupGetInfo <> nil) then begin
3765 { determine if UNC identifiers needed }
3766 ServerName := ServerUncName(ServerName);
3767
3768 S.Value := nil;
3769 G.Value := nil;
3770 try
3771 { allocate the unicode server name }
3772 CvtToWideChar(ServerName, S);
3773
3774 { allocate the unicode group name }
3775 CvtToWideChar(GroupName, G);
3776
3777 { call the API }
3778 Result := _NetGroupGetInfo(S.Value, G.Value, Level, Buffer);
3779 finally
3780 FreeMem(S.Value, S.Length);
3781 FreeMem(G.Value, G.Length);
3782 end;
3783 end else
3784 RaiseStWin32Error(EStNetException, GetLastError);
3785 end else begin
3786 { EStNetException }
3787 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3788 end;
3789 end;
3790
3791 function StNetGroupSetInfo(ServerName, GroupName: string; Level: DWord;
3792 Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
3793 var
3794 S, G : TLMWideChar;
3795 begin
3796 Result := 0;
3797 if IsNetApi32 then begin
3798 if (@_NetGroupSetInfo = nil) then
3799 @_NetGroupSetInfo := GetProcAddress(NETAPI32, 'NetGroupSetInfo');
3800
3801 if (@_NetGroupSetInfo <> nil) then begin
3802 { determine if UNC identifiers needed }
3803 ServerName := ServerUncName(ServerName);
3804
3805 S.Value := nil;
3806 G.Value := nil;
3807 try
3808 { allocate the unicode server name }
3809 CvtToWideChar(ServerName, S);
3810
3811 { allocate the unicode group name }
3812 CvtToWideChar(GroupName, G);
3813
3814 { call the API }
3815 Result := _NetGroupSetInfo(S.Value, G.Value, Level, Buffer, ParmErr);
3816 finally
3817 FreeMem(S.Value, S.Length);
3818 FreeMem(G.Value, G.Length);
3819 end;
3820 end else
3821 RaiseStWin32Error(EStNetException, GetLastError);
3822 end else begin
3823 { EStNetException }
3824 RaiseStWin32Error(EStNetException, GetLastError);
3825 end;
3826 end;
3827
3828 function StNetGroupDel(ServerName, GroupName: string): NET_API_STATUS;
3829 var
3830 S, G : TLMWideChar;
3831 begin
3832 Result := 0;
3833 if IsNetApi32 then begin
3834 if (@_NetGroupDel = nil) then
3835 @_NetGroupDel := GetProcAddress(NETAPI32, 'NetGroupDel');
3836
3837 if (@_NetGroupDel <> nil) then begin
3838 { determine if UNC identifiers needed }
3839 ServerName := ServerUncName(ServerName);
3840
3841 S.Value := nil;
3842 G.Value := nil;
3843 try
3844 { allocate the unicode server name }
3845 CvtToWideChar(ServerName, S);
3846
3847 { allocate the unicode group name }
3848 CvtToWideChar(GroupName, G);
3849
3850 { call the API }
3851 Result := _NetGroupDel(S.Value, G.Value);
3852 finally
3853 FreeMem(S.Value, S.Length);
3854 FreeMem(G.Value, G.Length);
3855 end;
3856 end else
3857 RaiseStWin32Error(EStNetException, GetLastError);
3858 end else begin
3859 { EStNetException }
3860 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3861 end;
3862 end;
3863
3864 function StNetGroupDelUser(ServerName, GroupName, UserName: string): NET_API_STATUS;
3865 var
3866 S, G, U : TLMWideChar;
3867 begin
3868 Result := 0;
3869 if IsNetApi32 then begin
3870 if (@_NetGroupDelUser = nil) then
3871 @_NetGroupDelUser := GetProcAddress(NETAPI32, 'NetGroupDelUser');
3872
3873 if (@_NetGroupDelUser <> nil) then begin
3874 { determine if UNC identifiers needed }
3875 ServerName := ServerUncName(ServerName);
3876
3877 S.Value := nil;
3878 G.Value := nil;
3879 U.Value := nil;
3880 try
3881 { allocate the unicode server name }
3882 CvtToWideChar(ServerName, S);
3883
3884 { allocate the unicode group name }
3885 CvtToWideChar(GroupName, G);
3886
3887 { allocate the unicode user name }
3888 CvtToWideChar(UserName, U);
3889
3890 { call the API }
3891 Result := _NetGroupDelUser(S.Value, G.Value, U.Value);
3892 finally
3893 FreeMem(S.Value, S.Length);
3894 FreeMem(G.Value, G.Length);
3895 FreeMem(U.Value, U.Length);
3896 end;
3897 end else
3898 RaiseStWin32Error(EStNetException, GetLastError);
3899 end else begin
3900 { EStNetException }
3901 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3902 end;
3903 end;
3904
3905 function StNetGroupGetUsers(ServerName, GroupName: string; Level: DWord;
3906 var Buffer: Pointer; PrefMaxLen: DWord;
3907 var EntriesRead, TotalEntries: DWord;
3908 ResumeHandle: Pointer): NET_API_STATUS;
3909 var
3910 S, G : TLMWideChar;
3911 begin
3912 Result := 0;
3913 if IsNetApi32 then begin
3914 if (@_NetGroupGetUsers = nil) then
3915 @_NetGroupGetUsers := GetProcAddress(NETAPI32, 'NetGroupGetUsers');
3916
3917 if (@_NetGroupGetUsers <> nil) then begin
3918 { determine if UNC identifiers needed }
3919 ServerName := ServerUncName(ServerName);
3920
3921 S.Value := nil;
3922 G.Value := nil;
3923 try
3924 { allocate the unicode server name }
3925 CvtToWideChar(ServerName, S);
3926
3927 { allocate the unicode group name }
3928 CvtToWideChar(GroupName, G);
3929
3930 { call the API }
3931 Result := _NetGroupGetUsers(S.Value, G.Value, Level, Buffer,
3932 PrefMaxLen, EntriesRead, TotalEntries,
3933 ResumeHandle);
3934 finally
3935 FreeMem(S.Value, S.Length);
3936 FreeMem(G.Value, G.Length);
3937 end;
3938 end else
3939 RaiseStWin32Error(EStNetException, GetLastError);
3940 end else begin
3941 { EStNetException }
3942 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3943 end;
3944 end;
3945
3946 function StNetGroupSetUsers(ServerName, GroupName: string; Level: DWord;
3947 Buffer: Pointer; var TotalEntries : DWord): NET_API_STATUS;
3948 var
3949 S, G : TLMWideChar;
3950 begin
3951 Result := 0;
3952 if IsNetApi32 then begin
3953 if (@_NetGroupSetUsers = nil) then
3954 @_NetGroupSetUsers := GetProcAddress(NETAPI32, 'NetGroupSetUsers');
3955
3956 if (@_NetGroupSetUsers <> nil) then begin
3957 { determine if UNC identifiers needed }
3958 ServerName := ServerUncName(ServerName);
3959
3960 S.Value := nil;
3961 G.Value := nil;
3962 try
3963 { allocate the unicode server name }
3964 CvtToWideChar(ServerName, S);
3965
3966 { allocate the unicode group name }
3967 CvtToWideChar(GroupName, G);
3968
3969 { call the API }
3970 Result := _NetGroupSetUsers(S.Value, G.Value, Level, Buffer, TotalEntries);
3971 finally
3972 FreeMem(S.Value, S.Length);
3973 FreeMem(G.Value, G.Length);
3974 end;
3975 end else
3976 RaiseStWin32Error(EStNetException, GetLastError);
3977 end else begin
3978 { EStNetException }
3979 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
3980 end;
3981 end;
3982
3983
3984 function StNetLocalGroupAdd(ServerName: string; Level: DWord; Buffer: Pointer;
3985 var ParmErr: DWord): NET_API_STATUS;
3986 var
3987 S : TLMWideChar;
3988 begin
3989 Result := 0;
3990 if IsNetApi32 then begin
3991 if (@_NetLocalGroupAdd = nil) then
3992 @_NetLocalGroupAdd := GetProcAddress(NETAPI32, 'NetLocalGroupAdd');
3993
3994 if (@_NetLocalGroupAdd <> nil) then begin
3995 { determine if UNC identifiers needed }
3996 ServerName := ServerUncName(ServerName);
3997
3998 S.Value := nil;
3999 try
4000 { allocate the unicode server name }
4001 CvtToWideChar(ServerName, S);
4002
4003 { call the API }
4004 Result := _NetLocalGroupAdd(S.Value, Level, Buffer, ParmErr);
4005 finally
4006 FreeMem(S.Value, S.Length);
4007 end;
4008 end else
4009 RaiseStWin32Error(EStNetException, GetLastError);
4010 end else begin
4011 { EStNetException }
4012 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4013 end;
4014 end;
4015
4016 function StNetLocalGroupAddMember(ServerName, GroupName: string;
4017 MemberSID: PSID): NET_API_STATUS;
4018 var
4019 S, G : TLMWideChar;
4020 begin
4021 Result := 0;
4022 if IsNetApi32 then begin
4023 if (@_NetLocalGroupAddMember = nil) then
4024 @_NetLocalGroupAddMember := GetProcAddress(NETAPI32, 'NetLocalGroupAddMember');
4025
4026 if (@_NetLocalGroupAddMember <> nil) then begin
4027 { determine if UNC identifiers needed }
4028 ServerName := ServerUncName(ServerName);
4029
4030 S.Value := nil;
4031 G.Value := nil;
4032 try
4033 { allocate the unicode server name }
4034 CvtToWideChar(ServerName, S);
4035
4036 { allocate the unicode group name }
4037 CvtToWideChar(GroupName, G);
4038
4039 { call the API }
4040 Result := _NetLocalGroupAddMember(S.Value, G.Value, MemberSID)
4041 finally
4042 FreeMem(S.Value, S.Length);
4043 FreeMem(G.Value, G.Length);
4044 end;
4045 end else
4046 RaiseStWin32Error(EStNetException, GetLastError);
4047 end else begin
4048 { EStNetException }
4049 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4050 end;
4051 end;
4052
4053 function StNetLocalGroupEnum(ServerName: string; Level: DWord;
4054 var Buffer: Pointer; PrefMaxLen: DWord;
4055 var EntriesRead, TotalEntries: DWord;
4056 var ResumeHandle: DWord): NET_API_STATUS;
4057 var
4058 S : TLMWideChar;
4059 begin
4060 Result := 0;
4061 if IsNetApi32 then begin
4062 if (@_NetLocalGroupEnum = nil) then
4063 @_NetLocalGroupEnum := GetProcAddress(NETAPI32, 'NetLocalGroupEnum');
4064
4065 if (@_NetLocalGroupEnum <> nil) then begin
4066 { determine if UNC identifiers needed }
4067 ServerName := ServerUncName(ServerName);
4068
4069 S.Value := nil;
4070 try
4071 { allocate the unicode server name }
4072 CvtToWideChar(ServerName, S);
4073
4074 { call the API }
4075 Result := _NetLocalGroupEnum(S.Value, Level, Buffer, PrefMaxLen,
4076 EntriesRead, TotalEntries, ResumeHandle);
4077 finally
4078 FreeMem(S.Value, S.Length);
4079 end;
4080 end else
4081 RaiseStWin32Error(EStNetException, GetLastError);
4082 end else begin
4083 { EStNetException }
4084 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4085 end;
4086 end;
4087
4088 function StNetLocalGroupGetInfo(ServerName, GroupName: string; Level: DWord;
4089 var Buffer: Pointer): NET_API_STATUS;
4090 var
4091 S, G : TLMWideChar;
4092 begin
4093 Result := 0;
4094 if IsNetApi32 then begin
4095 if (@_NetLocalGroupGetInfo = nil) then
4096 @_NetLocalGroupGetInfo := GetProcAddress(NETAPI32, 'NetLocalGroupGetInfo');
4097
4098 if (@_NetLocalGroupGetInfo <> nil) then begin
4099 { determine if UNC identifiers needed }
4100 ServerName := ServerUncName(ServerName);
4101
4102 S.Value := nil;
4103 G.Value := nil;
4104 try
4105 { allocate the unicode server name }
4106 CvtToWideChar(ServerName, S);
4107
4108 { allocate the unicode group name }
4109 CvtToWideChar(GroupName, G);
4110
4111 { call the API }
4112 Result := _NetLocalGroupGetInfo(S.Value, G.Value, Level, Buffer);
4113 finally
4114 FreeMem(S.Value, S.Length);
4115 FreeMem(G.Value, G.Length);
4116 end;
4117 end else
4118 RaiseStWin32Error(EStNetException, GetLastError);
4119 end else begin
4120 { EStNetException }
4121 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4122 end;
4123 end;
4124
4125 function StNetLocalGroupSetInfo(ServerName, GroupName: string; Level: DWord;
4126 Buffer: Pointer;
4127 var ParmErr: DWord): NET_API_STATUS;
4128 var
4129 S, G : TLMWideChar;
4130 begin
4131 Result := 0;
4132 if IsNetApi32 then begin
4133 if (@_NetLocalGroupSetInfo = nil) then
4134 @_NetLocalGroupSetInfo := GetProcAddress(NETAPI32, 'NetLocalGroupSetInfo');
4135
4136 if (@_NetLocalGroupSetInfo <> nil) then begin
4137 { determine if UNC identifiers needed }
4138 ServerName := ServerUncName(ServerName);
4139
4140 S.Value := nil;
4141 G.Value := nil;
4142 try
4143 { allocate the unicode server name }
4144 CvtToWideChar(ServerName, S);
4145
4146 { allocate the unicode group name }
4147 CvtToWideChar(GroupName, G);
4148
4149 { call the API }
4150 Result := _NetLocalGroupSetInfo(S.Value, G.Value, Level, Buffer, ParmErr);
4151 finally
4152 FreeMem(S.Value, S.Length);
4153 FreeMem(G.Value, G.Length);
4154 end;
4155 end else
4156 RaiseStWin32Error(EStNetException, GetLastError);
4157 end else begin
4158 { EStNetException }
4159 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4160 end;
4161 end;
4162
4163 function StNetLocalGroupDel(ServerName, GroupName: string): NET_API_STATUS;
4164 var
4165 S, G : TLMWideChar;
4166 begin
4167 Result := 0;
4168 if IsNetApi32 then begin
4169 if (@_NetLocalGroupDel = nil) then
4170 @_NetLocalGroupDel := GetProcAddress(NETAPI32, 'NetLocalGroupDel');
4171
4172 if (@_NetLocalGroupDel <> nil) then begin
4173 { determine if UNC identifiers needed }
4174 ServerName := ServerUncName(ServerName);
4175
4176 S.Value := nil;
4177 G.Value := nil;
4178 try
4179 { allocate the unicode server name }
4180 CvtToWideChar(ServerName, S);
4181
4182 { allocate the unicode group name }
4183 CvtToWideChar(GroupName, G);
4184
4185 { call the API }
4186 Result := _NetLocalGroupDel(S.Value, G.Value);
4187 finally
4188 FreeMem(S.Value, S.Length);
4189 FreeMem(G.Value, G.Length);
4190 end;
4191 end else
4192 RaiseStWin32Error(EStNetException, GetLastError);
4193 end else begin
4194 { EStNetException }
4195 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4196 end;
4197 end;
4198
4199 function StNetLocalGroupDelMember(ServerName, GroupName: string;
4200 MemberSID: PSID): NET_API_STATUS;
4201 var
4202 S, G : TLMWideChar;
4203 begin
4204 Result := 0;
4205 if IsNetApi32 then begin
4206 if (@_NetLocalGroupDelMember = nil) then
4207 @_NetLocalGroupDelMember := GetProcAddress(NETAPI32, 'NetLocalGroupDelMember');
4208
4209 if (@_NetLocalGroupDelMember <> nil) then begin
4210 { determine if UNC identifiers needed }
4211 ServerName := ServerUncName(ServerName);
4212
4213 S.Value := nil;
4214 G.Value := nil;
4215 try
4216 { allocate the unicode server name }
4217 CvtToWideChar(ServerName, S);
4218
4219 { allocate the unicode group name }
4220 CvtToWideChar(GroupName, G);
4221
4222 { call the API }
4223 Result := _NetLocalGroupDelMember(S.Value, G.Value, MemberSID)
4224 finally
4225 FreeMem(S.Value, S.Length);
4226 FreeMem(G.Value, G.Length);
4227 end;
4228 end else
4229 RaiseStWin32Error(EStNetException, GetLastError);
4230 end else begin
4231 { EStNetException }
4232 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4233 end;
4234 end;
4235
4236 function StNetLocalGroupGetMembers(ServerName, GroupName: string; Level: DWord;
4237 var Buffer: Pointer; PrefMaxLen: DWord;
4238 var EntriesRead, TotalEntries: DWord;
4239 ResumeHandle: Pointer): NET_API_STATUS;
4240 var
4241 S, G : TLMWideChar;
4242 begin
4243 Result := 0;
4244 if IsNetApi32 then begin
4245 if (@_NetLocalGroupGetMembers = nil) then
4246 @_NetLocalGroupGetMembers := GetProcAddress(NETAPI32, 'NetLocalGroupGetMembers');
4247
4248 if (@_NetLocalGroupGetMembers <> nil) then begin
4249 { determine if UNC identifiers needed }
4250 ServerName := ServerUncName(ServerName);
4251
4252 S.Value := nil;
4253 G.Value := nil;
4254 try
4255 { allocate the unicode server name }
4256 CvtToWideChar(ServerName, S);
4257
4258 { allocate the unicode group name }
4259 CvtToWideChar(GroupName, G);
4260
4261 { call the API }
4262 Result := _NetLocalGroupGetMembers(S.Value, G.Value, Level, Buffer,
4263 PrefMaxLen, EntriesRead,
4264 TotalEntries, ResumeHandle)
4265 finally
4266 FreeMem(S.Value, S.Length);
4267 FreeMem(G.Value, G.Length);
4268 end;
4269 end else
4270 RaiseStWin32Error(EStNetException, GetLastError);
4271 end else begin
4272 { EStNetException }
4273 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4274 end;
4275 end;
4276
4277 function StNetLocalGroupSetMembers(ServerName, GroupName: string; Level: DWord;
4278 Buffer: Pointer;
4279 var TotalEntries: DWord): NET_API_STATUS;
4280 var
4281 S, G : TLMWideChar;
4282 begin
4283 Result := 0;
4284 if IsNetApi32 then begin
4285 if (@_NetLocalGroupSetMembers = nil) then
4286 @_NetLocalGroupSetMembers := GetProcAddress(NETAPI32, 'NetLocalGroupSetMembers');
4287
4288 if (@_NetLocalGroupSetMembers <> nil) then begin
4289 { determine if UNC identifiers needed }
4290 ServerName := ServerUncName(ServerName);
4291
4292 S.Value := nil;
4293 G.Value := nil;
4294 try
4295 { allocate the unicode server name }
4296 CvtToWideChar(ServerName, S);
4297
4298 { allocate the unicode group name }
4299 CvtToWideChar(GroupName, G);
4300
4301 { call the API }
4302 Result := _NetLocalGroupSetMembers(S.Value, G.Value, Level, Buffer,
4303 TotalEntries);
4304 finally
4305 FreeMem(S.Value, S.Length);
4306 FreeMem(G.Value, G.Length);
4307 end;
4308 end else
4309 RaiseStWin32Error(EStNetException, GetLastError);
4310 end else begin
4311 { EStNetException }
4312 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4313 end;
4314 end;
4315
4316 function StNetLocalGroupAddMembers(ServerName, GroupName: string; Level: DWord;
4317 Buffer: Pointer;
4318 TotalEntries: DWord): NET_API_STATUS;
4319 var
4320 S, G : TLMWideChar;
4321 begin
4322 Result := 0;
4323 if IsNetApi32 then begin
4324 if (@_NetLocalGroupAddMembers = nil) then
4325 @_NetLocalGroupAddMembers := GetProcAddress(NETAPI32, 'NetLocalGroupAddMembers');
4326
4327 if (@_NetLocalGroupAddMembers <> nil) then begin
4328 { determine if UNC identifiers needed }
4329 ServerName := ServerUncName(ServerName);
4330
4331 S.Value := nil;
4332 G.Value := nil;
4333 try
4334 { allocate the unicode server name }
4335 CvtToWideChar(ServerName, S);
4336
4337 { allocate the unicode group name }
4338 CvtToWideChar(GroupName, G);
4339
4340 { call the API }
4341 Result := _NetLocalGroupAddMembers(S.Value, G.Value, Level, Buffer,
4342 TotalEntries);
4343 finally
4344 FreeMem(S.Value, S.Length);
4345 FreeMem(G.Value, G.Length);
4346 end;
4347 end else
4348 RaiseStWin32Error(EStNetException, GetLastError);
4349 end else begin
4350 { EStNetException }
4351 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4352 end;
4353 end;
4354
4355 function StNetLocalGroupDelMembers(ServerName, GroupName: string; Level: DWord;
4356 Buffer: Pointer; TotalEntries: DWord): NET_API_STATUS;
4357 var
4358 S, G : TLMWideChar;
4359 begin
4360 Result := 0;
4361 if IsNetApi32 then begin
4362 if (@_NetLocalGroupDelMembers = nil) then
4363 @_NetLocalGroupDelMembers := GetProcAddress(NETAPI32, 'NetLocalGroupDelMembers');
4364
4365 if (@_NetLocalGroupDelMembers <> nil) then begin
4366 { determine if UNC identifiers needed }
4367 ServerName := ServerUncName(ServerName);
4368
4369 S.Value := nil;
4370 G.Value := nil;
4371 try
4372 { allocate the unicode server name }
4373 CvtToWideChar(ServerName, S);
4374
4375 { allocate the unicode group name }
4376 CvtToWideChar(GroupName, G);
4377
4378 { call the API }
4379 Result := _NetLocalGroupDelMembers(S.Value, G.Value, Level, Buffer,
4380 TotalEntries);
4381 finally
4382 FreeMem(S.Value, S.Length);
4383 FreeMem(G.Value, G.Length);
4384 end;
4385 end else
4386 RaiseStWin32Error(EStNetException, GetLastError);
4387 end else begin
4388 { EStNetException }
4389 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4390 end;
4391 end;
4392
4393
4394 function StNetQueryDisplayInformation(ServerName: string; Level, Index,
4395 EntriesRequested, PrefMaxLen: DWord;
4396 var ReturnedCount: DWord;
4397 var Buffer: Pointer): NET_API_STATUS;
4398 var
4399 S : TLMWidechar;
4400 begin
4401 Result := 0;
4402 if IsNetApi32 then begin
4403 if (@_NetQueryDisplayInformation = nil) then
4404 @_NetQueryDisplayInformation := GetProcAddress(NETAPI32, 'NetQueryDisplayInformation');
4405
4406 if (@_NetQueryDisplayInformation <> nil) then begin
4407 { determine if UNC identifiers needed }
4408 ServerName := ServerUncName(ServerName);
4409
4410 S.Value := nil;
4411 try
4412 { allocate the unicode server name }
4413 CvtToWideChar(ServerName, S);
4414
4415 { call the API }
4416 Result := _NetQueryDisplayInformation(S.Value, Level, Index,
4417 EntriesRequested, PrefMaxLen,
4418 ReturnedCount, Buffer);
4419 finally
4420 FreeMem(S.Value, S.Length);
4421 end;
4422 end else
4423 RaiseStWin32Error(EStNetException, GetLastError);
4424 end else begin
4425 { EStNetException }
4426 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4427 end;
4428 end;
4429
4430 function StNetGetDisplayInformationIndex(ServerName: string; Level: DWord;
4431 Prefix: string;
4432 var Index: DWord): NET_API_STATUS;
4433 var
4434 S, P : TLMWidechar;
4435 begin
4436 Result := 0;
4437 if IsNetApi32 then begin
4438 if (@_NetGetDisplayInformationIndex = nil) then
4439 @_NetGetDisplayInformationIndex := GetProcAddress(NETAPI32, 'NetGetDisplayInformationIndex');
4440
4441 if (@_NetGetDisplayInformationIndex <> nil) then begin
4442 { determine if UNC identifiers needed }
4443 ServerName := ServerUncName(ServerName);
4444
4445 S.Value := nil;
4446 P.Value := nil;
4447 try
4448 { allocate the unicode server name }
4449 CvtToWideChar(ServerName, S);
4450
4451 { allocate the unicode prefix }
4452 CvtToWideChar(Prefix, P);
4453
4454 { call the API }
4455 Result := _NetGetDisplayInformationIndex(S.Value, Level, P.Value, Index);
4456 finally
4457 FreeMem(S.Value, S.Length);
4458 FreeMem(P.Value, P.Length);
4459 end;
4460 end else
4461 RaiseStWin32Error(EStNetException, GetLastError);
4462 end else begin
4463 { EStNetException }
4464 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4465 end;
4466 end;
4467
4468 function StNetAccessAdd(ServerName: string; Level: DWord; Buffer: Pointer;
4469 var ParmErr: DWord): NET_API_STATUS;
4470 var
4471 S : TLMWidechar;
4472 begin
4473 Result := 0;
4474 if IsNetApi32 then begin
4475 if (@_NetAccessAdd = nil) then
4476 @_NetAccessAdd := GetProcAddress(NETAPI32, 'NetAccessAdd');
4477
4478 if (@_NetAccessAdd <> nil) then begin
4479 S.Value := nil;
4480 try
4481 { allocate the unicode server name }
4482 CvtToWideChar(ServerName, S);
4483
4484 { call the API }
4485 Result := _NetAccessAdd(S.Value, Level, Buffer, ParmErr)
4486 finally
4487 FreeMem(S.Value, S.Length);
4488 end;
4489 end else
4490 RaiseStWin32Error(EStNetException, GetLastError);
4491 end else begin
4492 { EStNetException }
4493 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4494 end;
4495 end;
4496
4497 function StNetAccessEnum(ServerName, BasePath: string; Recursive, Level: DWord;
4498 var Buffer: Pointer; PrefMaxLen: DWord;
4499 var EntriesRead, TotalEntries,
4500 ResumeHandle: DWord): NET_API_STATUS;
4501 var
4502 S, B : TLMWideChar;
4503 begin
4504 Result := 0;
4505 if IsNetApi32 then begin
4506 if (@_NetAccessEnum = nil) then
4507 @_NetAccessEnum := GetProcAddress(NETAPI32, 'NetAccessEnum');
4508
4509 if (@_NetAccessEnum <> nil) then begin
4510 S.Value := nil;
4511 B.Value := nil;
4512 try
4513 { allocate the unicode server name }
4514 CvtToWideChar(ServerName, S);
4515
4516 { allocate the unicode base path }
4517 CvtToWideChar(BasePath, B);
4518
4519 { call the API }
4520 Result := _NetAccessEnum(S.Value, B.Value, Recursive, Level, Buffer,
4521 PrefMaxLen, EntriesRead, TotalEntries,
4522 ResumeHandle);
4523 finally
4524 FreeMem(S.Value, S.Length);
4525 FreeMem(B.Value, B.Length);
4526 end;
4527 end else
4528 RaiseStWin32Error(EStNetException, GetLastError);
4529 end else begin
4530 { EStNetException }
4531 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4532 end;
4533 end;
4534
4535 function StNetAccessGetInfo(ServerName, Resource: string; Level: DWord;
4536 var Buffer: Pointer): NET_API_STATUS;
4537 var
4538 S, R : TLMWideChar;
4539 begin
4540 Result := 0;
4541 if IsNetApi32 then begin
4542 if (@_NetAccessGetInfo = nil) then
4543 @_NetAccessGetInfo := GetProcAddress(NETAPI32, 'NetAccessGetInfo');
4544
4545 if (@_NetAccessGetInfo <> nil) then begin
4546 S.Value := nil;
4547 R.Value := nil;
4548 try
4549 { allocate the unicode server name }
4550 CvtToWideChar(ServerName, S);
4551
4552 { allocate the unicode resource }
4553 CvtToWideChar(Resource, R);
4554
4555 { call the API }
4556 Result := _NetAccessGetInfo(S.Value, R.Value, Level, Buffer);
4557 finally
4558 FreeMem(S.Value, S.Length);
4559 FreeMem(R.Value, R.Length);
4560 end;
4561 end else
4562 RaiseStWin32Error(EStNetException, GetLastError);
4563 end else begin
4564 { EStNetException }
4565 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4566 end;
4567 end;
4568
4569 function StNetAccessSetInfo(ServerName, Resource: string; Level: DWord;
4570 Buffer: Pointer; var ParmErr: DWord): NET_API_STATUS;
4571 var
4572 S, R : TLMWideChar;
4573 begin
4574 Result := 0;
4575 if IsNetApi32 then begin
4576 if (@_NetAccessSetInfo = nil) then
4577 @_NetAccessSetInfo := GetProcAddress(NETAPI32, 'NetAccessSetInfo');
4578
4579 if (@_NetAccessSetInfo <> nil) then begin
4580 S.Value := nil;
4581 R.Value := nil;
4582 try
4583 { allocate the unicode server name }
4584 CvtToWideChar(ServerName, S);
4585
4586 { allocate the unicode resource }
4587 CvtToWideChar(Resource, R);
4588
4589 { call the API }
4590 Result := _NetAccessSetInfo(S.Value, R.Value, Level, Buffer, ParmErr);
4591 finally
4592 FreeMem(S.Value, S.Length);
4593 FreeMem(R.Value, R.Length);
4594 end;
4595 end else
4596 RaiseStWin32Error(EStNetException, GetLastError);
4597 end else begin
4598 { EStNetException }
4599 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4600 end;
4601 end;
4602
4603 function StNetAccessDel(ServerName, Resource: string): NET_API_STATUS;
4604 var
4605 S, R : TLMWideChar;
4606 begin
4607 Result := 0;
4608 if IsNetApi32 then begin
4609 if (@_NetAccessDel = nil) then
4610 @_NetAccessDel := GetProcAddress(NETAPI32, 'NetAccessDel');
4611
4612 if (@_NetAccessDel <> nil) then begin
4613 S.Value := nil;
4614 R.Value := nil;
4615 try
4616 { allocate the unicode server name }
4617 CvtToWideChar(ServerName, S);
4618
4619 { allocate the unicode resource }
4620 CvtToWideChar(Resource, R);
4621
4622 { call the API }
4623 Result := _NetAccessDel(S.Value, R.Value);
4624 finally
4625 FreeMem(S.Value, S.Length);
4626 FreeMem(R.Value, R.Length);
4627 end;
4628 end else
4629 RaiseStWin32Error(EStNetException, GetLastError);
4630 end else begin
4631 { EStNetException }
4632 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4633 end;
4634 end;
4635
4636 function StNetAccessGetUserPerms(ServerName, UGname, Resource: string;
4637 var Perms: DWord): NET_API_STATUS;
4638 var
4639 S, U, R : TLMWideChar;
4640 begin
4641 Result := 0;
4642 if IsNetApi32 then begin
4643 if (@_NetAccessGetUserPerms = nil) then
4644 @_NetAccessGetUserPerms := GetProcAddress(NETAPI32, 'NetAccessGetUserPerms');
4645
4646 if (@_NetAccessGetUserPerms <> nil) then begin
4647 S.Value := nil;
4648 U.Value := nil;
4649 R.Value := nil;
4650 try
4651 { allocate the unicode server name }
4652 CvtToWideChar(ServerName, S);
4653
4654 { allocate the unicode user/group name }
4655 CvtToWideChar(UGname, U);
4656
4657 { allocate the unicode resource }
4658 CvtToWideChar(Resource, R);
4659
4660 { call the API }
4661 Result := _NetAccessGetUserPerms(S.Value, U.Value, R.Value, Perms);
4662 finally
4663 FreeMem(S.Value, S.Length);
4664 FreeMem(U.Value, U.Length);
4665 FreeMem(R.Value, R.Length);
4666 end;
4667 end else
4668 RaiseStWin32Error(EStNetException, GetLastError);
4669 end else begin
4670 { EStNetException }
4671 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4672 end;
4673 end;
4674
4675
4676 function StNetGetDCName(ServerName, DomainName: string;
4677 var Buffer: string): NET_API_STATUS;
4678 var
4679 S, D: TLMWideChar;
4680 DB : Pointer;
4681 begin
4682 Result := 0;
4683 if IsNetApi32 then begin
4684 if (@_NetGetDCName = nil) then
4685 @_NetGetDCName := GetProcAddress(NETAPI32, 'NetGetDCName');
4686
4687 if (@_NetGetDCName <> nil) then begin
4688 S.Value := nil;
4689 D.Value := nil;
4690 try
4691 { allocate the unicode server name }
4692 CvtToWideChar(ServerName, S);
4693
4694 { allocate the unicode domain name }
4695 CvtToWideChar(DomainName, D);
4696
4697 { call the API }
4698 Result := _NetGetDCName(S.Value, D.Value, DB);
4699 if Result = NERR_SUCCESS then begin
4700 Buffer := WideCharToString(DB);
4701 StNetApiBufferFree(DB);
4702 end;
4703 finally
4704 FreeMem(S.Value, S.Length);
4705 FreeMem(D.Value, D.Length);
4706 end;
4707 end else
4708 RaiseStWin32Error(EStNetException, GetLastError);
4709 end else begin
4710 { EStNetException }
4711 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4712 end;
4713 end;
4714
4715 function StNetGetAnyDCName(ServerName, DomainName: string;
4716 var Buffer: string): NET_API_STATUS;
4717 var
4718 S, D : TLMWideChar;
4719 B : PByte;
4720 begin
4721 Result := 0;
4722 if IsNetApi32 then begin
4723 if (@_NetGetAnyDCName = nil) then
4724 @_NetGetAnyDCName := GetProcAddress(NETAPI32, 'NetGetAnyDCName');
4725
4726 if (@_NetGetAnyDCName <> nil) then begin
4727 S.Value := nil;
4728 D.Value := nil;
4729 try
4730 { allocate the unicode server name }
4731 CvtToWideChar(ServerName, S);
4732
4733 { allocate the unicode domain name }
4734 CvtToWideChar(DomainName, D);
4735
4736 { call the API }
4737 Result := _NetGetAnyDCName(S.Value, D.Value, B);
4738 if Result = NERR_SUCCESS then begin
4739 Buffer := StrPas(PAnsiChar(B));
4740 StNetApiBufferFree(B);
4741 end;
4742 finally
4743 FreeMem(S.Value, S.Length);
4744 FreeMem(D.Value, D.Length);
4745 end;
4746 end else
4747 RaiseStWin32Error(EStNetException, GetLastError);
4748 end else begin
4749 { EStNetException }
4750 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4751 end;
4752 end;
4753
4754 function StI_NetLogonControl(ServerName: string; FunctionCode, QueryLevel: DWord;
4755 var Buffer: Pointer): NET_API_STATUS;
4756 var
4757 S : TLMWideChar;
4758 begin
4759 Result := 0;
4760 if IsNetApi32 then begin
4761 if (@_I_NetLogonControl = nil) then
4762 @_I_NetLogonControl := GetProcAddress(NETAPI32, 'I_NetLogonControl');
4763
4764 if (@_I_NetLogonControl <> nil) then begin
4765 S.Value := nil;
4766 try
4767 { allocate the unicode server name }
4768 CvtToWideChar(ServerName, S);
4769
4770 { call the API }
4771 Result := _I_NetLogonControl(S.Value, FunctionCode, QueryLevel, Buffer)
4772 finally
4773 FreeMem(S.Value, S.Length);
4774 end;
4775 end else
4776 RaiseStWin32Error(EStNetException, GetLastError);
4777 end else begin
4778 { EStNetException }
4779 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4780 end;
4781 end;
4782
4783 function StI_NetLogonControl2(ServerName: string; FunctionCode,
4784 QueryLevel: DWord; Data: Pointer;
4785 var Buffer: Pointer): NET_API_STATUS;
4786 var
4787 S : TLMWideChar;
4788 begin
4789 Result := 0;
4790 if IsNetApi32 then begin
4791 if (@_I_NetLogonControl2 = nil) then
4792 @_I_NetLogonControl2 := GetProcAddress(NETAPI32, 'I_NetLogonControl2');
4793
4794 if (@_I_NetLogonControl2 <> nil) then begin
4795 S.Value := nil;
4796 try
4797 { allocate the unicode server name }
4798 CvtToWideChar(ServerName, S);
4799
4800 { call the API }
4801 Result := _I_NetLogonControl2(S.Value, FunctionCode, QueryLevel, Data, Buffer);
4802 finally
4803 FreeMem(S.Value, S.Length);
4804 end;
4805 end else
4806 RaiseStWin32Error(EStNetException, GetLastError);
4807 end else begin
4808 { EStNetException }
4809 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4810 end;
4811 end;
4812
4813 function StNetEnumerateTrustedDomains(ServerName: string;
4814 var Buffer: Pointer): NET_API_STATUS;
4815 var
4816 S : TLMWideChar;
4817 begin
4818 Result := 0;
4819 if IsNetApi32 then begin
4820 if (@_NetEnumerateTrustedDomains = nil) then
4821 @_NetEnumerateTrustedDomains := GetProcAddress(NETAPI32, 'NetEnumerateTrustedDomains');
4822
4823 if (@_NetEnumerateTrustedDomains <> nil) then begin
4824 S.Value := nil;
4825 try
4826 { allocate the unicode server name }
4827 CvtToWideChar(ServerName, S);
4828
4829 { call the API }
4830 Result := _NetEnumerateTrustedDomains(S.Value, Buffer)
4831 finally
4832 FreeMem(S.Value, S.Length);
4833 end;
4834 end else
4835 RaiseStWin32Error(EStNetException, GetLastError);
4836 end else begin
4837 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4838 end;
4839 end;
4840
4841
4842 {LMALERT}
4843 function StNetAlertRaise(AlertEventName: string; Buffer: Pointer;
4844 BufferSize: DWord): NET_API_STATUS;
4845 var
4846 A : TLMWideChar;
4847 begin
4848 Result := 0;
4849 if IsNetApi32 then begin
4850 if (@_NetAlertRaise = nil) then
4851 @_NetAlertRaise := GetProcAddress(NETAPI32, 'NetAlertRaise');
4852
4853 if (@_NetAlertRaise <> nil) then begin
4854 A.Value := nil;
4855 try
4856 { allocate the unicode alert event name }
4857 CvtToWideChar(AlertEventName, A);
4858
4859 { call the API }
4860 Result := _NetAlertRaise(A.Value, Buffer, BufferSize);
4861 finally
4862 FreeMem(A.Value, A.Length);
4863 end;
4864 end else
4865 RaiseStWin32Error(EStNetException, GetLastError);
4866 end else begin
4867 { EStNetException }
4868 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4869 end;
4870 end;
4871
4872 function StNetAlertRaiseEx(AlertEventName: string; VariableInfo:
4873 Pointer; VariableInfoSize: DWord;
4874 ServiceName: string): NET_API_STATUS;
4875 var
4876 A, S : TLMWideChar;
4877 begin
4878 Result := 0;
4879 if IsNetApi32 then begin
4880 if (@_NetAlertRaiseEx = nil) then
4881 @_NetAlertRaiseEx := GetProcAddress(NETAPI32, 'NetAlertRaiseEx');
4882
4883 if (@_NetAlertRaiseEx <> nil) then begin
4884 A.Value := nil;
4885 S.Value := nil;
4886 try
4887 { allocate the unicode alert event name }
4888 CvtToWideChar(AlertEventName, A);
4889
4890 { allocate the unicode service name }
4891 CvtToWideChar(ServiceName, S);
4892
4893 { call the API }
4894 Result := _NetAlertRaiseEx(A.Value, VariableInfo, VariableInfoSize, S.Value);
4895 finally
4896 FreeMem(A.Value, A.Length);
4897 FreeMem(S.Value, S.Length);
4898 end;
4899 end else
4900 RaiseStWin32Error(EStNetException, GetLastError);
4901 end else begin
4902 { EStNetException }
4903 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4904 end;
4905 end;
4906
4907
4908 function StNetShareAdd(ServerName: string; Level: DWORD; Buffer: Pointer;
4909 var ParmErr: DWORD): NET_API_STATUS;
4910 var
4911 S : TLMWideChar;
4912 begin
4913 Result := 0;
4914 if IsNetApi32 then begin
4915 if (@_NetShareAdd = nil) then
4916 @_NetShareAdd := GetProcAddress(NETAPI32, 'NetShareAdd');
4917
4918 if (@_NetShareAdd <> nil) then begin
4919 S.Value := nil;
4920 try
4921 { allocate the unicode server name }
4922 CvtToWideChar(ServerName, S);
4923
4924 { call the API }
4925 Result := _NetShareAdd(S.Value, Level, Buffer, ParmErr);
4926 finally
4927 FreeMem(S.Value, S.Length);
4928 end;
4929 end else
4930 RaiseStWin32Error(EStNetException, GetLastError);
4931 end else begin
4932 { EStNetException }
4933 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4934 end;
4935 end;
4936
4937 function StNetShareEnum(ServerName: string; Level: DWORD; var Buffer: Pointer;
4938 PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord;
4939 var ResumeHandle: DWord): NET_API_STATUS;
4940 var
4941 S : TLMWideChar;
4942 begin
4943 Result := 0;
4944 if IsNetApi32 then begin
4945 if (@_NetShareEnum = nil) then
4946 @_NetShareEnum := GetProcAddress(NETAPI32, 'NetShareEnum');
4947
4948 if (@_NetShareEnum <> nil) then begin
4949 S.Value := nil;
4950 try
4951 { allocate the unicode server name }
4952 CvtToWideChar(ServerName, S);
4953
4954 { call the API }
4955 Result := _NetShareEnum(S.Value, Level, Buffer, PrefMaxLen, EntriesRead,
4956 TotalEntries, ResumeHandle);
4957 finally
4958 FreeMem(S.Value, S.Length);
4959 end;
4960 end else
4961 RaiseStWin32Error(EStNetException, GetLastError);
4962 end else begin
4963 { EStNetException }
4964 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4965 end;
4966 end;
4967
4968 function StNetShareEnumSticky(ServerName: string; Level: DWORD;
4969 var Buffer: Pointer; PrefMaxLen: DWord;
4970 var EntriesRead, TotalEntries,
4971 ResumeHandle: DWord): NET_API_STATUS;
4972 var
4973 S : TLMWideChar;
4974 begin
4975 Result := 0;
4976 if IsNetApi32 then begin
4977 if (@_NetShareEnumSticky = nil) then
4978 @_NetShareEnumSticky := GetProcAddress(NETAPI32, 'NetShareEnumSticky');
4979
4980 if (@_NetShareEnumSticky <> nil) then begin
4981 S.Value := nil;
4982 try
4983 { allocate the unicode server name }
4984 CvtToWideChar(ServerName, S);
4985
4986 { call the API }
4987 Result := _NetShareEnumSticky(S.Value, Level, Buffer, PrefMaxLen,
4988 EntriesRead, TotalEntries, ResumeHandle);
4989 finally
4990 FreeMem(S.Value, S.Length);
4991 end;
4992 end else
4993 RaiseStWin32Error(EStNetException, GetLastError);
4994 end else begin
4995 { EStNetException }
4996 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
4997 end;
4998 end;
4999
5000 function StNetShareGetInfo(ServerName, NetName: string; Level: DWORD;
5001 var Buffer: Pointer): NET_API_STATUS;
5002 var
5003 S, N : TLMWideChar;
5004 begin
5005 Result := 0;
5006 if IsNetApi32 then begin
5007 if (@_NetShareGetInfo = nil) then
5008 @_NetShareGetInfo := GetProcAddress(NETAPI32, 'NetShareGetInfo');
5009
5010 if (@_NetShareGetInfo <> nil) then begin
5011 S.Value := nil;
5012 N.Value := nil;
5013 try
5014 { allocate the unicode server name }
5015 CvtToWideChar(ServerName, S);
5016
5017 { allocate the unicode net name }
5018 CvtToWideChar(NetName, N);
5019
5020 { call the API }
5021 Result := _NetShareGetInfo(S.Value, N.Value, Level, Buffer);
5022 finally
5023 FreeMem(S.Value, S.Length);
5024 FreeMem(N.Value, N.Length);
5025 end;
5026 end else
5027 RaiseStWin32Error(EStNetException, GetLastError);
5028 end else begin
5029 { EStNetException }
5030 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5031 end;
5032 end;
5033
5034 function StNetShareSetInfo(ServerName, NetName: string; Level: DWORD;
5035 var Buffer: Pointer;
5036 var ParmErr: DWord): NET_API_STATUS;
5037 var
5038 S, N : TLMWideChar;
5039 begin
5040 Result := 0;
5041 if IsNetApi32 then begin
5042 if (@_NetShareSetInfo = nil) then
5043 @_NetShareSetInfo := GetProcAddress(NETAPI32, 'NetShareSetInfo');
5044
5045 if (@_NetShareSetInfo <> nil) then begin
5046 S.Value := nil;
5047 N.Value := nil;
5048 try
5049 { allocate the unicode server name }
5050 CvtToWideChar(ServerName, S);
5051
5052 { allocate the unicode net name }
5053 CvtToWideChar(NetName, N);
5054
5055 { call the API }
5056 Result := _NetShareSetInfo(S.Value, N.Value, Level, Buffer, ParmErr);
5057 finally
5058 FreeMem(S.Value, S.Length);
5059 FreeMem(N.Value, N.Length);
5060 end;
5061 end else
5062 RaiseStWin32Error(EStNetException, GetLastError);
5063 end else begin
5064 { EStNetException }
5065 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5066 end;
5067 end;
5068
5069 function StNetShareDel(ServerName, NetName: string; Reserved: DWord): NET_API_STATUS;
5070 var
5071 S, N : TLMWideChar;
5072 begin
5073 Result := 0;
5074 if IsNetApi32 then begin
5075 if (@_NetShareDel = nil) then
5076 @_NetShareDel := GetProcAddress(NETAPI32, 'NetShareDel');
5077
5078 if (@_NetShareDel <> nil) then begin
5079 S.Value := nil;
5080 N.Value := nil;
5081 try
5082 { allocate the unicode server name }
5083 CvtToWideChar(ServerName, S);
5084
5085 { allocate the unicode net name }
5086 CvtToWideChar(NetName, N);
5087
5088 { call the API }
5089 Result := _NetShareDel(S.Value, N.Value, Reserved)
5090 finally
5091 FreeMem(S.Value, S.Length);
5092 FreeMem(N.Value, N.Length);
5093 end;
5094 end else
5095 RaiseStWin32Error(EStNetException, GetLastError);
5096 end else begin
5097 { EStNetException }
5098 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5099 end;
5100 end;
5101
5102 function StNetShareDelSticky(ServerName, NetName: string; Reserved: DWord): NET_API_STATUS;
5103 var
5104 S, N : TLMWideChar;
5105 begin
5106 Result := 0;
5107 if IsNetApi32 then begin
5108 if (@_NetShareDelSticky = nil) then
5109 @_NetShareDelSticky := GetProcAddress(NETAPI32, 'NetShareDelSticky');
5110
5111 if (@_NetShareDelSticky <> nil) then begin
5112 S.Value := nil;
5113 N.Value := nil;
5114 try
5115 { allocate the unicode server name }
5116 CvtToWideChar(ServerName, S);
5117
5118 { allocate the unicode net name }
5119 CvtToWideChar(NetName, N);
5120
5121 { call the API }
5122 Result := _NetShareDelSticky(S.Value, N.Value, Reserved);
5123 finally
5124 FreeMem(S.Value, S.Length);
5125 FreeMem(N.Value, N.Length);
5126 end;
5127 end else
5128 RaiseStWin32Error(EStNetException, GetLastError);
5129 end else begin
5130 { EStNetException }
5131 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5132 end;
5133 end;
5134
5135 function StNetShareCheck(ServerName, Device: string; var ShareType: DWord): NET_API_STATUS;
5136 var
5137 S, D : TLMWideChar;
5138 begin
5139 Result := 0;
5140 if IsNetApi32 then begin
5141 if (@_NetShareCheck = nil) then
5142 @_NetShareCheck := GetProcAddress(NETAPI32, 'NetShareCheck');
5143
5144 if (@_NetShareCheck <> nil) then begin
5145 S.Value := nil;
5146 D.Value := nil;
5147 try
5148 { allocate the unicode server name }
5149 CvtToWideChar(ServerName, S);
5150
5151 { allocate the unicode device name }
5152 CvtToWideChar(Device, D);
5153
5154 { call the API }
5155 Result := _NetShareCheck(S.Value, D.Value, ShareType);
5156 finally
5157 FreeMem(S.Value, S.Length);
5158 FreeMem(D.Value, D.Length);
5159 end;
5160 end else
5161 RaiseStWin32Error(EStNetException, GetLastError);
5162 end else begin
5163 { EStNetException }
5164 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5165 end;
5166 end;
5167
5168
5169 function StNetSessionEnum(ServerName, UncClientName, UserName: string;
5170 Level: DWord; var Buffer: Pointer; PrefMaxLen: DWord;
5171 var EntriesRead, TotalEntries,
5172 ResumeHandle: DWord): NET_API_STATUS;
5173 var
5174 S, C, U : TLMWideChar;
5175 begin
5176 Result := 0;
5177 if IsNetApi32 then begin
5178 if (@_NetSessionEnum = nil) then
5179 @_NetSessionEnum := GetProcAddress(NETAPI32, 'NetSessionEnum');
5180
5181 if (@_NetSessionEnum <> nil) then begin
5182 S.Value := nil;
5183 C.Value := nil;
5184 U.Value := nil;
5185 try
5186 { allocate the unicode server name }
5187 CvtToWideChar(ServerName, S);
5188
5189 { allocate the unicode UNC client name }
5190 CvtToWideChar(UncClientName, C);
5191
5192 { allocate the unicode user name }
5193 CvtToWideChar(UserName, U);
5194
5195 { call the API }
5196 Result := _NetSessionEnum(S.Value, C.Value, U.Value, Level, Buffer,
5197 PrefMaxLen, EntriesRead, TotalEntries,
5198 ResumeHandle);
5199 finally
5200 FreeMem(S.Value, S.Length);
5201 FreeMem(C.Value, C.Length);
5202 FreeMem(U.Value, U.Length);
5203 end;
5204 end else
5205 RaiseStWin32Error(EStNetException, GetLastError);
5206 end else begin
5207 { EStNetException }
5208 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5209 end;
5210 end;
5211
5212 function StNetSessionDel(ServerName, UncClientName, UserName: string): NET_API_STATUS;
5213 var
5214 S, C, U : TLMWideChar;
5215 begin
5216 Result := 0;
5217 if IsNetApi32 then begin
5218 if (@_NetSessionDel = nil) then
5219 @_NetSessionDel := GetProcAddress(NETAPI32, 'NetSessionDel');
5220
5221 if (@_NetSessionDel <> nil) then begin
5222 S.Value := nil;
5223 C.Value := nil;
5224 U.Value := nil;
5225 try
5226 { allocate the unicode server name }
5227 CvtToWideChar(ServerName, S);
5228
5229 { allocate the unicode UNC client name }
5230 CvtToWideChar(UncClientName, C);
5231
5232 { allocate the unicode user name }
5233 CvtToWideChar(UserName, U);
5234
5235 { call the API }
5236 Result := _NetSessionDel(S.Value, C.Value, U.Value);
5237 finally
5238 FreeMem(S.Value, S.Length);
5239 FreeMem(C.Value, C.Length);
5240 FreeMem(U.Value, U.Length);
5241 end;
5242 end else
5243 RaiseStWin32Error(EStNetException, GetLastError);
5244 end else begin
5245 { EStNetException }
5246 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5247 end;
5248 end;
5249
5250 function StNetSessionGetInfo(ServerName, UncClientName, UserName: string;
5251 Level: DWord; var Buffer: Pointer): NET_API_STATUS;
5252 var
5253 S, C, U : TLMWideChar;
5254 begin
5255 Result := 0;
5256 if IsNetApi32 then begin
5257 if (@_NetSessionGetInfo = nil) then
5258 @_NetSessionGetInfo := GetProcAddress(NETAPI32, 'NetSessionGetInfo');
5259
5260 if (@_NetSessionGetInfo <> nil) then begin
5261 S.Value := nil;
5262 C.Value := nil;
5263 U.Value := nil;
5264 try
5265 { allocate the unicode server name }
5266 CvtToWideChar(ServerName, S);
5267
5268 { allocate the unicode UNC client name }
5269 CvtToWideChar(UncClientName, C);
5270
5271 { allocate the unicode user name }
5272 CvtToWideChar(UserName, U);
5273
5274 { call the API }
5275 Result := _NetSessionGetInfo(S.Value, C.Value, U.Value, Level, Buffer);
5276 finally
5277 FreeMem(S.Value, S.Length);
5278 FreeMem(C.Value, C.Length);
5279 FreeMem(U.Value, U.Length);
5280 end;
5281 end else
5282 RaiseStWin32Error(EStNetException, GetLastError);
5283 end else begin
5284 { EStNetException }
5285 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5286 end;
5287 end;
5288
5289
5290 function StNetConnectionEnum(ServerName, Qualifier: string; Level: DWord;
5291 var Buffer : Pointer; PrefMaxLen : DWord;
5292 var EntriesRead, TotalEntries,
5293 ResumeHandle: DWord): NET_API_STATUS;
5294 var
5295 S, Q : TLMWideChar;
5296 begin
5297 Result := 0;
5298 if IsNetApi32 then begin
5299 if (@_NetConnectionEnum = nil) then
5300 @_NetConnectionEnum := GetProcAddress(NETAPI32, 'NetConnectionEnum');
5301
5302 if (@_NetConnectionEnum <> nil) then begin
5303 S.Value := nil;
5304 Q.Value := nil;
5305 try
5306 { allocate the unicode server name }
5307 CvtToWideChar(ServerName, S);
5308
5309 { allocate the unicode qualifier }
5310 CvtToWideChar(Qualifier, Q);
5311
5312 { call the API }
5313 Result := _NetConnectionEnum(S.Value, Q.Value, Level, Buffer, PrefMaxLen,
5314 EntriesRead, TotalEntries, ResumeHandle);
5315 finally
5316 FreeMem(S.Value, S.Length);
5317 FreeMem(Q.Value, Q.Length);
5318 end;
5319 end else
5320 RaiseStWin32Error(EStNetException, GetLastError);
5321 end else begin
5322 { EStNetException }
5323 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5324 end;
5325 end;
5326
5327
5328 function StNetFileClose(ServerName: string; FileID: DWord): NET_API_STATUS;
5329 var
5330 S : TLMWideChar;
5331 begin
5332 Result := 0;
5333 if IsNetApi32 then begin
5334 if (@_NetFileClose = nil) then
5335 @_NetFileClose := GetProcAddress(NETAPI32, 'NetFileClose');
5336
5337 if (@_NetFileClose <> nil) then begin
5338 S.Value := nil;
5339 try
5340 { allocate the unicode server name }
5341 CvtToWideChar(ServerName, S);
5342
5343 { call the API }
5344 Result := _NetFileClose(S.Value, FileID);
5345 finally
5346 FreeMem(S.Value, S.Length);
5347 end;
5348 end else
5349 RaiseStWin32Error(EStNetException, GetLastError);
5350 end else begin
5351 { EStNetException }
5352 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5353 end;
5354 end;
5355
5356 function StNetFileEnum(ServerName, BasePath, UserName: string; Level: DWord;
5357 var Buffer: Pointer; PrefMexLen: DWord; var EntriesRead,
5358 TotalEntries, ResumeHandle: DWord): NET_API_STATUS;
5359 var
5360 S, B, U : TLMWideChar;
5361 begin
5362 Result := 0;
5363 if IsNetApi32 then begin
5364 if (@_NetFileEnum = nil) then
5365 @_NetFileEnum := GetProcAddress(NETAPI32, 'NetFileEnum');
5366
5367 if (@_NetFileEnum <> nil) then begin
5368 S.Value := nil;
5369 B.Value := nil;
5370 U.Value := nil;
5371 try
5372 { allocate the unicode server name }
5373 CvtToWideChar(ServerName, S);
5374
5375 { allocate the unicode base path }
5376 CvtToWideChar(BasePath, B);
5377
5378 { allocate the unicode user name }
5379 CvtToWideChar(UserName, U);
5380
5381 { call the API }
5382 Result := _NetFileEnum(S.Value, B.Value, U.Value, Level, Buffer,
5383 PrefMexLen, EntriesRead, TotalEntries, ResumeHandle);
5384 finally
5385 FreeMem(S.Value, S.Length);
5386 FreeMem(B.Value, B.Length);
5387 FreeMem(U.Value, U.Length);
5388 end;
5389 end else
5390 RaiseStWin32Error(EStNetException, GetLastError);
5391 end else begin
5392 { EStNetException }
5393 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5394 end;
5395 end;
5396
5397 function StNetFileGetInfo(ServerName: string; FileID, Level: DWord;
5398 var Buffer: Pointer): NET_API_STATUS;
5399 var
5400 S : TLMWideChar;
5401 begin
5402 Result := 0;
5403 if IsNetApi32 then begin
5404 if (@_NetFileGetInfo = nil) then
5405 @_NetFileGetInfo := GetProcAddress(NETAPI32, 'NetFileGetInfo');
5406
5407 if (@_NetFileGetInfo <> nil) then begin
5408 S.Value := nil;
5409 try
5410 { allocate the unicode server name }
5411 CvtToWideChar(ServerName, S);
5412
5413 { call the API }
5414 Result := _NetFileGetInfo(S.Value, FileID, Level, Buffer);
5415 finally
5416 FreeMem(S.Value, S.Length);
5417 end;
5418 end else
5419 RaiseStWin32Error(EStNetException, GetLastError);
5420 end else begin
5421 { EStNetException }
5422 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5423 end;
5424 end;
5425
5426
5427 {LMMSG}
5428 function StNetMessageNameAdd(ServerName, MsgName: string): NET_API_STATUS;
5429 var
5430 S, M : TLMWideChar;
5431 begin
5432 Result := 0;
5433 if IsNetApi32 then begin
5434 if (@_NetMessageNameAdd = nil) then
5435 @_NetMessageNameAdd := GetProcAddress(NETAPI32, 'NetMessageNameAdd');
5436
5437 if (@_NetMessageNameAdd <> nil) then begin
5438 S.Value := nil;
5439 M.Value := nil;
5440 try
5441 { allocate the unicode server name }
5442 CvtToWideChar(ServerName, S);
5443
5444 { allocate the unicode message name }
5445 CvtToWideChar(MsgName, M);
5446
5447 { call the API }
5448 Result := _NetMessageNameAdd(S.Value, M.Value);
5449 finally
5450 FreeMem(S.Value, S.Length);
5451 FreeMem(M.Value, M.Length);
5452 end;
5453 end else
5454 RaiseStWin32Error(EStNetException, GetLastError);
5455 end else begin
5456 { EStNetException }
5457 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5458 end;
5459 end;
5460
5461 function StNetMessageNameEnum(ServerName: string; Level: DWord; var Buffer:
5462 Pointer; PrefMaxLen: DWord; var EntriesRead,
5463 TotalEntries: DWord;
5464 ResumeHandle: PDWord): NET_API_STATUS;
5465 var
5466 S : TLMWideChar;
5467 begin
5468 Result := 0;
5469 if IsNetApi32 then begin
5470 if (@_NetMessageNameEnum = nil) then
5471 @_NetMessageNameEnum := GetProcAddress(NETAPI32, 'NetMessageNameEnum');
5472
5473 if (@_NetMessageNameEnum <> nil) then begin
5474 S.Value := nil;
5475 try
5476 { allocate the unicode server name }
5477 CvtToWideChar(ServerName, S);
5478
5479 { call the API }
5480 Result := _NetMessageNameEnum(S.Value, Level, Buffer, PrefMaxLen,
5481 EntriesRead, TotalEntries, ResumeHandle);
5482 finally
5483 FreeMem(S.Value, S.Length);
5484 end;
5485 end else
5486 RaiseStWin32Error(EStNetException, GetLastError);
5487 end else begin
5488 { EStNetException }
5489 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5490 end;
5491 end;
5492
5493 function StNetMessageNameGetInfo(ServerName, MsgName: string; Level: DWord;
5494 var Buffer: Pointer): NET_API_STATUS;
5495 var
5496 S, M : TLMWideChar;
5497 begin
5498 Result := 0;
5499 if IsNetApi32 then begin
5500 if (@_NetMessageNameGetInfo = nil) then
5501 @_NetMessageNameGetInfo := GetProcAddress(NETAPI32, 'NetMessageNameGetInfo');
5502
5503 if (@_NetMessageNameGetInfo <> nil) then begin
5504 S.Value := nil;
5505 M.Value := nil;
5506 try
5507 { allocate the unicode server name }
5508 CvtToWideChar(ServerName, S);
5509
5510 { allocate the unicode message name }
5511 CvtToWideChar(MsgName, M);
5512
5513 { call the API }
5514 Result := _NetMessageNameGetInfo(S.Value, M.Value, Level, Buffer);
5515 finally
5516 FreeMem(S.Value, S.Length);
5517 FreeMem(M.Value, M.Length);
5518 end;
5519 end else
5520 RaiseStWin32Error(EStNetException, GetLastError);
5521 end else begin
5522 { EStNetException }
5523 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5524 end;
5525 end;
5526
5527 function StNetMessageNameDel(ServerName, MsgName: string): NET_API_STATUS;
5528 var
5529 S, M : TLMWideChar;
5530 begin
5531 Result := 0;
5532 if IsNetApi32 then begin
5533 if (@_NetMessageNameDel = nil) then
5534 @_NetMessageNameDel := GetProcAddress(NETAPI32, 'NetMessageNameDel');
5535
5536 if (@_NetMessageNameDel <> nil) then begin
5537 S.Value := nil;
5538 M.Value := nil;
5539 try
5540 { allocate the unicode server name }
5541 CvtToWideChar(ServerName, S);
5542
5543 { allocate the unicode message name }
5544 CvtToWideChar(MsgName, M);
5545
5546 { call the API }
5547 Result := _NetMessageNameDel(S.Value, M.Value);
5548 finally
5549 FreeMem(S.Value, S.Length);
5550 FreeMem(M.Value, M.Length);
5551 end;
5552 end else
5553 RaiseStWin32Error(EStNetException, GetLastError);
5554 end else begin
5555 { EStNetException }
5556 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5557 end;
5558 end;
5559
5560 function StNetMessageBufferSend(ServerName, MsgName, FromName: string;
5561 Buffer: Pointer; BufferLen: DWord): NET_API_STATUS;
5562 var
5563 S, M, F : TLMWideChar;
5564 begin
5565 Result := 0;
5566 if IsNetApi32 then begin
5567 if (@_NetMessageBufferSend = nil) then
5568 @_NetMessageBufferSend := GetProcAddress(NETAPI32, 'NetMessageBufferSend');
5569
5570 if (@_NetMessageBufferSend <> nil) then begin
5571 S.Value := nil;
5572 M.Value := nil;
5573 F.Value := nil;
5574 try
5575 { allocate the unicode server name }
5576 CvtToWideChar(ServerName, S);
5577
5578 { allocate the unicode message name }
5579 CvtToWideChar(MsgName, M);
5580
5581 { allocate the unicode from name }
5582 CvtToWideChar(FromName, F);
5583
5584 { call the API }
5585 Result := _NetMessageBufferSend(S.Value, M.Value, F.Value, Buffer, BufferLen);
5586 finally
5587 FreeMem(S.Value, S.Length);
5588 FreeMem(M.Value, M.Length);
5589 FreeMem(F.Value, F.Length);
5590 end;
5591 end else
5592 RaiseStWin32Error(EStNetException, GetLastError);
5593 end else begin
5594 { EStNetException }
5595 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5596 end;
5597 end;
5598
5599
5600 {LMREMUTL}
5601 function StNetRemoteTOD(UncServerName: string; var Buffer: Pointer): NET_API_STATUS;
5602 var
5603 U : TLMWideChar;
5604 begin
5605 Result := 0;
5606 if IsNetApi32 then begin
5607 if (@_NetRemoteTOD = nil) then
5608 @_NetRemoteTOD := GetProcAddress(NETAPI32, 'NetRemoteTOD');
5609
5610 if (@_NetRemoteTOD <> nil) then begin
5611 U.Value := nil;
5612 try
5613 { allocate the unicode server name }
5614 CvtToWideChar(UncServerName, U);
5615
5616 { call the API }
5617 Result := _NetRemoteTOD(U.Value, Buffer);
5618 finally
5619 FreeMem(U.Value, U.Length);
5620 end;
5621 end else
5622 RaiseStWin32Error(EStNetException, GetLastError);
5623 end else begin
5624 { EStNetException }
5625 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5626 end;
5627 end;
5628
5629 function StNetRemoteComputerSupports(UncServerName: string; OptionsWanted: DWord;
5630 var OptionsSupported: DWord): NET_API_STATUS;
5631 var
5632 U : TLMWideChar;
5633 begin
5634 Result := 0;
5635 if IsNetApi32 then begin
5636 if (@_NetRemoteComputerSupports = nil) then
5637 @_NetRemoteComputerSupports := GetProcAddress(NETAPI32, 'NetRemoteComputerSupports');
5638
5639 if (@_NetRemoteComputerSupports <> nil) then begin
5640 U.Value := nil;
5641 try
5642 { allocate the unicode server name }
5643 CvtToWideChar(UncServerName, U);
5644
5645 { call the API }
5646 Result := _NetRemoteComputerSupports(U.Value, OptionsWanted, OptionsSupported);
5647 finally
5648 FreeMem(U.Value, U.Length);
5649 end;
5650 end else
5651 RaiseStWin32Error(EStNetException, GetLastError);
5652 end else begin
5653 { EStNetException }
5654 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5655 end;
5656 end;
5657
5658
5659 {LMSERVER}
5660 function StNetServerEnum(ServerName: string; Level: DWord; var Buffer: Pointer;
5661 PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord;
5662 ServerType: DWord; Domain: string;
5663 var ResumeHandle: DWord): NET_API_STATUS;
5664 var
5665 S, D : TLMWideChar;
5666 begin
5667 Result := 0;
5668 if IsNetApi32 then begin
5669 if (@_NetServerEnum = nil) then
5670 @_NetServerEnum := GetProcAddress(NETAPI32, 'NetServerEnum');
5671
5672 if (@_NetServerEnum <> nil) then begin
5673 S.Value := nil;
5674 D.Value := nil;
5675 try
5676 { allocate the unicode server name }
5677 CvtToWideChar(ServerName, S);
5678
5679 { allocate the unicode domain name }
5680 CvtToWideChar(Domain, D);
5681
5682 { call the API }
5683 Result := _NetServerEnum(S.Value, Level, Buffer, PrefMaxLen, EntriesRead,
5684 TotalEntries, ServerType, D.Value, ResumeHandle);
5685 finally
5686 FreeMem(S.Value, S.Length);
5687 FreeMem(D.Value, D.Length);
5688 end;
5689 end else
5690 RaiseStWin32Error(EStNetException, GetLastError);
5691 end else begin
5692 { EStNetException }
5693 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5694 end;
5695 end;
5696
5697 function StNetServerEnumEx(ServerName: string; Level: DWord; var Buffer: Pointer;
5698 PrefMaxLen: DWord; var EntriesRead, TotalEntries: DWord;
5699 ServerType: DWord; Domain,
5700 FirstNameToReturn : string): NET_API_STATUS;
5701 var
5702 S, D, F : TLMWideChar;
5703 begin
5704 Result := 0;
5705 if IsNetApi32 then begin
5706 if (@_NetServerEnumEx = nil) then
5707 @_NetServerEnumEx := GetProcAddress(NETAPI32, 'NetServerEnumEx');
5708
5709 if (@_NetServerEnumEx <> nil) then begin
5710 S.Value := nil;
5711 D.Value := nil;
5712 F.Value := nil;
5713 try
5714 { allocate the unicode server name }
5715 CvtToWideChar(ServerName, S);
5716
5717 { allocate the unicode domain name }
5718 CvtToWideChar(Domain, D);
5719
5720 { allocate the unicode first name to return }
5721 CvtToWideChar(FirstNameToReturn, F);
5722
5723 { call the API }
5724 Result := _NetServerEnumEx(S.Value, Level, Buffer, PrefMaxLen,
5725 EntriesRead, TotalEntries, ServerType,
5726 D.Value, F.Value);
5727 finally
5728 FreeMem(S.Value, S.Length);
5729 FreeMem(D.Value, D.Length);
5730 FreeMem(F.Value, F.Length);
5731 end;
5732 end else
5733 RaiseStWin32Error(EStNetException, GetLastError);
5734 end else begin
5735 { EStNetException }
5736 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5737 end;
5738 end;
5739
5740 function StNetServerGetInfo(ServerName: string; Level: DWord;
5741 var Buffer: Pointer): NET_API_STATUS;
5742 var
5743 S : TLMWideChar;
5744 begin
5745 Result := 0;
5746 if IsNetApi32 then begin
5747 if (@_NetServerGetInfo = nil) then
5748 @_NetServerGetInfo := GetProcAddress(NETAPI32, 'NetServerGetInfo');
5749
5750 if (@_NetServerGetInfo <> nil) then begin
5751 S.Value := nil;
5752 try
5753 { allocate the unicode server name }
5754 CvtToWideChar(ServerName, S);
5755
5756 { call the API }
5757 Result := _NetServerGetInfo(S.Value, Level, Buffer);
5758 finally
5759 FreeMem(S.Value, S.Length);
5760 end;
5761 end else
5762 RaiseStWin32Error(EStNetException, GetLastError);
5763 end else begin
5764 { EStNetException }
5765 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5766 end;
5767 end;
5768
5769 function StNetServerSetInfo(ServerName: string; Level: DWord; Buffer: Pointer;
5770 var ParmErr: DWord): NET_API_STATUS;
5771 var
5772 S : TLMWideChar;
5773 begin
5774 Result := 0;
5775 if IsNetApi32 then begin
5776 if (@_NetServerSetInfo = nil) then
5777 @_NetServerSetInfo := GetProcAddress(NETAPI32, 'NetServerSetInfo');
5778
5779 if (@_NetServerSetInfo <> nil) then begin
5780 S.Value := nil;
5781 try
5782 { allocate the unicode server name }
5783 CvtToWideChar(ServerName, S);
5784
5785 { call the API }
5786 Result := _NetServerSetInfo(S.Value, Level, Buffer, ParmErr);
5787 finally
5788 FreeMem(S.Value, S.Length);
5789 end;
5790 end else
5791 RaiseStWin32Error(EStNetException, GetLastError);
5792 end else begin
5793 { EStNetException }
5794 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5795 end;
5796 end;
5797
5798 function StNetServerDiskEnum(ServerName: string; Level: DWord;
5799 var Buffer: Pointer; PrefMaxLen: DWord;
5800 var EntriesRead, TotalEntries,
5801 ResumeHandle: DWord): NET_API_STATUS;
5802 var
5803 S : TLMWideChar;
5804 begin
5805 Result := 0;
5806 if IsNetApi32 then begin
5807 if (@_NetServerDiskEnum = nil) then
5808 @_NetServerDiskEnum := GetProcAddress(NETAPI32, 'NetServerDiskEnum');
5809
5810 if (@_NetServerDiskEnum <> nil) then begin
5811 S.Value := nil;
5812 try
5813 { allocate the unicode server name }
5814 CvtToWideChar(ServerName, S);
5815
5816 { call the API }
5817 Result := _NetServerDiskEnum(S.Value, Level, Buffer, PrefMaxLen,
5818 EntriesRead, TotalEntries, ResumeHandle);
5819 finally
5820 FreeMem(S.Value, S.Length);
5821 end;
5822 end else
5823 RaiseStWin32Error(EStNetException, GetLastError);
5824 end else begin
5825 { EStNetException }
5826 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5827 end;
5828 end;
5829
5830 function StNetServerComputerNameAdd(ServerName, EmulatedDomainName,
5831 EmulatedServerName: string): NET_API_STATUS;
5832 var
5833 S, D, E : TLMWideChar;
5834 begin
5835 Result := 0;
5836 if IsNetApi32 then begin
5837 if (@_NetServerComputerNameAdd = nil) then
5838 @_NetServerComputerNameAdd := GetProcAddress(NETAPI32, 'NetServerComputerNameAdd');
5839
5840 if (@_NetServerComputerNameAdd <> nil) then begin
5841 S.Value := nil;
5842 D.Value := nil;
5843 E.Value := nil;
5844 try
5845 { allocate the unicode server name }
5846 CvtToWideChar(ServerName, S);
5847
5848 { allocate the unicode domain name }
5849 CvtToWideChar(EmulatedDomainName, D);
5850
5851 { allocate the unicode emulated server name }
5852 CvtToWideChar(EmulatedServerName, E);
5853
5854 { call the API }
5855 Result := _NetServerComputerNameAdd(S.Value, D.Value, E.Value);
5856 finally
5857 FreeMem(S.Value, S.Length);
5858 FreeMem(D.Value, D.Length);
5859 FreeMem(E.Value, E.Length);
5860 end;
5861 end else
5862 RaiseStWin32Error(EStNetException, GetLastError);
5863 end else begin
5864 { EStNetException }
5865 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5866 end;
5867 end;
5868
5869 function StNetServerComputerNameDel(ServerName, EmulatedServerName: string): NET_API_STATUS;
5870 var
5871 S, E : TLMWideChar;
5872 begin
5873 Result := 0;
5874 if IsNetApi32 then begin
5875 if (@_NetServerComputerNameDel = nil) then
5876 @_NetServerComputerNameDel := GetProcAddress(NETAPI32, 'NetServerComputerNameDel');
5877
5878 if (@_NetServerComputerNameDel <> nil) then begin
5879 S.Value := nil;
5880 E.Value := nil;
5881 try
5882 { allocate the unicode server name }
5883 CvtToWideChar(ServerName, S);
5884
5885 { allocate the unicode emulated server name }
5886 CvtToWideChar(EmulatedServerName, E);
5887
5888 { call the API }
5889 Result := _NetServerComputerNameDel(S.Value, E.Value);
5890 finally
5891 FreeMem(S.Value, S.Length);
5892 FreeMem(E.Value, E.Length);
5893 end;
5894 end else
5895 RaiseStWin32Error(EStNetException, GetLastError);
5896 end else begin
5897 { EStNetException }
5898 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5899 end;
5900 end;
5901
5902 function StNetServerTransportAdd(ServerName: string; Level: DWord; Buffer: Pointer): NET_API_STATUS;
5903 var
5904 S : TLMWideChar;
5905 begin
5906 Result := 0;
5907 if IsNetApi32 then begin
5908 if (@_NetServerTransportAdd = nil) then
5909 @_NetServerTransportAdd := GetProcAddress(NETAPI32, 'NetServerTransportAdd');
5910
5911 if (@_NetServerTransportAdd <> nil) then begin
5912 S.Value := nil;
5913 try
5914 { allocate the unicode server name }
5915 CvtToWideChar(ServerName, S);
5916
5917 { call the API }
5918 Result := _NetServerTransportAdd(S.Value, Level, Buffer);
5919 finally
5920 FreeMem(S.Value, S.Length);
5921 end;
5922 end else
5923 RaiseStWin32Error(EStNetException, GetLastError);
5924 end else begin
5925 { EStNetException }
5926 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5927 end;
5928 end;
5929
5930 function StNetServerTransportAddEx(ServerName: WideString; Level: DWord; Buffer: Pointer): NET_API_STATUS;
5931 begin
5932 Result := 0;
5933 if IsNetApi32 then begin
5934 if (@_NetServerTransportAddEx = nil) then
5935 @_NetServerTransportAddEx := GetProcAddress(NETAPI32, 'NetServerTransportAddEx');
5936
5937 if (@_NetServerTransportAddEx <> nil) then begin
5938 try
5939 Result := _NetServerTransportAddEx(PWideChar(ServerName), Level, Buffer);
5940 finally
5941 end;
5942 end else
5943 RaiseStWin32Error(EStNetException, GetLastError);
5944 end else begin
5945 { EStNetException }
5946 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5947 end;
5948 end;
5949
5950 function StNetServerTransportDel(ServerName: string; Level: DWord; Buffer: Pointer): NET_API_STATUS;
5951 var
5952 S : TLMWideChar;
5953 begin
5954 Result := 0;
5955 if IsNetApi32 then begin
5956 if (@_NetServerTransportDel = nil) then
5957 @_NetServerTransportDel := GetProcAddress(NETAPI32, 'NetServerTransportDel');
5958
5959 if (@_NetServerTransportDel <> nil) then begin
5960 S.Value := nil;
5961 try
5962 { allocate the unicode server name }
5963 CvtToWideChar(ServerName, S);
5964
5965 { call the API }
5966 Result := _NetServerTransportDel(S.Value, Level, Buffer);
5967 finally
5968 FreeMem(S.Value, S.Length);
5969 end;
5970 end else
5971 RaiseStWin32Error(EStNetException, GetLastError);
5972 end else begin
5973 { EStNetException }
5974 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
5975 end;
5976 end;
5977
5978 function StNetServerTransportEnum(ServerName: string; Level: DWord;
5979 var Buffer: Pointer; PrefMaxLen: DWord;
5980 var EntriesRead, TotalEntries,
5981 ResumeHandle: DWord): NET_API_STATUS;
5982 var
5983 S : TLMWideChar;
5984 begin
5985 Result := 0;
5986 if IsNetApi32 then begin
5987 if (@_NetServerTransportEnum = nil) then
5988 @_NetServerTransportEnum := GetProcAddress(NETAPI32, 'NetServerTransportEnum');
5989
5990 if (@_NetServerTransportEnum <> nil) then begin
5991 S.Value := nil;
5992 try
5993 { allocate the unicode server name }
5994 CvtToWideChar(ServerName, S);
5995
5996 { call the API }
5997 Result := _NetServerTransportEnum(S.Value, Level, Buffer, PrefMaxLen,
5998 EntriesRead, TotalEntries, ResumeHandle);
5999 finally
6000 FreeMem(S.Value, S.Length);
6001 end;
6002 end else
6003 RaiseStWin32Error(EStNetException, GetLastError);
6004 end else begin
6005 { EStNetException }
6006 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6007 end;
6008 end;
6009
6010
6011 {LMUSE}
6012 function StNetUseAdd(UncServerName: string; Level: DWord; Buffer: Pointer;
6013 var ParmErr: DWord): NET_API_STATUS;
6014 var
6015 U : TLMWideChar;
6016 begin
6017 Result := 0;
6018 if IsNetApi32 then begin
6019 if (@_NetUseAdd = nil) then
6020 @_NetUseAdd := GetProcAddress(NETAPI32, 'NetUseAdd');
6021
6022 if (@_NetUseAdd <> nil) then begin
6023 U.Value := nil;
6024 try
6025 { allocate the unicode server name }
6026 CvtToWideChar(UncServerName, U);
6027
6028 { call the API }
6029 Result := _NetUseAdd(U.Value, Level, Buffer, ParmErr);
6030 finally
6031 FreeMem(U.Value, U.Length);
6032 end;
6033 end else
6034 RaiseStWin32Error(EStNetException, GetLastError);
6035 end else begin
6036 { EStNetException }
6037 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6038 end;
6039 end;
6040
6041 function StNetUseDel(UncServerName, UseName: string; ForceCond: DWord): NET_API_STATUS;
6042 var
6043 U, N : TLMWideChar;
6044 begin
6045 Result := 0;
6046 if IsNetApi32 then begin
6047 if (@_NetUseDel = nil) then
6048 @_NetUseDel := GetProcAddress(NETAPI32, 'NetUseDel');
6049
6050 if (@_NetUseDel <> nil) then begin
6051 U.Value := nil;
6052 N.Value := nil;
6053 try
6054 { allocate the unicode server name }
6055 CvtToWideChar(UncServerName, U);
6056
6057 { allocate the unicode use name }
6058 CvtToWideChar(UseName, N);
6059
6060 { call the API }
6061 Result := _NetUseDel(U.Value, N.Value, ForceCond);
6062 finally
6063 FreeMem(U.Value, U.Length);
6064 FreeMem(N.Value, N.Length);
6065 end;
6066 end else
6067 RaiseStWin32Error(EStNetException, GetLastError);
6068 end else begin
6069 { EStNetException }
6070 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6071 end;
6072 end;
6073
6074 function StNetUseEnum(UncServerName: string; Level : DWord; var Buffer: Pointer;
6075 PrefMaxSize : DWord; var EntriesRead, TotalEntries,
6076 ResumeHandle: DWord): NET_API_STATUS;
6077 var
6078 U : TLMWideChar;
6079 begin
6080 Result := 0;
6081 if IsNetApi32 then begin
6082 if (@_NetUseEnum = nil) then
6083 @_NetUseEnum := GetProcAddress(NETAPI32, 'NetUseEnum');
6084
6085 if (@_NetUseEnum <> nil) then begin
6086 U.Value := nil;
6087 try
6088 { allocate the unicode server name }
6089 CvtToWideChar(UncServerName, U);
6090
6091 { call the API }
6092 Result := _NetUseEnum(U.Value, Level, Buffer, PrefMaxSize, EntriesRead,
6093 TotalEntries, ResumeHandle);
6094 finally
6095 FreeMem(U.Value, U.Length);
6096 end;
6097 end else
6098 RaiseStWin32Error(EStNetException, GetLastError);
6099 end else begin
6100 { EStNetException }
6101 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6102 end;
6103 end;
6104
6105 function StNetUseGetInfo(UncServerName, UseName: string; Level: DWord;
6106 var Buffer: Pointer): NET_API_STATUS;
6107 var
6108 U, N : TLMWideChar;
6109 begin
6110 Result := 0;
6111 if IsNetApi32 then begin
6112 if (@_NetUseGetInfo = nil) then
6113 @_NetUseGetInfo := GetProcAddress(NETAPI32, 'NetUseGetInfo');
6114
6115 if (@_NetUseGetInfo <> nil) then begin
6116 U.Value := nil;
6117 N.Value := nil;
6118 try
6119 { allocate the unicode server name }
6120 CvtToWideChar(UncServerName, U);
6121
6122 { allocate the unicode use name }
6123 CvtToWideChar(UseName, N);
6124
6125 { call the API }
6126 Result := _NetUseGetInfo(U.Value, N.Value, Level, Buffer);
6127 finally
6128 FreeMem(U.Value, U.Length);
6129 FreeMem(N.Value, N.Length);
6130 end;
6131 end else
6132 RaiseStWin32Error(EStNetException, GetLastError);
6133 end else begin
6134 { EStNetException }
6135 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6136 end;
6137 end;
6138
6139
6140 {LMWKSTA}
6141 function StNetWkstaGetInfo(ServerName: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
6142 var
6143 S : TLMWideChar;
6144 begin
6145 Result := 0;
6146 if IsNetApi32 then begin
6147 if (@_NetWkstaGetInfo = nil) then
6148 @_NetWkstaGetInfo := GetProcAddress(NETAPI32, 'NetWkstaGetInfo');
6149
6150 if (@_NetWkstaGetInfo <> nil) then begin
6151 S.Value := nil;
6152 try
6153 { allocate the unicode server name }
6154 CvtToWideChar(ServerName, S);
6155
6156 { call the API }
6157 Result := _NetWkstaGetInfo(S.Value, Level, Buffer);
6158 finally
6159 FreeMem(S.Value, S.Length);
6160 end;
6161 end else
6162 RaiseStWin32Error(EStNetException, GetLastError);
6163 end else begin
6164 { EStNetException }
6165 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6166 end;
6167 end;
6168
6169 function StNetWkstaSetInfo(ServerName: string; Level: DWord; Buffer: Pointer;
6170 var ParmErr: DWord): NET_API_STATUS;
6171 var
6172 S : TLMWideChar;
6173 begin
6174 Result := 0;
6175 if IsNetApi32 then begin
6176 if (@_NetWkstaSetInfo = nil) then
6177 @_NetWkstaSetInfo := GetProcAddress(NETAPI32, 'NetWkstaSetInfo');
6178
6179 if (@_NetWkstaSetInfo <> nil) then begin
6180 S.Value := nil;
6181 try
6182 { allocate the unicode server name }
6183 CvtToWideChar(ServerName, S);
6184
6185 { call the API }
6186 Result := _NetWkstaSetInfo(S.Value, Level, Buffer, ParmErr);
6187 finally
6188 FreeMem(S.Value, S.Length);
6189 end;
6190 end else
6191 RaiseStWin32Error(EStNetException, GetLastError);
6192 end else begin
6193 { EStNetException }
6194 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6195 end;
6196 end;
6197
6198 function StNetWkstaUserGetInfo(Reserved: string; Level: DWord; var Buffer: Pointer): NET_API_STATUS;
6199 begin
6200 Result := 0;
6201 if IsNetApi32 then begin
6202 if (@_NetWkstaUserGetInfo = nil) then
6203 @_NetWkstaUserGetInfo := GetProcAddress(NETAPI32, 'NetWkstaUserGetInfo');
6204
6205 if (@_NetWkstaUserGetInfo <> nil) then
6206 Result := _NetWkstaUserGetInfo(nil, Level, Buffer)
6207 else
6208 RaiseStWin32Error(EStNetException, GetLastError);
6209 end else begin
6210 { EStNetException }
6211 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6212 end;
6213 end;
6214
6215 function StNetWkstaUserSetInfo(Reserved: string; Level: DWord; Buffer: Pointer;
6216 var ParmErr: DWord): NET_API_STATUS;
6217 begin
6218 Result := 0;
6219 if IsNetApi32 then begin
6220 if (@_NetWkstaUserSetInfo = nil) then
6221 @_NetWkstaUserSetInfo := GetProcAddress(NETAPI32, 'NetWkstaUserSetInfo');
6222
6223 if (@_NetWkstaUserSetInfo <> nil) then
6224 Result := _NetWkstaUserSetInfo(nil, Level, Buffer, ParmErr)
6225 else
6226 RaiseStWin32Error(EStNetException, GetLastError);
6227 end else begin
6228 { EStNetException }
6229 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6230 end;
6231 end;
6232
6233 function StNetWkstaUserEnum(ServerName: string; Level: DWord; var Buffer: Pointer;
6234 PrefMaxLen: DWord; var EntriesRead, TotalEntries,
6235 ResumeHandle: DWord): NET_API_STATUS;
6236 var
6237 S : TLMWideChar;
6238 begin
6239 Result := 0;
6240 if IsNetApi32 then begin
6241 if (@_NetWkstaUserEnum = nil) then
6242 @_NetWkstaUserEnum := GetProcAddress(NETAPI32, 'NetWkstaUserEnum');
6243
6244 if (@_NetWkstaUserEnum <> nil) then begin
6245 S.Value := nil;
6246 try
6247 { allocate the unicode server name }
6248 CvtToWideChar(ServerName, S);
6249
6250 { call the API }
6251 Result := _NetWkstaUserEnum(S.Value, Level, Buffer, PrefMaxLen,
6252 EntriesRead, TotalEntries, ResumeHandle);
6253 finally
6254 FreeMem(S.value, S.Length);
6255 end;
6256 end else
6257 RaiseStWin32Error(EStNetException, GetLastError);
6258 end else begin
6259 { EStNetException }
6260 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6261 end;
6262 end;
6263
6264 function StNetWkstaTransportAdd(ServerName: string; Level: DWord; Buffer: Pointer;
6265 var ParmErr: DWord): NET_API_STATUS;
6266 var
6267 S : TLMWideChar;
6268 begin
6269 Result := 0;
6270 if IsNetApi32 then begin
6271 if (@_NetWkstaTransportAdd = nil) then
6272 @_NetWkstaTransportAdd := GetProcAddress(NETAPI32, 'NetWkstaTransportAdd');
6273
6274 if (@_NetWkstaTransportAdd <> nil) then begin
6275 S.Value := nil;
6276 try
6277 { allocate the unicode server name }
6278 CvtToWideChar(ServerName, S);
6279
6280 { call the API }
6281 Result := _NetWkstaTransportAdd(S.Value, Level, Buffer, ParmErr);
6282 finally
6283 FreeMem(S.Value, S.Length);
6284 end;
6285 end else
6286 RaiseStWin32Error(EStNetException, GetLastError);
6287 end else begin
6288 { EStNetException }
6289 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6290 end;
6291 end;
6292
6293 function StNetWkstaTransportDel(ServerName, TransportName: string; Ucond: DWord): NET_API_STATUS;
6294 var
6295 S, T : TLMWideChar;
6296 begin
6297 Result := 0;
6298 if IsNetApi32 then begin
6299 if (@_NetWkstaTransportDel = nil) then
6300 @_NetWkstaTransportDel := GetProcAddress(NETAPI32, 'NetWkstaTransportDel');
6301
6302 if (@_NetWkstaTransportDel <> nil) then begin
6303 S.Value := nil;
6304 T.Value := nil;
6305 try
6306 { allocate the unicode server name }
6307 CvtToWideChar(ServerName, S);
6308
6309 { allocate the unicode transport name }
6310 CvtToWideChar(TransportName, T);
6311
6312 { call the API }
6313 Result := _NetWkstaTransportDel(S.Value, T.Value, Ucond);
6314 finally
6315 FreeMem(S.Value, S.Length);
6316 FreeMem(T.Value, T.Length);
6317 end;
6318 end else
6319 RaiseStWin32Error(EStNetException, GetLastError);
6320 end else begin
6321 { EStNetException }
6322 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6323 end;
6324 end;
6325
6326 function StNetWkstaTransportEnum(ServerName: string; Level: DWord;
6327 var Buffer: Pointer; PrefMaxLen: DWord;
6328 var EntriesRead, TotalEntries,
6329 ResumeHandle: DWord): NET_API_STATUS;
6330 var
6331 S : TLMWideChar;
6332 begin
6333 Result := 0;
6334 if IsNetApi32 then begin
6335 if (@_NetWkstaTransportEnum = nil) then
6336 @_NetWkstaTransportEnum := GetProcAddress(NETAPI32, 'NetWkstaTransportEnum');
6337
6338 if (@_NetWkstaTransportEnum <> nil) then begin
6339 S.Value := nil;
6340 try
6341 { allocate the unicode server name }
6342 CvtToWideChar(ServerName, S);
6343
6344 { call the API }
6345 Result := _NetWkstaTransportEnum(S.Value, Level, Buffer, PrefMaxLen,
6346 EntriesRead, TotalEntries, ResumeHandle);
6347 finally
6348 FreeMem(S.Value, S.Length);
6349 end;
6350 end else
6351 RaiseStWin32Error(EStNetException, GetLastError);
6352 end else begin
6353 { EStNetException }
6354 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6355 end;
6356 end;
6357
6358 {LMAPIBUF}
6359 function StNetApiBufferAllocate(ByteCount: Cardinal; var Buffer: Pointer): NET_API_STATUS;
6360 begin
6361 Result := 0;
6362 if IsNetApi32 then begin
6363 if (@_NetApiBufferAllocate = nil) then
6364 @_NetApiBufferAllocate := GetProcAddress(NETAPI32, 'NetApiBufferAllocate');
6365
6366 if (@_NetApiBufferAllocate <> nil) then
6367 Result := _NetApiBufferAllocate(ByteCount, Buffer)
6368 else
6369 RaiseStWin32Error(EStNetException, GetLastError);
6370 end else begin
6371 { EStNetException }
6372 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6373 end;
6374 end;
6375
6376 function StNetApiBufferFree(Buffer: Pointer): NET_API_STATUS;
6377 begin
6378 Result := 0;
6379 if IsNetApi32 then begin
6380 if (@_NetApiBufferFree = nil) then
6381 @_NetApiBufferFree := GetProcAddress(NETAPI32, 'NetApiBufferFree');
6382
6383 if (@_NetApiBufferFree <> nil) then
6384 Result := _NetApiBufferFree(Buffer)
6385 else
6386 RaiseStWin32Error(EStNetException, GetLastError);
6387 end else begin
6388 { EStNetException }
6389 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6390 end;
6391 end;
6392
6393 function StNetApiBufferReallocate(OldBuffer: Pointer; NewByteCount : Cardinal;
6394 var NewBuffer: Pointer): NET_API_STATUS;
6395 begin
6396 Result := 0;
6397 if IsNetApi32 then begin
6398 if (@_NetApiBufferReallocate = nil) then
6399 @_NetApiBufferReallocate := GetProcAddress(NETAPI32, 'NetApiBufferReallocate');
6400
6401 if (@_NetApiBufferReallocate <> nil) then
6402 Result := _NetApiBufferReallocate(OldBuffer, NewByteCount, NewBuffer)
6403 else
6404 RaiseStWin32Error(EStNetException, GetLastError);
6405 end else begin
6406 { EStNetException }
6407 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6408 end;
6409 end;
6410
6411 function StNetApiBufferSize(Buffer: Pointer; var ByteCount: DWord): NET_API_STATUS;
6412 begin
6413 Result := 0;
6414 if IsNetApi32 then begin
6415 if (@_NetApiBufferSize = nil) then
6416 @_NetApiBufferSize := GetProcAddress(NETAPI32, 'NetApiBufferSize');
6417
6418 if (@_NetApiBufferSize <> nil) then
6419 Result := _NetApiBufferSize(Buffer, ByteCount)
6420 else
6421 RaiseStWin32Error(EStNetException, GetLastError);
6422 end else begin
6423 { EStNetException }
6424 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6425 end;
6426 end;
6427
6428 {LMSTATS}
6429 function StNetStatisticsGet(ServerName, ServiceName: string; Level, Options: DWord;
6430 var Buffer: Pointer): NET_API_STATUS;
6431 var
6432 S, S1 : TLMWideChar;
6433 begin
6434 Result := 0;
6435 if IsNetApi32 then begin
6436 if (@_NetStatisticsGet = nil) then
6437 @_NetStatisticsGet := GetProcAddress(NETAPI32, 'NetStatisticsGet');
6438
6439 if (@_NetStatisticsGet <> nil) then begin
6440 S.Value := nil;
6441 S1.Value := nil;
6442 try
6443 { allocate the unicode server name }
6444 CvtToWideChar(ServerName, S);
6445
6446 { allocate the unicode service name }
6447 CvtToWideChar(ServiceName, S1);
6448
6449 { call the API }
6450 Result := _NetStatisticsGet(S.Value, S1.Value, Level, Options, Buffer);
6451 finally
6452 FreeMem(S.Value, S.Length);
6453 FreeMem(S1.Value, S1.Length);
6454 end;
6455 end else
6456 RaiseStWin32Error(EStNetException, GetLastError);
6457 end else begin
6458 { EStNetException }
6459 RaiseStWin32ErrorEx(EStNetException, GetLastError, NETAPI32DLL);
6460 end;
6461 end;
6462
6463 {WINBASE}
6464 function StGetSidIdentifierAuthority(Sid: PSID): PSIDIdentifierAuthority;
6465 begin
6466 Result := nil;
6467 if IsAdvApi32 then begin
6468 if (@_GetSidIdentifierAuthority = nil) then
6469 @_GetSidIdentifierAuthority := GetProcAddress(ADVAPI32, 'GetSidIdentifierAuthority');
6470
6471 if (@_GetSidIdentifierAuthority <> nil) then begin
6472 try
6473 Result := _GetSidIdentifierAuthority(Sid);
6474 finally
6475 end;
6476 end else
6477 RaiseStWin32Error(EStNetException, GetLastError);
6478 end else begin
6479 RaiseStWin32ErrorEx(EStNetException, GetLastError, ADVAPI32DLL);
6480 end;
6481 end;
6482
6483 function StGetSidSubAuthority(Sid: PSID; SubAuthority: DWord): DWord;
6484 begin
6485 Result := 0;
6486 if IsAdvApi32 then begin
6487 if (@_GetSidSubAuthority = nil) then
6488 @_GetSidSubAuthority := GetProcAddress(ADVAPI32, 'GetSidSubAuthority');
6489
6490 if (@_GetSidSubAuthority <> nil) then begin
6491
6492 try
6493 Result := _GetSidSubAuthority(Sid, SubAuthority)^;
6494 finally
6495 end;
6496 end else
6497 RaiseStWin32Error(EStNetException, GetLastError);
6498 end else begin
6499 { EStNetException }
6500 RaiseStWin32ErrorEx(EStNetException, GetLastError, ADVAPI32DLL);
6501 end;
6502 end;
6503
6504 function StGetSidSubAuthorityCount(SID: PSID): Byte;
6505 begin
6506 Result := 0;
6507 if IsAdvApi32 then begin
6508 if (@_GetSidSubAuthorityCount = nil) then
6509 @_GetSidSubAuthorityCount := GetProcAddress(ADVAPI32, 'GetSidSubAuthorityCount');
6510
6511 if (@_GetSidSubAuthorityCount <> nil) then begin
6512
6513 try
6514 Result := _GetSidSubAuthorityCount(Sid)^;
6515 finally
6516 end;
6517 end else
6518 RaiseStWin32Error(EStNetException, GetLastError);
6519 end else begin
6520 { EStNetException }
6521 RaiseStWin32ErrorEx(EStNetException, GetLastError, ADVAPI32DLL);
6522 end;
6523 end;
6524
6525 function StLookupAccountName(SystemName, AccountName: string; var Sid: Pointer;
6526 var SidLength: DWord; var DomainName: string;
6527 var peUse: DWord): Boolean;
6528 var
6529 BufLen : DWord;
6530 Buffer : Pointer;
6531 ErrorD : DWord;
6532 begin
6533 Result := False;
6534 if IsAdvApi32 then begin
6535 if (@_LookupAccountName = nil) then
6536 {$IFDEF UNICODE}
6537 @_LookupAccountName := GetProcAddress(ADVAPI32, 'LookupAccountNameW');
6538 {$ELSE}
6539 @_LookupAccountName := GetProcAddress(ADVAPI32, 'LookupAccountNameA');
6540 {$ENDIF}
6541
6542 if (@_LookupAccountName <> nil) then begin
6543 { This just sets up the buffer sizes }
6544 BufLen := 0;
6545 Buffer := nil;
6546 Result := _LookupAccountName(PChar(SystemName), PChar(AccountName),
6547 nil, SidLength, nil, BufLen, peUse);
6548 ErrorD := GetLastError;
6549
6550 { now for the real call }
6551 if ErrorD = ERROR_INSUFFICIENT_BUFFER then begin
6552 StNetApiBufferAllocate(BufLen, Buffer);
6553 StNetApiBufferAllocate(SidLength, Sid);
6554 try
6555 try
6556 Result := _LookupAccountName(PChar(SystemName),
6557 PChar(AccountName), Sid, SidLength,
6558 Buffer, BufLen, peUse);
6559 if Result then
6560 DomainName := StrPas(PChar(Buffer))
6561 else
6562 StNetApiBufferFree(Sid);
6563 finally
6564 StNetApiBufferFree(Buffer);
6565 end;
6566 except
6567 StNetApiBufferFree(Sid);
6568 raise;
6569 end;
6570 end else begin
6571 SetLastError(ErrorD);
6572 end;
6573 end else
6574 RaiseStWin32Error(EStNetException, GetLastError);
6575 end else begin
6576 { EStNetException }
6577 RaiseStWin32ErrorEx(EStNetException, GetLastError, ADVAPI32DLL);
6578 end;
6579 end;
6580
6581 function StLookupAccountSid(SystemName: string; Sid: PSid; var AccountName,
6582 DomainName: string; var peUse: DWord): Boolean;
6583 var
6584 A, D : Pointer;
6585 ALen, DLen : DWord;
6586 ErrorD : DWord;
6587 begin
6588 Result := False;
6589 if IsAdvApi32 then begin
6590 if (@_LookupAccountSid = nil) then
6591 {$IFDEF UNICODE}
6592 @_LookupAccountSid := GetProcAddress(ADVAPI32, 'LookupAccountSidW');
6593 {$ELSE}
6594 @_LookupAccountSid := GetProcAddress(ADVAPI32, 'LookupAccountSidA');
6595 {$ENDIF}
6596
6597 if (@_LookupAccountSid <> nil) then begin
6598 { This just sets up the buffer sizes }
6599 ALen := 0;
6600 DLen := 0;
6601
6602 A := nil;
6603 D := nil;
6604 Result := _LookupAccountName(PChar(SystemName), Sid, nil, ALen, nil,
6605 DLen, peUse);
6606 ErrorD := GetLastError;
6607 if ErrorD = ERROR_INSUFFICIENT_BUFFER then begin
6608 StNetApiBufferAllocate(ALen, A);
6609 StNetApiBufferAllocate(DLen, D);
6610 try
6611 Result := _LookupAccountName(PChar(SystemName), Sid, A, ALen, D,
6612 DLen, peUse);
6613 if Result then begin
6614 AccountName := StrPas(PChar(A));
6615 DomainName := StrPas(PChar(D));
6616 end;
6617 finally
6618 StNetApiBufferFree(A);
6619 StNetApiBufferFree(D);
6620 end;
6621 end else begin
6622 SetLastError(ErrorD);
6623 end;
6624 end else
6625 RaiseStWin32Error(EStNetException, GetLastError);
6626 end else begin
6627 { EStNetException }
6628 RaiseStWin32ErrorEx(EStNetException, GetLastError, ADVAPI32DLL);
6629 end;
6630 end;
6631
6632 initialization
6633
6634 finalization
6635 if (NETAPI32 <> 0) then
6636 FreeLibrary(NETAPI32);
6637
6638 if (ADVAPI32 <> 0) then
6639 FreeLibrary(ADVAPI32);
6640
6641 end.

  ViewVC Help
Powered by ViewVC 1.1.20