home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / WIN_NT / LMAPI.ZIP / DOC / NTLMAPI.TXT < prev    next >
Encoding:
Text File  |  1992-12-18  |  228.2 KB  |  4,195 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. Windows NT
  14. Windows Networking APIs
  15. Revision 1.0, August 14 1992
  16.  
  17. Do not remove any of the division marks (:::) in this template.  They control the basic layout of the document, including the way page numbers are printed.
  18.  
  19. {TOC \o|1.    Overview    3
  20. 2.    API buffers    3
  21. 2.1.    API Data Alignment    4
  22. 2.2.    Enumeration Buffer Lengths    4
  23. 2.3.    Parameter Error Reporting    4
  24. 2.4.    Parmnum For SetInfo    4
  25. 2.5.    Parmnum For GetInfo    4
  26. 2.6.    Embedded Strings    5
  27. 2.7.    Enumeration Resume Handles    5
  28. 2.8.    User-specific information    5
  29. 2.9.    Enumeration APIs    5
  30. 2.10.    SetInfo APIs    6
  31. 3.    Windows Networking APIs    6
  32. 3.1.    API Status    6
  33. 3.2.    RPC Buffer Allocation Errors    6
  34. 3.3.    Obsolete Information Fields    6
  35. 3.4.    NLS Support    7
  36. 4.    Windows Networking API Definitions.    7
  37. 4.1.    Buffer Manipulation APIs.    7
  38. 4.1.1.    NetApiBufferAllocate    7
  39. 4.1.2.    NetApiBufferFree    7
  40. 4.1.3.    NetApiBufferReallocate    8
  41. 4.1.4.    NetApiBufferSize    8
  42. 4.2.    Service APIs.    8
  43. 4.2.1.    NetServiceControl    9
  44. 4.2.2.    NetServiceEnum    10
  45. 4.2.3.    NetServiceGetInfo    11
  46. 4.2.4.    NetServiceInstall    12
  47. 4.3.    Server APIs    13
  48. 4.3.1.    NetServerEnum    20
  49. 4.3.2.    NetServerGetInfo    21
  50. 4.3.3.    NetServerSetInfo    22
  51. 4.3.4.    NetServerDiskEnum    23
  52. 4.4.    Workstation and WorkstationUser APIs    24
  53. 4.4.1.    NetWkstaGetInfo    32
  54. 4.4.2.    NetWkstaSetInfo    32
  55. 4.4.3.    NetWkstaUserGetInfo    33
  56. 4.4.4.    NetWkstaUserSetInfo    34
  57. 4.4.5.    NetWkstaUserEnum    34
  58. 4.5.    Use APIs    35
  59. 4.5.1.    NetUseAdd    37
  60. 4.5.2.    NetUseDel    37
  61. 4.5.3.    NetUseEnum    38
  62. 4.5.4.    NetUseGetInfo    39
  63. 4.6.    Share APIs    39
  64. 4.6.1.    NetShareAdd    41
  65. 4.6.2.    NetShareEnum    42
  66. 4.6.3.    NetShareGetInfo    43
  67. 4.6.4.    NetShareSetInfo    43
  68. 4.6.5.    NetShareDel    44
  69. 4.6.6.    NetShareCheck    45
  70. 4.7.    Session    45
  71. 4.7.1.    NetSessionEnum    46
  72. 4.7.2.    NetSessionGetInfo    48
  73. 4.7.3.    NetSessionDel    48
  74. 4.8.    Connection APIs    49
  75. 4.8.1.    NetConnectionEnum    50
  76. 4.9.    File APIs    51
  77. 4.9.1.    NetFileEnum    52
  78. 4.9.2.    NetFileGetInfo    53
  79. 4.9.3.    NetFileClose    54
  80. 4.10.    Message APIs    54
  81. 4.10.1.    NetMessageNameAdd    55
  82. 4.10.2.    NetMessageNameEnum    55
  83. 4.10.3.    NetMessageNameGetInfo    56
  84. 4.10.4.    NetMessageNameDel    57
  85. 4.10.5.    NetMessageBufferSend    57
  86. 4.11.    Remote Utility API    58
  87. 4.11.1.    NetRemoteTOD API    58
  88. 4.12.    Security Account APIs    59
  89. 4.12.1.    User APIs    59
  90. 4.12.1.1.    NetUserAdd    65
  91. 4.12.1.2.    NetUserEnum    66
  92. 4.12.1.3.    NetUserGetInfo    67
  93. 4.12.1.4.    NetUserSetInfo    68
  94. 4.12.1.5.    NetUserDel    68
  95. 4.12.1.6.    NetUserGetGroups    69
  96. 4.12.1.7.    NetUserGetLocalGroups    70
  97. 4.12.1.8.    NetUserSetGroups    71
  98. 4.12.2.    User Modal APIS    72
  99. 4.12.2.1.    NetUserModalsGet    73
  100. 4.12.2.2.    NetUserModalsSet    74
  101. 4.12.3.    Global Group APIs    74
  102. 4.12.3.1.    NetGroupAdd    76
  103. 4.12.3.2.    NetGroupAddUser    77
  104. 4.12.3.3.    NetGroupEnum    77
  105. 4.12.3.4.    NetGroupGetInfo    78
  106. 4.12.3.5.    NetGroupSetInfo    79
  107. 4.12.3.6.    NetGroupDel    80
  108. 4.12.3.7.    NetGroupDelUser    80
  109. 4.12.3.8.    NetGroupGetUsers    81
  110. 4.12.3.9.    NetGroupSetUsers    82
  111. 4.12.4.    Local Group APIs    83
  112. 4.12.4.1.    NetLocalGroupAdd    84
  113. 4.12.4.2.    NetLocalGroupAddMember    85
  114. 4.12.4.3.    NetLocalGroupEnum    86
  115. 4.12.4.4.    NetLocalGroupGetInfo    87
  116. 4.12.4.5.    NetLocalGroupSetInfo    87
  117. 4.12.4.6.    NetLocalGroupDel    88
  118. 4.12.4.7.    NetLocalGroupDelMember    89
  119. 4.12.4.8.    NetLocalGroupGetMembers    89
  120. 4.12.4.9.    NetLocalGroupSetMembers    90
  121. 4.12.5.    Access APIs    91
  122. 4.12.5.1.    NetAccessAdd    93
  123. 4.12.5.2.    NetAccessEnum    94
  124. 4.12.5.3.    NetAccessGetInfo    95
  125. 4.12.5.4.    NetAccessSetInfo    96
  126. 4.12.5.5.    NetAccessDel    97
  127. 4.12.5.6.    NetAccessGetUserPerms    97
  128. 4.12.5.7.    NetAccessCheck    98
  129. 4.13.    Domain APIs    99
  130. 4.13.1.    NetGetDCName    99
  131. 4.14.    Transport APIs    100
  132. 4.14.1.    NetServerTransportAdd    101
  133. 4.14.2.    NetServerTransportDel    101
  134. 4.14.3.    NetServerTransportEnum    102
  135. 4.14.4.    NetWkstaTransportAdd    103
  136. 4.14.5.    NetWkstaTransportDel    103
  137. 4.14.6.    NetWkstaTransportEnum    104
  138. 4.15.    Alert APIs    105
  139. 4.15.1.    NetAlertRaise    106
  140. 4.15.2.    NetAlertRaiseEx    107
  141. 4.16.    Error Logging APIs    107
  142. 4.16.1.    NetErrorLogClear    109
  143. 4.16.2.    NetErrorLogRead    109
  144. 4.17.    Configuration APIs    111
  145. 4.17.1.    NetConfigGet    111
  146. 4.17.2.    NetConfigGetAll    112
  147. 4.17.3.    NetConfigSet    112
  148. 4.18.    Statistics APIs    113
  149. 4.18.1.    NetStatisticsGet    116
  150. 4.19.    Auditing APIs    117
  151. Variable-Length Data    119
  152. 4.19.1.    NetAuditClear    123
  153. 4.19.2.    NetAuditRead    124
  154. 4.19.3.    NetAuditWrite    126
  155. 4.20.    Replicator APIs    127
  156. 4.20.1.    Replicator Configuration APIs    127
  157. 4.20.1.1.    NetReplGetInfo    129
  158. 4.20.2.    NetReplSetInfo    130
  159. 4.20.3.    Replicator Export Directory APIs    130
  160. 4.20.3.1.    NetReplExportDirAdd    132
  161. 4.20.4.    NetReplExportDirDel    132
  162. 4.20.5.    NetReplExportDirEnum    133
  163. 4.20.6.    NetReplExportDirGetInfo    134
  164. 4.20.7.    NetReplExportDirSetInfo    135
  165. 4.20.7.1.    NetReplExportDirLock    135
  166. 4.20.7.2.    NetReplExportDirUnlock    136
  167. 4.20.8.    Replicator Import Directory APIs    137
  168. 4.20.8.1.    NetReplImportDirAdd    138
  169. 4.20.9.    NetReplImportDirDel    139
  170. 4.20.10.    NetReplImportDirEnum    139
  171. 4.20.11.    NetReplImportDirGetInfo    140
  172. 4.20.11.1.    NetReplImportDirLock    141
  173. 4.20.11.2.    NetReplImportDirUnlock    142
  174. 5.    Lanman APIs That Are Not Supported In Windows NT    142
  175. 5.1.    APIs with no 32 bit Net equivalents    143
  176. 5.2.    APIs that only have support for remoting to downlevel    143
  177. 6.    Interoperabilty Considerations    143
  178. 6.1.    Requests From 16-bit LANMan Clients    143
  179. 6.2.    Calling 16-bit LANMan Servers    144
  180. 7.    Change History    146
  181. }.End Table C.
  182.  
  183. 1.    Overview
  184. For OS/2 based servers the LANMan APIs provided much of the functionality required for a network operating system which was missing from the local operating system. The Windows NT operating system will provide this missing set of functionality in the base. However, in order to make the migration of existing 16-bit applications as easy as possible, it is necessary to still define 32-bit equivalents of some of the LANMan APIs.  
  185. The Windows Networking APIs specified in this document are a private set of APIs designed to provide some of the API functionality that was available in LANManager 2.x.  They are not the public Windows NT networking APIs.  Windows NT takes some of the functionality that was previously supplied by the networking software, and moves this into the base APIs (e.g. error and audit logging, printing).  Windows NT also provides a network independent set of network APIs (the WNet APIs) that allow network api's to work across different network vendors' products.  If a base API or WNet API exists that could be used by your application, you should convert from the Windows networking API to the public Windows NT equivalent.  There are at least three reasons to make the change now:
  186. 1.1. The WNet APIs are network independent, while the Windows networking  APIs only work on LANManager networks.
  187. 1.2. The Windows networking APIs specified in this document may not be supported in future releases on Windows NT.  They are provided as a interim set of APIs to assist in the porting of LANManager applications.
  188. 1.3. The Windows Networking APIs, as they are not part of the public Win32 API set, have not received the rigorous testing that the Win32 APIs have.  They have been tested only by their usage internally.
  189. In this specification, equivalent Win32 APIs will be listed that could be used in place of the Windows networking API.  If at all possible, this is the API that your application should use.
  190. This spec assumes that the reader is familiar with the existing set of 16-bit LANMan APIs. The 32-bit widening of the API data structures is specified here but the description of the functionality for each field is not covered unless the functionality has changed from that specified in the LANMAN 2.x Programmer's Reference.
  191. 2.    API buffers
  192. The RPC runtimes will allocate the buffers required to remote the APIs. This is a requirement for both efficiency and interoperability. Using the RPC runtimes to allocate the API transmission buffers results in the two significant differences between a LANMan 2.x API and windows networking API.
  193.     o    For a set type API (data to the server) the API caller specifies a buffer containing the info structure relevant to the API level but does not specify the buffer length. 
  194.     o    For a get type API (data returned from the server) the caller does not pre-allocate a buffer for the return information.  The caller passes a LPBYTE * to the API on input. On successful return the buffer pointer will contain a pointer to a buffer containing the return information. When the caller has finished processing the returned information NetApiBufferFree must be called. This simplifies the calling code as the caller does not need to guess at the size of the buffer required and will not need to resize and reissue the API as was the case with the LANMan 2.x APIs.
  195. 2.1.    API Data Alignment
  196. All data structures specified for the Windows networking APIs will be 32-bit word aligned. The base size for an API structure element will be a DWORD. 
  197. 2.2.    Enumeration Buffer Lengths
  198. Enumeration APIs will take an advisory maximum data length parameter, prefmaxlen, which allows a control on the number of bytes returned from an enumeration call. The prefered length is specified in units of 8-bit bytes.  The actual API may return more than the prefered maximum length.
  199. A Windows networking API  ennumeration call will not return partial entries.
  200. 2.3.    Parameter Error Reporting
  201. Add and SetInfo APIs will return an index for a parameter in error.  The caller may pass a NULL pointer for the parm_err parameter indicating that the field should not be set by the API. For remoted APIs to downlevel servers this field will be returned as PARM_ERROR_UNKNOWN by the RpcXlate conversion layer.
  202. 2.4.    Parmnum For SetInfo
  203. In order to reduce the number of RPC interfaces we need for each SetInfo API, there will be no Parmnum parameter for the 32-bit SetInfo APIs. Instead, the fields that can be set in the information structures will be set using additional infolevels. Although this will increase the number of infolevels for a given API, it will be easier to program to them. In an attempt to keep the mapping to and from downlevel calls simple, the new infolevels will be easily mapped to the old parmnum values (by subtracting a specific number i.e. PARMNUM_BASE_INFOLEVEL (whose value will be 1000)).
  204. 2.5.    Parmnum For GetInfo
  205. There will be no addition of a parmnum field for the GetInfo API. 
  206. 2.6.    Embedded Strings
  207. Windows networking API info structures will not contain embedded strings. This improves the alignability of the info structures and allows for OEM flexibility in the core APIs. This does not change the feel of the LANMan 2.x APIs which support string pointers. Code porting merely requires a pointer assignment rather than a string copy.
  208. Any API information field that is returned in an enumeration call that can be subsequently used as a key for a GetInfo call is guaranteed to be present in the enumeration buffer. If the variable length information string that would specify the key field value will not fit then the entire fixed length structure for the entry is not returned. Other variable-length fields will be returned as a NULL pointer for the case where the string will not fit as with LANMan 2.x.
  209. 2.7.    Enumeration Resume Handles
  210. Enumeration resume handles will be identifiers for the actual resume key contained in the instance data for the API. This is required for security, interoperabilty and to simplify the caller code for the API. 
  211. If a NULL is passed for the pointer to the resume handle, then no handle is stored and the ennumeration search cannot be continued. This is useful in cases where the application does not want to ennumerate all the items.
  212. If an error is returned from an enumeration call, the resume handle must be treated as invalid and not used for any subsequent enumeration calls, i.e. the enumeration should be restarted from the beginning.
  213. 2.8.    User-specific information
  214. The LANMan 2.x APIs assumed that there would only be one user per machine. Therefore, some APIs have that assumption built in, e.g. the NetSession APIs. Since this assumption is not valid on NT, the APIs have had to be modified to take a user name as an additional parameter in order to be able to uniquely identify the information being queried or set.
  215. 2.9.    Enumeration APIs
  216. The enumeration APIs all return the number of entries read, the total entries that could have been returned if the buffer was big enough, a buffer with the entries, and a return code. The following table details what an application can expect for the various parameters (M is less than N):
  217. Condition    entriesread    totalentries    buffer    returncode
  218. No entries        0        0    NULL    SUCCESS
  219. >= 1 entry        N        N    NOT NULL    SUCCESS
  220. >= 1 entry        M        N    NOT NULL ERROR_MORE_DATA
  221. Failure        ?        ?    ?    Error Code
  222. The caller must first examine the returned status before proceeding to examine any of the other parameters for data.
  223. Note that "totalentries" is the total number of entries that would have been returned if the return buffer was big enough - i.e. the total number of entries that were available for entries, using the current resume handle, if any, when the API was called.
  224. 2.10.    SetInfo APIs
  225. All the SetInfo APIs take a structure that contains the new information to be set. If any of the pointer fields in the structure are NULL pointers, then the corresponding field is not changed by the call. This is consistent with LANMan 2.x functionality.
  226. In addition, the infolevels that allow GUEST access to query information do not allow callers with GUEST access to set the fields, i.e. a caller with GUEST that calls the SetInfo API will probably get an error back from the SetInfo call. 
  227. 3.    Windows Networking APIs
  228. 3.1.    API Status
  229. Windows networking APIs will use the LANMan 2.x error reporting convention, i.e. a successful API call returns 0, a non-zero return code indicates an error in the range of the LANMan 2.x API/OS2 errors.
  230. An extended error range will be added for NT specific errors.
  231. Since the Windows networking APIs will use RPC the API error definition will also be extended to include RPC error codes.
  232. 3.2.    RPC Buffer Allocation Errors
  233. Since the RPC runtime will allocate memory for send and receive buffers the API should expect to see RPC allocation errors. In the event of an RPC allocation error a resumable API handle is invalidated. This is a requirement since resumable APIs are not rewindable.
  234. 3.3.    Obsolete Information Fields
  235. Many of the information fields in the core API information structures will be obsolescent in the NT service implementation. These fields will remain in the information structure for level compatibility and will be returned with an intelligent default on NT systems.
  236. 3.4.    NLS Support
  237. There are only UNICODE versions of the Windows networking APIs.  If you use these APIs you MUST define UNICODE in your source file prior to including any of the LM include files.
  238. 4.    Windows Networking API Definitions.
  239. The WIndows Networking APIs are 'stdcall' calling convention functions which return a DWORD API status;
  240. #define NET_API_STATUS DWORD
  241. #define NET_API_FUNCTION  __stdcall
  242. 4.1.    Buffer Manipulation APIs.
  243. For remotable APIs which return information to the caller the RPC runtime will allocate the buffer containg the return information. When the caller has completed processing the returned information NetApiBufferFree must be called.  Additional buffer manipulation functions are also supported.
  244. 4.1.1.    NetApiBufferAllocate
  245. NetApiBufferAllocate allocates ByteCount bytes of memory from the heap.
  246. NET_API_STATUS NET_API_FUNCTION
  247. NetApiBufferAllocate (
  248.     IN DWORD ByteCount, 
  249.     IN LPBYTE * buffer
  250.     );
  251.  
  252. Parameters:
  253.  
  254. ByteCount __The number of bytes to allocate.
  255. buffer __A pointer to the location to store the pointer to the allocated buffer.
  256. 4.1.2.    NetApiBufferFree
  257. NetApiBufferFree frees the memory allocated by NetApiBufferAllocate.
  258. NET_API_STATUS NET_API_FUNCTION
  259. NetApiBufferFree (IN LPVOID buffer
  260.     );
  261. Parameters:
  262.  
  263. buffer __A pointer to an API information buffer previously returned on an API call.
  264. 4.1.3.    NetApiBufferReallocate
  265. NetApiBufferReallocate changes the size of a buffer allocated with NetApiBufferAllocate.
  266. NET_API_STATUS NET_API_FUNCTION
  267. NetApiBufferReallocate (
  268.     IN LPVOID OldBuffer,
  269.     IN DWORD NewByteCount,
  270.     IN LPVOID buffer
  271.     );
  272. Parameters:
  273.  
  274. OldBuffer __A pointer to the buffer to reallocate.
  275. NewByteCount __The new size of the buffer.
  276. buffer __A pointer to an API information buffer previously returned on an API call.
  277. 4.1.4.    NetApiBufferSize
  278. NetApiBufferSize returns the size in bytes of the buffer allocated via NetApiBufferAllocate.
  279. NET_API_STATUS NET_API_FUNCTION
  280. NetApiBufferSize (
  281.     IN LPVOID buffer,
  282.     OUT DWORD ByteCount
  283.     );
  284. Parameters:
  285.  
  286. buffer __A pointer to an API information buffer previously returned on an API call.
  287. ByteCount __The size of the buffer.
  288. 4.2.    Service APIs.
  289. A complete set of Service APIs are provided in the Win32 API set.  These should be used in place of the NetService APIs, unless you have a requirement to control services on a downlevel server.  See the Services overview in WinHelp for more details.
  290. Service API functions control services. A service is an application that an administrator can control using the Service Controller interfaces. 
  291. Services allow administrators to control applications on the network and maintain the integrity of users' data. On a typical network, applications are shared by many users.  If an administrator terminates an application running on a server, a user who has not  finished working with that application can lose important data. When an application is implemented as a service, the service controller checks the status before changing the state of  the service. NT Networking provides several standard services, such as the Workstation, Server, and Messenger services.
  292. A service can be started using the Service API functions. At startup time, the service defines whether it can be stopped, paused, and continued. 
  293. NetServiceControl controls the operations of network services, and it can provide time hints to controlling applications. NetServiceEnum retrieves information about all started services. NetServiceGetInfo retrieves information about a particular started service. NetServiceInstall starts a network service. NetServiceStatus sets status and code information for a network service.   
  294. The service APIs provide service information at three levels:
  295. typedef struct _SERVICE_INFO_0 {
  296.     LPWSTR        svci0_name;         /* service name */
  297. } SERVICE_INFO_0, *PSERVICE_INFO_0, *LPSERVICE_INFO_0;
  298. typedef struct _SERVICE_INFO_1 {
  299.     LPWSTR        svci1_name;
  300.     DWORD        svci1_status;
  301.     DWORD        svci1_code;
  302.     DWORD        svci1_pid;
  303. } SERVICE_INFO_1, *PSERVICE_INFO_1, *LPSERVICE_INFO_1;
  304. typedef struct _SERVICE_INFO_2 {
  305.     LPWSTR        svci2_name;
  306.     DWORD        svci2_status;
  307.     DWORD        svci2_code;
  308.     DWORD        svci2_pid;
  309.     LPWSTR        svci2_text;
  310.     DWORD        svci2_specific_error;
  311. } SERVICE_INFO_2, *PSERVICE_INFO_2, *LPSERVICE_INFO_2;
  312. The service APIs are:
  313. 4.2.1.    NetServiceControl
  314. NetServiceControl controls the operations of network services.
  315. Privilege Level
  316. Admin privilege. Power User or Server Operator privilege is required to successfully execute NetServiceControl unless the opcode is SERVICE_CTRL_INTERROGATE.  In this case, no special privilege is required.
  317. NET_API_STATUS NET_API_FUNCTION
  318. NetServiceControl (
  319.     IN LPWSTR servername OPTIONAL,
  320.     IN LPWSTR service,
  321.     IN DWORD opcode,
  322.     IN DWORD arg,
  323.     OUT LPBYTE * bufptr
  324.     );
  325. Parameters:
  326.  
  327. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  328. service __A pointer to an UNICODE string containing the name of the service to receive the control command.
  329. opcode __Control code to send to service
  330. SERVICE_CTRL_INTERROGATE    Obtain the status of the service
  331. SERVICE_CTRL_PAUSE    Pause the service
  332. SERVICE_CTRL_CONTINUE    Continue the paused service
  333. SERVICE_CTRL_UNINSTALL    Stop the service
  334. arg __Service specific contol argument to send to service
  335. bufptr __A pointer to the return information structure is returned in the address pointed to by bufptr.
  336. 4.2.2.    NetServiceEnum 
  337. NetServiceEnum retrieves information about all started services, including paused services. 
  338. Privilege Level
  339. No special privilege level is required to successfully execute NetServiceEnum.
  340. NET_API_STATUS NET_API_FUNCTION
  341. NetServiceEnum (
  342.     IN LPWSTR servername OPTIONAL,
  343.     IN DWORD level,
  344.     OUT LPBYTE * bufptr,
  345.     IN DWORD prefmaxlen,
  346.     OUT LPDWORD entriesread,
  347.     OUT LPDWORD totalentries,
  348.     IN OUT LPDWORD resumehandle OPTIONAL
  349.     );
  350. Parameters:
  351.  
  352. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  353. level __Level of information required, 0, 1 and 2 are valid.
  354. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  355. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  356. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  357. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  358. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing service search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  359. 4.2.3.    NetServiceGetInfo  
  360. NetServiceGetInfo retrieves information about a particular started service. 
  361. Privilege Level
  362. No special privilege level is required to successfully execute NetServiceGetInfo.
  363. NET_API_STATUS NET_API_FUNCTION
  364. NetServiceGetInfo (
  365.     IN LPWSTR servername OPTIONAL,
  366.     IN LPWSTR service,
  367.     IN DWORD level,
  368.     OUT LPBYTE * bufptr,
  369.     );
  370. Parameters:
  371.  
  372. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  373. service __A pointer to an UNICODE string containing the name of the service.
  374. level __Level of information required. 0, 1 and 2 are valid.
  375. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  376. 4.2.4.    NetServiceInstall  
  377. NetServiceInstall starts a network service. 
  378. Privilege Level
  379. Admin privilege. Power User or Server Operator privilege is required to successfully execute NetServiceInstall.
  380. NET_API_STATUS NET_API_FUNCTION
  381. NetServiceInstall (
  382.     IN LPWSTR servername OPTIONAL,
  383.     IN LPWSTR service,
  384.     IN DWORD argc,
  385.     IN LPWSTR argv[],
  386.     OUT LPBYTE * bufptr
  387.     );
  388. Parameters:
  389.  
  390. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  391. service __A pointer to an UNICODE string containing the name of the service to start.
  392. bufptr __On return a pointer to a SERVICE_INFO_2 structure is returned in the address pointed to by bufptr.
  393. cmdargs __A pointer to a set of command line arguments to pass to the starting service as command line arguments.
  394. 4.3.    Server APIs
  395. Server API functions perform administrative tasks on a local or remote server. Any user or application with admin privilege on a local or remote server can perform administrative tasks on that server to control its operation, user access, and resource sharing. The low-level parameters that affect a server's operation can be examined and modified by calling NetServerGetInfo and NetServerSetInfo.
  396. The LANMan 2.x server API included several fields which logically belong to other LANMan services and core NT components. For this reason the server information levels available in LANMan 2.x are no longer available in Windows networking APIs. The server specific information is available in 3 levels starting at base level 100.
  397. The server APIs information structures are:
  398. System Information -
  399. Level 100 available with guest access -
  400. typedef struct _SERVER_INFO_100 {
  401.     DWORD            sv100_platform_id;
  402.     LPWSTR            sv100_name;
  403. } SERVER_INFO_100, *PSERVER_INFO_100, *LPSERVER_INFO_100;
  404. Level 101 available with User access -
  405. typedef struct _SERVER_INFO_101 {
  406.     DWORD            sv101_platform_id;
  407.     LPWSTR            sv101_name;
  408.     DWORD            sv101_version_major;
  409.     DWORD            sv101_version_minor;
  410.     DWORD            sv101_type;
  411.     LPWSTR            sv101_comment;
  412. } SERVER_INFO_101, *PSERVER_INFO_101, *LPSERVER_INFO_101;
  413. Level 102 available with Admin access -
  414. typedef struct SERVER_INFO_102 {
  415.     DWORD            sv102_platform_id;
  416.     LPWSTR            sv102_name; 
  417.     DWORD            sv102_version_major;
  418.     DWORD            sv102_version_minor;
  419.     DWORD            sv102_type;
  420.     LPWSTR            sv102_comment;
  421.     DWORD            sv102_users;
  422.     DWORD            sv102_disc;
  423.     BOOL                sv102_hidden;
  424.     DWORD            sv102_announce;
  425.     DWORD            sv102_anndelta;
  426.     LPWSTR            sv102_userpath;
  427. } SERVER_INFO_102, *PSERVER_INFO_102, *LPSERVER_INFO_102;
  428. Level 400-499 OS/2 Server information.
  429. Level 402 available with Admin access -
  430. typedef struct _SERVER_INFO_402 {
  431.     DWORD            sv402_ulist_mtime;
  432.     DWORD            sv402_glist_mtime;
  433.     DWORD            sv402_alist_mtime;
  434.     LPWSTR            sv402_alerts;
  435.     DWORD            sv402_security;
  436.     DWORD            sv402_numadmin;
  437.     DWORD            sv402_lanmask;
  438.     LPWSTR            sv402_guestacct;
  439.     DWORD            sv402_chdevs;
  440.     DWORD            sv402_chdevq;
  441.     DWORD            sv402_chdevjobs;
  442.     DWORD            sv402_connections;
  443.     DWORD            sv402_shares;
  444.     DWORD            sv402_openfiles;
  445.     DWORD            sv402_sessopens;
  446.     DWORD            sv402_sessvcs;
  447.     DWORD            sv402_sessreqs;
  448.     DWORD            sv402_opensearch;
  449.     DWORD            sv402_activelocks;
  450.     DWORD            sv402_numreqbuf;
  451.     DWORD            sv402_sizreqbuf;
  452.     DWORD            sv402_numbigbuf;
  453.     DWORD            sv402_numfiletasks;
  454.     DWORD            sv402_alertsched;
  455.     DWORD            sv402_erroralert;
  456.     DWORD            sv402_logonalert;
  457.     DWORD            sv402_accessalert;
  458.     DWORD            sv402_diskalert;
  459.     DWORD            sv402_netioalert;
  460.     DWORD            sv402_maxauditsz;
  461.     LPWSTR            sv402_srvheuristics;
  462. } SERVER_INFO_402, *PSERVER_INFO_402, *LPSERVER_INFO_402;
  463. Level 403 available with Admin access -
  464. typedef struct _SERVER_INFO_403 {
  465.     DWORD             sv403_ulist_mtime;
  466.     DWORD            sv403_glist_mtime;
  467.     DWORD            sv403_alist_mtime;
  468.     LPWSTR            sv403_alerts;
  469.     DWORD            sv403_security;
  470.     DWORD            sv403_numadmin;
  471.     DWORD            sv403_lanmask;
  472.     LPWSTR            sv403_guestacct;
  473.     DWORD            sv403_chdevs;
  474.     DWORD            sv403_chdevq;
  475.     DWORD            sv403_chdevjobs;
  476.     DWORD            sv403_connections;
  477.     DWORD            sv403_shares;
  478.     DWORD            sv403_openfiles;
  479.     DWORD            sv403_sessopens;
  480.     DWORD            sv403_sessvcs;
  481.     DWORD            sv403_sessreqs;
  482.     DWORD            sv403_opensearch;
  483.     DWORD            sv403_activelocks;
  484.     DWORD            sv403_numreqbuf;
  485.     DWORD            sv403_sizreqbuf;
  486.     DWORD            sv403_numbigbuf;
  487.     DWORD            sv403_numfiletasks;
  488.     DWORD            sv403_alertsched;
  489.     DWORD            sv403_erroralert;
  490.     DWORD            sv403_logonalert;
  491.     DWORD            sv403_accessalert;
  492.     DWORD            sv403_diskalert;
  493.     DWORD            sv403_netioalert;
  494.     DWORD            sv403_maxauditsz;
  495.     LPWSTR            sv403_srvheuristics;
  496.     DWORD            sv403_auditedevents;
  497.     DWORD            sv403_autoprofile;
  498.     LPWSTR            sv403_autopath;
  499. } SERVER_INFO_403, *PSERVER_INFO_403, *LPSERVER_INFO_403;
  500. Level 500-599 NT Server information.
  501. Level 502 available with Admin access -
  502. typedef struct _SERVER_INFO_502 {
  503.     DWORD            sv502_sessopens;
  504.     DWORD            sv502_sessvcs;
  505.     DWORD            sv502_opensearch;
  506.     DWORD            sv502_sizreqbuf;
  507.     DWORD            sv502_initworkitems;
  508.     DWORD            sv502_maxworkitems;
  509.     DWORD            sv502_rawworkitems;
  510.     DWORD            sv502_irpstacksize;
  511.     DWORD            sv502_maxrawbuflen;
  512.     DWORD            sv502_sessusers;
  513.     DWORD            sv502_sessconns;
  514.     DWORD                   sv502_maxpagedmemoryusage;
  515.     DWORD                   sv502_maxnonpagedmemoryusage;
  516.     BOOL                sv502_enablesoftcompat;
  517.      BOOL                        sv502_enableforcedlogoff;
  518.     BOOL                        sv502_timesource;
  519.     BOOL                        sv502_acceptdownlevelapis;
  520.     BOOL                        sv502_lmannounce;
  521. } SERVER_INFO_502, *PSERVER_INFO_502, *LPSERVER_INFO_502;
  522. typedef struct _SERVER_INFO_503 {
  523.      DWORD                   sv503_sessopens;
  524.         DWORD                   sv503_sessvcs;
  525.      DWORD                   sv503_opensearch;
  526.     DWORD                   sv503_sizreqbuf;
  527.     DWORD                   sv503_initworkitems;
  528.     DWORD                   sv503_maxworkitems;
  529.     DWORD                   sv503_rawworkitems;
  530.     DWORD                   sv503_irpstacksize;
  531.     DWORD                   sv503_maxrawbuflen;
  532.     DWORD                   sv503_sessusers;
  533.     DWORD                   sv503_sessconns;
  534.     DWORD                   sv503_maxpagedmemoryusage;
  535.     DWORD                   sv503_maxnonpagedmemoryusage;
  536.     BOOL                        sv503_enablesoftcompat;
  537.     BOOL                        sv503_enableforcedlogoff;
  538.     BOOL                        sv503_timesource;
  539.     BOOL                        sv503_acceptdownlevelapis;
  540.     BOOL                        sv503_lmannounce;
  541.     LPTSTR                  sv503_domain;
  542.     DWORD                   sv503_maxcopyreadlen;
  543.     DWORD                   sv503_maxcopywritelen;
  544.     DWORD                   sv503_minkeepsearch;
  545.     DWORD                   sv503_maxkeepsearch;
  546.     DWORD                   sv503_minkeepcomplsearch;
  547.     DWORD                   sv503_maxkeepcomplsearch;
  548.     DWORD                   sv503_threadcountadd;
  549.     DWORD                   sv503_numblockthreads;
  550.     DWORD                   sv503_scavtimeout;
  551.     DWORD                   sv503_minrcvqueue;
  552.     DWORD                   sv503_minfreeworkitems;
  553.     DWORD                   sv503_xactmemsize;
  554.     DWORD                   sv503_threadpriority;
  555.     DWORD                   sv503_maxmpxct;
  556.     DWORD                   sv503_oplockbreakwait;
  557.     DWORD                   sv503_oplockbreakresponsewait;
  558.     BOOL                        sv503_enableoplocks;
  559.     BOOL                        sv503_enableoplockforceclose;
  560.     BOOL                        sv503_enablefcbopens;
  561.     BOOL                        sv503_enableraw;
  562.     BOOL                        sv503_enabledpc;
  563.     BOOL                        sv503_enablemdlio;
  564.     BOOL                        sv503_enablefastio;
  565. } SERVER_INFO_503, *PSERVER_INFO_503, *LPSERVER_INFO_503;
  566.  
  567. Level 598 available with "SUPER-Admin" access -
  568. typedef struct _SERVER_INFO_598 {
  569.     DWORD            sv598_chdevs;
  570.     DWORD            sv598_sessopens;
  571.     DWORD            sv598_sessvcs;
  572.     DWORD            sv598_opensearch;
  573.     DWORD            sv598_sizreqbuf;
  574.     DWORD            sv598_initworkitems;
  575.     DWORD            sv598_maxworkitems;
  576.     DWORD            sv598_rawworkitems;
  577.     DWORD            sv598_irpstacksize;
  578.     DWORD            sv598_maxrawbuflen;
  579.     DWORD            sv598_sessusers;
  580.     DWORD            sv598_sessconns;
  581.     BOOL                sv598_enablesoftcompat;
  582.     LPSTR            sv598_domain;
  583.     DWORD            sv598_maxcopyreadlen;
  584.     DWORD            sv598_maxcopywritelen;
  585.     DWORD            sv598_minkeepsearch;
  586.     DWORD            sv598_maxkeepsearch;
  587.     DWORD            sv598_minkeepcomplsearch;
  588.     DWORD            sv598_maxkeepcomplsearch;
  589.     DWORD            sv598_threadcountadd;
  590.     DWORD            sv598_numblockthreads;
  591.     DWORD            sv598_scavtimeout;
  592.     DWORD            sv598_minrcvqueue;
  593.     DWORD            sv598_minfreeworkitems;
  594.     DWORD            sv598_xactmemsize;
  595.     DWORD            sv598_maxmpxct;
  596.     BOOL                sv598_enableoplocks;
  597.     BOOL                sv598_enablefcbopens;
  598.     BOOL                sv598_enableraw;
  599.     BOOL                sv598_enabledpc;
  600.     BOOL                sv598_enablemdlio;
  601.     BOOL                sv598_enablefastio;
  602. } SERVER_INFO_598, *PSERVER_INFO_598, *LPSERVER_INFO_598;
  603. The following infolevels are only valid for NetServerSetInfo and replace the older way of passing in a Parmnum to set a specific field.
  604. The following are supported on downlevel systems (i.e. LANMan 2.x) as well: 
  605. typedef struct _SERVER_INFO_1005 {
  606.     DWORD            sv1005_comment;
  607. } SERVER_INFO_1005, *PSERVER_INFO_1005, *LPSERVER_INFO_1005;
  608. typedef struct _SERVER_INFO_1107 {
  609.     DWORD                   sv1107_users;
  610. } SERVER_INFO_1107, *PSERVER_INFO_1107, *LPSERVER_INFO_1107;
  611.  
  612. typedef struct _SERVER_INFO_1010 {
  613.     DWORD            sv1010_disc;
  614. } SERVER_INFO_1010, *PSERVER_INFO_1010, *LPSERVER_INFO_1010;
  615. typedef struct _SERVER_INFO_1016 {
  616.     BOOL                sv1016_hidden;
  617. } SERVER_INFO_1016, *PSERVER_INFO_1016, *LPSERVER_INFO_1016;
  618. typedef struct _SERVER_INFO_1017 {
  619.     DWORD            sv1017_announce;
  620. } SERVER_INFO_1017, *PSERVER_INFO_1017, *LPSERVER_INFO_1017;
  621. typedef struct _SERVER_INFO_1018 {
  622.     DWORD            sv1018_anndelta;
  623. } SERVER_INFO_1018, *PSERVER_INFO_1018, *LPSERVER_INFO_1018;
  624. typedef struct _SERVER_INFO_1037 {
  625.     DWORD            sv1037_alertsched;
  626. } SERVER_INFO_1037, *PSERVER_INFO_1037, *LPSERVER_INFO_1037;
  627. typedef struct _SERVER_INFO_1038 {
  628.     DWORD            sv1038_erroralert;
  629. } SERVER_INFO_1038, *PSERVER_INFO_1038, *LPSERVER_INFO_1038;
  630. typedef struct _SERVER_INFO_1039 {
  631.     DWORD            sv1039_logonalert;
  632. } SERVER_INFO_1039, *PSERVER_INFO_1039, *LPSERVER_INFO_1039;
  633. typedef struct _SERVER_INFO_1040 {
  634.     DWORD            sv1040_accessalert;
  635. } SERVER_INFO_1040, *PSERVER_INFO_1040, *LPSERVER_INFO_1040;
  636. typedef struct _SERVER_INFO_1041 {
  637.     DWORD            sv1041_diskalert;
  638. } SERVER_INFO_1041, *PSERVER_INFO_1041, *LPSERVER_INFO_1041;
  639. typedef struct _SERVER_INFO_1042 {
  640.     DWORD            sv1042_netioalert;
  641. } SERVER_INFO_1042, *PSERVER_INFO_1042, *LPSERVER_INFO_1042;
  642. typedef struct _SERVER_INFO_1043 {
  643.     DWORD            sv1043_maxauditsz;
  644. } SERVER_INFO_1043, *PSERVER_INFO_1043, *LPSERVER_INFO_1043;
  645. The following do not do anything on downlevel systems (i.e. LANMan 2.x) since they cannot be modified on the fly on those systems: 
  646. typedef struct _SERVER_INFO_1009 {
  647.     DWORD            sv1009_users;
  648. } SERVER_INFO_1009, *PSERVER_INFO_1009, *LPSERVER_INFO_1009;
  649. typedef struct _SERVER_INFO_1021 {
  650.     LPWSTR            sv1021_userpath;
  651. } SERVER_INFO_1021, *PSERVER_INFO_1021, *LPSERVER_INFO_1021;
  652. typedef struct _SERVER_INFO_1022 {
  653.     DWORD            sv1022_chdevs;
  654. } SERVER_INFO_1022, *PSERVER_INFO_1022, *LPSERVER_INFO_1022;
  655. typedef struct _SERVER_INFO_1028 {
  656.     DWORD            sv1028_sessopens;
  657. } SERVER_INFO_1028, *PSERVER_INFO_1028, *LPSERVER_INFO_1028;
  658. typedef struct _SERVER_INFO_1029 {
  659.     DWORD            sv1029_opensearch;
  660. } SERVER_INFO_1029, *PSERVER_INFO_1029, *LPSERVER_INFO_1029;
  661. The following are not supported on downlevel systems (i.e. LANMan 2.x) since these are NT-only fields: 
  662. typedef struct _SERVER_INFO_1001 {
  663.     DWORD            sv1001_maxworkitems;
  664. } SERVER_INFO_1001, *PSERVER_INFO_1001, *LPSERVER_INFO_1001;
  665. typedef struct _SERVER_INFO_1002 {
  666.     DWORD            sv1002_maxrawbuflen;
  667. } SERVER_INFO_1002, *PSERVER_INFO_1002, *LPSERVER_INFO_1002;
  668. typedef struct _SERVER_INFO_1003 {
  669.     DWORD            sv1003_sessusers;
  670. } SERVER_INFO_1003, *PSERVER_INFO_1003, *LPSERVER_INFO_1003;
  671. typedef struct _SERVER_INFO_1004 {
  672.     DWORD            sv1004_sesscons;
  673. } SERVER_INFO_1004, *PSERVER_INFO_1004, *LPSERVER_INFO_1004;
  674. typedef struct _SERVER_INFO_1006 {
  675.     DWORD            sv1006_enablesoftcompat;
  676. } SERVER_INFO_1006, *PSERVER_INFO_1006, *LPSERVER_INFO_1006;
  677. For NetServerSetInfo, parmnum values refer to the fields in the _SERVER_INFO structures as follows. These values are used when indicating an error in a specific parameter via parm_err.
  678.     parmnum value    Field in server_info struct
  679.     SV_NAME_PARMNUM             sv_name
  680.     SV_VERSION_MAJOR_PARMNUM     sv_version_major
  681.     SV_VERSION_MINOR_PARMNUM     sv_version_minor
  682.     SV_TYPE_PARMNUM             sv_type
  683.     SV_COMMENT_PARMNUM         sv_comment
  684.     SV_USERS_PARMNUM             sv_users
  685.     SV_DISC_PARMNUM             sv_disc
  686.     SV_HIDDEN_PARMNUM         sv_hidden
  687.     SV_ANNOUNCE_PARMNUM         sv_announce
  688.     SV_ANNDELTA_PARMNUM         sv_anndelta
  689.     SV_USERPATH_PARMNUM         sv_userpath
  690.     SV_ULIST_MTIME_PARMNUM         sv_ulist_mtime
  691.     SV_GLIST_MTIME_PARMNUM         sv_glist_mtime
  692.     SV_ALIST_MTIME_PARMNUM         sv_alist_mtime
  693.     SV_ALERTS_PARMNUM         sv_alerts
  694.     SV_SECURITY_PARMNUM        sv_security
  695.     SV_NUMADMIN_PARMNUM         sv_numadmin
  696.     SV_LANMASK_PARMNUM         sv_lanmask
  697.     SV_GUESTACC_PARMNUM         sv_guestacc
  698.     SV_CHDEVS_PARMNUM         sv_chdevs
  699.     SV_CHDEVQ_PARMNUM         sv_chdevq
  700.     SV_CHDEVJOBS_PARMNUM         sv_chdevjobs
  701.     SV_CONNECTIONS_PARMNUM     sv_connections
  702.     SV_SHARES_PARMNUM         sv_shares
  703.     SV_OPENFILES_PARMNUM         sv_openfiles
  704.     SV_SESSOPENS_PARMNUM         sv_sessopens
  705.     SV_SESSVCS_PARMNUM         sv_sessvcs
  706.     SV_SESSREQS_PARMNUM         sv_sessreqs
  707.     SV_OPENSEARCH_PARMNUM         sv_opensearch
  708.     SV_ACTIVELOCKS_PARMNUM     sv_activelocks
  709.     SV_NUMREQBUF_PARMNUM         sv_numreqbuf
  710.     SV_SIZREQBUF_PARMNUM         sv_sizreqbuf
  711.     SV_NUMBIGBUF_PARMNUM         sv_numbigbuf
  712.     SV_NUMFILETASKS_PARMNUM     sv_numfiletasks
  713.     SV_ALERTSCHED_PARMNUM         sv_alertsched
  714.     SV_ERRORALERT_PARMNUM         sv_erroralert
  715.     SV_LOGONALERT_PARMNUM         sv_logonalert
  716.     SV_ACCESSALERT_PARMNUM     sv_accessalert
  717.     SV_DISKALERT_PARMNUM         sv_diskalert
  718.     SV_NETIOALERT_PARMNUM         sv_netioalert
  719.     SV_MAXAUDITSZ_PARMNUM         sv_maxauditsz
  720.     SV_SRVHEURISTICS_PARMNUM     sv_srvheuristics
  721.     SV_AUDITEDEVENTS_PARMNUM     sv_auditedevents
  722.     SV_AUTOPROFILE_PARMNUM     sv_autoprofile
  723.     SV_MAXWORKITEMS_PARMNUM     sv_maxworkitems
  724.     SV_RAWWORKITEMS_PARMNUM     sv_rawworkitems
  725.     SV_IRPSTACKSIZE_PARMNUM     sv_irpstacksize
  726.     SV_SESSUSERS_PARMNUM         sv_sessusers
  727.     SV_SESSCONNS_PARMNUM         sv_sessconns
  728.     SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM sv_maxnonpagedmemoryusage
  729.     SV_MAXPAGEDMEMORYUSAGE_PARMNUM       sv_maxpagedmmeoryusage        
  730.     SV_ENABLEOFTCOMPAT_PARMNUM     sv_enablesoftcompat
  731.     SV_INITWORKITEMS_PARMNUM     sv_initworkitems
  732.     SV_MAXSAWBUFLEN_PARMNUM     sv_maxrawbuflen
  733.     SV_MAXCOPYREADLEN_PARMNUM     sv_maxcopyreadlen
  734.     SV_MAXCOPYWRITELEN_PARMNUM     sv_maxcopywritelen
  735.     SV_MINKEEPSEARCH_PARMNUM     sv_minkeepsearch
  736.     SV_MAXKEEPSEARCH_PARMNUM     sv_maxkeepsearch
  737.     SV_MINKEEPCOMPLSEARCH_PARMNUM     sv_minkeepcomplsearch
  738.     SV_MAXKEEPCOMPLSEARCH_PARMNUM     sv_maxkeepcomplsearch
  739.     SV_THREADCOUNTADD_PARMNUM     sv_threadcountadd
  740.     SV_NUMBLOCKTHREADS_PARMNUM     sv_numblockthreads
  741.     SV_SCAVTIMEOUT_PARMNUM     sv_scavtimeout
  742.     SV_MINRCVQUEUE_PARMNUM     sv_minrcvqueue
  743.     SV_NINFREEWORKITEMS_PARMNUM     sv_minfreeworkitems
  744.     SV_XACTMEMSIZE_PARMNUM     sv_xactmemsize
  745.     SV_MAXMPXCT_PARMNUM     sv_maxmpxct
  746.     SV_ENABLEOPLOCKS_PARMNUM     sv_enableoplocks
  747.     SV_ENABLEFCBOPENS_PARMNUM     sv_enablefcbopens
  748.     SV_ENABLERAW_PARMNUM     sv_enableraw
  749.     SV_ENABLEDPC_PARMNUM     sv_enabledpc
  750.     SV_ENABLEMDLIO_PARMNUM     sv_enablemdlio
  751.  
  752. The server APIs are:
  753. 4.3.1.    NetServerEnum
  754. Use the WNetEnumResource Win32 API if the information you require is returned by it.  The WNetEnumResource will return the type (disk, printer, ...), name and comment for a server.
  755. NetServerEnum lists all servers of the specified type(s) that are visible in the specified domain(s). For example, an application can call NetServerEnum to list all domain controllers only or all SQL servers only.   
  756. Privilege Level
  757. No special privilege level is required to successfully execute NetServerEnum.
  758. NET_API_STATUS NET_API_FUNCTION
  759. NetServerEnum (
  760.     IN LPWSTR servername OPTIONAL,
  761.     IN DWORD level,
  762.     OUT LPBYTE * bufptr,
  763.     IN DWORD prefmaxlen,
  764.     OUT LPDWORD entriesread,
  765.     OUT LPDWORD totalentries,
  766.     IN DWORD servertype,
  767.     IN LPWSTR domain,
  768.     IN OUT LPDWORD resumehandle OPTIONAL
  769.     );
  770. Parameters:
  771.  
  772. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  773. level __Level of information required. 100 and 101 are valid.
  774. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  775. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  776. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  777. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  778. servertype __A DWORD mask which filters server entries to return from the enumeration. The defines mask bits are:
  779. SV_TYPE_WORKSTATION    0x00000001     All LAN Manager workstation
  780. SV_TYPE_SERVER    0x00000002     All LAN Manager server
  781. SV_TYPE_SQLSERVER    0x00000004    Any server running with SQL server
  782. SV_TYPE_DOMAIN_CTRL    0x00000008    Primary domain controller
  783. SV_TYPE_DOMAIN_BAKCTRL    0x00000010    Backup domain controller
  784. SV_TYPE_TIMESOURCE    0x00000020    Server running the timesource service
  785. SV_TYPE_AFP    0x00000040    Apple File Protocol servers
  786. SV_TYPE_NOVELL    0x00000080    Novell servers
  787. SV_TYPE_DOMAIN_MEMBER    0x00000100    Domain Member
  788. SV_TYPE_PRINT    0x00000200    Server sharing print queue
  789. SV_TYPE_DIALIN    0x00000400    Server running dialin service.
  790. SV_TYPE_XENIX_SERVER    0x00000800    Xenix server
  791. SV_TYPE_NT    0x00001000    NT server    
  792. SV_TYPE_WFW            0x00002000    Server running Windows for Workgroups
  793. SV_TYPE_POTENTIAL_BROWSER    0x00010000    Server that can run the browser service
  794. SV_TYPE_BACKUP_BROWSER     0x00020000    Server running a browser service as backup
  795. SV_TYPE_MASTER_BROWSER    0x00040000    Server running the master browser service
  796. SV_TYPE_DOMAIN_MASTER    0x00080000    Server running the domain master browser
  797. SV_TYPE_ALL    0xffffffff        All servers
  798.  
  799. domain __A pointer to an UNICODE string containing the name of the domain for which a list of servers is to returned. The domain must be the primary domain, one of the other domains for the workstation or the logon domain.
  800. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing server search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  801.  
  802. 4.3.2.    NetServerGetInfo
  803. NetServerGetInfo retrieves information about the specified server. 
  804. Privilege Level
  805. Admin privilege or accounts, comm, print, or server operator privilege is required to successfully execute NetServerGetInfo at level 102 or higher. No special privilege is required for level 100 or level 101 calls.
  806. NET_API_STATUS NET_API_FUNCTION
  807. NetServerGetInfo (
  808.     IN LPWSTR servername OPTIONAL,
  809.     IN DWORD level,
  810.     OUT LPBYTE * bufptr,
  811.     );
  812. Parameters:
  813.  
  814. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  815. level __Level of information required. 100, 101 and 102 are valid for all platforms. 302, 402, 403, 502 are valid for the appropriate platform.
  816. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  817. 4.3.3.    NetServerSetInfo 
  818. NetServerSetInfo sets a server's operating parameters; it can set them individually or collectively. This information is stored such that it remains in effect after the system has been reinitialized.
  819. Privilege Level
  820. Admin privilege or server operator privilege is required to successfully execute NetServerSetInfo.
  821. NET_API_STATUS NET_API_FUNCTION
  822. NetServerSetInfo (
  823.     IN LPWSTR servername OPTIONAL,
  824.     IN DWORD level,
  825.     IN LPBYTE buf,
  826.     OUT LPDWORD parm_err OPTIONAL
  827.     );
  828. Parameters:
  829.  
  830. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  831. level __Level of information to set. 100, 101 and 102 are valid for all platforms. 302, 402, 403, 502 are valid for the appropriate platform. In addition, 1001 - 1006, 1009 - 1011, 1016 - 1018, 1021, 1022, 1028, 1029, 1037 - 1043 are valid based on the restrictions for downlevel systems described above.
  832. buf __A pointer to a buffer containing the server information. 
  833. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  834. 4.3.4.    NetServerDiskEnum 
  835. NetServerDiskEnum retrieves a list of disk drives on a server. 
  836. Privilege Level
  837. Admin privilege or server operator privilege is required to successfully execute NetServerDiskEnum on a remote computer. No special privilege is required for local calls.
  838. NET_API_STATUS NET_API_FUNCTION
  839. NetServerDiskEnum (
  840.     IN LPWSTR servername OPTIONAL,
  841.     IN DWORD level,
  842.     OUT LPBYTE * bufptr,
  843.     IN DWORD prefmaxlen,
  844.     OUT LPDWORD entriesread,
  845.     OUT LPDWORD totalentries,
  846.     IN OUT LPDWORD resumehandle OPTIONAL
  847.     );
  848. Parameters:
  849.  
  850. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  851. level __Level of information required. 0 is the only valid level.
  852. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  853. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  854. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  855. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  856. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing server disk search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  857. 4.4.    Workstation and WorkstationUser APIs
  858. Wksta API functions perform administrative tasks on a local or remote workstation. Any user or application with admin privilege on a local or remote server can perform administrative tasks on that workstation to control its operation, user access, and resource sharing. The low-level parameters that affect a workstation's  operation can be examined and modified by calling NetWkstaGetInfo and NetWkstaSetInfo.
  859. The workstation API data structures are restructured from those of LANMan 2.x to allow the information to be grouped by type and privilege. The LANMan 2.x workstation information format is discontinued due to the following problems:
  860.     o    The base level (0 and 1) were not grouped by accessibility such that a non superset level (level 10) was required to allow guest access to the information.
  861.     o    Platform specific implementation information was included in the base levels such that every platform had to return all information including a default for non-relevant fields. This grew the size of the information structures unneccessarily, making the API cumbersome to use.
  862. The workstation APIs allow access to two discrete groups of workstation information:
  863.     o    System information.
  864.     o    Platform specific information (NT, OS/2, DOS, etc.)
  865. The WkstaUser APIs allow access to user-specific information. The user-specific information is separated from the workstation information because there can be more than one user on a workstation.
  866. Within each group the fields are categorized by security access such that the guest accessible fields are a subset of the user accessible fields which are a subset of the admin accessible fields.
  867. The system information structure contains a platform base number which identifies the levels and format of the platform specific information structures.
  868. The workstation APIs information structures are:
  869. System Information -
  870. Level 100 available with guest access -
  871. typedef struct _WKSTA_INFO_100 {
  872.     DWORD        wki100_platform_id;
  873.     LPWSTR        wki100_computername;
  874.     LPWSTR        wki100_langroup;
  875.     DWORD        wki100_ver_major;
  876.     DWORD        wki100_ver_minor;
  877. } WKSTA_INFO_100, *PWKSTA_INFO_100, *LPWKSTA_INFO_100;
  878. Level 101 available with User access -
  879. typedef struct _WKSTA_INFO_101 {
  880.     DWORD        wki101_platform_id;
  881.     LPWSTR        wki101_computername;
  882.     LPWSTR        wki101_langroup;
  883.     DWORD        wki101_ver_major;
  884.     DWORD        wki101_ver_minor;
  885.     LPWSTR        wki101_lanroot;
  886. } WKSTA_INFO_101, *PWKSTA_INFO_101, *LPWKSTA_INFO_101;
  887. Level 102 available with Admin access -
  888. typedef struct _WKSTA_INFO_102 {
  889.     DWORD        wki102_platform_id;
  890.     LPWSTR        wki102_computername;
  891.     LPWSTR        wki102_langroup;
  892.     DWORD        wki102_ver_major;
  893.     DWORD        wki102_ver_minor;
  894.     LPWSTR        wki102_lanroot;
  895.     DWORD        wki102_logged_on_users;
  896. } WKSTA_INFO_102, *PWKSTA_INFO_102, *LPWKSTA_INFO_102;
  897. Platform Specific Information
  898. Level 300-399 Dos Workstation information.
  899. Level 300 available with guest access -
  900. Level 302 available with Admin access -
  901. typedef struct _WKSTA_INFO_302 {
  902.     DWORD        wki302_char_wait;
  903.     DWORD        wki302_collection_time;
  904.     DWORD        wki302_maximum_collection_count;
  905.     DWORD        wki302_keep_conn;
  906.     DWORD        wki302_keep_search;
  907.     DWORD        wki302_max_cmds;
  908.     DWORD        wki302_num_work_buf;
  909.     DWORD        wki302_siz_work_buf;
  910.     DWORD        wki302_max_wrk_cache;
  911.     DWORD        wki302_sess_timeout;
  912.     DWORD        wki302_siz_error;
  913.     DWORD        wki302_num_alerts;
  914.     DWORD        wki302_num_services;
  915.     DWORD        wki302_errlog_sz;
  916.     DWORD        wki302_print_buf_time;
  917.     DWORD        wki302_num_char_buf;
  918.     DWORD        wki302_siz_char_buf;
  919.     LPWSTR        wki302_wrk_heuristics;
  920.     DWORD        wki302_mailslots;
  921.     DWORD        wki302_num_dgram_buf;
  922. } WKSTA_INFO_302, *PWKSTA_INFO_302, *LPWKSTA_INFO_302;
  923. Level 400-499 OS/2 Workstation information.
  924. Level 402 available with Admin access -
  925. typedef struct _WKSTA_INFO_402 {
  926.     DWORD        wki402_char_wait;
  927.     DWORD        wki402_collection_time;
  928.     DWORD        wki402_maximum_collection_count;
  929.     DWORD        wki402_keep_conn;
  930.     DWORD        wki402_keep_search;
  931.     DWORD        wki402_max_cmds;
  932.     DWORD        wki402_num_work_buf;
  933.     DWORD        wki402_siz_work_buf;
  934.     DWORD        wki402_max_wrk_cache;
  935.     DWORD        wki402_sess_timeout;
  936.     DWORD        wki402_siz_error;
  937.     DWORD        wki402_num_alerts;
  938.     DWORD        wki402_num_services;
  939.     DWORD        wki402_errlog_sz;
  940.     DWORD        wki402_print_buf_time;
  941.     DWORD        wki402_num_char_buf;
  942.     DWORD        wki402_siz_char_buf;
  943.     LPWSTR        wki402_wrk_heuristics;
  944.     DWORD        wki402_mailslots;
  945.     DWORD        wki402_num_dgram_buf;
  946.     DWORD        wki402_max_threads;
  947. } WKSTA_INFO_402, *PWKSTA_INFO_402, *LPWKSTA_INFO_402;
  948. Level 500-599 NT Workstation information.
  949. Level 502 available with Admin access -
  950. typedef struct _WKSTA_INFO_502 {
  951.     DWORD        wki502_char_wait;
  952.     DWORD        wki502_collection_time;
  953.     DWORD        wki502_maximum_collection_count;
  954.     DWORD        wki502_keep_conn;
  955.     DWORD        wki502_max_cmds;
  956.     DWORD        wki502_sess_timeout;
  957.     DWORD        wki502_siz_char_buf;
  958.     DWORD        wki502_max_threads;
  959.     DWORD        wki502_lock_quota;
  960.     DWORD        wki502_lock_increment;
  961.     DWORD        wki502_lock_maximum;
  962.     DWORD        wki502_pipe_increment;
  963.     DWORD        wki502_pipe_maximum;
  964.     DWORD        wki502_cache_file_timeout;
  965.     DWORD        wki502_dormant_file_limit;
  966.     DWORD        wki502_read_ahead_throughput;
  967.     DWORD        wki502_num_mailslot_buffers;
  968.     DWORD        wki502_num_srv_announce_buffers;
  969.     DWORD        wki502_dgreceiver_threads;
  970.     BOOL            wki502_use_opportunistic_locking;
  971.     BOOL            wki502_use_unlock_behind;
  972.     BOOL            wki502_use_close_behind;
  973.     BOOL            wki502_buf_named_pipes;
  974.     BOOL            wki502_use_lock_read_unlock;
  975.     BOOL            wki502_utilize_nt_caching;
  976.     BOOL            wki502_use_raw_read;
  977.     BOOL            wki502_use_raw_write;
  978.     BOOL            wki502_use_write_raw_data;
  979.     BOOL            wki502_use_encryption;
  980.     BOOL            wki502_buf_files_deny_write;
  981.     BOOL            wki502_buf_read_only_files;
  982.     BOOL            wki502_force_core_create_mode;
  983.     BOOL            wki502_use_512_byte_max_transfer;
  984. } WKSTA_INFO_502, *PWKSTA_INFO_502, *LPWKSTA_INFO_502;
  985. This format of workstation information allows for a more logical future extension. When new information is to be added to any set of guest,user and admin information a new set of levels is created to include the current infromation plus the new information.
  986. The following infolevels are only valid for NetWkstaSetInfo and replace the older way of passing in a Parmnum to set a specific field.
  987. The following are supported on downlevel systems (i.e. LANMan 2.x) as well: 
  988. typedef struct _WKSTA_INFO_1010 {
  989.     DWORD            wki1010_char_wait;
  990. } WKSTA_INFO_1010, *PWKSTA_INFO_1010, *LPWKSTA_INFO_1010;
  991. typedef struct _WKSTA_INFO_1011 {
  992.     DWORD            wki1011_collection_time;
  993. } WKSTA_INFO_1011, *PWKSTA_INFO_1011, *LPWKSTA_INFO_1011;
  994. typedef struct _WKSTA_INFO_1012 {
  995.     DWORD            wki1012_maximum_collection_count;
  996. } WKSTA_INFO_1012, *PWKSTA_INFO_1012, *LPWKSTA_INFO_1012;
  997. typedef struct _WKSTA_INFO_1027 {
  998.     DWORD            wki1027_errlog_sz;
  999. } WKSTA_INFO_1027, *PWKSTA_INFO_1027, *LPWKSTA_INFO_1027;
  1000. typedef struct _WKSTA_INFO_1028 {
  1001.     DWORD            wki1028_print_buf_time;
  1002. } WKSTA_INFO_1028, *PWKSTA_INFO_1028, *LPWKSTA_INFO_1028;
  1003. typedef struct _WKSTA_INFO_1032 {
  1004.     DWORD            wki1032_wrk_heuristics;
  1005. } WKSTA_INFO_1032, *PWKSTA_INFO_1032, *LPWKSTA_INFO_1032;
  1006. typedef struct _WKSTA_INFO_1035 {
  1007.     LPWSTR            wki1035_oth_domains;
  1008. } WKSTA_INFO_1035, *PWKSTA_INFO_1035, *LPWKSTA_INFO_1035;
  1009. The following do nothing on downlevel systems (i.e. LANMan 2.x) since these fields cannot be set on them: 
  1010. typedef struct _WKSTA_INFO_1013 {
  1011.     DWORD            wki1013_keep_conn;
  1012. } WKSTA_INFO_1013, *PWKSTA_INFO_1013, *LPWKSTA_INFO_1013;
  1013. typedef struct _WKSTA_INFO_1018 {
  1014.     DWORD            wki1018_sess_timeout;
  1015. } WKSTA_INFO_1018, *PWKSTA_INFO_1018, *LPWKSTA_INFO_1018;
  1016. typedef struct _WKSTA_INFO_1023 {
  1017.     DWORD            wki1023_siz_char_buf;
  1018. } WKSTA_INFO_1023, *PWKSTA_INFO_1023, *LPWKSTA_INFO_1023;
  1019. typedef struct _WKSTA_INFO_1033 {
  1020.     DWORD            wki1033_max_threads;
  1021. } WKSTA_INFO_1033, *PWKSTA_INFO_1033, *LPWKSTA_INFO_1033;
  1022. The following are not supported on downlevel systems (i.e. LANMan 2.x): 
  1023. typedef struct _WKSTA_INFO_1041 {
  1024.     DWORD            wki1041_lock_quota;
  1025. } WKSTA_INFO_1041, *PWKSTA_INFO_1041, *LPWKSTA_INFO_1041;
  1026. typedef struct _WKSTA_INFO_1042 {
  1027.     DWORD            wki1042_lock_increment;
  1028. } WKSTA_INFO_1042, *PWKSTA_INFO_1042, *LPWKSTA_INFO_1042;
  1029. typedef struct _WKSTA_INFO_1043 {
  1030.     DWORD            wki1043_lock_maximum;
  1031. } WKSTA_INFO_1043, *PWKSTA_INFO_1043, *LPWKSTA_INFO_1043;
  1032. typedef struct _WKSTA_INFO_1044 {
  1033.     DWORD            wki1044_pipe_increment;
  1034. } WKSTA_INFO_1044, *PWKSTA_INFO_1044, *LPWKSTA_INFO_1044;
  1035. typedef struct _WKSTA_INFO_1045 {
  1036.     DWORD            wki1045_pipe_maximum;
  1037. } WKSTA_INFO_1045, *PWKSTA_INFO_1045, *LPWKSTA_INFO_1045;
  1038. typedef struct _WKSTA_INFO_1046 {
  1039.     DWORD            wki1046_dormant_file_limit;
  1040. } WKSTA_INFO_1046, *PWKSTA_INFO_1046, *LPWKSTA_INFO_1046;
  1041. typedef struct _WKSTA_INFO_1047 {
  1042.     DWORD            wki1047_cache_file_timeout;
  1043. } WKSTA_INFO_1047, *PWKSTA_INFO_1047, *LPWKSTA_INFO_1047;
  1044. typedef struct _WKSTA_INFO_1048 {
  1045.     BOOL            wki1048_use_opportunity_locking;
  1046. } WKSTA_INFO_1048, *PWKSTA_INFO_1048, *LPWKSTA_INFO_1048;
  1047. typedef struct _WKSTA_INFO_1049 {
  1048.     BOOL            wki1049_use_unlock_behind;
  1049. } WKSTA_INFO_1049, *PWKSTA_INFO_1049, *LPWKSTA_INFO_1049;
  1050. typedef struct _WKSTA_INFO_1050 {
  1051.     BOOL            wki1050_use_close_behind;
  1052. } WKSTA_INFO_1050, *PWKSTA_INFO_1050, *LPWKSTA_INFO_1050;
  1053. typedef struct _WKSTA_INFO_1051 {
  1054.     BOOL            wki1051_buf_named_pipes;
  1055. } WKSTA_INFO_1051, *PWKSTA_INFO_1051, *LPWKSTA_INFO_1051;
  1056. typedef struct _WKSTA_INFO_1052 {
  1057.     BOOL            wki1052_use_lock_read_unlock;
  1058. } WKSTA_INFO_1052, *PWKSTA_INFO_1052, *LPWKSTA_INFO_1052;
  1059. typedef struct _WKSTA_INFO_1053 {
  1060.     BOOL            wki1053_utilize_nt_caching;
  1061. } WKSTA_INFO_1053, *PWKSTA_INFO_1053, *LPWKSTA_INFO_1053;
  1062. typedef struct _WKSTA_INFO_1054 {
  1063.     BOOL            wki1054_use_raw_read;
  1064. } WKSTA_INFO_1054, *PWKSTA_INFO_1054, *LPWKSTA_INFO_1054;
  1065. typedef struct _WKSTA_INFO_1055 {
  1066.     BOOL            wki1055_use_raw_write;
  1067. } WKSTA_INFO_1055, *PWKSTA_INFO_1055, *LPWKSTA_INFO_1055;
  1068. typedef struct _WKSTA_INFO_1056 {
  1069.     BOOL            wki1056_use_write_raw_data;
  1070. } WKSTA_INFO_1056, *PWKSTA_INFO_1056, *LPWKSTA_INFO_1056;
  1071. typedef struct _WKSTA_INFO_1057 {
  1072.     BOOL            wki1057_use_encryption;
  1073. } WKSTA_INFO_1057, *PWKSTA_INFO_1057, *LPWKSTA_INFO_1057;
  1074. typedef struct _WKSTA_INFO_1058 {
  1075.     BOOL            wki1058_buf_files_deny_write;
  1076. } WKSTA_INFO_1058, *PWKSTA_INFO_1058, *LPWKSTA_INFO_1058;
  1077. typedef struct _WKSTA_INFO_1059 {
  1078.     BOOL            wki1059_buf_read_only_files;
  1079. } WKSTA_INFO_1059, *PWKSTA_INFO_1059, *LPWKSTA_INFO_1059;
  1080. typedef struct _WKSTA_INFO_1060 {
  1081.     BOOL            wki1060_force_core_create_mode;
  1082. } WKSTA_INFO_1060, *PWKSTA_INFO_1060, *LPWKSTA_INFO_1060;
  1083. typedef struct _WKSTA_INFO_1061 {
  1084.     BOOL            wki1061_use_512_byte_max_transfer;
  1085. } WKSTA_INFO_1061, *PWKSTA_INFO_1061, *LPWKSTA_INFO_1061;
  1086. typedef struct _WKSTA_INFO_1062 {
  1087.     DWORD            wki1062_read_ahead_throughput;
  1088. } WKSTA_INFO_1062, *PWKSTA_INFO_1062, *LPWKSTA_INFO_1062;
  1089. The WkstaUser API information structures are:
  1090. Level 0 and 1 available with User access -
  1091. typedef struct _WKSTA_USER_INFO_0 {
  1092.     LPWSTR        wkui0_username;
  1093. } WKSTA_USER_INFO_0, *PWKSTA_USER_INFO_0, *LPWKSTA_USER_INFO_0; 
  1094.  
  1095. typedef struct _WKSTA_USER_INFO_1 {
  1096.     LPWSTR        wkui1_username;
  1097.     LPWSTR        wkui1_logon_domain;
  1098.     LPWSTR        wkui1_logon_server;
  1099.     LPWSTR        wkui1_oth_domains;
  1100. } WKSTA_USER_INFO_1, *PWKSTA_USER_INFO_1, *LPWKSTA_USER_INFO_1;
  1101.  
  1102. typedef struct _WKSTA_USER_INFO_1101 {
  1103.     LPTSTR          wkui1101_oth_domains;
  1104. } WKSTA_USER_INFO_1101, *PWKSTA_USER_INFO_1101,
  1105.   *LPWKSTA_USER_INFO_1101;
  1106.  
  1107. For NetWkstaSetInfo, parmnum values refer to the fields in the wksta_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  1108. parmnum value    Field in wksta_info struct
  1109. WKSTA_PLATFORM_ID_PARMNUM    wki_platform_id
  1110. WKSTA_COMPUTERNAME_PARMNUM    wki_computername
  1111. WKSTA_LANGROUP_PARMNUM    wki_langroup
  1112. WKSTA_OTH_DOMAINS_PARMNUM    wki_oth_domains
  1113. WKSTA_VER_MAJOR_PARMNUM    wki_ver_major
  1114. WKSTA_VER_MINOR_PARMNUM    wki_ver_minor
  1115. WKSTA_LOGGED_ON_USERS_PARMNUM    wki_logged_on_users
  1116. WKSTA_LANROOT_PARMNUM    wki_lanroot
  1117. WKSTA_LOGON_DOMAIN_PARMNUM    wki_logon_domain
  1118. WKSTA_LOGON_SERVER_PARMNUM    wki_logon_server
  1119. WKSTA_CHARWAIT_PARMNUM    wki_char_wait
  1120. WKSTA_CHARTIME_PARMNUM    wki_collection_time
  1121. WKSTA_CHARCOUNT_PARMNUM    wki_maximum_collection_count
  1122. WKSTA_KEEPCONN_PARMNUM    wki_keep_conn
  1123. WKSTA_KEEPSEARCH_PARMNUM    wki_keep_search
  1124. WKSTA_MAXCMDS_PARMNUM    wki_max_cmds
  1125. WKSTA_NUMWORKBUF_PARMNUM    wki_num_work_buf
  1126. WKSTA_MAXWRKCACHE_PARMNUM    wki_max_wrk_cache
  1127. WKSTA_SESSTIMEOUT_PARMNUM    wki_sess_timeout
  1128. WKSTA_SIZERROR_PARMNUM    wki_siz_error
  1129. WKSTA_NUMALERTS_PRAMNUM    wki_num_alerts
  1130. WKSTA_NUMSERVICES_PARMNUM    wki_num_services
  1131. WKSTA_ERRLOGSZ_PARMNUM    wki_errlog_sz
  1132. WKSTA_PRINTBUFTIME_PARMNUM    wki_print_buf_time
  1133. WKSTA_NUMCHARBUF_PARMNUM    wki_num_char_buf
  1134. WKSTA_SIZCHARBUF_PARMNUM    wki_siz_char_buf
  1135. WKSTA_WRKHEURISTICS_PARMNUM    wki_wrk_heuristics
  1136. WKSTA_MAILSLOTS_PRAMNUM    wki_mailslots
  1137. WKSTA_MAXTHREADS_PARMNUM    wki_max_threads
  1138. WKSTA_SIZWORKBUF_PARMNUM    wki_siz_work_buf
  1139. WKSTA_DORMANTTIMEOUT_PARMNUM    wki_dormant_timeout
  1140. WKSTA_LOCKQUOTA_PARMNUM    wki_lock_quota
  1141. WKSTA_LOCKINCREMENT_PARMNUM    wki_lock_increment
  1142. WKSTA_LOCKMAXIMUM_PARMNUM    wki_lock_maximum
  1143. WKSTA_PIPEINCREMENT_PRAMNUM    wki_pipe_increment
  1144. WKSTA_PIPEMAXIMUM_PARMNUM    wki_pipe_maximum
  1145. WKSTA_RAWREADTHRESHOLD_PARMNUM    wki_raw_read_threshold
  1146. WKSTA_USEOPLOCKING_PARMNUM    wki_use_opportunistic_locking
  1147. WKSTA_USEOPBATCH_PARMNUM    wki_use_op_batch
  1148. WKSTA_USEUNLOCKBEHIND_PARMNUM    wki_use_unlock_behind
  1149. WKSTA_USECLOSEBEHIND_PARMNUM    wki_use_close_behind
  1150. WKSTA_BUFNAMEDPIPES_PARMNUM    wksta_buf_named_pipes
  1151. WKSTA_USELOCKANDREADANDUNLOCK_PARMNUM    wki_use_lock_and_read_and_unlock
  1152. WKSTA_UTILIZENTCACHING_PARMNUM    wki_utilize_nt_caching
  1153. WKSTA_USERAWREAD_PARMNUM    wki_use_raw_read
  1154. WKSTA_USEWRITERAWWITHDATA_PARMNUM    wki_use_write_raw_with_data
  1155. WKSTA_USEENCRYPTION_PARMNUM    wki_use_encryption
  1156. WKSTA_BUFFILESWITHDENYWRITE_PARMNUM    wki_buf_files_with_deny_write
  1157. WKSTA_BUFREADONLYFILES_PRAMNUM    wki_buf_read_only_files
  1158. WKSTA_FORCECORECREATEMODE_PARMNUM    wki_force_core_create_mode
  1159. WKSTA_USE512BYTESMAXTRANSFER_PARMNUM    wki_use_512_bytes_max_transfer
  1160.  
  1161. The workstation APIs are:
  1162. 4.4.1.    NetWkstaGetInfo 
  1163. NetWkstaGetInfo returns information about the configuration elements for a workstation. 
  1164. Privilege Level
  1165. Privilege requirements are described with the data structures for the infolevels above.
  1166. NET_API_STATUS NET_API_FUNCTION
  1167. NetWkstaGetInfo (
  1168.     IN LPWSTR servername OPTIONAL,
  1169.     IN DWORD level,
  1170.     OUT LPBYTE * bufptr
  1171.     );
  1172. Parameters:
  1173.  
  1174. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1175. level __Level of information required. 100, 101, 102, 302, 402 and 502 are valid.
  1176. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1177. 4.4.2.    NetWkstaSetInfo 
  1178. NetWkstaSetInfo configures a workstation. This information is stored such that it remains in effect after the system has been reinitialized.
  1179. Privilege Level
  1180. Admin privilege is required to successfully execute NetWkstaSetInfo.
  1181. NET_API_STATUS NET_API_FUNCTION
  1182. NetWkstaSetInfo (
  1183.     IN LPWSTR servername OPTIONAL,
  1184.     IN DWORD level,
  1185.     IN LPBYTE buf,
  1186.     OUT LPDWORD parm_err OPTIONAL
  1187.     );
  1188. Parameters:
  1189.  
  1190. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1191. level __Level of information to set. 100, 101, 102, 201, 202, 302, 402, and 502 are valid. In addition, 1010 - 1013, 1018, 1023, 1027, 1028, 1032, 1033, 1035, and 1041-1062 are valid based on the restrictions mentioned above.
  1192. buf __A pointer to a buffer containing the wksta information. 
  1193. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  1194. The WkstaUser APIs are:
  1195. 4.4.3.    NetWkstaUserGetInfo 
  1196. NetWkstaUserGetInfo returns the user-specific information about the configuration elements for a workstation. 
  1197. Privilege Level
  1198. Privilege requirements are described with the data structures for the infolevels above. This API only works locally. 
  1199. NET_API_STATUS NET_API_FUNCTION
  1200. NetWkstaUserGetInfo (
  1201.     IN LPWSTR reserved,
  1202.     IN DWORD level,
  1203.     OUT LPBYTE * bufptr
  1204.     );
  1205. Parameters:
  1206.  
  1207. reserved __This field must be set to zero.
  1208. level __Level of information required. 0 and 1 are valid.
  1209. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1210. 4.4.4.    NetWkstaUserSetInfo 
  1211. NetWkstaUserSetInfo sets the user-specific information about the configuration elements for a workstation. 
  1212. Privilege Level
  1213. Privilege requirements are described with the data structures for the infolevels above. This API only works locally. 
  1214. NET_API_STATUS NET_API_FUNCTION
  1215. NetWkstaUserSetInfo (
  1216.     IN LPWSTR reserved,
  1217.     IN DWORD level,
  1218.     OUT LPBYTE * bufptr.
  1219.     OUT LPDWORD parm_err  OPTIONAL
  1220.     );
  1221. Parameters:
  1222.  
  1223. reserved __This field must be set to zero.
  1224. level __Level of information required. 0 and 1 are valid.
  1225. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1226. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  1227. 4.4.5.    NetWkstaUserEnum 
  1228. NetWkstaUserEnum lists information about all current users on the workstation. 
  1229. Privilege Level
  1230. Admin privilege is required to successfully execute NetWkstaUserEnum both locally and on a remote server.
  1231. NET_API_STATUS NET_API_FUNCTION
  1232. NetWkstaUserEnum (
  1233.     IN LPWSTR servername OPTIONAL,
  1234.     IN DWORD level,
  1235.     OUT LPBYTE * bufptr,
  1236.     IN DWORD prefmaxlen,
  1237.     OUT LPDWORD entriesread,
  1238.     OUT LPDWORD totalentries,
  1239.     IN OUT LPDWORD resumehandle OPTIONAL
  1240.     );
  1241. Parameters:
  1242.  
  1243. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1244. level __Level of information provided. Must be 0 or 1. 
  1245. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1246. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1247. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1248. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1249. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing use search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  1250. 4.5.    Use APIs
  1251. The WNetAddConnection(2) and WNetCancelConnection(2) APIs should be used instead of the NetUse APIs.
  1252. Use API functions examine or control connections (uses) between workstations and servers. Connections are distinguished from sessions: a session is established the first time a workstation makes a connection to a shared resource on the server; all further connections between the workstation and the server are part of this same session until the session ends. Two types of connections can be made: devicename connections (which can only be explicit) and universal-naming convention (UNC) connections (which can be explicit or implicit). 
  1253. Connections are made on a per user basis.  A connection made by a user is deleted when that user logs off.  For this reason the NetUse API are local only, since a connection set up by a remote user would not be accessible to any other users, even the user that was interactively logged onto that machine.
  1254. NetUseAdd creates a devicename connection or an explicit UNC connection. Implicit UNC connections are made by the function responsible for the connection. 
  1255. NetUseAdd establishes an explicit connection between the local computer and a resource shared on a server by redirecting a local devicename to the sharename of a remote server resource (\\servername\sharename). Once a devicename connection is made, users or applications can use the remote resource by specifying the local devicename. To establish an implicit UNC connection, an application passes the sharename of a resource to any function that accepts UNC pathnames.. The function accepts the UNC name and makes a connection to the specified sharename. All further requests on this connection require the full sharename.
  1256. NetUseDel ends a connection to a shared resource. NetUseEnum enumerates all current connections between the local computer and resources on remote servers. NetUseGetInfo returns information about a connection to a shared resource.
  1257. The Use APIs are available at three information levels.
  1258. typedef struct _USE_INFO_0 {
  1259.     LPWSTR        ui0_local;
  1260.     LPWSTR        ui0_remote;
  1261. } USE_INFO_0, *PUSE_INFO_0, *LPUSE_INFO_0;
  1262. typedef struct _USE_INFO_1 {
  1263.     LPWSTR        ui1_local;
  1264.     LPWSTR        ui1_remote;
  1265.     LPWSTR        ui1_password;
  1266.     DWORD        ui1_status;
  1267.     DWORD        ui1_asg_type;
  1268.     DWORD        ui1_refcount;
  1269.     DWORD        ui1_usecount;
  1270. } USE_INFO_1, *PUSE_INFO_1, *LPUSE_INFO_1;
  1271. Infolevel 2 is not available if the API is remoted to a downlevel system - ERROR_NOT_SUPPORTED will be returned in that case.
  1272. typedef struct _USE_INFO_2 {
  1273.     LPWSTR        ui2_local;
  1274.     LPWSTR        ui2_remote;
  1275.     LPWSTR        ui2_password;
  1276.     DWORD        ui2_status;
  1277.     DWORD        ui2_asg_type;
  1278.     DWORD        ui2_refcount;
  1279.     DWORD        ui2_usecount;
  1280.     LPWSTR        ui2_username;
  1281.     LPWSTR        ui2_domainname;
  1282. } USE_INFO_2, *PUSE_INFO_2, *LPUSE_INFO_2;
  1283. The use APIs are:
  1284. 4.5.1.    NetUseAdd 
  1285. WNetAddConnection(2) should be used in place of NetUseAdd.  
  1286. NetUseAdd establishes a connection between a local or NULL devicename and a shared resource by redirecting the local or NULL (UNC) devicename to the shared resource. 
  1287. NET_API_STATUS NET_API_FUNCTION
  1288. NetUseAdd (
  1289.     IN LPWSTR reserved OPTIONAL,
  1290.     IN DWORD level,
  1291.     IN LPBYTE buf,
  1292.     OUT LPDWORD parm_err OPTIONAL
  1293.     );
  1294. Parameters:
  1295.  
  1296. reserved __Must be NULL.
  1297. level __Level of information to set. 1 and 2 are valid.
  1298. buf __A pointer to a buffer containing the use information structure. 
  1299. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  1300. 4.5.2.    NetUseDel 
  1301. WNetCancelConnection(2) should be used in place of NetUseDel.
  1302. NetUseDel ends a connection to a shared resource. 
  1303. Privilege Level
  1304. This API cannot be executed on a remote server.
  1305. NET_API_STATUS NET_API_FUNCTION
  1306. NetUseDel (
  1307.     IN LPWSTR reserved OPTIONAL,
  1308.     IN LPWSTR usename,
  1309.     IN DWORD ucond
  1310.     );
  1311. Parameters:
  1312.  
  1313. reserved __Must be NULL.
  1314. usename __A pointer to an UNICODE string containing the path of the use to delete.
  1315. ucond __Level of force to use in deleting the use.
  1316. 4.5.3.    NetUseEnum 
  1317. WNetEnumResource should be used in place of NetUseEnum.
  1318. NetUseEnum lists all current connections between the local computer and resources on remote servers. 
  1319. Privilege Level
  1320. This API cannot be executed on a remote server.
  1321. NET_API_STATUS NET_API_FUNCTION
  1322. NetUseEnum (
  1323.     IN LPWSTR reserved OPTIONAL,
  1324.     IN DWORD level,
  1325.     OUT LPBYTE * bufptr,
  1326.     IN DWORD prefmaxlen,
  1327.     OUT LPDWORD entriesread,
  1328.     OUT LPDWORD totalentries,
  1329.     IN OUT LPDWORD resumehandle OPTIONAL
  1330.     );
  1331. Parameters:
  1332.  
  1333. reserved __Must be NULL.
  1334. level __Level of information provided. Must be 0, 1 or 2. 
  1335. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1336. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1337. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1338. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1339. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing use search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  1340. 4.5.4.    NetUseGetInfo 
  1341. WNetGetConnection should be used in place of NetUseGetInfo.
  1342. NetUseGetInfo retrieves information about a connection to a shared resource. 
  1343. NET_API_STATUS NET_API_FUNCTION
  1344. NetUseGetInfo (
  1345.     IN LPWSTR reserved OPTIONAL,
  1346.     IN LPWSTR usename,
  1347.     IN DWORD level,
  1348.     OUT LPBYTE * bufptr
  1349.     );
  1350. Parameters:
  1351.  
  1352. reserved __Must be NULL.
  1353. usename __A pointer to an UNICODE string containing the local or remote name active use to return information on.
  1354. level __Level of information required. 0, 1 and 2 are valid.
  1355. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1356. 4.6.    Share APIs
  1357. Share API functions control shared resources. A shared resource is a local resource on a server (for example, a disk directory, print device, or named pipe) that can be accessed by users and applications on the network.
  1358. NetShareAdd allows a user or application to share a resource of a specific type using  the specified sharename. NetShareAdd requires the sharename and local devicename to share the resource. A user or application must have an account on the server to access the resource. 
  1359. LAN Manager defines three types of special sharenames for interprocess communication (IPC) and remote administration of the server:
  1360.     o    IPC$, reserved for interprocess communication.
  1361.     o    ADMIN$, reserved for remote administration.
  1362.     o    A$, B$, C$ (and other local disk names followed by a dollar sign), assigned to local disk devices.
  1363. Share APIs are available at three information levels.
  1364. typedef struct _SHARE_INFO_0 {
  1365.     LPWSTR        shi0_netname;
  1366. } SHARE_INFO_0, *PSHARE_INFO_0, *LPSHARE_INFO_0;
  1367. typedef struct _SHARE_INFO_1 {
  1368.     LPWSTR        shi1_netname;
  1369.     DWORD        shi1_type;
  1370.     LPWSTR        shi1_remark;
  1371. } SHARE_INFO_1, *PSHARE_INFO_1, *LPSHARE_INFO_1;
  1372.  
  1373. typedef struct _SHARE_INFO_2 {
  1374.     LPWSTR        shi2_netname;
  1375.     DWORD        shi2_type;
  1376.     LPWSTR        shi2_remark;
  1377.     DWORD        shi2_permissions;
  1378.     DWORD        shi2_max_uses;
  1379.     DWORD        shi2_current_uses;
  1380.     LPWSTR        shi2_path;
  1381.     LPWSTR        shi2_passwd;
  1382. } SHARE_INFO_2, *PSHARE_INFO_2, *LPSHARE_INFO_2;
  1383. The following infolevels are only valid for NetShareSetInfo and replace the older way of passing in a Parmnum to set a specific field.
  1384. The following are supported on downlevel systems (i.e. LANMan 2.x) as well: 
  1385. typedef struct _SHARE_INFO_1004 {
  1386.     LPWSTR        shi1004_remark;
  1387. } SHARE_INFO_1004, *PSHARE_INFO_1004, *LPSHARE_INFO_1004;
  1388. typedef struct _SHARE_INFO_1006 {
  1389.     DWORD        shi1006_max_uses;
  1390. } SHARE_INFO_1006, *PSHARE_INFO_1006, *LPSHARE_INFO_1006;
  1391. For NetShareSetInfo, parmnum values refer to the fields in the share_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  1392.     parmnum value    Field in share_info struct
  1393.     SHI_NETNAME_PARMNUM    shi_netname
  1394.     SHI_TYPE_PARMNUM    shi_type
  1395.     SHI_REMARK_PRAMNUM    shi_remark
  1396.     SHI_PERMISSIONS_PARMNUM    shi_permissions
  1397.     SHI_MAX_USES_PARMNUM    shi_max_uses
  1398.     SHI_CURRENT_USES_PARMNUM    shi_current_uses
  1399.     SHI_PATH_PARMNUM    shi_path
  1400.     SHI_PASSWD_PARMNUM    shi_passwd
  1401. The Share APIs are:
  1402. 4.6.1.    NetShareAdd 
  1403. NetShareAdd shares a server resource. 
  1404. Privilege Level
  1405. Do we still have comm operator and comm device queues?
  1406. This is now sticky, correct?
  1407. Admin privilege or comm, print, or server operator privilege is required to successfully execute NetShareAdd on a remote server or on a computer that has local security  enabled. The print operator can add only printer queues. The comm operator can add  only communication-device queues.
  1408. NET_API_STATUS NET_API_FUNCTION
  1409. NetShareAdd (
  1410.     IN LPWSTR servername OPTIONAL,
  1411.     IN DWORD level,
  1412.     IN LPBYTE buf,
  1413.     OUT LPDWORD parm_err OPTIONAL
  1414.     );
  1415. Parameters:
  1416.  
  1417. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1418. level __Level of information provided. Must be 2.
  1419. buf __A pointer to a buffer containing the share information structure.
  1420. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  1421. 4.6.2.    NetShareEnum 
  1422. WNetEnumResource should be used in place of NetShareEnum.
  1423. NetShareEnum retrieves information about each shared resource on a server. 
  1424. Privilege Level
  1425. Admin privilege or comm, print, or server operator privilege is required to successfully execute NetShareEnum at level 2 on a remote server or on a computer that has local security enabled. No special privilege is required for level 0 or level 1 calls.
  1426. NET_API_STATUS NET_API_FUNCTION
  1427. NetShareEnum (
  1428.     IN LPWSTR servername OPTIONAL,
  1429.     IN DWORD level,
  1430.     OUT LPBYTE * bufptr,
  1431.     IN DWORD prefmaxlen,
  1432.     OUT LPDWORD entriesread,
  1433.     OUT LPDWORD totalentries,
  1434.     IN OUT LPDWORD resumehandle OPTIONAL
  1435.     );
  1436. Parameters:
  1437.  
  1438. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1439. level __Level of information required. 0, 1 and 2 are valid.
  1440. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1441. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1442. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1443. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1444. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing share search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  1445. 4.6.3.    NetShareGetInfo 
  1446. NetShareGetInfo retrieves information about a particular shared resource on a server. 
  1447. Privilege Level
  1448. Admin privilege or comm, print, or server operator privilege is required to successfully execute NetShareGetInfo at level 2 on a remote server or on a computer that has local security enabled. No special privilege is required for level 0 or level 1 calls.
  1449. NET_API_STATUS NET_API_FUNCTION
  1450. NetShareGetInfo (
  1451.     IN LPWSTR servername OPTIONAL,
  1452.     IN LPWSTR netname,
  1453.     IN DWORD level,
  1454.     OUT LPBYTE * bufptr
  1455.     );
  1456. Parameters:
  1457.  
  1458. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1459. netname __A pointer to an UNICODE string containing the netname of the share to return information on.
  1460. level __Level of information required. 0, 1 and 2 are valid.
  1461. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1462. 4.6.4.    NetShareSetInfo 
  1463. NetShareSetInfo sets the parameters of a shared resource. 
  1464. Is this SetInfo also sticky?
  1465. Privilege Level
  1466. Admin privilege or comm, print, or server operator privilege is required to successfully execute NetShareSetInfo on a remote server or on a computer that has local security enabled. The print operator can set information only about printer queues. The comm operator can set information only about communication-device queues.
  1467. NET_API_STATUS NET_API_FUNCTION
  1468. NetShareSetInfo (
  1469.     IN LPWSTR servername OPTIONAL,
  1470.     IN LPWSTR netname,
  1471.     IN DWORD level,
  1472.     IN LPBYTE buf,
  1473.     OUT LPDWORD parm_err OPTIONAL
  1474.     );
  1475. Parameters:
  1476.  
  1477. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1478. netname __A pointer to an UNICODE string containing the netname of the share to set information on.
  1479. level __Level of information to set. 1, 2, 1004 - 1006 and 1009 are valid.  
  1480. buf __A pointer to a buffer containing the share information. 
  1481. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  1482. 4.6.5.    NetShareDel 
  1483. NetShareDel deletes a sharename from a server's list of shared resources, disconnecting all connections to the shared resource. 
  1484. Privilege Level
  1485. Admin privilege or comm, print, or server operator privilege is required to successfully execute NetShareDel on a remote server or on a computer that has local security enabled. The print operator can delete only printer queues. The comm operator can delete only communication-device queues.
  1486. NET_API_STATUS NET_API_FUNCTION
  1487. NetShareDel (
  1488.     IN LPWSTR servername OPTIONAL,
  1489.     IN LPWSTR netname,
  1490.     IN DWORD reserved
  1491.     );
  1492. Parameters:
  1493.  
  1494. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1495. netname __A pointer to an UNICODE string containing the netname of the share to delete.
  1496. reserved __Reserved, must be zero.
  1497. 4.6.6.    NetShareCheck 
  1498. NetShareCheck checks whether or not a server is sharing a device.   
  1499. Privilege Level
  1500. No special privilege level is required to successfully execute NetShareCheck.
  1501. NET_API_STATUS NET_API_FUNCTION
  1502. NetShareCheck (
  1503.     IN LPWSTR servername OPTIONAL,
  1504.     IN LPWSTR device,
  1505.     OUT LPDWORD type
  1506.     );
  1507. Parameters:
  1508.  
  1509. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1510. device __A pointer to an UNICODE string containing the name of the device to check for shared access.
  1511. type __On return the address pointed to by the type parameter contains the type of share the device is offered with. This field is only set if success was returned.
  1512. 4.7.    Session 
  1513. Session API functions control network sessions established between workstations and servers. They require that the Server service be started on the specified server. A session is a link between a workstation and a server. It is established the first time a workstation makes a connection with a shared resource on the server. Until the session ends, all further connections between the workstation and the server are part of this same session. To end a session, an application on the server end of a connection calls NetSessionDel. This deletes all current connections between the workstation and the server. NetSessionEnum returns information about all sessions established for a server. NetSessionGetInfo returns information about a particular session.
  1514. Per-user information is managed by the NetSession APIs via the use of the username parameter. Since there can be multiple users per session, this parameter is necessary in order to access the user-specific information for the session. 
  1515. Session APIs are available at four information levels.
  1516. typedef struct _SESSION_INFO_0 {
  1517.     LPWSTR        sesi0_cname;
  1518. } SESSION_INFO_0, *PSESSION_INFO_0, *LPSESSION_INFO_0;
  1519. typedef struct _SESSION_INFO_1 {
  1520.     LPWSTR         sesi1_cname;
  1521.     LPWSTR         sesi1_username;
  1522.     DWORD        sesi1_num_opens;
  1523.     DWORD        sesi1_time;
  1524.     DWORD        sesi1_idle_time;
  1525.     DWORD        sesi1__flags;
  1526. } SESSION_INFO_1, *PSESSION_INFO_1, *LPSESSION_INFO_1;
  1527. typedef struct _SESSION_INFO_2 {
  1528.     LPWSTR        sesi2_cname;
  1529.     LPWSTR         sesi2_username;
  1530.     DWORD        sesi2_num_opens;
  1531.     DWORD        sesi2_time;
  1532.     DWORD        sesi2_idle_time;
  1533.     DWORD        sesi2_flags;
  1534.     LPWSTR        sesi2_cltype_name;
  1535. } SESSION_INFO_2, *PSESSION_INFO_2, *LPSESSION_INFO_2;
  1536. typedef struct _SESSION_INFO_10 {
  1537.     LPWSTR        sesi10_cname;
  1538.     LPWSTR         sesi10_username;
  1539.     DWORD        sesi10_time;
  1540.     DWORD        sesi10_idle_time;
  1541. } SESSION_INFO_10, *PSESSION_INFO_10, *LPSESSION_INFO_10;
  1542.  
  1543. sesi_username cannot be NULL. sesi1_flags and sesi2_flags can take the following bits:
  1544.     SESS_GUEST    0x00000001
  1545.     SESS_NONENCRYPTION    0x00000002
  1546. The session APIs are:
  1547. 4.7.1.    NetSessionEnum 
  1548. NetSessionEnum provides information about all current sessions. 
  1549. Privilege Level
  1550. Admin privilege or server operator privilege is required to successfully execute NetSessionEnum at level 1 or level 2. No special privilege is required for level 0 or level 10 calls.
  1551. NET_API_STATUS NET_API_FUNCTION
  1552. NetSessionEnum (
  1553.     IN LPWSTR servername OPTIONAL,
  1554.     IN LPWSTR clientname OPTIONAL,
  1555.     IN LPWSTR username OPTIONAL,
  1556.     IN DWORD level,
  1557.     OUT LPBYTE * bufptr,
  1558.     IN DWORD prefmaxlen,
  1559.     OUT LPDWORD entriesread,
  1560.     OUT LPDWORD totalentries,
  1561.     IN OUT LPDWORD resumehandle OPTIONAL
  1562.     );
  1563. Parameters:
  1564.  
  1565. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1566. clientname __A pointer to an UNICODE string containing the name of the computer session for which information is to be returned. A NULL pointer or string specifies that all computer sessions on the server are to be ennumerated.
  1567. username __A pointer to an UNICODE string containing the name of the the user for which to ennumerate the sessions. A NULL pointer or string specifies that sessions for all users are to be ennumerated.
  1568. level __Level of information required. 0, 1, 2 and 10 are valid.
  1569. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1570. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1571. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1572. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1573. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing session search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored.
  1574.  
  1575. 4.7.2.    NetSessionGetInfo 
  1576. NetSessionGetInfo retrieves information about a session established between a particular server and workstation. 
  1577. Privilege Level
  1578. Admin privilege or server operator privilege is required to successfully execute NetSessionGetInfo at level 1 or level 2. No special privilege is required for level 0 or level 10 calls.
  1579. NET_API_STATUS NET_API_FUNCTION
  1580. NetSessionGetInfo (
  1581.     IN LPWSTR servername OPTIONAL,
  1582.     IN LPWSTR clientname,
  1583.     IN LPWSTR username,
  1584.     IN DWORD level,
  1585.     OUT LPBYTE * bufptr
  1586.     );
  1587. Parameters:
  1588.  
  1589. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1590. clientname __A pointer to an UNICODE string containing the name of the computer session for which information is to be returned. This field cannot be NULL.
  1591. username __A pointer to an UNICODE string containing the name of the user whose session information is to be returned. This field cannot be NULL.
  1592. level __Level of information required. 0, 1, 2 and 10 are valid.
  1593. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1594. 4.7.3.    NetSessionDel 
  1595. NetSessionDel ends a session between a server and a workstation. 
  1596. Privilege Level
  1597. Admin privilege or server operator privilege is required to successfully execute NetSessionDel.
  1598. NET_API_STATUS NET_API_FUNCTION
  1599. NetSessionDel (
  1600.     IN LPWSTR servername OPTIONAL,
  1601.     IN LPWSTR clientname,
  1602.     IN LPWSTR username,
  1603.     IN DWORD reserved
  1604.     );
  1605. Parameters:
  1606.  
  1607. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1608. clientname __A pointer to an UNICODE string containing the computer name of the client to disconnect. If clientname is NULL, then all the sessions of the user in username will be deleted on the server specified.
  1609. username __A pointer to an UNICODE string containing the name of the user whose session is to be terminated. A NULL indicates that all users' sessions from the clientname specified are to be terminated.
  1610. reserved __reserved, must be zero.
  1611. 4.8.    Connection APIs
  1612. WNetConnection APIs should be used in place of NetConnection APIs.
  1613. The Connection API function, NetConnectionEnum, lists server connections. A computer accesses a shared resource on a server by means of a connection. A connection is a software link between a computer and a server, made by assigning a  local or NULL devicename to the shared resource on the server. The NetUseAdd  function establishes connections.
  1614. NetConnectionEnum lists information about all connections to a server made by a specified computer, or about all connections made to a specified sharename.
  1615. Connection APIs are available at two information levels:
  1616. typedef struct _CONNECTION_INFO_0 {
  1617.     DWORD        coni0_id;
  1618. } CONNECTION_INFO_0, *PCONNECTION_INFO_0, *LPCONNECTION_INFO_0;
  1619. typedef struct _CONNECTION_INFO_1 {
  1620.     DWORD        coni1_id;
  1621.     DWORD        coni1_type;
  1622.     DWORD        coni1_num_opens;
  1623.     DWORD        coni1_num_users;
  1624.     DWORD        coni1_time;
  1625.     LPWSTR        coni1_username;
  1626.     LPWSTR        coni1_netname;
  1627. } CONNECTION_INFO_1, *PCONNECTION_INFO_1, *LPCONNECTION_INFO_1;
  1628. The connection APIs are:
  1629. 4.8.1.    NetConnectionEnum 
  1630. WNetEnumResource should be used in place of NetConnectionEnum.
  1631. NetConnectionEnum lists all connections made to a shared resource on the server or all connections established from a particular computer. If there is more than one user using this connection, then it is possible to get more than one structure for the same connection, but with different username. 
  1632. Privilege Level
  1633. Admin privilege or server, print, or comm operator privilege is required to successfully execute NetConnectionEnum.
  1634. NET_API_STATUS NET_API_FUNCTION
  1635. NetConnectionEnum (
  1636.     IN LPWSTR servername OPTIONAL,
  1637.     IN LPWSTR qualifier,
  1638.     IN DWORD level,
  1639.     OUT LPBYTE * bufptr,
  1640.     IN DWORD prefmaxlen,
  1641.     OUT LPDWORD entriesread,
  1642.     OUT LPDWORD totalentries,
  1643.     IN OUT LPDWORD resumehandle OPTIONAL
  1644.     );
  1645. Parameters:
  1646.  
  1647. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1648. qualifier __A pointer to an UNICODE string containing a sharename or computername for the connections of interest. If it is a sharename, then all the connections made to that sharename are listed. If it is a computername (i.e. it starts with two backslash characters), then NetConnectionEnum lists all connections made from that computer to the server specified. 
  1649. level __Level of information required. 0 and 1 are valid.
  1650. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1651. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1652. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1653. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1654. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing connection search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  1655. 4.9.    File APIs
  1656. File API functions provide a way to monitor and close the file, device, and pipe resources open on a server. NetFileClose forces a server resource closed. This function can be used when a system error prevents normal closure. NetFileEnum returns information about resources open on a server. A file can be opened one or more times by one or more applications. Each file opening is uniquely identified. NetFileEnum returns an entry for each file opening. NetFileGetInfo returns information about one particular opening of a resource.
  1657. File APIs are available at information levels 2 and 3 only. Levels 0 and 1 are not supported.
  1658. typedef struct _FILE_INFO_2 {
  1659.     DWORD        fi2_id;
  1660. } FILE_INFO_2, *PFILE_INFO_2, *LPFILE_INFO_2;
  1661. typedef struct _FILE_INFO_3 {
  1662.     DWORD        fi3_id;
  1663.     DWORD        fi3_permissions;
  1664.     DWORD        fi3_num_locks;
  1665.     LPWSTR        fi3_pathname;
  1666.     LPWSTR        fi3_username;
  1667. } FILE_INFO_3, *PFILE_INFO_3, *LPFILE_INFO_3;
  1668. The file APIs are:
  1669. 4.9.1.    NetFileEnum
  1670. NetFileEnum supplies information about some or all open files on a server, allowing the user to supply a resume handle and get required information through repeated calls to the function. 
  1671. Privilege Level
  1672. Admin privilege or server operator privilege is required to successfully execute NetFileEnum.
  1673. NET_API_STATUS NET_API_FUNCTION
  1674. NetFileEnum (
  1675.     IN LPWSTR servername OPTIONAL,
  1676.     IN LPWSTR basepath,
  1677.     IN LPWSTR username,
  1678.     IN DWORD level,
  1679.     OUT LPBYTE * bufptr,
  1680.     IN DWORD prefmaxlen,
  1681.     OUT LPDWORD entriesread,
  1682.     OUT LPDWORD totalentries,
  1683.     IN OUT LPDWORD resumehandle OPTIONAL
  1684.     );
  1685. Parameters:
  1686.  
  1687. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1688. basepath __A pointer to an UNICODE string containing a qualifier for the returned information. If NULL then all open resources are enumerated, else only resources which have basepath as a prefix are enumerated. A prefix is the path component up to a back-slash. 
  1689. username __A pointer to an UNICODE string that specifies the name of the user. If not NULL, username serves as a qualifier to the ennumeration. The files returned are limited to those that have usernames matching the qualifier. If username is NULL, no username qualifier is used.
  1690. level __Level of information required. 2 and 3 are valid.
  1691. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1692. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1693. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1694. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1695. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing file search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  1696.  
  1697. 4.9.2.    NetFileGetInfo 
  1698. NetFileGetInfo retrieves information about a particular opening of a server resource.
  1699. Privilege Level
  1700. Admin privilege or server operator privilege is required to successfully execute NetFileGetInfo.
  1701. NET_API_STATUS NET_API_FUNCTION
  1702. NetFileGetInfo (
  1703.     IN LPWSTR servername OPTIONAL,
  1704.     IN DWORD fileid,
  1705.     IN DWORD level,
  1706.     OUT LPBYTE * bufptr
  1707.     );
  1708. Parameters:
  1709.  
  1710. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1711. fileid __The fileid of the open resource to return information on. The fileid value must be that returned in a previous enumeration call.
  1712. level __Level of information required. 2 and 3 are valid.
  1713. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1714. 4.9.3.    NetFileClose
  1715. NetFileClose forces a resource to close. This function can be used when an error prevents closure by other means. 
  1716. Privilege Level
  1717. Admin privilege or server operator privilege is required to successfully execute NetFileClose.
  1718. NET_API_STATUS NET_API_FUNCTION
  1719. NetFileClose (
  1720.     IN LPWSTR servername OPTIONAL,
  1721.     IN DWORD fileid
  1722.     );
  1723. Parameters:
  1724.  
  1725. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1726. fileid __The fileid of the opened resource instance to be closed.
  1727. 4.10.    Message APIs
  1728. Message API functions send and receive messages and manipulate message aliases. A message is a buffer of text data sent to a user or application on the network. To receive a message, a user or application must register a message alias in a computer's table of message names. This can be done by using NetMessageNameAdd. A message name table contains a list of registered message aliases (users and applications) permitted to receive messages.
  1729. The aliases registered in the message name table are case insensitive. NetMessageNameDel deletes a specific message alias from the message name table. NetMessageNameEnum lists all the aliases stored in the message name table. NetMessageNameGetInfo retrieves information about a particular message alias in the message name table.
  1730. To send a message, an application calls NetMessageBufferSend.
  1731. Applications can also send broadcast messages to all users in a domain or to all computers on a network using NetMessageBufferSend.
  1732. Message APIs are available at two information levels.
  1733. MSG_INFO_1 only exists for compatability. The NT messenger will not forward names or allow names to be forwarded to it.
  1734. typedef struct _MSG_INFO_0 {
  1735.     LPWSTR        msgi0_name;
  1736. } MSG_INFO_0, *PMSG_INFO_0, *LPMSG_INFO_0;
  1737. typedef struct _MSG_INFO_1 {
  1738.     LPWSTR        msgi1_name;
  1739.     DWORD        msgi1_forward_flag;
  1740.     LPWSTR        msgi1_forward;
  1741. } MSG_INFO_1, *PMSG_INFO_1, *LPMSG_INFO_1;
  1742. The Message APIs are:
  1743. 4.10.1.    NetMessageNameAdd  
  1744. NetMessageNameAdd registers a message alias in the message name table. NetMessageNameAdd requires that the Messenger service be started. 
  1745. Privilege Level
  1746. Admin privilege is required to successfully execute NetMessageNameAdd on a remote server.
  1747. NET_API_STATUS NET_API_FUNCTION
  1748. NetMessageNameAdd (
  1749.     IN LPWSTR servername OPTIONAL,
  1750.     IN LPWSTR msgname
  1751.     };
  1752. Parameters:
  1753.  
  1754. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1755. msgname __A pointer to an UNICODE string of limit 15 characters containing the message name to be added.
  1756. Note. The forward action flag from the LANMan 2.x NetMessageNameAdd is no longer a parameter as message forwarding is no longer supported. If the NetMessageNameAdd API detects that a forwarded version of msgname exists on the network then the API will fail with error NERR_Already_Exists.
  1757. 4.10.2.    NetMessageNameEnum  
  1758. NetMessageNameEnum lists the message aliases that will receive messages on a specified computer. NetMessageNameEnum requires that the Messenger service be started. 
  1759. Privilege Level
  1760. Admin privilege is required to successfully execute NetMessageNameEnum on a remote server.
  1761. NET_API_STATUS NET_API_FUNCTION
  1762. NetMessageNameEnum (
  1763.     IN LPWSTR servername OPTIONAL,
  1764.     IN DWORD level,
  1765.     OUT LPBYTE * bufptr,
  1766.     IN DWORD prefmaxlen,
  1767.     OUT LPDWORD entriesread,
  1768.     OUT LPDWORD totalentries,
  1769.     IN OUT LPDWORD resumehandle OPTIONAL
  1770.     );
  1771. Parameters:
  1772.  
  1773. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1774. level __Level of information required. 0 and 1 are valid.
  1775. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1776. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  1777. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  1778. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  1779. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing message name search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  1780. 4.10.3.    NetMessageNameGetInfo  
  1781. NetMessageNameGetInfo retrieves information about a particular message alias in the message name table. NetMessageNameGetInfo requires that the Messenger service be started. 
  1782. Privilege Level
  1783. Admin privilege is required to successfully execute NetMessageNameGetInfo on a remote server.
  1784. NET_API_STATUS NET_API_FUNCTION
  1785. NetMessageNameGetInfo (
  1786.     IN LPWSTR servername OPTIONAL,
  1787.     IN LPWSTR msgname,
  1788.     IN DWORD level,
  1789.     OUT LPBYTE * bufptr
  1790.     );
  1791. Parameters:
  1792.  
  1793. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1794. msgname __A pointer to an UNICODE string containing the message name to return information on.
  1795. level __Level of information required. 0 & 1 are valid.
  1796. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1797. 4.10.4.    NetMessageNameDel  
  1798. NetMessageNameDel deletes a message alias from the table of message aliases on a computer. NetMessageNameDel requires that the Messenger service be started. 
  1799. Privilege Level
  1800. Admin privilege is required to successfully execute NetMessageNameDel on a remote server.
  1801. NET_API_STATUS NET_API_FUNCTION
  1802. NetMessageNameDel (
  1803.     IN LPWSTR servername OPTIONAL,
  1804.     IN LPWSTR msgname
  1805.     );
  1806. Parameters:
  1807.  
  1808. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1809. msgname __A pointer to an UNICODE string of limit 15 characters containing the message name to be deleted.
  1810. 4.10.5.    NetMessageBufferSend  
  1811. NetMessageBufferSend sends a buffer of information to a registered message alias. 
  1812. Privilege Level
  1813. No special privilege is required to execute NetMessage buffer send locally. Admin, accounts, print, or server operator privilege is required to successfully execute NetMessageBufferSend on a remote server.
  1814. NET_API_STATUS NET_API_FUNCTION
  1815. NetMessageBufferSend (
  1816.     IN LPWSTR servername OPTIONAL,
  1817.     IN LPWSTR msgname,
  1818.     IN LPWSTR fromname,
  1819.     IN LPBYTE buf,
  1820.     IN DWORD buflen
  1821.     );
  1822. Parameters:
  1823.  
  1824. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1825. msgname __A pointer to an UNICODE string containing the message name to which the message buffer should be sent.
  1826. fromname __A pointer to an UNICODE string containing the message name sending the information. fromname is a new parameter for Windows networking. This parameter is needed for sending alerts from the computer name rather than the logged on user. If a NULL is specified the message is send from the logged on user as with LANMan 2.x.
  1827. buf __A pointer to a buffer of message text.
  1828. buflen __The length in bytes of the message text in buf.
  1829. 4.11.    Remote Utility API
  1830. Remote Utility API functions enable applications to access the time-of-day information on a remote server.
  1831. NetRemoteTOD returns time-of-day information from a remote server.
  1832. 4.11.1.    NetRemoteTOD API
  1833. The remote time of day information is available at one information level:
  1834. typedef struct _TIME_OF_DAY_INFO {
  1835.     DWORD        tod_elapsedt;
  1836.     DWORD        tod_msecs;
  1837.     DWORD        tod_hours;
  1838.     DWORD        tod_mins;
  1839.     DWORD        tod_secs;
  1840.     DWORD        tod_hunds;
  1841.     LONG            tod_timezone;
  1842.     DWORD        tod_tinterval;
  1843.     DWORD        tod_day;
  1844.     DWORD        tod_month;
  1845.     DWORD        tod_year;
  1846.     DWORD        tod_weekday;
  1847. } TIME_OF_DAY_INFO, *PTIME_OF_DAY_INFO, *LPTIME_OF_DAY_INFO;
  1848. NetRemoteTOD returns a server's time of day. 
  1849. Privilege Level
  1850. No special privilege level is required to successfully execute NetRemoteTOD.
  1851. NET_API_STATUS NET_API_FUNCTION
  1852. NetRemoteTOD (
  1853.     IN LPWSTR servername OPTIONAL,
  1854.     OUT LPBYTE * bufptr
  1855.     );
  1856. Parameters:
  1857.  
  1858. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  1859. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  1860. 4.12.    Security Account APIs
  1861. 4.12.1.    User APIs
  1862. User API functions control a user's account in the security database. Each user or application that accesses resources must have an account in the security database. The NT Security system (SAM)  uses this user account to verify that the user or application has permission to use a resource. When a user or an application requests access to a resource, the security system checks for an appropriate user account or group account to permit the access.
  1863. NetUserEnum can be used to list all user accounts in a domain. An application can change a user's privilege level by calling NetUserSetInfo. It can also change the user's resource access privileges by modifying that user's groups (for more information, see the Group category API functions). Individually assigned user privileges take precedence over group privileges. An application can verify the groups to which a user belongs by calling NetUserGetGroups, which returns a list of  global groupnames.  The NetUserGetLocalGroups function does the same for local groups. When a user account is no longer needed, use NetUserDel to delete the account from the server. Once the account is removed, the user can no longer access the server, except by using the guest account.  Because the user's password is confidential, it is not returned by NetUserEnum or NetUserGetInfo. The password is initially assigned when NetUserAdd is called. NetUserSetInfo sets the password and other elements of a user account. 
  1864. User account information is available at five levels:
  1865. typedef struct _USER_INFO_0 {
  1866.     LPWSTR        usri0_name;
  1867. } USER_INFO_0, *PUSER_INFO_0, *LPUSER_INFO_0;
  1868. typedef struct _USER_INFO_1 {
  1869.     LPWSTR        usri1_name;
  1870.     LPWSTR        usri1_password;
  1871.     DWORD        usri1_password_age;
  1872.     DWORD        usri1_priv;
  1873.     LPWSTR        usri1_home_dir;
  1874.     LPWSTR        usri1_comment;
  1875.     DWORD        usri1_flags;
  1876.     LPWSTR        usri1_script_path;
  1877. } USER_INFO_1, *PUSER_INFO_1, *LPUSER_INFO_1;
  1878. typedef struct _USER_INFO_2 {
  1879.     LPWSTR        usri2_name;
  1880.     LPWSTR        usri2_password;
  1881.     DWORD        usri2_password_age;
  1882.     DWORD        usri2_priv;
  1883.     LPWSTR        usri2_home_dir;
  1884.     LPWSTR        usri2_comment;
  1885.     DWORD        usri2_flags;
  1886.     LPWSTR        usri2_script_path;
  1887.     DWORD        usri2_auth_flags;
  1888.     LPWSTR        usri2_full_name;
  1889.     LPWSTR        usri2_usr_comment;
  1890.     LPWSTR        usri2_parms;
  1891.     LPWSTR        usri2_workstations;
  1892.     DWORD        usri2_last_logon;
  1893.     DWORD        usri2_last_logoff;
  1894.     DWORD        usri2_acct_expires;
  1895.     DWORD        usri2_max_storage;
  1896.     DWORD        usri2_units_per_week;
  1897.     LPBYTE        usri2_logon_hours;
  1898.     DWORD        usri2_bad_pw_count;
  1899.     DWORD        usri2_num_logons;
  1900.     LPWSTR        usri2_logon_server;
  1901.     DWORD        usri2_country_code;
  1902.     DWORD        usri2_code_page;
  1903. } USER_INFO_2, *PUSER_INFO_2, *LPUSER_INFO_2;
  1904. typedef struct _USER_INFO_3 {
  1905.      LPWSTR           usri3_name;
  1906.     LPWSTR           usri3_password;
  1907.     DWORD            usri3_password_age;
  1908.     DWORD            usri3_priv;
  1909.     LPWSTR           usri3_home_dir;
  1910.     LPWSTR           usri3_comment;
  1911.     DWORD            usri3_flags;
  1912.     LPWSTR           usri3_script_path;
  1913.     DWORD            usri3_auth_flags;
  1914.     LPWSTR           usri3_full_name;
  1915.     LPWSTR           usri3_usr_comment;
  1916.     LPWSTR           usri3_parms;
  1917.     LPWSTR           usri3_workstations;
  1918.     DWORD            usri3_last_logon;
  1919.     DWORD            usri3_last_logoff;
  1920.     DWORD            usri3_acct_expires;
  1921.     DWORD            usri3_max_storage;
  1922.     DWORD            usri3_units_per_week;
  1923.     PBYTE            usri3_logon_hours;
  1924.     DWORD            usri3_bad_pw_count;
  1925.     DWORD            usri3_num_logons;
  1926.     LPWSTR           usri3_logon_server;
  1927.     DWORD            usri3_country_code;
  1928.     DWORD            usri3_code_page;
  1929.     DWORD            usri3_user_id;
  1930.     DWORD            usri3_primary_group_id;
  1931.     LPWSTR           usri3_profile;
  1932.     LPWSTR           usri3_home_dir_drive;
  1933.     DWORD            usri3_password_expired;
  1934. }USER_INFO_3, *PUSER_INFO_3, *LPUSER_INFO_3;
  1935.  
  1936. typedef struct _USER_INFO_10 {
  1937.     LPWSTR        usri10_name;
  1938.     LPWSTR        usri10_comment;
  1939.     LPWSTR        usri10_usr_comment;
  1940.     LPWSTR        usri10_full_name;
  1941. } USER_INFO_10, *PUSER_INFO_10, *LPUSER_INFO_10;
  1942. typedef struct _USER_INFO_11 {
  1943.     LPWSTR        usri11_name;
  1944.     LPWSTR        usri11_comment;
  1945.     LPWSTR        usri11_usr_comment;
  1946.     LPWSTR        usri11_full_name;
  1947.     DWORD        usri11_priv;
  1948.     DWORD        usri11_auth_flags;
  1949.     DWORD        usri11_password_age;
  1950.     LPWSTR        usri11_home_dir;
  1951.     LPWSTR        usri11_parms;
  1952.     DWORD        usri11_last_logon;
  1953.     DWORD        usri11_last_logoff;
  1954.     DWORD        usri11_bad_pw_count;
  1955.     DWORD        usri11_num_logons;
  1956.     LPWSTR        usri11_logon_server;
  1957.     DWORD        usri11_country_code;
  1958.     LPWSTR        usri11_workstations;
  1959.     DWORD        usri11_max_storage;
  1960.     DWORD        usri11_units_per_week;
  1961.     LPBYTE        usri11_logon_hours;
  1962.     DWORD        usri11_code_page;
  1963. } USER_INFO_11, *PUSER_INFO_11, *LPUSER_INFO_11;
  1964. typedef struct _USER_INFO_20 {
  1965.     LPWSTR           usri20_name;
  1966.     LPWSTR           usri20_full_name;
  1967.     LPWSTR           usri20_comment;
  1968.     DWORD            usri20_flags;
  1969.     DWORD            usri20_user_id;
  1970. }USER_INFO_20, *PUSER_INFO_20, *LPUSER_INFO_20;
  1971.  
  1972. The following infolevels are only valid for NetUserSetInfo and replace the older way of passing in a Parmnum to set a specific field.
  1973. The following are supported on downlevel systems (i.e. LANMan 2.x) as well: 
  1974. typedef struct _USER_INFO_1003 {
  1975.     LPWSTR        usri1003_password;
  1976. } USER_INFO_1003, *PUSER_INFO_1003, *LPUSER_INFO_1003;
  1977. typedef struct _USER_INFO_1005 {
  1978.     DWORD        usri1005_priv;
  1979. } USER_INFO_1005, *PUSER_INFO_1005, *LPUSER_INFO_1005;
  1980. typedef struct _USER_INFO_1006 {
  1981.     LPWSTR        usri1006_home_dir;
  1982. } USER_INFO_1006, *PUSER_INFO_1006, *LPUSER_INFO_1006;
  1983. typedef struct _USER_INFO_1007 {
  1984.     LPWSTR        usri1007_comment;
  1985. } USER_INFO_1007, *PUSER_INFO_1007, *LPUSER_INFO_1007;
  1986. typedef struct _USER_INFO_1008 {
  1987.     DWORD        usri1008_flags;
  1988. } USER_INFO_1008, *PUSER_INFO_1008, *LPUSER_INFO_1008;
  1989. typedef struct _USER_INFO_1009 {
  1990.     LPWSTR        usri1009_script_path;
  1991. } USER_INFO_1009, *PUSER_INFO_1009, *LPUSER_INFO_1009;
  1992. typedef struct _USER_INFO_1010 {
  1993.     DWORD        usri1010_auth_flags;
  1994. } USER_INFO_1010, *PUSER_INFO_1010, *LPUSER_INFO_1010;
  1995. typedef struct _USER_INFO_1011 {
  1996.     LPWSTR        usri1011_full_name;
  1997. } USER_INFO_1011, *PUSER_INFO_1011, *LPUSER_INFO_1011;
  1998. typedef struct _USER_INFO_1012 {
  1999.     LPWSTR        usri1012_usr_comment;
  2000. } USER_INFO_1012, *PUSER_INFO_1012, *LPUSER_INFO_1012;
  2001. typedef struct _USER_INFO_1013 {
  2002.     LPWSTR        usri1013_parms;
  2003. } USER_INFO_1013, *PUSER_INFO_1013, *LPUSER_INFO_1013;
  2004. typedef struct _USER_INFO_1014 {
  2005.     LPWSTR        usri1014_workstations;
  2006. } USER_INFO_1014, *PUSER_INFO_1014, *LPUSER_INFO_1014;
  2007. typedef struct _USER_INFO_1017 {
  2008.     DWORD        usri1017_acct_expires;
  2009. } USER_INFO_1017, *PUSER_INFO_1017, *LPUSER_INFO_1017;
  2010. typedef struct _USER_INFO_1018 {
  2011.     DWORD        usri1018_max_storage;
  2012. } USER_INFO_1018, *PUSER_INFO_1018, *LPUSER_INFO_1018;
  2013. typedef struct _USER_INFO_1020 {  
  2014.     DWORD           usri1020_units_per_week;
  2015.     LPBYTE        usri1020_logon_hours;
  2016. } USER_INFO_1020, *PUSER_INFO_1020, *LPUSER_INFO_1020;
  2017. typedef struct _USER_INFO_1023 {
  2018.     LPWSTR        usri1023_logon_server;
  2019. } USER_INFO_1023, *PUSER_INFO_1023, *LPUSER_INFO_1023;
  2020. typedef struct _USER_INFO_1024 {
  2021.     DWORD        usri1024_country_code;
  2022. } USER_INFO_1024, *PUSER_INFO_1024, *LPUSER_INFO_1024;
  2023. typedef struct _USER_INFO_1025 {
  2024.     DWORD        usri1025_code_page;
  2025. } USER_INFO_1025, *PUSER_INFO_1025, *LPUSER_INFO_1025;
  2026. typedef struct _USER_INFO_1051 {
  2027.      DWORD           usri1051_primary_group_id;
  2028. } USER_INFO_1051, *PUSER_INFO_1051, *LPUSER_INFO_1051;
  2029.  
  2030. typedef struct _USER_INFO_1052 {
  2031.     LPWSTR          usri1052_profile;
  2032. } USER_INFO_1052, *PUSER_INFO_1052, *LPUSER_INFO_1052;
  2033.  
  2034. typedef struct _USER_INFO_1053 {
  2035.     LPWSTR          usri1053_home_dir_drive;
  2036. } USER_INFO_1053, *PUSER_INFO_1053, *LPUSER_INFO_1053;
  2037. For NetUserSetInfo, parmnum values refer to the fields in the user_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  2038.     parmnum value    Field in user_info struct
  2039.     USER_NAME_PARMNUM                usri_name
  2040.     USER_PASSWORD_PARMNUM                usri_password
  2041.     USER_PASSWORD_AGE_PARMNUM            usri_password_age
  2042.     USER_PRIV_PARMNUM                usri_priv
  2043.     USER_HOME_DIR_PARMNUM                usri_home_dir
  2044.     USER_COMMENT_PARMNUM                usri_comment
  2045.     USER_FLAGS_PARMNUM                usri_flags
  2046.     USER_SCRIPT_PATH_PARMNUM            usri_script_path
  2047.     USER_AUTH_FLAGS_PARMNUM            usri_auth_flags
  2048.     USER_FULL_NAME_PARMNUM            usri_full_name
  2049.     USER_USR_COMMENT_PARMNUM            usri_usr_comment
  2050.     USER_PARMS_PARMNUM                usri_parms
  2051.     USER_WORKSTATIONS_PARMNUM            usri_workstations
  2052.     USER_LAST_LOGON_PARMNUM            usri_last_logon
  2053.     USER_LAST_LOGOFF_PARMNUM            usri_last_logoff
  2054.     USER_ACCT_EXPIRES_PARMNUM            usri_acct_expires
  2055.     USER_MAX_STORAGE_PARMNUM            usri_max_storage
  2056.     USER_UNITS_PER_WEEK_PARMNUM            usri_units_per_week
  2057.     USER_LOGON_HOURS_PARMNUM            usri_logon_hours
  2058.     USER_PAD_PW_COUNT_PARMNUM            usri_bad_pw_count
  2059.     USER_NUM_LOGONS_PARMNUM            usri_num_logons
  2060.     USER_LOGON_SERVER_PARMNUM            usri_logon_server
  2061.     USER_COUNTRY_CODE_PARMNUM            usri_country_code
  2062.     USER_CODE_PAGE_PARMNUM            usri_code_page    USER_PRIMARY_GROUP_PARMNUM                usri_primary_group_id    USER_PROFILE                      usri_profile    USER_HOME_DIR_DRIVE_PARMNUM              usri_home_dir_drive
  2063.  
  2064. 4.12.1.1.    NetUserAdd 
  2065. NetUserAdd adds a user account.
  2066. Privilege Level
  2067. Admin privilege or account operator privilege is required to successfully execute NetUserAdd.
  2068. NET_API_STATUS NET_API_FUNCTION
  2069. NetUserAdd (
  2070.     IN LPWSTR servername OPTIONAL,
  2071.     IN DWORD level,
  2072.     IN LPBYTE buf,
  2073.     OUT LPDWORD parm_err OPTIONAL
  2074.     );
  2075. Parameters:
  2076.  
  2077. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2078. level __Level of information provided. Must be 1, 2 or 3.
  2079. buf __A pointer to a buffer containing the user information structure.
  2080. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2081. 4.12.1.2.    NetUserEnum 
  2082. NetUserEnum provides resumable enumeration of information about each user account in a domain. 
  2083. Privilege Level
  2084. Admin privilege or account operator privilege is required to successfully execute NetUserEnum at levels 1 and 2. No special privilege is required at level 0 or 10.
  2085. NET_API_STATUS NET_API_FUNCTION
  2086. NetUserEnum (
  2087.     IN LPWSTR servername OPTIONAL,
  2088.     IN DWORD level,
  2089.     IN DWORD filter,
  2090.     OUT LPBYTE * bufptr,
  2091.     IN DWORD prefmaxlen,
  2092.     OUT LPDWORD entriesread,
  2093.     OUT LPDWORD totalentries,
  2094.     IN OUT LPDWORD resumehandle OPTIONAL
  2095.     );
  2096. Parameters:
  2097.  
  2098. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2099. level __Level of information required. 0, 1, 2, 3, 10, 11 and 20 are valid.
  2100. filter__Specifies a filter of account types ot enumerate.  0 implies all account types.  Allowable values are:
  2101.  
  2102.             FILTER_TEMP_DUPLICATE_ACCOUNTS
  2103.             FILTER_NORMAL_ACCOUNT
  2104.             FILTER_INTERDOMAIN_TRUST_ACCOUNT
  2105.             FILTER_WORKSTATION_TRUST_ACCOUNT
  2106.             FILTER_SERVER_TRUST_ACCOUNT
  2107.  
  2108. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  2109. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2110. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2111. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2112. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing user search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  2113. 4.12.1.3.    NetUserGetInfo 
  2114. NetUserGetInfo retrieves information about a particular user account on a server. 
  2115. Privilege Level
  2116. Admin privilege or account operator privilege is required to successfully execute NetUserGetInfo at level 1 and 2. No special privilege is required at levels 0 or 10. A user may call NetUserGetInfo on his/her own account at level 11.
  2117. NET_API_STATUS NET_API_FUNCTION
  2118. NetUserGetInfo (
  2119.     IN LPWSTR servername OPTIONAL,
  2120.     IN LPWSTR username,
  2121.     IN DWORD level,
  2122.     OUT LPBYTE * bufptr
  2123.     );
  2124. Parameters:
  2125.  
  2126. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2127. username __A pointer to an UNICODE string containing the name of the user account on which to return information.
  2128. level __Level of information required. 0, 1, 2, 3,10,11 and 20 are valid.
  2129. bufptr __A pointer to the return information structure is returned in the address pointed to by bufptr.
  2130. 4.12.1.4.    NetUserSetInfo 
  2131. NetUserSetInfo sets the parameters of a user account. 
  2132. Privilege Level
  2133. Admin privilege or account operator privilege is required to successfully execute NetUserSetInfo. A user may call NetUserSetInfo to set certain information on his/her own account.
  2134. NET_API_STATUS NET_API_FUNCTION
  2135. NetUserSetInfo (
  2136.     IN LPWSTR servername OPTIONAL,
  2137.     IN LPWSTR username,
  2138.     IN DWORD level,
  2139.     IN LPBYTE buf,
  2140.     OUT LPDWORD parm_err OPTIONAL
  2141.     );
  2142. Parameters:
  2143.  
  2144. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2145. username __A pointer to an UNICODE string containing the name of the user account to set information on.
  2146. level __Level of information to set. 0, 1, 2, 3, or 20.
  2147. buf __A pointer to a buffer containing the user information. 
  2148. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2149. 4.12.1.5.    NetUserDel 
  2150. NetUserDel deletes a user account from the accounts database.
  2151. Privilege Level
  2152. Admin privilege or account operator privilege is required to successfully execute NetUserDel.
  2153. NET_API_STATUS NET_API_FUNCTION
  2154. NetUserDel (
  2155.     IN LPWSTR servername OPTIONAL,
  2156.     IN LPWSTR username
  2157.     );
  2158. Parameters:
  2159.  
  2160. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2161. username __A pointer to an UNICODE string containing the name of the user account to delete
  2162. 4.12.1.6.    NetUserGetGroups 
  2163. NetUserGetGroups retrieves a list of global groups to which a specified user belongs.
  2164. Privilege Level
  2165. Admin privilege or account operator privilege is required to successfully execute NetUserGetGroups.
  2166. NET_API_STATUS NET_API_FUNCTION
  2167. NetUserGetGroups (
  2168.     IN LPWSTR servername OPTIONAL,
  2169.     IN LPWSTR username,
  2170.     IN DWORD level,
  2171.     OUT LPBYTE * bufptr,
  2172.     IN DWORD prefmaxlen,
  2173.     OUT LPDWORD entriesread,
  2174.     OUT LPDWORD totalentries
  2175.     );
  2176. Parameters:
  2177.  
  2178. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2179. username __A pointer to an UNICODE string containing the name of the user to return global group membership for.
  2180. level __Level of information required. Only 0 or 1 are valid.
  2181. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr. The returned information is an array of GROUP_USERS_INFO_x structures..
  2182. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2183. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2184. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2185. 4.12.1.7.    NetUserGetLocalGroups 
  2186. NetUserGetLocalGroups retrieves a list of local groups to which a specified user belongs.
  2187. Privilege Level
  2188. Admin privilege or account operator privilege is required to successfully execute NetUserGetLocalGroups.
  2189. NET_API_STATUS NET_API_FUNCTION
  2190. NetUserGetLocalGroups (
  2191.     IN LPWSTR servername OPTIONAL,
  2192.     IN LPWSTR username,
  2193.     IN DWORD level,
  2194.     IN DWORD flags,
  2195.     OUT LPBYTE * bufptr,
  2196.     IN DWORD prefmaxlen,
  2197.     OUT LPDWORD entriesread,
  2198.     OUT LPDWORD totalentries
  2199.     );
  2200. Parameters:
  2201.  
  2202. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2203. username __A pointer to an UNICODE string containing the name of the user to return global group membership for.
  2204. level __Level of information required. Only 0 is valid.
  2205. flags __Bitmask of flags. Currently, only LG_INCLUDE_INDIRECT is defined. If this bit is set, the function will also return localgroups the user is a member of indirectly (ie. by the virtue of being in a globalgroup that itself is a member of one or more localgroups).
  2206. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr. The returned information is an array of LOCALGROUP_USERS_INFO_0 structures..
  2207. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2208. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2209. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2210. 4.12.1.8.    NetUserSetGroups 
  2211. NetUserSetGroups sets global group memberships for a specified user account.
  2212. Privilege Level
  2213. Admin privilege or account operator privilege is required to successfully execute NetUserSetGroups.
  2214. NET_API_STATUS NET_API_FUNCTION
  2215. NetUserSetGroups (
  2216.     IN LPWSTR servername OPTIONAL,
  2217.     IN LPWSTR username,
  2218.     IN DWORD level,
  2219.     IN LPBYTE bufptr,
  2220.     IN DWORD num_entries
  2221.     );
  2222. Parameters:
  2223.  
  2224. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2225. username __A pointer to an UNICODE string containing the name of the user to set global group memberships for.
  2226. level __Level of information required. Only 0 or 1 are valid.
  2227. bufptr __A pointer to an array of global groups information structures.
  2228. num_entries__Number of global group information structures contained in the array pointed to by bufptr.
  2229. 4.12.2.    User Modal APIS
  2230. The user modal API functions control the system wide parameters which affect the NT Security system behaviour. 
  2231. User modal information is available at three levels
  2232. typedef struct _USER_MODALS_INFO_0 {
  2233.     DWORD        usrmod0_min_passwd_len;
  2234.     DWORD        usrmod0_max_passwd_age;
  2235.     DWORD        usrmod0_min_passwd_age;
  2236.     DWORD        usrmod0_force_logoff;
  2237.     DWORD        usrmod0_password_hist_len;
  2238. } USER_MODALS_INFO_0, *PUSER_MODALS_INFO_0, LPUSER_MODALS_INFO_0;
  2239. typedef struct _USER_MODALS_INFO_1 {
  2240.     DWORD        usrmod1_role;
  2241.     LPWSTR        usrmod1_primary;
  2242. } USER_MODALS_INFO_1, *PUSER_MODALS_INFO_1, *LPUSER_MODALS_INFO_1;
  2243. typedef struct _USER_MODALS_INFO_2 {
  2244.     LPWSTR          usrmod2_domain_name;
  2245.     PSID            usrmod2_domain_id;
  2246. }USER_MODALS_INFO_2, *PUSER_MODALS_INFO_2, *LPUSER_MODALS_INFO_2;
  2247. The following infolevels are only valid for NetUserModalsSet and replace the older way of passing in a Parmnum to set a specific field.
  2248. The following are supported on downlevel systems (i.e. LANMan 2.x) as well. NOTE that the mapping from the old parmnum to the infolevel does not apply to the role and primary fields. 
  2249. typedef struct _USER_MODALS_INFO_1001 {
  2250.     DWORD        usrmod1001_min_passwd_len;
  2251. } USER_MODALS_INFO_1001, *PUSER_MODALS_INFO_1001, *LPUSER_MODALS_INFO_1001;
  2252. typedef struct _USER_MODALS_INFO_1002 {
  2253.     DWORD        usrmod1002_max_passwd_age;
  2254. } USER_MODALS_INFO_1002, *PUSER_MODALS_INFO_1002, *LPUSER_MODALS_INFO_1002;
  2255. typedef struct _USER_MODALS_INFO_1003 {
  2256.      DWORD        usrmod1003_min_passwd_age;
  2257. } USER_MODALS_INFO_1003, *PUSER_MODALS_INFO_1003, *LPUSER_MODALS_INFO_1003;
  2258. typedef struct _USER_MODALS_INFO_1004 {
  2259.     DWORD        usrmod1004_force_logoff;
  2260. } USER_MODALS_INFO_1004, *PUSER_MODALS_INFO_1004, *LPUSER_MODALS_INFO_1004;
  2261. typedef struct _USER_MODALS_INFO_1005 {
  2262.     DWORD        usrmod1005_password_hist_len;
  2263. } USER_MODALS_INFO_1005, *PUSER_MODALS_INFO_1005, *LPUSER_MODALS_INFO_1005;
  2264. typedef struct _USER_MODALS_INFO_1006 {
  2265.     DWORD        usrmod1006_role;
  2266. } USER_MODALS_INFO_1006, *PUSER_MODALS_INFO_1006, *LPUSER_MODALS_INFO_1006;
  2267. typedef struct _USER_MODALS_INFO_1007 {
  2268.     LPWSTR        usrmod1007_primary;
  2269. } USER_MODALS_INFO_1007, *PUSER_MODALS_INFO_1007, *LPUSER_MODALS_INFO_1007;
  2270. For NetUserModalsSet, parmnum values refer to the fields in the modals_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  2271.     parmnum value    Field in modals_info struct
  2272.     MODALS_MIN_PASSWD_LEN_PARMNUM    usrmod_min_passwd_len
  2273.     MODALS_MAX_PASSWD_AGE_PARMNUM    usrmod_max_passwd_age
  2274.     MODALS_MIN_PASSWD_AGE_PARMNUM    usrmod_min_passwd_age
  2275.     MODALS_FORCE_LOGOFF_PARMNUM    usrmod_force_logoff
  2276.     MODALS_PASSWD_HIST_LIST_PARMNUM    usrmod_passwd_hist_list
  2277.     MODALS_ROLE_PARMNUM    usrmod_role
  2278.     MODALS_PRIMARY_PARMNUM    usrmod_primary    MODALS_DOMAIN_NAME_PARMNUM        usrmod_domain_name                  MODALS_DOMAIN_ID_PARMNUM            usrmod_domain_id
  2279. The User Modal APIs are:
  2280. 4.12.2.1.    NetUserModalsGet
  2281. NetUserModalsGet retrieves global information for all users and global groups in the user account database.
  2282. Privilege Level
  2283. Admin privilege or account operator privilege is required to successfully execute NetUserModalsGetInfo.
  2284. NET_API_STATUS NET_API_FUNCTION
  2285. NetUserModalsGet (
  2286.     IN LPWSTR servername OPTIONAL,
  2287.     IN DWORD level,
  2288.     OUT LPBYTE * bufptr
  2289.     );
  2290. Parameters:
  2291.  
  2292. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2293. level__Level of information required. 0 1, and 2 are valid.
  2294. bufptr __A pointer to the return information structure is returned in the address pointed to by bufptr.
  2295. 4.12.2.2.    NetUserModalsSet 
  2296. NetUserModalsSet sets global information for all users and global groups in the user account database.
  2297. Privilege Level
  2298. Admin privilege or account operator privilege is required to successfully execute NetUserModalsSet.
  2299. NET_API_STATUS NET_API_FUNCTION
  2300. NetUserModalsSet (
  2301.     IN LPWSTR servername OPTIONAL,
  2302.     IN DWORD level,
  2303.     IN LPBYTE buf,
  2304.     OUT LPDWORD parm_err OPTIONAL
  2305.     );
  2306. Parameters:
  2307.  
  2308. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2309. username __A pointer to an UNICODE string containing the name of the user account to set information on.
  2310. level __Level of information to set. 0, 1 and 2 are valid.
  2311. buf __A pointer to a buffer containing the user modals information. 
  2312. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2313. 4.12.3.    Global Group APIs
  2314. The global group API functions control global groups of users in a way that can be used across domains. A global group is a set of users who share common permissions in the security database. Group API functions create or delete global groups, and review or adjust the membership of the global groups. The global group has a groupname that specifies the usernames of global group members.
  2315. To create a global group, an application calls NetGroupAdd, supplying a groupname. Initially, the global group has no members. To assign members to the global group, call NetGroupSetUsers. To add a user to an existing global group, call NetGroupAddUser. To set general information about the global group, call NetGroupSetInfo.
  2316. NetGroupDelUser deletes a specified username from a global group, and NetGroupDel disbands a global group. NetGroupDel works whether or not the global group has any members.
  2317. Three Group category API functions retrieve information about the global groups on a server: NetGroupEnum produces a list of all global groups; NetGroupGetUsers lists all members of a specified global group; and NetGroupGetInfo returns general information about the global group.
  2318. Each user account automatically belongs to one of the special global groups Domain Users or None, according to the user's privilege level. Membership of these global groups is indirectly controlled by the NetUserAdd, NetUserDel, and NetUserSetInfo functions. For more information, see the User category API functions.
  2319. Group API functions control groups of users.
  2320. Group account information is available at two levels:
  2321. typedef struct _GROUP_INFO_0 {
  2322.     LPWSTR        grpi0_name;
  2323. } GROUP_INFO_0, *PGROUP_INFO_0, *LPGROUP_INFO_0;
  2324. typedef struct _GROUP_INFO_1 {
  2325.     LPWSTR        grpi1_name;
  2326.     LPWSTR        grpi1_comment;
  2327. } GROUP_INFO_1, *PGROUP_INFO_1, *LPGROUP_INFO_1;
  2328. typedef struct _GROUP_INFO_2 {
  2329.     LPWSTR           grpi2_name;
  2330.     LPWSTR           grpi2_comment;
  2331.     DWORD            grpi2_group_id;
  2332.     DWORD            grpi2_attributes;
  2333. }GROUP_INFO_2, *PGROUP_INFO_2;
  2334.  
  2335. The Groups to which a user belongs may be obtained at one information level.
  2336. typedef struct _GROUP_USERS_INFO_0 {
  2337.     LPWSTR        grui0_name;
  2338. } GROUP_USERS_INFO_0, *PGROUP_USERS_INFO_0, *LPGROUP_USERS_INFO_0;
  2339. typedef struct _GROUP_USERS_INFO_1 {
  2340.     LPWSTR        grui1_name;
  2341.             DWORD                     grui1_attributes;
  2342. } GROUP_USERS_INFO_1, *PGROUP_USERS_INFO_1, *LPGROUP_USERS_INFO_1;
  2343. The following infolevels are only valid for NetGroupSetInfo and replace the older way of passing in a Parmnum to set a specific field.
  2344. The following are supported on downlevel systems (i.e. LANMan 2.x) as well: 
  2345. typedef struct _GROUPINFO_1002 {
  2346.     LPWSTR        grpi1002_comment;
  2347. } GROUP_USERS_INFO_1002, *PGROUP_USERS_INFO_1002, *LPGROUP_USERS_INFO_1002;
  2348. typedef struct _GROUP_INFO_1005 {
  2349.     DWORD          grpi1005_attributes;
  2350. } GROUP_INFO_1005, *PGROUP_INFO_1005, *LPGROUP_INFO_1005;
  2351. For NetGroupSetInfo, parmnum values refer to the fields in the group_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  2352. parmnum value    Field in group_info struct
  2353. GROUP_NAME_PARMNUM    grpi_name
  2354. GROUP_COMMENT_PARMNUM    grpi_comment
  2355. GROUP_ATTRIBUTES_PARMNUM    grpi_attributes
  2356. The Group APIs are:
  2357. 4.12.3.1.    NetGroupAdd 
  2358. NetGroupAdd creates a global group in the security database.
  2359. Privilege Level
  2360. Admin privilege or account operator privilege is required to successfully execute NetGroupAdd.
  2361. NET_API_STATUS NET_API_FUNCTION
  2362. NetGroupAdd (
  2363.     IN LPWSTR servername OPTIONAL,
  2364.     IN DWORD level,
  2365.     IN LPBYTE buf,
  2366.     OUT LPDWORD parm_err OPTIONAL
  2367.     );
  2368. Parameters:
  2369.  
  2370. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2371. level __Level of information provided. Must be 0 1, or 2.
  2372. buf __A pointer to a buffer containing the global group information structure.
  2373. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2374. 4.12.3.2.    NetGroupAddUser 
  2375. NetGroupAddUser gives an existing user account membership in an existing global group.
  2376. Privilege Level
  2377. Admin privilege or account operator privilege is required to successfully execute NetGroupAddUser.
  2378. NET_API_STATUS NET_API_FUNCTION
  2379. NetGroupAddUser (
  2380.     IN LPWSTR servername OPTIONAL,
  2381.     IN LPWSTR GroupName,
  2382.     IN LPWSTR username
  2383.     );
  2384. Parameters:
  2385.  
  2386. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2387. GroupName __A pointer to an UNICODE string containing the name of the global group to which the user is to be given membership.
  2388. Username __A pointer to an UNICODE string containing the name of the user to be given global group membership.
  2389. 4.12.3.3.    NetGroupEnum 
  2390. NetGroupEnum retrieves information about each global group account. 
  2391. Privilege Level
  2392. Admin privilege or account operator privilege is required to successfully execute NetGroupEnum.
  2393. NET_API_STATUS NET_API_FUNCTION
  2394. NetGroupEnum (
  2395.     IN LPWSTR servername OPTIONAL,
  2396.     IN DWORD level,
  2397.     OUT LPBYTE * bufptr,
  2398.     IN DWORD prefmaxlen,
  2399.     OUT LPDWORD entriesread,
  2400.     OUT LPDWORD totalentries,
  2401.     IN OUT LPDWORD resumehandle OPTIONAL
  2402.     );
  2403. Parameters:
  2404.  
  2405. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2406. level __Level of information required. 0 and 1 are valid.
  2407. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  2408. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2409. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2410. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2411. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing global group search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  2412. 4.12.3.4.    NetGroupGetInfo 
  2413. NetGroupGetInfo retrieves information about a particular global group account on a server. 
  2414. Privilege Level
  2415. Admin privilege or account operator privilege is required to successfully execute NetGroupGetInfo.
  2416. NET_API_STATUS NET_API_FUNCTION
  2417. NetGroupGetInfo (
  2418.     IN LPWSTR servername OPTIONAL,
  2419.     IN LPWSTR groupname,
  2420.     IN DWORD level,
  2421.     OUT LPBYTE * bufptr
  2422.     );
  2423. Parameters:
  2424.  
  2425. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2426. groupname __A pointer to an UNICODE string containing the name of the global group account to return information on.
  2427. level __Level of information required. 0, 1 and 2 are valid.
  2428. bufptr __A pointer to the return information structure is returned in the address pointed to by bufptr.
  2429. 4.12.3.5.    NetGroupSetInfo 
  2430. NetGroupSetInfo sets the parameters of a global group account. 
  2431. Privilege Level
  2432. Admin privilege or account operator privilege is required to successfully execute NetGroupSetInfo.
  2433. NET_API_STATUS NET_API_FUNCTION
  2434. NetGroupSetInfo (
  2435.     IN LPWSTR servername OPTIONAL,
  2436.     IN LPWSTR groupname,
  2437.     IN DWORD level,
  2438.     IN LPBYTE buf,
  2439.     OUT LPDWORD parm_err OPTIONAL
  2440.     );
  2441. Parameters:
  2442.  
  2443. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2444. groupname __A pointer to an UNICODE string containing the name of the global group account to set information on.
  2445. level __Level of information to set. Only 0, 1 and 2 are valid.
  2446. buf __A pointer to a buffer containing the global group information. 
  2447. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2448. 4.12.3.6.    NetGroupDel 
  2449. NetGroupDel deletes a global group account from the accounts database.
  2450. Privilege Level
  2451. Admin privilege or account operator privilege is required to successfully execute NetGroupDel.
  2452. NET_API_STATUS NET_API_FUNCTION
  2453. NetGroupDel (
  2454.     IN LPWSTR servername OPTIONAL,
  2455.     IN LPWSTR groupname
  2456.     );
  2457. Parameters:
  2458.  
  2459. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2460. groupname __A pointer to an UNICODE string containing the name of the global group account to delete
  2461. 4.12.3.7.    NetGroupDelUser 
  2462. NetGroupDelUser removes a user from a particular global group in the user account database.
  2463. Privilege Level
  2464. Admin privilege or account operator privilege is required to successfully execute NetGroupDelUser.
  2465. NET_API_STATUS NET_API_FUNCTION
  2466. NetGroupDelUser (
  2467.     IN LPWSTR servername OPTIONAL,
  2468.     IN LPWSTR GroupName,
  2469.     IN LPWSTR Username
  2470.     );
  2471. Parameters:
  2472.  
  2473. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2474. GroupName __A pointer to an UNICODE string containing the name of the global group from which the user membership is to be removed.
  2475. Username __A pointer to an UNICODE string containing the name of the user to remove from the global group.
  2476. 4.12.3.8.    NetGroupGetUsers 
  2477. NetGroupGetUsers retrieves a list of the members of a particular global group in the user account database.
  2478. Privilege Level
  2479. Admin privilege or account operator privilege is required to successfully execute NetGroupGetUsers except when the request is made by a user who has membership in the specified global group in which case no special privilege is required.
  2480. NET_API_STATUS NET_API_FUNCTION
  2481. NetGroupGetUsers (
  2482.     IN LPWSTR servername OPTIONAL,
  2483.     IN LPWSTR groupname,
  2484.     IN DWORD level,
  2485.     OUT LPBYTE * bufptr,
  2486.     IN DWORD prefmaxlen,
  2487.     OUT LPDWORD entriesread,
  2488.     OUT LPDWORD totalentries,
  2489.     IN OUT LPDWORD resumehandle OPTIONAL
  2490.     );
  2491. Parameters:
  2492.  
  2493. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2494. groupname __A pointer to an UNICODE string containing the name of the global group whose members are to be listed.
  2495. level __Level of information required. Only 0 and 1 are valid.
  2496. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  2497. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2498. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2499. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2500. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing usergroup search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  2501. 4.12.3.9.    NetGroupSetUsers 
  2502. NetGroupSetUsers sets the global group membership for the specified global group. Each user specified is made a member of the global group. Users that are not specified but are currently members of the global group will have their membership revoked.
  2503. Privilege Level
  2504. Admin privilege or account operator privilege is required to successfully execute NetGroupSetUsers on a remote server.
  2505. NET_API_STATUS NET_API_FUNCTION
  2506. NetGroupSetUsers (
  2507.     IN LPWSTR servername OPTIONAL,
  2508.     IN LPWSTR groupname,
  2509.     IN DWORD level,
  2510.     IN LPBYTE buf,
  2511.     IN DWORD totalentries
  2512.     );
  2513. Parameters:
  2514.  
  2515. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2516. groupname __A pointer to an UNICODE string containing the name of the global group to which the specified users belong.
  2517. level __Level of information supplied. Only 0 is valid.
  2518. buf __Points to the buffer in which the data to be set is stored. This data consists of a sequence of _GROUP_USERS_INFO_0 data structures.
  2519. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2520. 4.12.4.    Local Group APIs
  2521. A local group is a set of users who share common permissions in the security database.  A local group can have members which are either users or global groups (global groups can only contain users).  The local group API functions control members of  local groups in a way that can only be used by the systems within a "cluster".  A "cluster" is the individual workstation if the system is a Windows NT system, but it contains all the NT Advanced Servers of a domain if the system is a NT Advanced Server.  Thus, a local group defined on a workstation can only be used on that workstation, but a local group defined on an Advanced Server can be used by any other Advanced Server within the same domain.  The local group API functions create or delete local groups, and review or adjust the memberships of  local groups. 
  2522. A member can be added to a local group by specifying the security identifier (SID) of the member.  The Win32 LookupAccountName API can be used to translate a member account name to a SID.  
  2523. To create a local group, an application calls NetLocalGroupAdd, supplying a local group name. Initially, the local group has no members. To assign members to the local group, call NetLocalGroupSetMembers. To add a member to an existing local group, call NetLocalGroupAddMember. To set general information about the local group, call NetLocalGroupSetInfo.
  2524. NetLocalGroupDelMember deletes a specified member from a local group, and NetLocalGroupDel disbands a local group, deleting all existing members of the local group first. 
  2525. Three local group category API functions retrieve information about the local groups on a server: NetLocalGroupEnum produces a list of all local groups; NetLocalGroupGetMembers lists all members of a specified local group; and NetLocalGroupGetInfo returns general information about the local group.  
  2526. Group account information is available at three levels:
  2527. typedef struct _LOCALGROUP_INFO_0 {
  2528.     LPWSTR        lgrpi0_name;
  2529. } LOCALGROUP_INFO_0, *PLOCALGROUP_INFO_0,  LPLOCALGROUP_INFO_0;
  2530. typedef struct _LOCALGROUP_INFO_1 {
  2531.     LPWSTR        lgrpi1_name;
  2532.     LPWSTR        lgrpi1_comment;
  2533. } LOCALGROUP_INFO_1, *PLOCALGROUP_INFO_1,  LPLOCALGROUP_INFO_1;
  2534. typedef struct _LOCALGROUP_INFO_1002 {
  2535.     LPWSTR        lgrpi1002_comment;
  2536. } LOCALGROUP_INFO_1002, *PLOCALGROUP_INFO_1002,  LPLOCALGROUP_INFO_1002;
  2537. The local group to which a member belongs may be obtained at two information level.
  2538. typedef struct _LOCALGROUP_MEMBERS_INFO_0 {
  2539.     PSID            lgrmi0_sid;
  2540. } LOCALGROUP_MEMBERS_INFO_0, *PLOCALGROUP_MEMBERS_INFO_0, *LPLOCALGROUP_MEMBERS_INFO_0;
  2541. typedef struct _LOCALGROUP_MEMBERS_INFO_0 {
  2542.     PSID            lgrmi0_sid;
  2543. } LOCALGROUP_MEMBERS_INFO_0, *PLOCALGROUP_MEMBERS_INFO_0, *LPLOCALGROUP_MEMBERS_INFO_0;
  2544. typedef struct _LOCALGROUP_MEMBERS_INFO_1 {
  2545.     PSID            lgrmi1_sid;
  2546.     SID_NAME_USE    lgrmi1_sidusage;
  2547.     LPWSTR        lgrmi1_name;
  2548. } LOCALGROUP_MEMBERS_INFO_1, *PLOCALGROUP_MEMBERS_INFO_1, *LPLOCALGROUP_MEMBERS_INFO_1;
  2549. typedef struct _LOCALGROUP_USERS_INFO_0 {
  2550.     LPWSTR            lgrui0_name;
  2551. } LOCALGROUP_USERS_INFO_0, *PLOCALGROUP_USERS_INFO_0, *LPLOCALGROUP_USERS_INFO_0;
  2552. For NetLocalGroupSetInfo, parmnum values refer to the fields in the group_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  2553. parmnum value    Field in group_info struct
  2554. LOCALGROUP_NAME_PARMNUM    lgrpi_name
  2555. LOCALGROUP_COMMENT_PARMNUM    lgrpi_comment
  2556. The Local Group APIs are:
  2557. 4.12.4.1.    NetLocalGroupAdd 
  2558. NetLocalGroupAdd creates a local group in the security database.
  2559. Privilege Level
  2560. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupAdd.
  2561. NET_API_STATUS NET_API_FUNCTION
  2562. NetLocalGroupAdd (
  2563.     IN LPWSTR servername OPTIONAL,
  2564.     IN DWORD level,
  2565.     IN LPBYTE buf,
  2566.     OUT LPDWORD parm_err OPTIONAL
  2567.     );
  2568. Parameters:
  2569.  
  2570. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2571. level __Level of information provided. Must be 0 or 1.
  2572. buf __A pointer to a buffer containing the local group information structure.
  2573. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2574. 4.12.4.2.    NetLocalGroupAddMember
  2575. NetLocalGroupAddMember gives an existing user account or global group membership in an existing local group.
  2576. Privilege Level
  2577. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupAddMember.
  2578. NET_API_STATUS NET_API_FUNCTION
  2579. NetLocalGroupAddMember (
  2580.     IN LPWSTR servername OPTIONAL,
  2581.     IN LPWSTR groupname,
  2582.     IN PSID membersid
  2583.     );
  2584. Parameters:
  2585.  
  2586. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2587. groupname __A pointer to an UNICODE string containing the name of the local group to which the user or global group is to be given membership.
  2588. membersid __A pointer to the SID of a user or global group from the local, primary, or trust domains to be given local group membership.
  2589. 4.12.4.3.    NetLocalGroupEnum 
  2590. NetLocalGroupEnum retrieves information about each local group account. 
  2591. Privilege Level
  2592. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupEnum.
  2593. NET_API_STATUS NET_API_FUNCTION
  2594. NetLocalGroupEnum (
  2595.     IN LPWSTR servername OPTIONAL,
  2596.     IN DWORD level,
  2597.     OUT LPBYTE * bufptr,
  2598.     IN DWORD prefmaxlen,
  2599.     OUT LPDWORD entriesread,
  2600.     OUT LPDWORD totalentries,
  2601.     IN OUT LPDWORD resumehandle OPTIONAL
  2602.     );
  2603. Parameters:
  2604.  
  2605. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2606. level __Level of information required. 0 and 1 are valid.
  2607. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  2608. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2609. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2610. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2611. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing local group search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  2612. 4.12.4.4.    NetLocalGroupGetInfo 
  2613. NetLocalGroupGetInfo retrieves information about a particular local group account on a server. 
  2614. Privilege Level
  2615. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupGetInfo.
  2616. NET_API_STATUS NET_API_FUNCTION
  2617. NetLocalGroupGetInfo (
  2618.     IN LPWSTR servername OPTIONAL,
  2619.     IN LPWSTR groupname,
  2620.     IN DWORD level,
  2621.     OUT LPBYTE * bufptr
  2622.     );
  2623. Parameters:
  2624.  
  2625. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2626. groupname __A pointer to an UNICODE string containing the name of the local group account to return information on.
  2627. level __Level of information required. 0 and 1 are valid.
  2628. bufptr __A pointer to the return information structure is returned in the address pointed to by bufptr.
  2629. 4.12.4.5.    NetLocalGroupSetInfo 
  2630. NetLocalGroupSetInfo sets the parameters of a local group. 
  2631. Privilege Level
  2632. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupSetInfo.
  2633. NET_API_STATUS NET_API_FUNCTION
  2634. NetLocalGroupSetInfo (
  2635.     IN LPWSTR servername OPTIONAL,
  2636.     IN LPWSTR groupname,
  2637.     IN DWORD level,
  2638.     IN LPBYTE buf,
  2639.     OUT LPDWORD parm_err OPTIONAL
  2640.     );
  2641. Parameters:
  2642.  
  2643. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2644. groupname __A pointer to an UNICODE string containing the name of the local group account to set information on.
  2645. level __Level of information to set. 0, 1, and 1002 are valid.
  2646. buf __A pointer to a buffer containing the local group information. 
  2647. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2648. 4.12.4.6.    NetLocalGroupDel 
  2649. NetLocalGroupDel deletes a local group account and all its members from the accounts database.
  2650. Privilege Level
  2651. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupDel.
  2652. NET_API_STATUS NET_API_FUNCTION
  2653. NetLocalGroupDel (
  2654.     IN LPWSTR servername OPTIONAL,
  2655.     IN LPWSTR groupname
  2656.     );
  2657. Parameters:
  2658.  
  2659. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2660. groupname __A pointer to an UNICODE string containing the name of the local group account to delete
  2661. 4.12.4.7.    NetLocalGroupDelMember 
  2662. NetLocalGroupDelMember removes a member from a particular local group in the security  database.
  2663. Privilege Level
  2664. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupDelMember.
  2665. NET_API_STATUS NET_API_FUNCTION
  2666. NetLocalGroupDelMember (
  2667.     IN LPWSTR servername OPTIONAL,
  2668.     IN LPWSTR groupname,
  2669.     IN PSID membersid
  2670.     );
  2671. Parameters:
  2672.  
  2673. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2674. groupname __A pointer to an UNICODE string containing the name of the local group from which the user membership is to be removed.
  2675. membersid __A pointer to a SID of a user or global group to remove from the local group.
  2676. 4.12.4.8.    NetLocalGroupGetMembers 
  2677. NetLocalGroupGetMembers retrieves a list of the members of a particular local group in the security database.
  2678. Privilege Level
  2679. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupGetMembers except when the request is made by a user who has membership in the specified local group in which case no special privilege is required.
  2680. NET_API_STATUS NET_API_FUNCTION
  2681. NetLocalGroupGetMembers (
  2682.     IN LPWSTR servername OPTIONAL,
  2683.     IN LPWSTR groupname,
  2684.     IN DWORD level,
  2685.     OUT LPBYTE * bufptr,
  2686.     IN DWORD prefmaxlen,
  2687.     OUT LPDWORD entriesread,
  2688.     OUT LPDWORD totalentries,
  2689.     IN OUT LPDWORD resumehandle OPTIONAL
  2690.     );
  2691. Parameters:
  2692.  
  2693. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2694. groupname __A pointer to an UNICODE string containing the name of the local group whose members are to be listed.
  2695. level __Level of information required. Levels 0 and 1 are valid.
  2696. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  2697. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2698. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2699. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2700. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing usergroup search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  2701. 4.12.4.9.    NetLocalGroupSetMembers 
  2702. NetLocalGroupSetMembers sets the local group membership for the specified local group. Each user or global group specified is made a member of the local group. Users or global groups that are not specified but are currently members of the local group will have their membership revoked.
  2703. Privilege Level
  2704. Admin privilege or account operator privilege is required to successfully execute NetLocalGroupSetMembers on a remote server.
  2705. NET_API_STATUS NET_API_FUNCTION
  2706. NetLocalGroupSetMembers (
  2707.     IN LPWSTR servername OPTIONAL,
  2708.     IN LPWSTR groupname,
  2709.     IN DWORD level,
  2710.     IN LPBYTE buf,
  2711.     IN DWORD totalentries
  2712.     );
  2713. Parameters:
  2714.  
  2715. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2716. groupname __A pointer to an UNICODE string containing the name of the local group to which the specified users or global groups belong.
  2717. level __Level of information supplied. Only 0 is valid.
  2718. buf __Points to the buffer in which the data to be set is stored. This data consists of a sequence of  LOCALGROUP_MEMBERS_INFO_0 data structures.
  2719. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2720. 4.12.5.    Access APIs
  2721. A full set of Access setting APIs exist in Win32.  These should be used in place of the NetAccess APIs.  The NetAccess APIs only work when remoted to a downlevel system.
  2722. Access Permissions API functions examine or modify user or group access permissions  for specified resources. An access control list (ACL) contains the name of a resource, an audit attribute field, and a list of access control entries. An access control entry (ACE) is a username or groupname and its corresponding access permissions.     
  2723. The audit attribute field defines what type of events will be audited for that resource. It is possible to audit various types of events, depending on whether the resource is a file  or a directory. It is possible to audit events such as opening, writing, and deleting a file; creating or deleting a directory; and changing the ACL of the resource.
  2724. NetAccessAdd creates an ACL for a resource and sets username or groupname access permissions. NetAccessDel deletes the ACL for a resource. NetAccessGetInfo returns the ACL for a particular resource. NetAccessEnum returns information about all ACLs. 
  2725. Only users or applications with admin privilege or special permission for the resource  can define or examine access permissions on a remote server or on a computer that has  local security. Users have special permissions for a resource when they are granted  ACCESS_PERM permission for that resource; this is also known as P permission.  
  2726. NetAccessCheck verifies whether a user has permission to perform a specified operation on a particular resource. If access permission is needed, you can use NetAccessSetInfo  to change the ACL. NetAccessGetUserPerms returns a specified user's or group's permission for a specified resource.  
  2727. Access Permission information is available at two levels:
  2728. typedef struct _ACCESS_INFO_0 {
  2729.     LPWSTR        acc0_resource_name;
  2730. } ACCESS_INFO_0, *PACCESS_INFO_0, *LPACCESS_INFO_0;
  2731. typedef struct _ACCESS_INFO_1 {
  2732.     LPWSTR        acc1_resource_name;
  2733.     DWORD        acc1_attr;
  2734.     DWORD        acc1_count;
  2735. } ACCESS_INFO_1, *PACCESS_INFO_1, *LPACCESS_INFO_1;
  2736. Access list information is available at one levels
  2737. typedef struct _ACCESS_LIST {
  2738.     LPWSTR        acl_ugname;
  2739.     DWORD        acl_access;
  2740. } ACCESS_LIST, *PACCESS_LIST, *LPACCESS_LIST;
  2741. The following infolevels are only valid for NetAccessSetInfo and replace the older way of passing in a Parmnum to set a specific field.
  2742. The following are supported on downlevel systems (i.e. LANMan 2.x) as well: 
  2743. typedef struct _ACCESS_INFO_1002 {
  2744.     DWORD        acc1002_attr;
  2745. } ACCESS_INFO_1002, *PACCESS_INFO_1002, *LPACCESS_INFO_1002;
  2746. For NetAccessSetInfo, parmnum values refer to the fields in the access_info structure as follows. These values are used when indicating an error in a specific parameter via parm_err.
  2747. parmnum value    Field in access_info struct
  2748. ACCESS_RESOURCE_NAME_PARMNUM    acc_resource_name
  2749. ACCESS_ATTR_PARMNUM    acc_attr
  2750. ACCESS_COUNT_PARMNUM    acc_count
  2751. ACCESS_ACCESS_LIST_PARMNUM    array following acc1_count
  2752. The following are defined for the bits in the acc1_attr field of _ACCESS_INFO_1:
  2753. ACCESS_AUDIT    0x001
  2754. ACCESS_SUCCESS_OPEN    0x010
  2755. ACCESS_SUCCESS_WRITE    0x020
  2756. ACCESS_SUCCESS_DELETE    0x040
  2757. ACCESS_SUCCESS_ACL    0x080
  2758. ACCESS_SUCCESS_MASK    0x0F0
  2759. ACCESS_FAIL_OPEN    0x100
  2760. ACCESS_FAIL_WRITE    0x200
  2761. ACCESS_FAIL_DELETE    0x400
  2762. ACCESS_FAIL_ACL    0x800
  2763. ACCESS_FAIL_MASK    0xF00
  2764. ACCESS_FAIL_SHIFT    0x004
  2765. The Access Permission APIs are:
  2766. 4.12.5.1.    NetAccessAdd 
  2767. Only works when remoted to a downlevel system.  Use Win32 (GetFileSecurity, SetFileSecurity) APIs for NT.
  2768. NetAccessAdd creates a new Access Control List (ACL) for a resource.
  2769. Privilege Level
  2770. Admin privilege is required to successfully execute NetAccessAdd.
  2771. NET_API_STATUS NET_API_FUNCTION
  2772. NetAccessAdd (
  2773.     IN LPWSTR servername OPTIONAL,
  2774.     IN DWORD level,
  2775.     IN LPBYTE buf,
  2776.     OUT LPDWORD parm_err OPTIONAL
  2777.     );
  2778. Parameters:
  2779.  
  2780. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2781. level __Level of information provided. Must be 1.
  2782. buf __A pointer to a buffer containing the access information structure.
  2783. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2784. 4.12.5.2.    NetAccessEnum 
  2785. Only works when remoted to a downlevel system.  Use Win32 (GetFileSecurity, SetFileSecurity) APIs for NT.
  2786. NetAccessEnum retrieves information about each access permision record.
  2787. NetAccessEnum is being phased out and is only available at levels 0 and 1 for Windows networking. It is recommended that NetAccessEnum not be used because it is unlikely to be supported in future releases. 
  2788. Privilege Level
  2789. NetAccessEnum does not require admin privilege to execute but will only return records for entries for which the user has 'P' permission if the caller does not have admin privilege.
  2790. NET_API_STATUS NET_API_FUNCTION
  2791. NetAccessEnum (
  2792.     IN LPWSTR servername OPTIONAL,
  2793.     IN LPWSTR basepath,
  2794.     IN DWORD recursive,
  2795.     IN DWORD level,
  2796.     OUT LPBYTE * bufptr,
  2797.     IN DWORD prefmaxlen,
  2798.     OUT LPDWORD entriesread,
  2799.     OUT LPDWORD totalentries,
  2800.     IN OUT LPDWORD resumehandle OPTIONAL
  2801.     );
  2802. Parameters:
  2803.  
  2804. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2805. basepath __A pointer to an UNICODE string that contains a base pathname for the resources. A NULL pointer or NULL string means no base path is to be used. The path can be specified as a universal naming convention (UNC) pathname.
  2806. recursive __A flag to enables or disable recursive searching. If recursive is 0, NetAccessEnum returns entries only for the resource named as the base path by basepath and for the resources directly below that base path. If recursive is nonzero, NetAccessEnum returns entries for all access control lists (ACLs) that have basepath at the beginning of the resource name. 
  2807. level __Level of information required. Only 0 and 1 are valid.
  2808. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  2809. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  2810. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  2811. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  2812. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing access search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  2813.  
  2814. 4.12.5.3.    NetAccessGetInfo 
  2815. Only works when remoted to a downlevel system.  Use Win32 (GetFileSecurity, SetFileSecurity) APIs for NT.
  2816. NetAccessGetInfo retrieves the access control information for a specific resource.
  2817. Privilege Level
  2818. Admin privilege or P permission is required to successfully execute NetAccessGetInfo.
  2819. NET_API_STATUS NET_API_FUNCTION
  2820. NetAccessGetInfo (
  2821.     IN LPWSTR servername OPTIONAL,
  2822.     IN LPWSTR resource,
  2823.     IN DWORD level,
  2824.     OUT LPBYTE * bufptr,
  2825.     );
  2826. Parameters:
  2827.  
  2828. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2829. resource __A pointer to an UNICODE string containing the name of the resource on which to return access control information.
  2830. level __Level of information required. 0 and 1 are valid.
  2831. bufptr __A pointer to the return information structure is returned in the address pointed to by bufptr.
  2832. 4.12.5.4.    NetAccessSetInfo 
  2833. Only works when remoted to a downlevel system.  Use Win32 (GetFileSecurity, SetFileSecurity) APIs for NT.
  2834. NetAccessSetInfo changes the access control list for a resource.
  2835. Privilege Level
  2836. Admin privilege or P permission for the resource is required to successfully execute NetAccessSetInfo.
  2837. NET_API_STATUS NET_API_FUNCTION
  2838. NetAccessSetInfo (
  2839.     IN LPWSTR servername OPTIONAL,
  2840.     IN LPWSTR resource,
  2841.     IN DWORD level,
  2842.     IN LPBYTE buf,
  2843.     OUT LPDWORD parm_err OPTIONAL
  2844.     );
  2845. Parameters:
  2846.  
  2847. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2848. resource __A pointer to an UNICODE string containing the name of the resource for which the access information shoule be changed.
  2849. level __Level of information to set. Only 1 and 1002 are valid.
  2850. buf __A pointer to a buffer containing the access entry information. 
  2851. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  2852. 4.12.5.5.    NetAccessDel 
  2853. Only works when remoted to a downlevel system.  Use Win32 (GetFileSecurity, SetFileSecurity) APIs for NT.
  2854. NetAccessDel deletes the access control list for a particular resource.
  2855. Privilege Level
  2856. Admin privilege or P permission for the resource is required to successfully execute NetAccessDel.
  2857. NET_API_STATUS NET_API_FUNCTION
  2858. NetAccessDel (
  2859.     IN LPWSTR servername OPTIONAL,
  2860.     IN LPWSTR resource
  2861.     );
  2862. Parameters:
  2863.  
  2864. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2865. resource __A pointer to an UNICODE string containing the name of the resource for which to remove the access control entry.
  2866. 4.12.5.6.    NetAccessGetUserPerms
  2867. Only works when remoted to a downlevel system.  Use Win32 (GetFileSecurity, SetFileSecurity) APIs for NT.
  2868. NetAccessGetUserPerms returns a specified user's or group's access permissions for a particular resource..
  2869. Privilege Level
  2870. Admin privilege or P permission for the resource is required to successfully execute NetAccessGetUserPerms.except when users request their own access permissions to a resource. In this case no special privilege is required.
  2871. NET_API_STATUS NET_API_FUNCTION
  2872. NetAccessGetUserPerms (
  2873.     IN LPWSTR servername OPTIONAL,
  2874.     IN LPWSTR UGname,
  2875.     IN LPWSTR resource,
  2876.     OUT LPDWORD Perms
  2877.     );
  2878. Parameters:
  2879.  
  2880. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2881. UGname __A pointer to an UNICODE string containing the name of the user or group to query permissions for.
  2882. resource __A pointer to an UNICODE string containing the resource for which to query user permissions.
  2883. Perms __Points to a DWORD in which the user permissions for the specified resource are returned.
  2884. 4.12.5.7.    NetAccessCheck
  2885. Only works when remoted to a downlevel system.  Use Win32 (AccessCheck) API for NT.
  2886. NetAccessCheck verifies that a user has permission to perform a specified operation on a particular resource.
  2887. Privilege Level
  2888. Admin privilege is required to successfully execute NetAccessCheck.
  2889. NET_API_STATUS NET_API_FUNCTION
  2890. NetAccessCheck (
  2891.     IN LPWSTR servername OPTIONAL,
  2892.     IN LPWSTR username,
  2893.     IN LPWSTR resource,
  2894.     IN DWORD operation,
  2895.     OUT LPDWORD result
  2896.     );
  2897. Parameters:
  2898.  
  2899. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2900. username __A pointer to an UNICODE string containing the name of the user to check for access to the resource.
  2901. resource __A pointer to an UNICODE string containing the resource for which to check user permissions.
  2902. operation __Points to a DWORD specifying the type of access operation requested.
  2903.  
  2904. ACCESS_READ     0x01    Permission to read data from a resource
  2905.                 and, by default, execute the resource.
  2906. ACCESS_WRITE    0x02    Permission to write data to the
  2907.                  resource.
  2908. ACCESS_CREATE    0x04    Permission to create an instance of the
  2909.                 resource (for example, a file); data
  2910.                 can be written to the resource when
  2911.                  creating it.
  2912. ACCESS_EXEC     0x08    Permission to execute the resource.
  2913. ACCESS_DELETE    0x10    Permission to delete the resource.
  2914. ACCESS_ATRIB    0x20    Permission to modify the resource's
  2915.                 attributes (for example, the date and
  2916.                 time a file was last modified).
  2917. ACCESS_PERM     0x40    Permission to modify the permissions
  2918.                 (read, write, create, execute, and 
  2919.                 delete) assigned to a resource for a
  2920.                 user, group, or application.
  2921. ACCESS_ALL        0x7F    Permission to read, write, create,
  2922.                 execute, or delete a resource, or to
  2923.                 modify attributes or permissions.in
  2924.                 which the user permissions for the
  2925.                 specified resource are returned.
  2926. result __Points to a DWORD in which the result of the access check is returned.
  2927. 4.13.    Domain APIs
  2928. Domain API functions retrieve information about a domain. They require that the workstation service be started. 
  2929. The Domain APIs are:
  2930. 4.13.1.    NetGetDCName
  2931. NetGetDCName returns the name of the Primary Domain Controller for the specified domain. 
  2932. Privilege Level
  2933. No special privilege is required to successfully execute NetGetDCName.
  2934. NET_API_STATUS NET_API_FUNCTION
  2935. NetGetDCName (
  2936.     IN LPWSTR servername OPTIONAL,
  2937.     IN LPWSTR domainname,
  2938.     OUT LPBYTE * bufptr
  2939.     );
  2940. Parameters:
  2941.  
  2942. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2943. domainname __A pointer to an UNICODE string containing the name of the domain. A NULL pointer or string indicates that the name of the domain controller for the primary domain is to be returned.
  2944. bufptr __A pointer to the buffer containing the domain controller name is returned in the address pointed to by bufptr.
  2945.  
  2946. 4.14.    Transport APIs
  2947. Transport APIs handle binding and unbinding of transports to/from the server and redirector, and also ennumerate the transports used by a component. The ServerTransport APIs deal with transports managed by the server, and the WkstaTransport APIs deal with transports managed by the redirector.
  2948. NetServerTransportAdd allows the user to bind the transport to the server. NetServerTransportDel allows the user to unbind the server from the transport. NetServerTransportEnum ennumerates the transports that are managed by the server.
  2949. NetWkstaTransportAdd/Del/Enum perform equivalent operations for the workstation.
  2950. ServerTransport APIs are available at one information level.
  2951. typedef struct _SERVER_TRANSPORT_INFO_0 {
  2952.     DWORD        svti0_number_of_vcs;
  2953.     LPWSTR        svti0_transport_name;
  2954.     LPBYTE        svti0_transport_address;
  2955.     DWORD        svti0_transportaddresslength;
  2956.     LPWSTR        svti0_networkaddress;
  2957. } SERVER_TRANSPORT_INFO_0, *PSERVER_TRANSPORT_INFO_0, *LPSERVER_TRANSPORT_INFO_0;
  2958.  
  2959. WkstaTransport APIs are available at one information level.
  2960. typedef struct _WKSTA_TRANSPORT_INFO_0 {
  2961.     DWORD        wkti0_quality_of_service;
  2962.     DWORD        wkti0_number_of_vcs;
  2963.     LPWSTR        wkti0_transport_name;
  2964.     LPWSTR        wkti0_transport_address;
  2965. } WKSTA_TRANSPORT_INFO_0, *PWKSTA_TRANSPORT_INFO_0, *LPWKSTA_TRANSPORT_INFO_0;
  2966. The APIs are:
  2967. 4.14.1.    NetServerTransportAdd
  2968. NetServerTransportAdd binds the server to the transport.
  2969. Privilege Level
  2970. Admin privilege is required to successfully execute NetServerTransportAdd.
  2971. NET_API_STATUS NET_API_FUNCTION
  2972. NetServerTransportAdd (
  2973.     IN LPWSTR servername OPTIONAL,
  2974.     IN DWORD level,
  2975.     IN LPBYTE buf
  2976.     );
  2977. Parameters:
  2978.  
  2979. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2980. level __Level of information required. Only 0 is valid.
  2981. buf __A pointer to a buffer containing the server transport information structure.
  2982.  
  2983. 4.14.2.    NetServerTransportDel
  2984. NetServerTransportDel unbinds the transport from the server.
  2985. Privilege Level
  2986. Admin privilege is required to successfully execute NetServerTransportDel.
  2987. NET_API_STATUS NET_API_FUNCTION
  2988. NetServerTransportDel (
  2989.     IN LPWSTR servername OPTIONAL,
  2990.     IN LPWSTR transportname
  2991.     );
  2992. Parameters:
  2993.  
  2994. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  2995. transportname __A pointer to an UNICODE string containing the name of the transport from which to unbind.
  2996. 4.14.3.    NetServerTransportEnum
  2997. NetServerTransportEnum supplies information about transports that are managed by the server. 
  2998. Privilege Level
  2999. No special privilege is required to successfully execute NetServerTransportEnum.
  3000. NET_API_STATUS NET_API_FUNCTION
  3001. NetServerTransportEnum (
  3002.     IN LPWSTR servername OPTIONAL,
  3003.     IN DWORD level,
  3004.     OUT LPBYTE * bufptr,
  3005.     IN DWORD prefmaxlen,
  3006.     OUT LPDWORD entriesread,
  3007.     OUT LPDWORD totalentries,
  3008.     IN OUT LPDWORD resumehandle OPTIONAL
  3009.     );
  3010. Parameters:
  3011.  
  3012. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3013. level __Level of information required. Only 0 is valid.
  3014. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  3015. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  3016. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  3017. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  3018. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing server transport search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  3019. 4.14.4.    NetWkstaTransportAdd
  3020. NetWkstaTransportAdd binds the redirector to the transport.
  3021. Privilege Level
  3022. Admin privilege is required to successfully execute  NetWkstaTransportAdd.
  3023. NET_API_STATUS NET_API_FUNCTION
  3024. NetWkstaTransportAdd (
  3025.     IN LPWSTR servername OPTIONAL,
  3026.     IN DWORD level,
  3027.     IN LPBYTE buf
  3028.     );
  3029. Parameters:
  3030.  
  3031. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3032. level __Level of information required. Only 0 is valid.
  3033. buf __A pointer to a buffer containing the server transport information structure.
  3034.  
  3035. 4.14.5.    NetWkstaTransportDel
  3036. NetWkstaTransportDel unbinds the transport from the redirector.
  3037. Privilege Level
  3038. Admin privilege is required to successfully execute  NetWkstaTransportDel.
  3039. NET_API_STATUS NET_API_FUNCTION
  3040. NetWkstaTransportDel (
  3041.     IN LPWSTR servername OPTIONAL,
  3042.     IN LPWSTR transportname,
  3043.      IN DWORD ucond
  3044.     );
  3045. Parameters:
  3046.  
  3047. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3048. transportname __A pointer to an UNICODE string containing the name of the transport from which to unbind.
  3049. ucond __Force level to delete connections on the transport binding.
  3050. 4.14.6.    NetWkstaTransportEnum
  3051. NetWkstaTransportEnum supplies information about transports that are managed by the redirector. 
  3052. Privilege Level
  3053. No special privilege is required to successfully execute NetWkstaTransportEnum.
  3054. NET_API_STATUS NET_API_FUNCTION
  3055. NetWkstaTransportEnum (
  3056.     IN LPWSTR servername OPTIONAL,
  3057.     IN DWORD level,
  3058.     OUT LPBYTE * bufptr,
  3059.     IN DWORD prefmaxlen,
  3060.     OUT LPDWORD entriesread,
  3061.     OUT LPDWORD totalentries,
  3062.     IN OUT LPDWORD resumehandle OPTIONAL
  3063.     );
  3064. Parameters:
  3065.  
  3066. servername __A pointer to an UNICODE string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3067. level __Level of information required. Only 0 is valid.
  3068. bufptr __On return a pointer to the return information structure is returned in the address pointed to by bufptr.
  3069. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  3070. entriesread __On return the actual enumerated element count is located in the DWORD pointed to by entriesread.
  3071. totalentries __On return the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  3072. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing workstation transport search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored..
  3073. 4.15.    Alert APIs
  3074. Alert API functions notify network service programs and applications of network events. An event is a particular instance of a process or state of hardware as defined by an application. The Alert API functions allow applications to indicate when predefined  events occur.
  3075. NetAlertRaise is used to indicate that an event has occurred.  
  3076. The fixed-length header contains the standard alert data structure. The STD_ALERT data structure has the following format:   
  3077. typedef struct _STD_ALERT {
  3078.     DWORD        alrt_timestamp;
  3079.     WCHAR        alrt_eventname[EVLEN+1];
  3080.     WCHAR        alrt_servicename[SNLEN+1];
  3081. } STD_ALERT, *PSTD_ALERT, *LPSTD_ALERT;
  3082. The ADMIN_OTHER_INFO data structure has this format:    
  3083. typedef struct _ADMIN_OTHER_INFO {
  3084.     DWORD        alrtad_errcode;
  3085.     DWORD        alrtad_numstrings;
  3086. } ADMIN_OTHER_INFO, *PADMIN_OTHER_INFO, *LPADMIN_OTHER_INFO;
  3087.  
  3088. /* Followed by consecutive UNICODE strings; the count
  3089.     is in the alrtad_numstrings element. */
  3090.  
  3091.     WCHAR          mergestrings[];
  3092. The ERRLOG_OTHER_INFO data structure has this format:    
  3093. typedef struct _ERRLOG_OTHER_INFO {
  3094.     DWORD        alrter_errcode;
  3095.     DWORD        alrter_offset;
  3096. } ERRLOG_OTHER_INFO, *PERRLOG_OTHER_INFO, *LPERRLOG_OTHER_INFO;
  3097. The PRINT_OTHER_INFO data structure has this format:    
  3098. typedef struct _PRINT_OTHER_INFO {
  3099.     DWORD        alrtpr_jobid;
  3100.     DWORD        alrtpr_status;
  3101.     DWORD        alrtpr_submitted;
  3102.     DWORD        alrtpr_size;
  3103. } PRINT_OTHER_INFO, *PPRINT_OTHER_INFO, *LPPRINT_OTHER_INFO;
  3104. /* Followed by consecutive UNICODE strings. */
  3105.  
  3106.     WCHAR        computername[];
  3107.     WCHAR        username[];
  3108.     WCHAR        queuename[];
  3109.     WCHAR        destname[];
  3110.     WCHAR        status_string[];
  3111. The USER_OTHER_INFO data structure has this format:    
  3112. typedef struct _USER_OTHER_INFO {
  3113.     DWORD        alrtus_errcode;
  3114.     DWORD        alrtus_numstrings;
  3115. } USER_OTHER_INFO, *PUSER_OTHER_INFO, *LPUSER_OTHER_INFO; 
  3116. /*
  3117.  * Followed by a number of consecutive UNICODE strings;
  3118.  * the count is in the alrtus_numstrings element. */
  3119.  */
  3120.     WCHAR        mergestrings[];
  3121.  
  3122. /* Further followed by two more consecutive UNICODE strings. */ 
  3123.     WCHAR        username[];
  3124.     WCHAR        computername[];
  3125. The APIs are:
  3126. 4.15.1.    NetAlertRaise
  3127. NetAlertRaise notifies all registered clients that a particular event occurred. 
  3128. Privilege Level
  3129. No special privilege level is required to successfully execute NetAlertRaise.
  3130. NET_API_STATUS NET_API_FUNCTION
  3131. NetAlertRaise (
  3132.     IN LPWSTR event,
  3133.     IN LPBYTE buffer,
  3134.     IN DWORD numbytes
  3135.     );
  3136. Parameters:
  3137.  
  3138. event __Points to an UNICODE string that specifies which type of alert to raise.
  3139. buffer __Points to the data to be sent to the clients listening for this alert. The data should consist of the STD_ALERT data structure followed by any additional alert data.
  3140. numbytes __Specifies the size of the buffer in bytes. 
  3141. 4.15.2.    NetAlertRaiseEx
  3142. NetAlertRaiseEx simplifies the raising of an admin alert. 
  3143. Privilege Level
  3144. No special privilege level is required to successfully execute NetAlertRaiseEx.
  3145. NET_API_STATUS NET_API_FUNCTION
  3146. NetAlertRaiseEx (
  3147.     IN LPWSTR event,
  3148.     IN LPVOID VariableInfo,
  3149.     IN DWORD VariableInfoSize,
  3150.     IN LPWSTR ServiceName
  3151.     );
  3152. Parameters:
  3153.  
  3154. event __Points to an UNICODE string that specifies which type of alert to raise.
  3155. VariableInfo __Information to put into the admin alert.
  3156. VariableInfoSize __Number of bytes of variable information.
  3157. ServiceName __Name of the service raising the admin alert.
  3158. 4.16.    Error Logging APIs
  3159. Only use these for remoting to downlevel.  For NT use the EventLog API (ReadEventlog, ReportEvent, ...)
  3160. Windows NT uses an integrated Eventlogging mechanism for reporting both errors and audits.  The NetError and NetAudit APIs are provided to access downlevel LANMan logs.  They will report ERROR_NOT_SUPPORTED if called to an Windows NT system. 
  3161. The error log is a file that stores error messages (in binary format). It contains information about LAN Manager software internal errors, MS OS/2 and MS-DOS internal errors, and network service errors.
  3162. NetErrorLogRead reads entries from the error log; and NetErrorLogClear clears the error log and, optionally, saves the entries in a backup file.
  3163. NetErrorLogRead uses the ERROR_LOG data structure to read entries from and write entries to the error log. An entry consists of a fixed-length data structure. The data structure can be followed by UNICODE strings (el_text) that describe the error message, and a block of raw data (el_data) related to the cause of the error. Because of the variable lengths and structures of the el_data and el_text portions of the entry, only the fixed-length data structure is defined in the ERROR_LOG data structure. 
  3164. The error log entry has the following format:
  3165. typedef struct _ERROR_LOG {
  3166.     DWORD        el_len;
  3167.     DWORD        el_reserved;
  3168.     DWORD        el_time;
  3169.     DWORD        el_error;
  3170.     LPWSTR        el_name 
  3171.     LPWSTR        el_text;
  3172.     LPBYTE        el_data;
  3173.     DWORD        el_data_size; 
  3174.     DWORD        el_nstrings;
  3175. } ERROR_LOG, *PERROR_LOG, *LPERROR_LOG;
  3176.  
  3177. /*
  3178.  *   Variable-length raw data specific to the error. el_len will be preceded by pad bytes
  3179.  *    as required for proper alignment.  There may also be pad byes after the end of the
  3180.  *    fixed length structure, before el_data.  Use the pointer in the fixed length structure 
  3181.  *    to reference this data.
  3182.  */
  3183.     BYTE          el_data[];     /* Raw data       */ 
  3184.     DWORD        el_len2;
  3185.  
  3186. The error log handle is defined as follows:
  3187. typedef struct _HLOG {
  3188.     DWORD        time;
  3189.     DWORD        last_flags;
  3190.     DWORD        offset;
  3191.     DWORD        rec_offset;
  3192. } HLOG, *PHLOG, *LPHLOG;
  3193. The error log APIs are:
  3194. 4.16.1.    NetErrorLogClear  
  3195. NetErrorLogClear clears the error log and optionally saves the entries in a backup file. 
  3196. Privilege Level
  3197. Admin privilege is required to successfully execute NetErrorLogClear on a remote server.
  3198. NET_API_STATUS NET_API_FUNCTION
  3199. NetErrorLogClear (
  3200.     IN LPWSTR server,
  3201.     IN LPWSTR backupfile OPTIONAL,
  3202.     IN LPBYTE reserved OPTIONAL
  3203.     );
  3204. Parameters:
  3205.  
  3206. server __Points to an UNICODE string that contains the name of the server on which to execute NetErrorLogClear. A NULL pointer or NULL string specifies the local computer.
  3207. backupfile __Points to an UNICODE string that assigns a name for an optional backup file. The calling application must have write permission for the path specified by backupfile. A NULL pointer indicates not to back up the error log.
  3208. reserved __Reserved. Must be NULL.
  3209. 4.16.2.    NetErrorLogRead  
  3210. NetErrorLogRead reads from the specified error log.  
  3211. Privilege Level
  3212. No special privilege level is required to successfully execute NetErrorLogRead.
  3213. NET_API_STATUS NET_API_FUNCTION
  3214. NetErrorLogRead (
  3215.     IN LPWSTR server,
  3216.     IN LPWSTR reserved1 OPTIONAL,
  3217.     IN LPHLOG errloghandle,
  3218.     IN DWORD offset,
  3219.     IN LPDWORD reserved2 OPTIONAL,
  3220.     IN DWORD reserved3,
  3221.     IN DWORD offsetflag,
  3222.     OUT LPBYTE * bufptr,
  3223.     IN DWORD prefmaxlen,
  3224.     OUT LPDWORD bytesread,
  3225.     OUT LPDWORD totalbytes
  3226.     );
  3227. Parameters:
  3228.  
  3229. server __Points to an UNICODE string that contains the name of the server on which to execute NetErrorLogClear. A NULL pointer or NULL string specifies the local computer.
  3230. reserved1 __Reserved. Must be NULL.
  3231. errloghandle __Points to the error log handle. An application calling NetErrorLogRead for the first time must initialize the 128-bit error log handle.
  3232. offset __Specifies the record offset at which to begin reading. This parameter is ignored unless bit 1 of offsetflag is set. If used, offset is taken as an offset of the record number (not bytes) at which to begin reading. Note that the record offset parameter is zero-based from both directions, depending upon the direction it is read. 
  3233. reserved2 __Reserved. Must be NULL.
  3234. reserved3 __Reserved. Must be zero.
  3235. offsetflag __Specifies the open flags, bitmapped as follows:
  3236.     Bit(s)    Value
  3237.  
  3238.     4.16.2.1.    If 0, the log is read forward. If 1, the log
  3239.         is read backward and records are returned in
  3240.         reverse chronological order.
  3241.     4.16.2.2.    If 0, the read proceeds normally
  3242.         (sequentially). If 1, the read proceeds from
  3243.         the nth record from the start of the log,
  3244.         where n is the offset parameter.
  3245.     4.16.2.3.    Reserved; must be 0.
  3246.  
  3247. bufptr __On return a pointer to the return information buffer is returned in the address pointed to by bufptr.
  3248. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  3249. bytesread __On return the actual number of bytes read into the buffer is located in the DWORD pointed to by bytesread.
  3250. totalbytes __On return the total bytes available to be read from the log is located in the DWORD pointed to by totalbytes.
  3251. 4.17.    Configuration APIs
  3252. These are only for downlevel support.  Use the Registry APIs to retrieve configuration information on NT.
  3253. Configuration API functions retrieve network configuration information.
  3254. Configuration APIs are available at one information level.
  3255. typedef struct _CONFIG_INFO_0 {
  3256.     LPWSTR        cfgi0_key;
  3257.     LPWSTR        cfgi0_data;
  3258. } CONFIG_INFO_0, *PCONFIG_INFO_0, *LPCONFIG_INFO_0;
  3259. The Configuration APIs are:  
  3260. 4.17.1.    NetConfigGet 
  3261. NetConfigGet retrieves the value of a single specified entry for a particular component on the local computer or on a remote server. 
  3262. Privilege Level
  3263. Admin privilege or accounts, comm, print, or server operator privilege is required to successfully execute NetConfigGet on a remote server.
  3264. NET_API_STATUS NET_API_FUNCTION
  3265. NetConfigGet (
  3266.     IN LPWSTR server,
  3267.     IN LPWSTR component,
  3268.     IN LPWSTR parameter,
  3269.     OUT LPBYTE * bufptr
  3270.     );
  3271. Parameters:
  3272.  
  3273. server __Points to an UNICODE string that contains the name of the server on which to execute NetConfigGet. A NULL pointer or NULL string specifies the local computer.
  3274. component __Points to an UNICODE string that specifies which configuration component to search.
  3275. parameter __Points to an UNICODE string that specifies the entry for the component specified whose value is to be returned.
  3276. bufptr __On return a pointer to the returned information is returned in the address pointed to by bufptr.
  3277. 4.17.2.    NetConfigGetAll 
  3278. NetConfigGetAll retrieves all the configuration information for a given component on a local or a remote computer. 
  3279. Privilege Level
  3280. Admin privilege or account, comm, print, or server operator privilege is required to successfully execute NetConfigGetAll on a remote server.
  3281. NET_API_STATUS NET_API_FUNCTION
  3282. NetConfigGetAll (
  3283.     IN LPWSTR server,
  3284.     IN LPWSTR component,
  3285.     OUT LPBYTE * bufptr
  3286.     );
  3287. Parameters:
  3288.  
  3289. server __Points to an UNICODE string that contains the name of the server on which to execute NetConfigGet. A NULL pointer or NULL string specifies the local computer.
  3290. component __Points to an UNICODE string that specifies which configuration component to search.
  3291. bufptr __On return a pointer to the returned information is returned in the address pointed to by bufptr.
  3292. 4.17.3.    NetConfigSet 
  3293. NetConfigSet sets the value of a single specified entry for a particular component on the local computer or on a remote server. 
  3294. Privilege Level
  3295. Admin privilege or server operator privilege is required to successfully execute NetConfigSet on a remote server.
  3296. NET_API_STATUS NET_API_FUNCTION
  3297. NetConfigSet (
  3298.     IN LPWSTR server,
  3299.     IN LPWSTR reserved1 OPTIONAL,
  3300.     IN LPWSTR component,
  3301.     IN DWORD level,
  3302.     IN DWORD reserved2,
  3303.     IN LPBYTE  buf,
  3304.     IN DWORD reserved3  
  3305.     );
  3306. Parameters:
  3307.  
  3308. server __Points to an UNICODE string that contains the name of the server on which to execute NetConfigSet. A NULL pointer or NULL string specifies the local computer.
  3309. reserved1 __Reserved. Must be NULL.
  3310. component __Points to an UNICODE string that specifies which configuration component to set.
  3311. level __Infolevel of request. Must be zero.
  3312. reserved2 __Reserved. Must be zero.
  3313. buf __Buffer containing a CONFIG_INFO_0 structures.
  3314. reserved3 __Reserved. Must be zero. 
  3315. 4.18.    Statistics APIs
  3316. LAN Manager accumulates a set of operating statistics for workstations and servers from the time that the Workstation or Server service is started. NetStatisticsGet is called to get those statistics. The Statistics API function, NetStatisticsGet, retrieves the operating statistics for workstations and servers. Since NT and downlevel workstations collect a different set of statistics, the caller must know whether the server is NT or downlevel (which can be discovered via the NetServerGetInfo API) and interpret the returned buffer accordingly.  
  3317. The way lmstats.h is defined now, you can't define both an uplevel and downlevel structure without standing on your head (doing undef's etc).  We need to fix this so both structures have unique names.
  3318. NetStatisticsGet returns a STAT_WORKSTATION_0 data structure when workstation statistics are requested; it returns a STAT_SERVER_0 data structure when server statistics are requested.  
  3319. The downlevel STAT_WORKSTATION_0 data structure has this format:    
  3320. typedef struct _STAT_WORKSTATION_0 {
  3321.     DWORD        stw0_start;
  3322.     DWORD        stw0_numNCB_r;
  3323.     DWORD        stw0_numNCB_s;
  3324.     DWORD        stw0_numNCB_a;
  3325.     DWORD        stw0_fiNCB_r;
  3326.     DWORD        stw0_fiNCB_s;
  3327.     DWORD        stw0_fiNCB_a;
  3328.     DWORD        stw0_fcNCB_r;
  3329.     DWORD        stw0_fcNCB_s;
  3330.     DWORD        stw0_fcNCB_a;
  3331.     DWORD        stw0_sesstart;
  3332.     DWORD        stw0_sessfailcon;
  3333.     DWORD        stw0_sessbroke;
  3334.     DWORD        stw0_uses;
  3335.     DWORD        stw0_usefail;
  3336.     DWORD        stw0_autorec;
  3337.     DWORD        stw0_bytessent_r_hi;
  3338.     DWORD        stw0_bytessent_r_lo;
  3339.     DWORD        stw0_bytesrcvd_r_hi;
  3340.     DWORD        stw0_bytesrcvd_r_lo;
  3341.     DWORD        stw0_bytessent_s_hi;
  3342.     DWORD        stw0_bytessent_s_lo;
  3343.     DWORD        stw0_bytesrcvd_s_hi;
  3344.     DWORD        stw0_bytesrcvd_s_lo;
  3345.     DWORD        stw0_bytessent_a_hi;
  3346.     DWORD        stw0_bytessent_a_lo;
  3347.     DWORD        stw0_bytesrcvd_a_hi;
  3348.     DWORD        stw0_bytesrcvd_a_lo;
  3349.     DWORD        stw0_reqbufneed;
  3350.     DWORD        stw0_bigbufneed;
  3351. } STAT_WORKSTATION_0, *PSTAT_WORKSTATION_0, *LPSTAT_WORKSTATION_0;
  3352. The NT STAT_WORKSTATION_0 data structure has this format:    
  3353. typedef struct _STAT_WORKSTATION_0 {
  3354.     LARGE_INTEGER       StatisticsStartTime;
  3355.     LARGE_INTEGER       BytesReceived;
  3356.     LARGE_INTEGER       SmbsReceived;
  3357.     LARGE_INTEGER       PagingReadBytesRequested;
  3358.     LARGE_INTEGER       NonPagingReadBytesRequested;
  3359.     LARGE_INTEGER       CacheReadBytesRequested;
  3360.     LARGE_INTEGER       NetworkReadBytesRequested;
  3361.     LARGE_INTEGER       BytesTransmitted;
  3362.     LARGE_INTEGER       SmbsTransmitted;
  3363.     LARGE_INTEGER       PagingWriteBytesRequested;
  3364.     LARGE_INTEGER       NonPagingWriteBytesRequested;
  3365.     LARGE_INTEGER       CacheWriteBytesRequested;
  3366.     LARGE_INTEGER       NetworkWriteBytesRequested;
  3367.     DWORD               InitiallyFailedOperations;    
  3368.     DWORD               FailedCompletionOperations;    
  3369.     DWORD              ReadOperations;    
  3370.     DWORD              RandomReadOperations;    
  3371.     DWORD              ReadSmbs;    
  3372.     DWORD              LargeReadSmbs;    
  3373.     DWORD              SmallReadSmbs;    
  3374.     DWORD              WriteOperations;    
  3375.     DWORD               RandomWriteOperations;    
  3376.     DWORD               WriteSmbs;    
  3377.     DWORD               LargeWriteSmbs;    
  3378.     DWORD               SmallWriteSmbs;    
  3379.     DWORD               RawReadsDenied;
  3380.     DWORD               RawWritesDenied;    
  3381.     DWORD               NetworkErrors;
  3382.     //  Connection/Session counts
  3383.     DWORD               Sessions;    
  3384.     DWORD               FailedSessions;    
  3385.     DWORD               Reconnects;    
  3386.     DWORD               CoreConnects;    
  3387.     DWORD               Lanman20Connects;    
  3388.     DWORD               Lanman21Connects;    
  3389.     DWORD               LanmanNtConnects;    
  3390.     DWORD               ServerDisconnects;    
  3391.     DWORD               HungSessions;    
  3392.     DWORD               UseCount;    
  3393.     DWORD               FailedUseCount;    
  3394.     //    
  3395.         //  Queue Lengths (updates protected by RdrMpxTableSpinLock NOT
  3396.     //  RdrStatisticsSpinlock)    
  3397.     //
  3398.     DWORD               CurrentCommands;
  3399. } STAT_WORKSTATION_0, *PSTAT_WORKSTATION_0, *LPSTAT_WORKSTATION_0;
  3400.  
  3401. The STAT_SERVER_0 data structure has this format:
  3402. typedef struct _STAT_SERVER_0 {
  3403.     DWORD        sts0_start;
  3404.     DWORD        sts0_fopens;
  3405.     DWORD        sts0_devopens;
  3406.     DWORD        sts0_jobsqueued;
  3407.     DWORD        sts0_sopens;
  3408.     DWORD        sts0_stimedout;
  3409.     DWORD        sts0_serrorout;
  3410.     DWORD        sts0_pwerrors;
  3411.     DWORD        sts0_permerrors;
  3412.     DWORD        sts0_syserrors;
  3413.     DWORD        sts0_bytessent_low;
  3414.     DWORD        sts0_bytessent_high;
  3415.     DWORD        sts0_bytesrcvd_low;
  3416.     DWORD        sts0_bytesrcvd_high;
  3417.     DWORD        sts0_avresponse;
  3418.     DWORD        sts0_reqbufneed;
  3419.     DWORD        sts0_bigbufneed;
  3420. } STAT_SERVER_0, *PSTAT_SERVER_0, *LPSTAT_SERVER_0;
  3421. 4.18.1.    NetStatisticsGet
  3422. NetStatisticsGet retrieves, and optionally clears, operating statistics for a service. Currently, only the Workstation and Server services are supported.  
  3423. Privilege Level
  3424. Admin privilege or server operator privilege is required to successfully execute NetStatisticsGet on a remote server. 
  3425. NET_API_STATUS NET_API_FUNCTION
  3426. NetStatisticsGet (
  3427.     IN LPWSTR server,
  3428.     IN LPWSTR service,
  3429.     IN DWORD level,
  3430.     IN DWORD options,
  3431.     OUT LPBYTE * bufptr
  3432.     );
  3433. Parameters:
  3434.  
  3435. server __Points to an UNICODE string that contains the name of the server on which to execute NetConfigGet. A NULL pointer or NULL string specifies the local computer.
  3436. service __Points to an UNICODE string that contains the name of the service about which to get the statistics. Only the values SERVER and WORKSTATION are currently allowed. 
  3437. level __Specifies the level of detail requested; must be 0.
  3438. options __Specifies the options flags.
  3439.     Bit(s)    Meaning
  3440.     4.18.1.1.    Clear statistics.
  3441.     4.18.1.2.    Reserved; must be 0.
  3442.  
  3443. bufptr __On return a pointer to the returned information is returned in the address pointed to by bufptr.
  3444.  
  3445. 4.19.    Auditing APIs
  3446. These are for downlevel only.  NT automatically records audits on failed accesses when AccessCheckAndAudit is used.  To read audits, use the Eventlog ReadEventlog API.
  3447. Windows NT uses an integrated Eventlogging mechanism for reporting both errors and audits.  The NetError and NetAudit APIs are provided to access downlevel LANMan logs.  They will report ERROR_NOT_SUPPORTED if called to an Windows NT system. 
  3448. Auditing API functions control the audit log. Auditing API functions monitor operations on the specified server. If auditing is enabled, each monitored operation generates an audit entry. For example, when a user establishes a connection to the server, a single audit entry is generated. 
  3449. Audit entries are stored in a binary file called an audit trail or audit log. All Auditing API functions perform their operations on this file. LAN Manager defines many types of audit entries.  
  3450. NetAuditRead reads the audit log. NetAuditClear clears the audit log. 
  3451. Data Structures 
  3452. All audit entries include a fixed-length header used in conjunction with variable-length data specific to the entry type. Because of the variable lengths and structures of the ae_data element of the audit entry (it is possible for ae_data to be zero bytes), only the fixed header is defined in the audit_entry data structure.
  3453. The variable-length portion of the audit entry can contain an offset to a variable-length UNICODE string. The offset values are DWORDs. To determine the value of the pointer to this string, add the offset value to the address of the ae_data data structure.
  3454. The following example illustrates this procedure. Assume that pAE points to a buffer that contains a complete audit entry and that the ae_type element of the audit_entry data structure contains the value AE_CONNSTOP, which specifies the predefined AE_CONNSTOP data structure. To point the variable pszComputerName to the UNICODE string that contains the name of the client whose connection was stopped, an application would perform the following algorithm:
  3455. PAUDIT_ENTRY    pAE;            /* Fixed part of audit entry */
  3456. LPAE_CONNSTOP     pAEvar;        /* Variable-length structure */
  3457. LPWSTR            pszComputerName;    /* Pointer to var-length string*/
  3458.  
  3459. /* Calculate the offset to the variable-length structure. */
  3460. pAEvar = (_LPAE_CONNSTOP) (((LPBYTE) pAE) + pAE->ae_data_offset);
  3461.  
  3462. /* Calculate the offset to the computername. */
  3463. pszComputerName = ((LPBYTE) pAEvar) + pAEvar->ae_cp_compname;
  3464. Fixed-Length Header
  3465. The audit_entry data structure has this format:    
  3466. typedef struct _AUDIT_ENTRY {
  3467.     DWORD        ae_len;
  3468.     DWORD        ae_reserved;
  3469.     DWORD        ae_time;
  3470.     DWORD        ae_type;
  3471.     DWORD        ae_data_offset;  /* Offset from beginning
  3472.                                               address of audit_entry */
  3473.     DWORD        ae_data_size;
  3474. } AUDIT_ENTRY, *PAUDIT_ENTRY, *LPAUDIT_ENTRY;
  3475.  
  3476. /* Variable-length data specific to type of audit entry.  There may be pad bytes after
  3477.      ae_data_size for alignment purposes.
  3478. */
  3479.  
  3480.     BYTE            ae_data[];
  3481.  
  3482. /* Terminating length indicator.  Preceded by pad bytes for proper alignment.*/
  3483.  
  3484.     DWORD        ae_len2;
  3485. where
  3486. ae_len and ae_len2     Specify the length of the audit entry. Both have the same value. The ae_len element is included at the beginning and at the end of the audit entry to enable both backward and forward scanning of the log.
  3487. ae_reserved     Reserved.
  3488. ae_time     Specifies when the audit entry was generated. The value is stored as the number of seconds elapsed since 00:00:00, January 1, 1970.
  3489. ae_type     Specifies the type of audit entry. Type values from 0x0000 through 0x07FF are reserved. OEMs and other applications programmers can reserve values from 0x0800 through 0xFFFF.   
  3490. ae_data_offset     Specifies the byte offset from the beginning of the audit entry to the beginning of the variable-length portion (ae_data) of the audit entry. 
  3491. ae_data     Specifies the variable-length portion of the audit entry; it differs depending on the type of entry specified by ae_type. The information begins at ae_data_offset bytes from the top of the audit entry. For information about the structure of each entry type defined by LAN Manager, see the following section.
  3492. Variable-Length Data
  3493. The following data structuresare specific to the audit entry type The structures follow the audit_entry header, but they are not necessarily contiguous.  
  3494. The _AE_SRVSTATUS data structure is associated with an audit entry of type AE_SRVSTATUS.     
  3495. typedef struct _AE_SRVSTATUS {
  3496.     DWORD        ae_sv_status;
  3497. }AE_SRVSTATUS , * PAE_SRVSTATUS ;
  3498. The _AE_SESSLOGON data structure is associated with an audit entry of type AE_SESSLOGON.     
  3499. typedef struct _AE_SESSLOGON {
  3500.     DWORD        ae_so_compname;    
  3501.     DWORD        ae_so_username;    
  3502.     DWORD        ae_so_privilege;
  3503. }AE_SESSLOGON , * PAE_SESSLOGON ;
  3504. The _AE_SESSLOGOFF data structure is associated with an audit entry of type AE_SESSLOGOFF.    
  3505. typedef struct ae_sesslogoff {
  3506.     DWORD        ae_sf_compname;  
  3507.     DWORD        ae_sf_username; 
  3508.     DWORD        ae_sf_reason;
  3509. }AE_SESSLOGOFF , * PAE_SESSLOGOFF;
  3510. The _AE_SESSPWERR data structure is associated with an audit entry of type AE_SESSPWERR. 
  3511. typedef struct _AE_SESSPWERR {
  3512.     DWORD        ae_sp_compname; 
  3513.     DWORD        ae_sp_username; 
  3514. }AE_SESSPWERR , * PAE_SESSPWERR ;
  3515. The _AE_CONNSTART data structure is associated with an audit entry of type AE_CONNSTART. 
  3516. typedef struct _AE_CONNSTART {
  3517.     DWORD        ae_ct_compname;  
  3518.     DWORD        ae_ct_username;  
  3519.     DWORD        ae_ct_netname;   
  3520.     DWORD        ae_ct_connid;
  3521. }AE_CONNSTART , * PAE_CONNSTART ; 
  3522. The _AE_CONNSTOP data structure is associated with an audit entry of type AE_CONNSTOP. 
  3523. typedef struct _AE_CONNSTOP {
  3524.     DWORD        ae_cp_compname;  
  3525.     DWORD        ae_cp_username;  
  3526.     DWORD        ae_cp_netname;   
  3527.     DWORD        ae_cp_connid;
  3528.     DWORD        ae_cp_reason;
  3529. }AE_CONNSTOP , * PAE_CONNSTOP ;
  3530. The _AE_CONNREJ data structure is associated with an audit entry of type AE_CONNREJ. 
  3531. typedef struct _AE_CONNREJ {
  3532.     DWORD        ae_cr_compname;  
  3533.     DWORD        ae_cr_username;  
  3534.     DWORD        ae_cr_netname;   
  3535.     DWORD        ae_cr_reason;
  3536. }AE_CONNREJ , * PAE_CONNREJ ;
  3537. The _AE_RESACCESS data structure is associated with an audit entry of type AE_RESACCESS. 
  3538. typedef struct _AE_RESACCESS {
  3539.     DWORD        ae_ra_compname;  
  3540.     DWORD        ae_ra_username;  
  3541.     DWORD        ae_ra_resname;  
  3542.     DWORD        ae_ra_operation;
  3543.     DWORD        ae_ra_returncode;
  3544.     DWORD        ae_ra_restype;
  3545.     DWORD        ae_ra_fileid;
  3546. }AE_RESACCESS , * PAE_RESACCESS ;
  3547. The _AD_RESACCESSREJ data structure is associated with an audit entry of type AE_RESACCESSREJ. 
  3548. typedef struct _AE_RESACCESSREJ {
  3549.     DWORD        ae_rr_compname;  
  3550.     DWORD        ae_rr_username;  
  3551.     DWORD        ae_rr_resname;   
  3552.     DWORD        ae_rr_operation;
  3553. }AE_RESACCESSREJ , * PAE_RESACCESSREJ ;
  3554. The _AD_CLOSEFILE data structure is associated with an audit entry of type AE_CLOSEFILE.   
  3555. typedef struct _AE_CLOSEFILE {
  3556.     DWORD        ae_cf_compname;  
  3557.     DWORD        ae_cf_username;  
  3558.     DWORD        ae_cf_resname;   
  3559.     DWORD        ae_cf_fileid;
  3560.     DWORD        ae_cf_duration
  3561.     DWORD        ae_cf_reason;
  3562. }AE_CLOSEFILE , * PAE_CLOSEFILE ;
  3563. The _AE_SERVICESTAT data structure is associated with an audit entry of type AE_SERVICESTAT.  
  3564. typedef struct _AE_SERVICESTAT {
  3565.     DWORD        ae_ss_compname;  
  3566.     DWORD        ae_ss_username;  
  3567.     DWORD        ae_ss_svcname;   
  3568.     DWORD        ae_ss_status;
  3569.     DWORD        ae_ss_code;
  3570.     DWORD        ae_ss_text;      
  3571.     DWORD        ae_ss_returnval;
  3572. }AE_SERVICESTAT , * PAE_SERVICESTAT ;
  3573. The _AE_ACLMOD data structure is associated with audit entries of type AE_ACLMOD and AE_ACLMODFAIL.  
  3574. struct _ae_aclmod {
  3575.     DWORD        ae_am_compname;  
  3576.     DWORD        ae_am_username;  
  3577.     DWORD        ae_am_resname;   
  3578.     DWORD        ae_am_action;
  3579.     DWORD        ae_am_datalen;
  3580. }ae_aclmod, * Pae_aclmod;
  3581. The _AE_UASMOD data structure is associated with an audit entry of type AE_UASMOD.  
  3582. typedef struct _AE_UASMOD {
  3583.     DWORD        ae_um_compname;   
  3584.     DWORD        ae_um_username;   
  3585.     DWORD        ae_um_resname;    
  3586.     DWORD        ae_um_rectype;
  3587.     DWORD        ae_um_action;
  3588.     DWORD        ae_um_datalen;
  3589. }AE_UASMOD , * PAE_UASMOD ;
  3590. The _AE_NETLOGON data structure is associated with an audit entry of type AE_NETLOGON.  
  3591. typedef struct _AE_NETLOGON {
  3592.     DWORD        ae_no_compname;    
  3593.     DWORD        ae_no_username;    
  3594.     DWORD        ae_no_privilege;
  3595.     DWORD        ae_no_authflags;
  3596. }AE_NETLOGON , * PAE_NETLOGON ;
  3597. The _AE_NETLOGOFF data structure is associated with an audit entry of type AE_NETLOGOFF.   
  3598. typedef struct _AE_NETLOGOFF {
  3599.     DWORD        ae_nf_compname;   
  3600.     DWORD        ae_nf_username;  
  3601.     DWORD        ae_nf_reserved1;
  3602.     DWORD        ae_nf_reserved2;
  3603. }AE_NETLOGOFF , * PAE_NETLOGOFF ;
  3604. The _AE_ACCLIM data structure is associated with an audit entry of type AE_ACCLIMITEXCD.
  3605. typedef struct _AE_ACCLIM {
  3606.     DWORD        ae_al_compname;   
  3607.     DWORD        ae_al_username;   
  3608.     DWORD        ae_al_resname;   
  3609.     DWORD        ae_al_limit;
  3610. }AE_ACCLIM , * PAE_ACCLIM ;
  3611. The _AE_LOCKOUT data structure is associated with an audit entry of type AE_LOCKOUT.
  3612. typedef struct ae_lockout {
  3613.     DWORD            ae_lk_compname;  
  3614.     DWORD            ae_lk_username;   
  3615.     DWORD            ae_lk_action;     
  3616.     DWORD            ae_lk_bad_pw_count;
  3617. }ae_lockout , Pae_lockout ;   
  3618. The _AE_GENERIC data structure is associated with an audit entry of type AE_GENERIC.
  3619. typedef struct _AE_GENERIC {
  3620.     DWORD        ae_ge_msgfile;
  3621.     DWORD        ae_ge_msgnum;
  3622.     DWORD        ae_ge_params;
  3623.     DWORD        ae_ge_param1;
  3624.     DWORD        ae_ge_param2;
  3625.     DWORD        ae_ge_param3;
  3626.     DWORD        ae_ge_param4;
  3627.     DWORD        ae_ge_param5;
  3628.     DWORD        ae_ge_param6;
  3629.     DWORD        ae_ge_param7;
  3630.     DWORD        ae_ge_param8;
  3631.     DWORD        ae_ge_param9;
  3632. }AE_GENERIC , * PAE_GENERIC ;
  3633. The audit log handle is defined as follows:
  3634. typedef struct _HLOG {
  3635.     DWORD        time;
  3636.     DWORD        last_flags;
  3637.     DWORD        offset;
  3638.     DWORD        rec_offset;
  3639. } HLOG, *PHLOG, *LPHLOG;
  3640. 4.19.1.    NetAuditClear 
  3641. NetAuditClear clears the audit log on a server and, optionally, saves the entries in a backup file.   
  3642. Privilege Level
  3643. Admin privilege is required to successfully execute NetAuditClear on a remote server or on a computer that has local security enabled.
  3644. NET_API_STATUS NET_API_FUNCTION
  3645. NetAuditClear (
  3646.     IN LPWSTR server,
  3647.     IN LPWSTR backupfile OPTIONAL,
  3648.     IN LPWSTR service  OPTIONAL
  3649.     );
  3650. Parameters:
  3651.  
  3652. server __Points to an UNICODE string that contains the name of the server on which to execute NetAuditClear. A NULL pointer or NULL string specifies the local computer.
  3653. backupfile __Points to an UNICODE string that contains a name for the optional backup file. The calling application must have create and write permissions for the path specified by backupfile, and the path must already exist. If the pathname is relative, it is assumed to be relative to the LAN Manager LOGS directory. A NULL pointer specifies not to back up the audit log. 
  3654. service __Points to an UNICODE string that contains the name of the service that owns the desired audit log to which the operation is to be performed.
  3655. 4.19.2.    NetAuditRead 
  3656. NetAuditRead reads from the audit log on a server. 
  3657. Privilege Level
  3658. Admin privilege or accounts, comm, print, or server operator privilege is required to successfully execute NetAuditRead on a remote server or on a computer that has local security enabled.
  3659. NET_API_STATUS NET_API_FUNCTION
  3660. NetAuditRead (
  3661.     IN LPWSTR server,
  3662.     IN LPWSTR service OPTIONAL,
  3663.     IN LPHLOG auditloghandle,
  3664.     IN DWORD offset,
  3665.     IN LPDWORD reserved1 OPTIONAL,
  3666.     IN DWORD reserved2,
  3667.     IN DWORD offsetflag,
  3668.     OUT LPBYTE * bufptr,
  3669.     IN DWORD prefmaxlen,
  3670.     OUT LPDWORD bytesread,
  3671.     OUT LPDWORD totalavailable  
  3672.     );
  3673. Parameters:
  3674.  
  3675. server __Points to an UNICODE string that contains the name of the server on which to execute NetAuditRead. A NULL pointer or NULL string specifies the local computer.
  3676. service __Points to an UNICODE string that contains the name of the service that owns the desired audit log to which the operation is to be performed.
  3677. auditloghandle __Points to the handle for the audit log. An application calling NetAuditRead for the first time must initialize the audit log handle as follows. The most significant bit (MSB) is the leftmost bit; the least significant bit (LSB) is the rightmost bit. After the first call, each call to NetAuditRead must be given the value for the handle returned by the previous call.
  3678.     auditloghandle    Value
  3679.  
  3680.     4.19.2.1.    (MSB) - 64          0        
  3681.     4.19.2.2.    - 0 (LSB)          1
  3682.         
  3683. offset __Specifies the record offset at which to begin reading. This parameter is ignored unless bit 1 in the offsetflag parameter is set. If offsetflag bit 1 is set, offset is taken as an offset based on the record number (not bytes) at which the returned data should begin. Note that the record offset parameter is zero-based from both directions, depending upon the direction of the read. If reading backward, record 0 is the last record in the log. If reading forward, record 0 is the first record in the log.
  3684. reserved1 __Reserved. Must be NULL.
  3685. reserved2 __Reserved. Must be zero.
  3686. offsetflag __Specifies the open flags, as follows:
  3687.     Bit(s)    Meaning
  3688.  
  3689.     4.19.2.3.    If 0, the log is read forward. If 1, the log is
  3690.         read backward and records are returned in the
  3691.         buffer in reverse chronological order (newest
  3692.         records first).
  3693.  
  3694.     4.19.2.4.    If 0, reading proceeds sequentially. If 1,
  3695.         reading proceeds from the nth record from the
  3696.         start of the log, where n is the offset
  3697.         parameter.
  3698.  
  3699.     4.19.2.5.    Reserved; must be 0.
  3700.  
  3701. bufptr __On return a pointer to the returned information is returned in the address pointed to by bufptr. After a successful read operation, this buffer contains a sequence of audit entries with the accompanying variable-length data structures.
  3702. prefmaxlen __Prefered maximum length of returned data (in 8-bit bytes). 
  3703. bytesread __On return the actual number of bytes read into the buffer is located in the DWORD pointed to by bytesread.
  3704. totalavailable __On return the total bytes available to be read from the log is located in the DWORD pointed to by totalavailable.
  3705. 4.19.3.    NetAuditWrite
  3706. This looks like a local only API.  If so, remove it since these are for downlevel support only.
  3707. NetAuditWrite writes an audit entry to the local audit log. 
  3708. Privilege Level
  3709. No special privilege level is required to successfully execute NetAuditWrite.
  3710. NET_API_STATUS NET_API_FUNCTION
  3711. NetAuditWrite (
  3712.     IN DWORD type,
  3713.     IN LPBYTE buf,
  3714.     IN DWORD numbytes
  3715.     IN LPWSTR service,
  3716.     IN LPBYTE reserved,
  3717.     );
  3718. Parameters:
  3719.  
  3720. type __Specifies the type of entry to write to the audit log.
  3721. buf __Points to a buffer that contains the data structure associated with the specified audit entry.
  3722. numbytes __Specifies the size (in bytes) of the buffer pointed to by buf.
  3723. service __Points to an UNICODE string that contains the name of the service that owns the desired audit log to which the operation is to be performed.
  3724. reserved __Reserved. Must be NULL.
  3725. 4.20.    Replicator APIs
  3726. The NT Replicator APIs control how the NT Replicator service updates selective directories from an export server to one or more clients.  In addition to providing compatible LAN Manager 2.x functionality in a well-defined manner, this new set of LAN Manager APIs allow for specific API (operation) security checking.
  3727. The change from the file system based control on LAN Manager 2.x to Replicator API control on NT has the following implications:
  3728.     o    Applications can no longer delete a directory in the import path of a client to stop receiving updates from its master.
  3729.     o    Applications can no longer use the REPL.INI file in each replicated directory on a master to control the method of replication. 
  3730.     o    Applications can no longer lock or unlock a directory on a master from being replicated by creating or deleting the USERLOCK.* file(s). 
  3731.     o    Applications can no longer lock or unlock a directory on a client from receiving updates from its master by creating or deleting the USERLOCK.* file(s).
  3732.     o    Applications which depend on the LAN Manager 2.x behavior of ignoring locks for file integrity trees will need to be modified.  (NT policy differs from LAN Manager 2.x policy; under NT the locks are always respected.)
  3733. Each of the intended operations listed above can be specified to the NT Replicator service through an appropriate API.
  3734. Any user or application which belongs to the admin or server operator group on a local or remote export server can modify the parameters which control the replication master.
  3735. There are three categories of Replicator APIs:
  3736.     o    Replicator Configuration APIs
  3737.     o    Replicator Export Directory APIs
  3738.     o    Replicator Import Directory APIs.
  3739. 4.20.1.    Replicator Configuration APIs
  3740. The configuration parameters of the Replicator service can be examined using NetReplGetInfo.  They can be modified using NetReplSetInfo.  
  3741. The Replicator service configuration parameters are:
  3742.     role - Role of the Replicator service which is either REPL_ROLE_IMPORT (client), REPL_ROLE_EXPORT (master), or REPL_ROLE_BOTH.  On a Advanced Server, any of these values are allowed.  Under Windows/NT systems, only REPL_ROLE_IMPORT is allowed.
  3743.     exportpath - Fully-qualified path name to the master tree in which directories are created and replicated from.  This path must include the drive letter.
  3744.     exportlist - List of machine and domain names to send update announcements to.  If this list is not provided, then update announcements will be sent to the server's domain.  The list entries are separated by semicolons; machine names in the list must not have leading backslashes
  3745.     importpath - Fully-qualified path name to the client tree in which directories are created to receive the replicas of the master.  This path must include the drive letter.
  3746.     importlist - List of machines and domain names to receive updates from.  If this list is not provided, then update announcements are received from the server's domain. The list entries are separated by semicolons; machine names in the list must not have leading backslashes.
  3747.     logonusername - User account name belonging to the replicator group which the client logs on with to read files from its master(s).  This field is ignored by the NT replicator, but is provided for possible future use.
  3748.     interval - Time in minutes within which the master checks for changes in all the replicated directories.  This field may be ignored by the NT replicator, but is provided for possible future use.
  3749.     pulse - Time in number of intervals within which the master notifies its clients of the current replica version when no updates are necessary.  This field may be ignored by the NT replicator, but is provided for possible future use.
  3750.     guardtime - Time in minutes which a REPL_INTEGRITY_TREE level integrity directory must be stable before a client is allowed to update from it. (See explanation on integrity in section 4.20.2).  The default guard time is 2 minutes.
  3751.     random - A value in seconds sent by a master to its clients so that the clients can use the 0 - random range to generate a random time to wait on before updating from the master.
  3752.  
  3753. The configuration parameters (except the importpath and exportpath) values are all dynamically settable.
  3754. These APIs can be called whether the Replicator service is running or not.  If the Replicator service is already running, any modification (except to the importpath and exportpath) to the replication configuration takes effect immediately, and is persistent after the Replicator service has been stopped.  If the Replicator service is not started, the parameters are stored as persistent information and will take effect when the Replicator service starts up.  The service must be stopped to set the importpath and exportpath values.
  3755. The Replicator configuration APIs information structures are:
  3756. typedef struct _REPL_INFO_0 {
  3757.     DWORD        rp0_role;
  3758.     LPWSTR        rp0_exportpath;
  3759.     LPWSTR        rp0_exportlist;
  3760.     LPWSTR        rp0_importpath;
  3761.     LPWSTR        rp0_importlist;
  3762.     LPWSTR        rp0_logonusername;
  3763.     DWORD        rp0_interval;
  3764.     DWORD        rp0_pulse;
  3765.     DWORD        rp0_guardtime;
  3766.     DWORD        rp0_random;
  3767. } REPL_INFO_0, *PREPL_INFO_0, *LPREPL_INFO_0;
  3768. typedef struct _REPL_INFO_1000 {
  3769.     DWORD        rp1000_interval;
  3770. } REPL_INFO_1000, *PREPL_INFO_1000, *LPREPL_INFO_1000;
  3771. typedef struct _REPL_INFO_1001 {
  3772.     DWORD        rp1001_pulse;
  3773. } REPL_INFO_1001, *PREPL_INFO_1001, *LPREPL_INFO_1001;
  3774. typedef struct _REPL_INFO_1002 {
  3775.     DWORD        rp1002_guardtime;
  3776. } REPL_INFO_1002, *PREPL_INFO_1002, *LPREPL_INFO_1002;
  3777. typedef struct _REPL_INFO_1003 {
  3778.     DWORD        rp1003_random;
  3779. } REPL_INFO_1003, *PREPL_INFO_1003, *LPREPL_INFO_1003;
  3780. 4.20.1.1.    NetReplGetInfo
  3781. NetReplGetInfo retrieves the Replicator service configuration information. 
  3782. Security
  3783. No special group membership is required to successfully execute NetReplGetInfo.
  3784. NET_API_STATUS NET_API_FUNCTION
  3785. NetReplGetInfo (
  3786.     IN LPWSTR servername OPTIONAL,
  3787.     IN DWORD level,
  3788.     OUT LPBYTE * bufptr
  3789.     );
  3790. Parameters:
  3791.  
  3792. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3793. level __Level of information required.  Only level 0 is valid.
  3794. bufptr __On return a pointer to the return information structure is written in the address pointed to by bufptr.
  3795. 4.20.2.    NetReplSetInfo
  3796. NetReplSetInfo modifies the Replicator service configuration information. 
  3797. Security
  3798. Admin or server operator group membership is required to successfully execute NetReplSetInfo.
  3799. NET_API_STATUS NET_API_FUNCTION
  3800. NetReplSetInfo (
  3801.     IN LPWSTR servername OPTIONAL,
  3802.     IN DWORD level,
  3803.     IN LPBYTE buf,
  3804.     OUT LPDWORD parm_err OPTIONAL
  3805.     );
  3806. Parameters:
  3807.  
  3808. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3809. level __Level of information to set 0, 1000, 1001, 1002, and 1003 are valid levels. 
  3810. buf __A pointer to a buffer containing the configuration information structure which corresponds to the specified level.
  3811. parm_err __Optional pointer to a DWORD to return the identifier of the first parameter in error when ERROR_INVALID_PARAMETER is returned.  If NULL the parameter is not returned on error.
  3812. 4.20.3.    Replicator Export Directory APIs 
  3813. The ReplExportDir APIs control top-level directories under the export path on the master.   A user can create a new directory under the export path and the Replicator service will automatically replicate that directory.  Or, a directory under the export path can be registered using NetReplExportDirAdd.  When adding a directory to be replicated via these APIs, the replication controls (integrity and extent) are specified via the NetReplExportDirAdd API.  If the directory is created in the file system and no replicator APIs are called, then the directory is treated as having file integrity and tree extent.  
  3814. Integrity determines when a master updates a client.  When integrity is REPL_INTEGRITY_FILE, the client gets a replica of a file within the directory when it is not in use (being changed or replicated).  When integrity is set to REPL_INTEGRITY_TREE, every file and directory within the replicated directory must be stable for the amount of time specified by the guardtime parameter before the client is updated.  Extent determines whether the entire tree within the directory is replicated (REPL_EXTENT_TREE) or only the files in the first-level directory is replicated (REPL_EXTENT_FILE).  
  3815. The replication controls of each replicated directory can be examined using NetReplExportDirGetInfo, and dynamically modified using NetReplExportDirSetInfo.  These control fields used to be specified in the REPL.INI file within each replicated directory on LAN Manager 2.x, and they were not dynamically settable.  On NT, the REPL.INI file is not used and will be ignored in the replication process.
  3816. NetReplExportDirEnum returns a list of directories that are currently replicated.  NetReplExportDirDel deregisters a directory so that it is no longer replicated.
  3817. The lock status information is returned in two fields: lockcount and locktime.  Lockcount indicates the number of outstanding locks on a directory.  Locktime is the time (in seconds since 1970, GMT) when the directory was first locked, or is 0 if the directory is not locked at the present time.  
  3818. NetReplExportDirLock locks a directory so that it is not replicated, by incrementing a lock reference count for the directory.  A lock on a directory can be unlocked using NetReplExportDirUnlock.   The replication does not resume unless all outstanding locks on that directory are released, and the lock reference count is returned to 0.  (The locktime field is automatically set to 0 when lockcount is 0.)
  3819. The ReplExportDir APIs can be called whether the Replicator service is running or not.  If the Replicator service is running as a master, any modification to the directory controls takes effect immediately, and is persistent after the Replicator service has been stopped.  If the Replicator service is not started, the controls for the directory is stored as persistent information and will take effect when the Replicator service starts up.
  3820. The ReplExportDir APIs are available at the following information levels:
  3821. typedef struct _REPL_EDIR_INFO_0 {
  3822.     LPWSTR        rped0_dirname;
  3823. } REPL_EDIR_INFO_0, *PREPL_EDIR_INFO_0, *LPREPL_EDIR_INFO_0;
  3824. typedef struct _REPL_EDIR_INFO_1 {
  3825.     LPWSTR        rped1_dirname;
  3826.     DWORD        rped1_integrity;
  3827.     DWORD        rped1_extent;
  3828. } REPL_EDIR_INFO_1, *PREPL_EDIR_INFO_1, *LPREPL_EDIR_INFO_1;
  3829. typedef struct _REPL_EDIR_INFO_2 {
  3830.     LPWSTR        rped2_dirname;
  3831.     DWORD        rped2_integrity;
  3832.     DWORD        rped2_extent;
  3833.     DWORD        rped2_lockcount;
  3834.     DWORD        rped2_locktime;
  3835. } REPL_EDIR_INFO_2, *PREPL_EDIR_INFO_2, *LPREPL_EDIR_INFO_2;
  3836. typedef struct _REPL_EDIR_INFO_1000 {
  3837.     DWORD        rped1000_integrity;
  3838. } REPL_EDIR_INFO_1000, *PREPL_EDIR_INFO_1000, *LPREPL_EDIR_INFO_1000;
  3839. typedef struct _REPL_EDIR_INFO_1001 {
  3840.     DWORD        rped1001_extent;
  3841. } REPL_EDIR_INFO_1001, *PREPL_EDIR_INFO_1001, *LPREPL_EDIR_INFO_1001;
  3842. 4.20.3.1.    NetReplExportDirAdd 
  3843. NetReplExportDirAdd registers an existing directory in the export path to be replicated.  The default values for locktime and lockcount (both 0) are assumed.
  3844. Security
  3845. Admin or server operator group membership is required to successfully execute NetReplExportDirAdd.
  3846. NET_API_STATUS NET_API_FUNCTION
  3847. NetReplExportDirAdd (
  3848.     IN LPWSTR servername OPTIONAL,
  3849.     IN DWORD level,
  3850.     IN LPBYTE buf,
  3851.     OUT LPDWORD parm_err OPTIONAL
  3852.     );
  3853. Parameters:
  3854.  
  3855. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3856. level __Level of information to add.  Only level 1 is valid.
  3857. buf __A pointer to a buffer containing the directory control information structure. 
  3858. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  3859. 4.20.4.    NetReplExportDirDel 
  3860. NetReplExportDirDel deregisters a replicated directory. 
  3861. Privilege Level
  3862. Security
  3863. Admin or server operator group membership is required to successfully execute NetReplExportDirDel.
  3864. NET_API_STATUS NET_API_FUNCTION
  3865. NetReplExportDirDel (
  3866.     IN LPWSTR servername OPTIONAL,
  3867.     IN LPWSTR dirname
  3868.     );
  3869. Parameters:
  3870.  
  3871. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3872. dirname __A pointer to a NULL terminated Unicode string containing the name of a replicated directory to deregister.
  3873. 4.20.5.    NetReplExportDirEnum 
  3874. NetReplExportDirEnum lists the replicated directories in the export path.
  3875. Security
  3876. No special group membership is required to successfully execute NetReplExportDirEnum.
  3877. NET_API_STATUS NET_API_FUNCTION
  3878. NetReplExportDirEnum (
  3879.     IN LPWSTR servername OPTIONAL,
  3880.     IN DWORD level,
  3881.     OUT LPBYTE * bufptr,
  3882.     IN DWORD prefmaxlen,
  3883.     OUT LPDWORD entriesread,
  3884.     OUT LPDWORD totalentries,
  3885.     IN OUT LPDWORD resumehandle OPTIONAL
  3886.     );
  3887. Parameters:
  3888.  
  3889. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3890. level __Level of information to return.  Levels 0,1, and 2 are valid. 
  3891. bufptr __On return, an array of the specified information structure is returned in the address pointed to by bufptr.
  3892. prefmaxlen __Preferred maximum length of returned data (in 8-bit bytes).  A value of 0xFFFFFFFF indicates that all available entries should be returned.
  3893. entriesread __On return, the actual enumerated element count is located in the DWORD pointed to by entriesread.
  3894. totalentries __On return, the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  3895. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing use search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored.
  3896. 4.20.6.    NetReplExportDirGetInfo 
  3897. NetReplExportDirGetInfo retrieves a replicated directory control information. 
  3898. Security
  3899. No special group membership is required to successfully execute NetReplExportDirGetInfo.
  3900. NET_API_STATUS NET_API_FUNCTION
  3901. NetReplExportDirGetInfo (
  3902.     IN LPWSTR servername OPTIONAL,
  3903.     IN LPWSTR dirname,
  3904.     IN DWORD level,
  3905.     OUT LPBYTE * bufptr
  3906.     );
  3907. Parameters:
  3908.  
  3909. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3910. dirname __A pointer to a NULL terminated Unicode string containing the directory name to return control information about.
  3911. level __Level of information to return.  Levels 0, 1, and 2 are valid.
  3912. bufptr __On return a pointer to the return information structure is written in the address pointed to by bufptr.
  3913. 4.20.7.    NetReplExportDirSetInfo
  3914. NetReplExportDirSetInfo modifies the control information of a replicated directory. 
  3915. Security
  3916. Admin or server operator group membership is required to successfully execute NetReplExportDirSetInfo.
  3917. NET_API_STATUS NET_API_FUNCTION
  3918. NetReplExportDirSetInfo (
  3919.     IN LPWSTR servername OPTIONAL,
  3920.     IN LPWSTR dirname,
  3921.     IN DWORD level,
  3922.     IN LPBYTE buf,
  3923.     OUT LPDWORD parm_err OPTIONAL
  3924.     );
  3925. Parameters:
  3926.  
  3927. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3928. dirname __A pointer to a NULL terminated Unicode string containing the directory name to return control information about.
  3929. level __Level of information to set.  Levels 1, 1000, and 1001 are valid. 
  3930. buf __A pointer to a buffer containing the control information structure which corresponds to the specified level.
  3931. parm_err __Optional pointer to a DWORD to return the identifier of the first parameter in error when ERROR_INVALID_PARAMETER is returned.  If NULL the parameter is not returned on error.
  3932. 4.20.7.1.    NetReplExportDirLock
  3933. NetReplExportDirLock locks a replicated directory so that replication from it can be suspended.  This function increments the lock reference count for the specified directory.
  3934. Security
  3935. Admin or server operator group membership is required to successfully execute NetReplExportDirLock.
  3936. NET_API_STATUS NET_API_FUNCTION
  3937. NetReplExportDirLock (
  3938.     IN LPWSTR servername OPTIONAL,
  3939.     IN LPWSTR dirname
  3940.     );
  3941. Parameters:
  3942.  
  3943. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3944. dirname __A pointer to a NULL terminated Unicode string containing the directory name to lock.
  3945. 4.20.7.2.    NetReplExportDirUnlock
  3946. NetReplExportDirUnlock unlocks a directory so that replication from it can resume.  This function decrements the lock reference count for the specified directory.
  3947. Security
  3948. Admin or server operator group membership is required to successfully execute NetReplExportDirUnlock.
  3949. NET_API_STATUS NET_API_FUNCTION
  3950. NetReplExportDirUnlock (
  3951.     IN LPWSTR servername OPTIONAL,
  3952.     IN LPWSTR dirname,
  3953.     IN DWORD unlockforce
  3954.     );
  3955. Parameters:
  3956.  
  3957. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3958. dirname __A pointer to a NULL terminated Unicode string containing the directory name to unlock.
  3959. unlockforce __A value which indicates the force level to unlock the directory.
  3960. Force levels:
  3961.  
  3962. REPL_UNLOCK_NOFORCE - Unlocks the directory by decrementing the lock reference count.  The lock reference count may or may not return to 0, so the directory could still be locked.
  3963.  
  3964. REPL_UNLOCK_FORCE - Unlocks the directory completely by removing all outstanding locks on the directory.  The lock reference count is set to 0.
  3965.  
  3966. 4.20.8.    Replicator Import Directory APIs 
  3967. The ReplImportDir APIs designate the top-level directories under the import path to receive updates on.  They also return status information about a replicated directory on the client.  On LAN Manager 2.x, a user must create a directory under the import path and the Replicator service automatically replicates to it.  On NT, import directories are automatically added if they are exported by an export server from which importer is importing.  Another way to register a directory in advance of it being exported, is to use the  NetReplImportDirAdd API.  This API does not create the directory itself. This is useful if you wish to modify some of the properties of the import directory (for example, to lock it) prior to it first beginning to import this directory.
  3968. NetReplImportDirDel deregisters a directory.  This is used to clean up a directory that is no longer being exported.  It will not stop replication if there is an active exporter, since it will be re-registered the next time the exporter tells the importer what directories it is exporting.  If you wish to prevent importing of an actively exported directory, use the NetReplImportDirLock API.
  3969. NetReplImportDirEnum lists all the directories that are replicated to a client, and NetReplImportDirGetInfo returns the status of a specified directory.  
  3970. The status information of a directory consists of the replication state, the UNC computername of the master (mastername), and the time  (in seconds since 1970, GMT) when the directory was last updated (last_update_time).  If the state is REPL_STATE_OK, the directory currently has a master, and is receiving regular update notices from it.  If the state is REPL_STATE_NO_MASTER, the directory is not supported by any master, and it is normally empty.  If the state is REPL_STATE_NO_SYNC, the directory has a master, but the master has not sent any update notices within the interval time period.  This may be due to a communication failure, the master crashing, the directory being locked, files in the client directory being opened at update time, or an unstable REPL_INTEGRITY_TREE integrity directory on the master.  If the client Replicator service is not started the state is REPL_STATE_NEVER_REPLICATED, mastername is a NULL string, and last_update_time is 0.NetReplImportDirLock locks a directory so that it does not receive updates, by incrementing a lock reference count for the directory.  A lock on a directory can be unlocked using NetReplImportDirUnlock.   The directory is not updated unless all outstanding locks on that directory are released, and the lock reference count is returned to 0.
  3971. The lock status information is returned in two fields: lockcount and locktime.  Lockcount indicates the number of outstanding locks on a directory.  Locktime is the time (in seconds since 1970, GMT) when the directory was first locked.  (locktime is set to 0 whenever lockcount goes to 0.)
  3972. The ReplImportDir APIs can be called whether the Replicator service is running or not.  If the Replicator service is running as a client, directory adds or deletes take effect immediately, and is persistent after the Replicator service has been stopped.  If the Replicator service is not started, any added directory will receive updates when the Replicator service starts up (if there exists a master which exports the directory). 
  3973. The ReplImportDir APIs are available at the following information levels:
  3974. typedef struct _REPL_IDIR_INFO_0 {
  3975.     LPWSTR        rpid0_dirname;
  3976. } REPL_IDIR_INFO_0, *PREPL_IDIR_INFO_0, *LPREPL_IDIR_INFO_0;
  3977. typedef struct _REPL_IDIR_INFO_1 {
  3978.     LPWSTR        rpid1_dirname;
  3979.     DWORD        rpid1_state;
  3980.     LPWSTR        rpid1_mastername;
  3981.     DWORD        rpid1_last_update_time;
  3982.     DWORD        rpid1_lockcount;
  3983.     DWORD        rpid1_locktime;
  3984. } REPL_IDIR_INFO_1, *PREPL_IDIR_INFO_1, *LPREPL_IDIR_INFO_1;
  3985. 4.20.8.1.    NetReplImportDirAdd 
  3986. NetReplImportDirAdd registers an existing directory in the import path to receive replication from a master.
  3987. Security
  3988. Admin or replicator group membership is required to successfully execute NetReplImportDirAdd.
  3989. NET_API_STATUS NET_API_FUNCTION
  3990. NetReplImportDirAdd (
  3991.     IN LPWSTR servername OPTIONAL,
  3992.     IN DWORD level,
  3993.     IN LPBYTE buf,
  3994.     OUT LPDWORD parm_err OPTIONAL
  3995.     );
  3996. Parameters:
  3997.  
  3998. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  3999. level __Level of information to add.  Only level 0 is valid.
  4000. buf __A pointer to a buffer containing the directory name. 
  4001. parm_err __Optional pointer to a DWORD to return the index of the first parameter in error when ERROR_INVALID_PARAMETER is returned. If NULL the parameter is not returned on error.
  4002. 4.20.9.    NetReplImportDirDel 
  4003. NetReplImportDirDel deregisters directory so that it no longer receives updates from the master.  Note that this API does not actually delete the directory from the file system.  Also, the directory may be automatically re-registered by the Replicator service at any time.  To prevent importing of a directory that is being exported by some Replicator service, use the NetReplImportDirLock API instead. 
  4004. Privilege Level
  4005. Security
  4006. Admin or replicator group membership is required to successfully execute NetReplImportDirDel.
  4007. NET_API_STATUS NET_API_FUNCTION
  4008. NetReplImportDirDel (
  4009.     IN LPWSTR servername OPTIONAL,
  4010.     IN LPWSTR dirname
  4011.     );
  4012. Parameters:
  4013.  
  4014. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  4015. dirname __A pointer to a NULL terminated Unicode string containing the name of a replicated directory to deregister.
  4016. 4.20.10.    NetReplImportDirEnum 
  4017. NetReplImportDirEnum lists the replicated directories in the import path.
  4018. Security
  4019. No special group membership is required to successfully execute NetReplImportDirEnum.
  4020. NET_API_STATUS NET_API_FUNCTION
  4021. NetReplImportDirEnum (
  4022.     IN LPWSTR servername OPTIONAL,
  4023.     IN DWORD level,
  4024.     OUT LPBYTE * bufptr,
  4025.     IN DWORD prefmaxlen,
  4026.     OUT LPDWORD entriesread,
  4027.     OUT LPDWORD totalentries,
  4028.     IN OUT LPDWORD resumehandle OPTIONAL
  4029.     );
  4030. Parameters:
  4031.  
  4032. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  4033. level __Level of information to return.  Levels 0 or 1 are valid. 
  4034. bufptr __On return, an array of the specified information structure is returned in the address pointed to by bufptr.
  4035. prefmaxlen __Preferred maximum length of returned data (in 8-bit bytes).  A value of 0xFFFFFFFF indicates that all available entries should be returned.
  4036. entriesread __On return, the actual enumerated element count is located in the DWORD pointed to by entriesread.
  4037. totalentries __On return, the total number of entries that could have been enumerated from the current resume position is located in the DWORD pointed to by totalentries.
  4038. resumehandle __On return, a resume handle is stored in the DWORD pointed to by resumehandle, and is used to continue an existing use search. The handle should be zero on the first call and left unchanged for subsequent calls. If resumehandle is NULL, then no resume handle is stored.
  4039. 4.20.11.    NetReplImportDirGetInfo 
  4040. NetReplImportDirGetInfo retrieves the status information on a client replicated directory.
  4041. Security
  4042. No special group membership is required to successfully execute NetReplImportDirGetInfo.
  4043. NET_API_STATUS NET_API_FUNCTION
  4044. NetReplImportDirGetInfo (
  4045.     IN LPWSTR servername OPTIONAL,
  4046.     IN LPWSTR dirname,
  4047.     IN DWORD level,
  4048.     OUT LPBYTE * bufptr
  4049.     );
  4050. Parameters:
  4051.  
  4052. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  4053. dirname __A pointer to a NULL terminated Unicode string containing the directory name to return control information about.
  4054. level __Level of information to return.  Levels 0 and 1 are valid.
  4055. bufptr __On return a pointer to the return information structure is written in the address pointed to by bufptr.
  4056. 4.20.11.1.    NetReplImportDirLock
  4057. NetReplImportDirLock locks a replicated directory so that replication to it can be suspended.  This function increments the lock reference count for the specified directory.
  4058. Security
  4059. Admin or replicator group membership is required to successfully execute NetReplImportDirLock.
  4060. NET_API_STATUS NET_API_FUNCTION
  4061. NetReplImportDirLock (
  4062.     IN LPWSTR servername OPTIONAL,
  4063.     IN LPWSTR dirname
  4064.     );
  4065. Parameters:
  4066.  
  4067. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  4068. dirname __A pointer to a NULL terminated Unicode string containing the directory name to lock.
  4069. 4.20.11.2.    NetReplImportDirUnlock
  4070. NetReplImportDirUnlock unlocks a directory so that replication to it can resume.  This function decrements the lock reference count for the specified directory.
  4071. Security
  4072. Admin or replicator group membership is required to successfully execute NetReplImportDirUnlock.
  4073. NET_API_STATUS NET_API_FUNCTION
  4074. NetReplImportDirUnlock (
  4075.     IN LPWSTR servername OPTIONAL,
  4076.     IN LPWSTR dirname,
  4077.     IN DWORD unlockforce
  4078.     );
  4079. Parameters:
  4080.  
  4081. servername __A pointer to a NULL terminated Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local machine.
  4082. dirname __A pointer to a NULL terminated Unicode string containing the directory name to unlock.
  4083. unlockforce __A value which indicates the force level to unlock the directory.
  4084. Force levels:
  4085.  
  4086. REPL_UNLOCK_NOFORCE - Unlocks the directory by decrementing the lock reference count.  The lock reference count may or may not return to 0, so the directory could still be locked.
  4087.  
  4088. REPL_UNLOCK_FORCE - Unlocks the directory completely by removing all outstanding locks on the directory.  The lock reference count is set to 0.
  4089.  
  4090. 5.    Lanman APIs That Are Not Supported In Windows NT
  4091. The following section lists the 16-bit LANMan APIs that are no longer supported in the 32-bit API set. In general, the rule we have followed is to not support anything that was marked as obsolete in LANMan 2.x. In addition, there are some APIs that no longer make sense in NT, and those have been removed as well. Another set of APIs has been folded into the NT base or Win32 API set . 
  4092. 5.1.    APIs with no 32 bit Net equivalents
  4093.     -    NetAlertStop, NetAlertStart
  4094.     -    NetBiosClose, NetBiosEnum, NetBiosGetInfo, NetBiosOpen, NetBiosSubmit  
  4095.     -    NetCharDev and NetCharDevQ APIs
  4096.     -    NetErrorLogWrite
  4097.     -    NetLogonEnum
  4098.     -    NetHandleGetInfo levels 2 and 3 
  4099.     -    NetMessageFileSend, NetMessageLogFileGet, NetMessageLogFileSet, NetMessageNameFwd, NetMessageNameUnFwd 
  4100.     -    NetRemoteCopy, NetRemoteExec, NetRemoteMove
  4101.     -    NetServerAdminCommand 
  4102.     -    NetWkstaSetUID
  4103.  
  4104. 5.2.    APIs that only have support for remoting to downlevel
  4105.     -    NetAccess APIs
  4106.     -    NetAudit APIs
  4107.     -    NetConfig APIs
  4108.     -    NetError APIs
  4109.  
  4110. 6.    Interoperabilty Considerations
  4111. 6.1.    Requests From 16-bit LANMan Clients
  4112. NT provides support for most remote API called from downlevel clients.  However, the following calls are NOT supported when remoted from a downlevel client to an NT server.  In some of the below, there is a more current "2" version of the API which is supported (e.g. NetServerEnum).
  4113. NetFileEnum
  4114. NetFileGetInfo
  4115. NetFileClose
  4116. NetServerAdminCommand
  4117. NetAuditOpen
  4118. NetAuditClear
  4119. NetErrorLogOpen
  4120. NetErrorLogClear
  4121. NetMessageNameFwd
  4122. NetMessageNameUnFwd
  4123. NetMessageFileSend
  4124. NetMessageLogFileSet
  4125. NetMessageLogFileGet
  4126. NetUserAdd
  4127. NetUserSetInfo
  4128. NetUserPasswordSet
  4129. NetWkstaSetUID
  4130. NetUseEnum
  4131. NetUseAdd
  4132. NetUseDel
  4133. NetUseGetInfo
  4134. NetProfileSave
  4135. NetProfileLoad
  4136. NetStatisticsGet
  4137. NetStatisticsClear
  4138. NetNetBiosEnum
  4139. NetNetBiosGetInfo
  4140. NetServerEnum
  4141. NetConfigGet2
  4142. NetConfigGetAll2
  4143. NetHandleGetInfo
  4144. NetHandleSetInfo
  4145. NetAuditRead
  4146. NetUserValidate2
  4147. NetAccessCheck
  4148. NetAlertRaise
  4149. NetAlertStart
  4150. NetAlertStop
  4151. NetAuditWrite
  4152. NetServiceStatus
  4153. DosPrintDriverEnum
  4154. DosPrintQProcessorEnum
  4155. DosPrintPortEnum
  4156. DosPrintDest
  4157. NetConfigSet
  4158.  
  4159. 6.2.    Calling 16-bit LANMan Servers
  4160. When an RPC based API fails to connect to the appropriate interface the client-side stub may attempt to initiate a down-level API request to the server selected. For most of the Windows networking APIs specified in this document, and any API where the functionality and data formats are changed only for 32-bit usage, the conversion is straightforward. For components which offer new functionality the caller of the API should generally be aware of the destination type. When the new API offers a superset of the functionality of the down-level station the same API is used for both destinations, but the new API fields must have either a reserved value of an associated field to inform the conversion layer the field may be ignored if going downlevel. This is required so that an API caller is not misled as to the action performed when the API was called.
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168. - {PAGE|i} -
  4169.  
  4170. NT Lanman APIs
  4171.  
  4172. Page  {PAGE|18} 
  4173.  
  4174. Microsoft Corporation Company Confidential
  4175.  
  4176. Microsoft Corporation Company Confidential
  4177.  
  4178. Core LANMan Service APIs    {page|iv}
  4179.  
  4180. Core LANMan Service APIs    {page|3}
  4181.  
  4182. Microsoft Corporation Company Confidential
  4183.  
  4184. Microsoft Corporation Company Confidential
  4185.  
  4186. Core LANMan Service APIs    {page|1}
  4187.  
  4188. Core LANMan Service APIs    {page|1}
  4189.  
  4190. Microsoft Corporation Company Confidential
  4191.  
  4192. Microsoft Corporation Company Confidential
  4193.  
  4194.  
  4195.