2 * Copyright 2002 Andriy Palamarchuk
4 * User information Net API.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_LMACCESS_H
22 #define __WINE_LMACCESS_H
30 #define ACCESS_NONE 0x0000
31 #define ACCESS_READ 0x0001
32 #define ACCESS_WRITE 0x0002
33 #define ACCESS_CREATE 0x0004
34 #define ACCESS_EXEC 0x0008
35 #define ACCESS_DELETE 0x0010
36 #define ACCESS_ATRIB 0x0020
37 #define ACCESS_PERM 0x0040
38 #define ACCESS_GROUP 0x8000
39 #define ACCESS_ALL (ACCESS_READ|ACCESS_WRITE|ACCESS_CREATE|ACCESS_EXEC|ACCESS_DELETE|ACCESS_ATRIB|ACCESS_PERM)
41 #define UF_SCRIPT 0x000001
42 #define UF_ACCOUNTDISABLE 0x000002
43 #define UF_HOMEDIR_REQUIRED 0x000008
44 #define UF_LOCKOUT 0x000010
45 #define UF_PASSWD_NOTREQD 0x000020
46 #define UF_PASSWD_CANT_CHANGE 0x000040
47 #define UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 0x000080
48 #define UF_TEMP_DUPLICATE_ACCOUNT 0x000100
49 #define UF_NORMAL_ACCOUNT 0x000200
50 #define UF_INTERDOMAIN_TRUST_ACCOUNT 0x000800
51 #define UF_WORKSTATION_TRUST_ACCOUNT 0x001000
52 #define UF_SERVER_TRUST_ACCOUNT 0x002000
53 #define UF_DONT_EXPIRE_PASSWD 0x010000
54 #define UF_MNS_LOGON_ACCOUNT 0x020000
55 #define UF_SMARTCARD_REQUIRED 0x040000
56 #define UF_TRUSTED_FOR_DELEGATION 0x080000
57 #define UF_NOT_DELEGATED 0x100000
58 #define UF_USE_DES_KEY_ONLY 0x200000
59 #define UF_DONT_REQUIRE_PREAUTH 0x400000
60 #define UF_PASSWORD_EXPIRED 0x800000
63 #define UF_MACHINE_ACCOUNT_MASK ( \
64 UF_INTERDOMAIN_TRUST_ACCOUNT | \
65 UF_WORKSTATION_TRUST_ACCOUNT | \
66 UF_SERVER_TRUST_ACCOUNT)
68 #define UF_ACCOUNT_TYPE_MASK ( \
69 UF_TEMP_DUPLICATE_ACCOUNT | \
71 UF_INTERDOMAIN_TRUST_ACCOUNT | \
72 UF_WORKSTATION_TRUST_ACCOUNT | \
73 UF_SERVER_TRUST_ACCOUNT)
75 #define UF_SETTABLE_BITS ( \
79 UF_HOMEDIR_REQUIRED | \
81 UF_PASSWD_CANT_CHANGE | \
82 UF_ACCOUNT_TYPE_MASK | \
83 UF_DONT_EXPIRE_PASSWD | \
84 UF_MNS_LOGON_ACCOUNT |\
85 UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED |\
86 UF_SMARTCARD_REQUIRED | \
87 UF_TRUSTED_FOR_DELEGATION | \
89 UF_USE_DES_KEY_ONLY | \
90 UF_DONT_REQUIRE_PREAUTH |\
94 # define GROUP_SPECIALGRP_USERS (const WCHAR []){ 'U','S','E','R','S',0 }
95 #elif defined(_MSC_VER)
96 # define GROUP_SPECIALGRP_USERS L"USERS"
98 static const WCHAR GROUP_SPECIALGRP_USERS
[] = { 'U','S','E','R','S',0 };
101 #if defined(__GNUC__)
102 # define GROUP_SPECIALGRP_ADMINS (const WCHAR []){ 'A','D','M','I','N','S',0 }
103 #elif defined(_MSC_VER)
104 # define GROUP_SPECIALGRP_ADMINS L"ADMINS"
106 static const WCHAR GROUP_SPECIALGRP_ADMINS
[] = { 'A','D','M','I','N','S',0 };
109 #if defined(__GNUC__)
110 # define GROUP_SPECIALGRP_GUESTS (const WCHAR []){ 'G','U','E','S','T','S',0 }
111 #elif defined(_MSC_VER)
112 # define GROUP_SPECIALGRP_GUESTS L"GUESTS"
114 static const WCHAR GROUP_SPECIALGRP_GUESTS
[] = { 'G','U','E','S','T','S',0 };
117 #if defined(__GNUC__)
118 # define GROUP_SPECIALGRP_LOCAL (const WCHAR []){ 'L','O','C','A','L',0 }
119 #elif defined(_MSC_VER)
120 # define GROUP_SPECIALGRP_LOCAL L"LOCAL"
122 static const WCHAR GROUP_SPECIALGRP_LOCAL
[] = { 'L','O','C','A','L',0 };
125 #ifndef WINE_NTSTATUS_DECLARED
126 #define WINE_NTSTATUS_DECLARED
127 typedef LONG NTSTATUS
;
129 #ifndef WINE_PNTSTATUS_DECLARED
130 #define WINE_PNTSTATUS_DECLARED
131 typedef NTSTATUS
*PNTSTATUS
;
134 /* NetGetUserInfo structures */
135 typedef struct _USER_INFO_0
{
137 } USER_INFO_0
, *PUSER_INFO_0
, *LPUSER_INFO_0
;
139 typedef struct _USER_INFO_1
{
141 LPWSTR usri1_password
;
142 DWORD usri1_password_age
;
144 LPWSTR usri1_home_dir
;
145 LPWSTR usri1_comment
;
147 LPWSTR usri1_script_path
;
148 } USER_INFO_1
, *PUSER_INFO_1
, *LPUSER_INFO_1
;
150 typedef struct _USER_INFO_2
{
152 LPWSTR usri2_password
;
153 DWORD usri2_password_age
;
155 LPWSTR usri2_home_dir
;
156 LPWSTR usri2_comment
;
158 LPWSTR usri2_script_path
;
159 DWORD usri2_auth_flags
;
160 LPWSTR usri2_full_name
;
161 LPWSTR usri2_usr_comment
;
163 LPWSTR usri2_workstations
;
164 DWORD usri2_last_logon
;
165 DWORD usri2_last_logoff
;
166 DWORD usri2_acct_expires
;
167 DWORD usri2_max_storage
;
168 DWORD usri2_units_per_week
;
169 PBYTE usri2_logon_hours
;
170 DWORD usri2_bad_pw_count
;
171 DWORD usri2_num_logons
;
172 LPWSTR usri2_logon_server
;
173 DWORD usri2_country_code
;
174 DWORD usri2_code_page
;
175 } USER_INFO_2
, *PUSER_INFO_2
, *LPUSER_INFO_2
;
177 typedef struct _USER_INFO_3
{
179 LPWSTR usri3_password
;
180 DWORD usri3_password_age
;
182 LPWSTR usri3_home_dir
;
183 LPWSTR usri3_comment
;
185 LPWSTR usri3_script_path
;
186 DWORD usri3_auth_flags
;
187 LPWSTR usri3_full_name
;
188 LPWSTR usri3_usr_comment
;
190 LPWSTR usri3_workstations
;
191 DWORD usri3_last_logon
;
192 DWORD usri3_last_logoff
;
193 DWORD usri3_acct_expires
;
194 DWORD usri3_max_storage
;
195 DWORD usri3_units_per_week
;
196 PBYTE usri3_logon_hours
;
197 DWORD usri3_bad_pw_count
;
198 DWORD usri3_num_logons
;
199 LPWSTR usri3_logon_server
;
200 DWORD usri3_country_code
;
201 DWORD usri3_code_page
;
203 DWORD usri3_primary_group_id
;
204 LPWSTR usri3_profile
;
205 LPWSTR usri3_home_dir_drive
;
206 DWORD usri3_password_expired
;
207 } USER_INFO_3
, *PUSER_INFO_3
, *LPUSER_INFO_3
;
209 typedef struct _USER_INFO_4
{
211 LPWSTR usri4_password
;
212 DWORD usri4_password_age
;
214 LPWSTR usri4_home_dir
;
215 LPWSTR usri4_comment
;
217 LPWSTR usri4_script_path
;
218 DWORD usri4_auth_flags
;
219 LPWSTR usri4_full_name
;
220 LPWSTR usri4_usr_comment
;
222 LPWSTR usri4_workstations
;
223 DWORD usri4_last_logon
;
224 DWORD usri4_last_logoff
;
225 DWORD usri4_acct_expires
;
226 DWORD usri4_max_storage
;
227 DWORD usri4_units_per_week
;
228 PBYTE usri4_logon_hours
;
229 DWORD usri4_bad_pw_count
;
230 DWORD usri4_num_logons
;
231 LPWSTR usri4_logon_server
;
232 DWORD usri4_country_code
;
233 DWORD usri4_code_page
;
235 DWORD usri4_primary_group_id
;
236 LPWSTR usri4_profile
;
237 LPWSTR usri4_home_dir_drive
;
238 DWORD usri4_password_expired
;
239 } USER_INFO_4
, *PUSER_INFO_4
, *LPUSER_INFO_4
;
241 typedef struct _USER_INFO_10
{
243 LPWSTR usri10_comment
;
244 LPWSTR usri10_usr_comment
;
245 LPWSTR usri10_full_name
;
246 } USER_INFO_10
, *PUSER_INFO_10
, *LPUSER_INFO_10
;
248 typedef struct _USER_INFO_11
{
250 LPWSTR usri11_comment
;
251 LPWSTR usri11_usr_comment
;
252 LPWSTR usri11_full_name
;
254 DWORD usri11_auth_flags
;
255 DWORD usri11_password_age
;
256 LPWSTR usri11_home_dir
;
258 DWORD usri11_last_logon
;
259 DWORD usri11_last_logoff
;
260 DWORD usri11_bad_pw_count
;
261 DWORD usri11_num_logons
;
262 LPWSTR usri11_logon_server
;
263 DWORD usri11_country_code
;
264 LPWSTR usri11_workstations
;
265 DWORD usri11_max_storage
;
266 DWORD usri11_units_per_week
;
267 PBYTE usri11_logon_hours
;
268 DWORD usri11_code_page
;
269 } USER_INFO_11
, *PUSER_INFO_11
, *LPUSER_INFO_11
;
271 typedef struct _USER_INFO_20
{
273 LPWSTR usri20_full_name
;
274 LPWSTR usri20_comment
;
276 DWORD usri20_user_id
;
277 } USER_INFO_20
, *PUSER_INFO_20
, *LPUSER_INFO_20
;
279 typedef struct _USER_INFO_23
{
281 LPWSTR usri23_full_name
;
282 LPWSTR usri23_comment
;
284 PSID usri23_user_sid
;
285 } USER_INFO_23
, *PUSER_INFO_23
, *LPUSER_INFO_23
;
287 typedef struct _USER_INFO_1003
{
288 LPWSTR usri1003_password
;
289 } USER_INFO_1003
, *PUSER_INFO_1003
, *LPUSER_INFO_1003
;
291 typedef struct _USER_INFO_1005
{
293 } USER_INFO_1005
, *PUSER_INFO_1005
, *LPUSER_INFO_1005
;
295 typedef struct _USER_INFO_1006
{
296 LPWSTR usri1006_home_dir
;
297 } USER_INFO_1006
, *PUSER_INFO_1006
, *LPUSER_INFO_1006
;
299 typedef struct _USER_INFO_1007
{
300 LPWSTR usri1007_comment
;
301 } USER_INFO_1007
, *PUSER_INFO_1007
, *LPUSER_INFO_1007
;
303 typedef struct _USER_INFO_1008
{
304 DWORD usri1008_flags
;
305 } USER_INFO_1008
, *PUSER_INFO_1008
, *LPUSER_INFO_1008
;
307 typedef struct _USER_INFO_1009
{
308 LPWSTR usri1009_script_path
;
309 } USER_INFO_1009
, *PUSER_INFO_1009
, *LPUSER_INFO_1009
;
311 typedef struct _USER_INFO_1010
{
312 DWORD usri1010_auth_flags
;
313 } USER_INFO_1010
, *PUSER_INFO_1010
, *LPUSER_INFO_1010
;
315 typedef struct _USER_INFO_1011
{
316 LPWSTR usri1011_full_name
;
317 } USER_INFO_1011
, *PUSER_INFO_1011
, *LPUSER_INFO_1011
;
319 typedef struct _USER_INFO_1012
{
320 LPWSTR usri1012_usr_comment
;
321 } USER_INFO_1012
, *PUSER_INFO_1012
, *LPUSER_INFO_1012
;
323 typedef struct _USER_INFO_1013
{
324 LPWSTR usri1013_parms
;
325 } USER_INFO_1013
, *PUSER_INFO_1013
, *LPUSER_INFO_1013
;
327 typedef struct _USER_INFO_1014
{
328 LPWSTR usri1014_workstations
;
329 } USER_INFO_1014
, *PUSER_INFO_1014
, *LPUSER_INFO_1014
;
331 typedef struct _USER_INFO_1017
{
332 DWORD usri1017_acct_expires
;
333 } USER_INFO_1017
, *PUSER_INFO_1017
, *LPUSER_INFO_1017
;
335 typedef struct _USER_INFO_1018
{
336 DWORD usri1018_max_storage
;
337 } USER_INFO_1018
, *PUSER_INFO_1018
, *LPUSER_INFO_1018
;
339 typedef struct _USER_INFO_1020
{
340 DWORD usri1020_units_per_week
;
341 LPBYTE usri1020_logon_hours
;
342 } USER_INFO_1020
, *PUSER_INFO_1020
, *LPUSER_INFO_1020
;
344 typedef struct _USER_INFO_1023
{
345 LPWSTR usri1023_logon_server
;
346 } USER_INFO_1023
, *PUSER_INFO_1023
, *LPUSER_INFO_1023
;
348 typedef struct _USER_INFO_1024
{
349 DWORD usri1024_country_code
;
350 } USER_INFO_1024
, *PUSER_INFO_1024
, *LPUSER_INFO_1024
;
352 typedef struct _USER_INFO_1025
{
353 DWORD usri1025_code_page
;
354 } USER_INFO_1025
, *PUSER_INFO_1025
, *LPUSER_INFO_1025
;
356 typedef struct _USER_INFO_1051
{
357 DWORD usri1051_primary_group_id
;
358 } USER_INFO_1051
, *PUSER_INFO_1051
, *LPUSER_INFO_1051
;
360 typedef struct _USER_INFO_1052
{
361 LPWSTR usri1052_profile
;
362 } USER_INFO_1052
, *PUSER_INFO_1052
, *LPUSER_INFO_1052
;
364 typedef struct _USER_INFO_1053
{
365 LPWSTR usri1053_home_dir_drive
;
366 } USER_INFO_1053
, *PUSER_INFO_1053
, *LPUSER_INFO_1053
;
368 typedef struct _USER_MODALS_INFO_0
{
369 DWORD usrmod0_min_passwd_len
;
370 DWORD usrmod0_max_passwd_age
;
371 DWORD usrmod0_min_passwd_age
;
372 DWORD usrmod0_force_logoff
;
373 DWORD usrmod0_password_hist_len
;
374 } USER_MODALS_INFO_0
, *PUSER_MODALS_INFO_0
, *LPUSER_MODALS_INFO_0
;
376 typedef struct _USER_MODALS_INFO_1
{
378 LPWSTR usrmod1_primary
;
379 } USER_MODALS_INFO_1
, *PUSER_MODALS_INFO_1
, *LPUSER_MODALS_INFO_1
;
381 typedef struct _USER_MODALS_INFO_2
{
382 LPWSTR usrmod2_domain_name
;
383 PSID usrmod2_domain_id
;
384 } USER_MODALS_INFO_2
, *PUSER_MODALS_INFO_2
, *LPUSER_MODALS_INFO_2
;
386 typedef struct _USER_MODALS_INFO_3
{
387 DWORD usrmod3_lockout_duration
;
388 DWORD usrmod3_lockout_observation_window
;
389 DWORD usrmod3_lockout_threshold
;
390 } USER_MODALS_INFO_3
, *PUSER_MODALS_INFO_3
, *LPUSER_MODALS_INFO_3
;
392 typedef struct _NET_DISPLAY_USER
{
394 LPWSTR usri1_comment
;
396 LPWSTR usri1_full_name
;
398 DWORD usri1_next_index
;
399 } NET_DISPLAY_USER
, *PNET_DISPLAY_USER
;
401 typedef struct _NET_DISPLAY_MACHINE
{
403 LPWSTR usri2_comment
;
406 DWORD usri2_next_index
;
407 } NET_DISPLAY_MACHINE
, *PNET_DISPLAY_MACHINE
;
409 typedef struct _NET_DISPLAY_GROUP
{
411 LPWSTR grpi3_comment
;
412 DWORD grpi3_group_id
;
413 DWORD grpi3_attributes
;
414 DWORD grpi3_next_index
;
415 } NET_DISPLAY_GROUP
, *PNET_DISPLAY_GROUP
;
417 typedef struct _LOCALGROUP_INFO_0
{
419 } LOCALGROUP_INFO_0
, *PLOCALGROUP_INFO_0
, *LPLOCALGROUP_INFO_0
;
421 typedef struct _LOCALGROUP_INFO_1
{
423 LPWSTR lgrpi1_comment
;
424 } LOCALGROUP_INFO_1
, *PLOCALGROUP_INFO_1
, *LPLOCALGROUP_INFO_1
;
426 typedef struct _LOCALGROUP_INFO_1002
{
427 LPWSTR lgrpi1002_comment
;
428 } LOCALGROUP_INFO_1002
, *PLOCALGROUP_INFO_1002
, *LPLOCALGROUP_INFO_1002
;
430 typedef struct _LOCALGROUP_MEMBERS_INFO_0
{
432 } LOCALGROUP_MEMBERS_INFO_0
, *PLOCALGROUP_MEMBERS_INFO_0
, *LPLOCALGROUP_MEMBERS_INFO_0
;
434 typedef struct _LOCALGROUP_MEMBERS_INFO_1
{
436 SID_NAME_USE lgrmi1_sidusage
;
438 } LOCALGROUP_MEMBERS_INFO_1
, *PLOCALGROUP_MEMBERS_INFO_1
, *LPLOCALGROUP_MEMBERS_INFO_1
;
440 typedef struct _LOCALGROUP_MEMBERS_INFO_2
{
442 SID_NAME_USE lgrmi2_sidusage
;
443 LPWSTR lgrmi2_domainandname
;
444 } LOCALGROUP_MEMBERS_INFO_2
, *PLOCALGROUP_MEMBERS_INFO_2
, *LPLOCALGROUP_MEMBERS_INFO_2
;
446 typedef struct _LOCALGROUP_MEMBERS_INFO_3
{
447 LPWSTR lgrmi3_domainandname
;
448 } LOCALGROUP_MEMBERS_INFO_3
, *PLOCALGROUP_MEMBERS_INFO_3
, *LPLOCALGROUP_MEMBERS_INFO_3
;
450 typedef struct _LOCALGROUP_USERS_INFO_0
{
452 } LOCALGROUP_USERS_INFO_0
, *PLOCALGROUP_USERS_INFO_0
, *LPLOCALGROUP_USERS_INFO_0
;
454 #define USER_PRIV_GUEST 0
455 #define USER_PRIV_USER 1
456 #define USER_PRIV_ADMIN 2
457 #define USER_PRIV_MASK 3
459 #define LOCALGROUP_NAME_PARMNUM 1
460 #define LOCALGROUP_COMMENT_PARMNUM 2
462 NET_API_STATUS WINAPI
NetGetDCName(LPCWSTR
,LPCWSTR
,LPBYTE
*);
463 NET_API_STATUS WINAPI
NetGroupEnum(LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
464 NET_API_STATUS WINAPI
NetLocalGroupAdd(LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
465 NET_API_STATUS WINAPI
NetLocalGroupAddMember(LPCWSTR
,LPCWSTR
,PSID
);
466 NET_API_STATUS WINAPI
NetLocalGroupAddMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
467 NET_API_STATUS WINAPI
NetLocalGroupDel(LPCWSTR
,LPCWSTR
);
468 NET_API_STATUS WINAPI
NetLocalGroupDelMember(LPCWSTR
,LPCWSTR
,PSID
);
469 NET_API_STATUS WINAPI
NetLocalGroupDelMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
470 NET_API_STATUS WINAPI
NetLocalGroupEnum(LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,PDWORD_PTR
);
471 NET_API_STATUS WINAPI
NetLocalGroupGetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*);
472 NET_API_STATUS WINAPI
NetLocalGroupGetMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,PDWORD_PTR
);
473 NET_API_STATUS WINAPI
NetLocalGroupSetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
474 NET_API_STATUS WINAPI
NetLocalGroupSetMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
475 NET_API_STATUS WINAPI
NetQueryDisplayInformation(LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPDWORD
,PVOID
*);
476 NET_API_STATUS WINAPI
NetUserAdd(LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
477 NET_API_STATUS WINAPI
NetUserChangePassword(LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
478 NET_API_STATUS WINAPI
NetUserDel(LPCWSTR
,LPCWSTR
);
479 NET_API_STATUS WINAPI
NetUserEnum(LPCWSTR
,DWORD
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
480 NET_API_STATUS WINAPI
NetUserGetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*);
481 NET_API_STATUS WINAPI
NetUserGetGroups(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
);
482 NET_API_STATUS WINAPI
NetUserGetLocalGroups(LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
);
483 NET_API_STATUS WINAPI
NetUserModalsGet(LPCWSTR
,DWORD
,LPBYTE
*);