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 |\
93 #if defined(_MSC_VER) || defined(__MINGW32__)
94 # define GROUP_SPECIALGRP_USERS L"USERS"
96 static const WCHAR GROUP_SPECIALGRP_USERS
[] = { 'U','S','E','R','S',0 };
99 #if defined(_MSC_VER) || defined(__MINGW32__)
100 # define GROUP_SPECIALGRP_ADMINS L"ADMINS"
102 static const WCHAR GROUP_SPECIALGRP_ADMINS
[] = { 'A','D','M','I','N','S',0 };
105 #if defined(_MSC_VER) || defined(__MINGW32__)
106 # define GROUP_SPECIALGRP_GUESTS L"GUESTS"
108 static const WCHAR GROUP_SPECIALGRP_GUESTS
[] = { 'G','U','E','S','T','S',0 };
111 #if defined(_MSC_VER) || defined(__MINGW32__)
112 # define GROUP_SPECIALGRP_LOCAL L"LOCAL"
114 static const WCHAR GROUP_SPECIALGRP_LOCAL
[] = { 'L','O','C','A','L',0 };
117 #ifndef WINE_NTSTATUS_DECLARED
118 #define WINE_NTSTATUS_DECLARED
119 typedef LONG NTSTATUS
;
121 #ifndef WINE_PNTSTATUS_DECLARED
122 #define WINE_PNTSTATUS_DECLARED
123 typedef NTSTATUS
*PNTSTATUS
;
126 /* NetGetUserInfo structures */
127 typedef struct _USER_INFO_0
{
129 } USER_INFO_0
, *PUSER_INFO_0
, *LPUSER_INFO_0
;
131 typedef struct _USER_INFO_1
{
133 LPWSTR usri1_password
;
134 DWORD usri1_password_age
;
136 LPWSTR usri1_home_dir
;
137 LPWSTR usri1_comment
;
139 LPWSTR usri1_script_path
;
140 } USER_INFO_1
, *PUSER_INFO_1
, *LPUSER_INFO_1
;
142 typedef struct _USER_INFO_2
{
144 LPWSTR usri2_password
;
145 DWORD usri2_password_age
;
147 LPWSTR usri2_home_dir
;
148 LPWSTR usri2_comment
;
150 LPWSTR usri2_script_path
;
151 DWORD usri2_auth_flags
;
152 LPWSTR usri2_full_name
;
153 LPWSTR usri2_usr_comment
;
155 LPWSTR usri2_workstations
;
156 DWORD usri2_last_logon
;
157 DWORD usri2_last_logoff
;
158 DWORD usri2_acct_expires
;
159 DWORD usri2_max_storage
;
160 DWORD usri2_units_per_week
;
161 PBYTE usri2_logon_hours
;
162 DWORD usri2_bad_pw_count
;
163 DWORD usri2_num_logons
;
164 LPWSTR usri2_logon_server
;
165 DWORD usri2_country_code
;
166 DWORD usri2_code_page
;
167 } USER_INFO_2
, *PUSER_INFO_2
, *LPUSER_INFO_2
;
169 typedef struct _USER_INFO_3
{
171 LPWSTR usri3_password
;
172 DWORD usri3_password_age
;
174 LPWSTR usri3_home_dir
;
175 LPWSTR usri3_comment
;
177 LPWSTR usri3_script_path
;
178 DWORD usri3_auth_flags
;
179 LPWSTR usri3_full_name
;
180 LPWSTR usri3_usr_comment
;
182 LPWSTR usri3_workstations
;
183 DWORD usri3_last_logon
;
184 DWORD usri3_last_logoff
;
185 DWORD usri3_acct_expires
;
186 DWORD usri3_max_storage
;
187 DWORD usri3_units_per_week
;
188 PBYTE usri3_logon_hours
;
189 DWORD usri3_bad_pw_count
;
190 DWORD usri3_num_logons
;
191 LPWSTR usri3_logon_server
;
192 DWORD usri3_country_code
;
193 DWORD usri3_code_page
;
195 DWORD usri3_primary_group_id
;
196 LPWSTR usri3_profile
;
197 LPWSTR usri3_home_dir_drive
;
198 DWORD usri3_password_expired
;
199 } USER_INFO_3
, *PUSER_INFO_3
, *LPUSER_INFO_3
;
201 typedef struct _USER_INFO_4
{
203 LPWSTR usri4_password
;
204 DWORD usri4_password_age
;
206 LPWSTR usri4_home_dir
;
207 LPWSTR usri4_comment
;
209 LPWSTR usri4_script_path
;
210 DWORD usri4_auth_flags
;
211 LPWSTR usri4_full_name
;
212 LPWSTR usri4_usr_comment
;
214 LPWSTR usri4_workstations
;
215 DWORD usri4_last_logon
;
216 DWORD usri4_last_logoff
;
217 DWORD usri4_acct_expires
;
218 DWORD usri4_max_storage
;
219 DWORD usri4_units_per_week
;
220 PBYTE usri4_logon_hours
;
221 DWORD usri4_bad_pw_count
;
222 DWORD usri4_num_logons
;
223 LPWSTR usri4_logon_server
;
224 DWORD usri4_country_code
;
225 DWORD usri4_code_page
;
227 DWORD usri4_primary_group_id
;
228 LPWSTR usri4_profile
;
229 LPWSTR usri4_home_dir_drive
;
230 DWORD usri4_password_expired
;
231 } USER_INFO_4
, *PUSER_INFO_4
, *LPUSER_INFO_4
;
233 typedef struct _USER_INFO_10
{
235 LPWSTR usri10_comment
;
236 LPWSTR usri10_usr_comment
;
237 LPWSTR usri10_full_name
;
238 } USER_INFO_10
, *PUSER_INFO_10
, *LPUSER_INFO_10
;
240 typedef struct _USER_INFO_11
{
242 LPWSTR usri11_comment
;
243 LPWSTR usri11_usr_comment
;
244 LPWSTR usri11_full_name
;
246 DWORD usri11_auth_flags
;
247 DWORD usri11_password_age
;
248 LPWSTR usri11_home_dir
;
250 DWORD usri11_last_logon
;
251 DWORD usri11_last_logoff
;
252 DWORD usri11_bad_pw_count
;
253 DWORD usri11_num_logons
;
254 LPWSTR usri11_logon_server
;
255 DWORD usri11_country_code
;
256 LPWSTR usri11_workstations
;
257 DWORD usri11_max_storage
;
258 DWORD usri11_units_per_week
;
259 PBYTE usri11_logon_hours
;
260 DWORD usri11_code_page
;
261 } USER_INFO_11
, *PUSER_INFO_11
, *LPUSER_INFO_11
;
263 typedef struct _USER_INFO_20
{
265 LPWSTR usri20_full_name
;
266 LPWSTR usri20_comment
;
268 DWORD usri20_user_id
;
269 } USER_INFO_20
, *PUSER_INFO_20
, *LPUSER_INFO_20
;
271 typedef struct _USER_INFO_23
{
273 LPWSTR usri23_full_name
;
274 LPWSTR usri23_comment
;
276 PSID usri23_user_sid
;
277 } USER_INFO_23
, *PUSER_INFO_23
, *LPUSER_INFO_23
;
279 typedef struct _USER_INFO_1003
{
280 LPWSTR usri1003_password
;
281 } USER_INFO_1003
, *PUSER_INFO_1003
, *LPUSER_INFO_1003
;
283 typedef struct _USER_INFO_1005
{
285 } USER_INFO_1005
, *PUSER_INFO_1005
, *LPUSER_INFO_1005
;
287 typedef struct _USER_INFO_1006
{
288 LPWSTR usri1006_home_dir
;
289 } USER_INFO_1006
, *PUSER_INFO_1006
, *LPUSER_INFO_1006
;
291 typedef struct _USER_INFO_1007
{
292 LPWSTR usri1007_comment
;
293 } USER_INFO_1007
, *PUSER_INFO_1007
, *LPUSER_INFO_1007
;
295 typedef struct _USER_INFO_1008
{
296 DWORD usri1008_flags
;
297 } USER_INFO_1008
, *PUSER_INFO_1008
, *LPUSER_INFO_1008
;
299 typedef struct _USER_INFO_1009
{
300 LPWSTR usri1009_script_path
;
301 } USER_INFO_1009
, *PUSER_INFO_1009
, *LPUSER_INFO_1009
;
303 typedef struct _USER_INFO_1010
{
304 DWORD usri1010_auth_flags
;
305 } USER_INFO_1010
, *PUSER_INFO_1010
, *LPUSER_INFO_1010
;
307 typedef struct _USER_INFO_1011
{
308 LPWSTR usri1011_full_name
;
309 } USER_INFO_1011
, *PUSER_INFO_1011
, *LPUSER_INFO_1011
;
311 typedef struct _USER_INFO_1012
{
312 LPWSTR usri1012_usr_comment
;
313 } USER_INFO_1012
, *PUSER_INFO_1012
, *LPUSER_INFO_1012
;
315 typedef struct _USER_INFO_1013
{
316 LPWSTR usri1013_parms
;
317 } USER_INFO_1013
, *PUSER_INFO_1013
, *LPUSER_INFO_1013
;
319 typedef struct _USER_INFO_1014
{
320 LPWSTR usri1014_workstations
;
321 } USER_INFO_1014
, *PUSER_INFO_1014
, *LPUSER_INFO_1014
;
323 typedef struct _USER_INFO_1017
{
324 DWORD usri1017_acct_expires
;
325 } USER_INFO_1017
, *PUSER_INFO_1017
, *LPUSER_INFO_1017
;
327 typedef struct _USER_INFO_1018
{
328 DWORD usri1018_max_storage
;
329 } USER_INFO_1018
, *PUSER_INFO_1018
, *LPUSER_INFO_1018
;
331 typedef struct _USER_INFO_1020
{
332 DWORD usri1020_units_per_week
;
333 LPBYTE usri1020_logon_hours
;
334 } USER_INFO_1020
, *PUSER_INFO_1020
, *LPUSER_INFO_1020
;
336 typedef struct _USER_INFO_1023
{
337 LPWSTR usri1023_logon_server
;
338 } USER_INFO_1023
, *PUSER_INFO_1023
, *LPUSER_INFO_1023
;
340 typedef struct _USER_INFO_1024
{
341 DWORD usri1024_country_code
;
342 } USER_INFO_1024
, *PUSER_INFO_1024
, *LPUSER_INFO_1024
;
344 typedef struct _USER_INFO_1025
{
345 DWORD usri1025_code_page
;
346 } USER_INFO_1025
, *PUSER_INFO_1025
, *LPUSER_INFO_1025
;
348 typedef struct _USER_INFO_1051
{
349 DWORD usri1051_primary_group_id
;
350 } USER_INFO_1051
, *PUSER_INFO_1051
, *LPUSER_INFO_1051
;
352 typedef struct _USER_INFO_1052
{
353 LPWSTR usri1052_profile
;
354 } USER_INFO_1052
, *PUSER_INFO_1052
, *LPUSER_INFO_1052
;
356 typedef struct _USER_INFO_1053
{
357 LPWSTR usri1053_home_dir_drive
;
358 } USER_INFO_1053
, *PUSER_INFO_1053
, *LPUSER_INFO_1053
;
360 typedef struct _USER_MODALS_INFO_0
{
361 DWORD usrmod0_min_passwd_len
;
362 DWORD usrmod0_max_passwd_age
;
363 DWORD usrmod0_min_passwd_age
;
364 DWORD usrmod0_force_logoff
;
365 DWORD usrmod0_password_hist_len
;
366 } USER_MODALS_INFO_0
, *PUSER_MODALS_INFO_0
, *LPUSER_MODALS_INFO_0
;
368 typedef struct _USER_MODALS_INFO_1
{
370 LPWSTR usrmod1_primary
;
371 } USER_MODALS_INFO_1
, *PUSER_MODALS_INFO_1
, *LPUSER_MODALS_INFO_1
;
373 typedef struct _USER_MODALS_INFO_2
{
374 LPWSTR usrmod2_domain_name
;
375 PSID usrmod2_domain_id
;
376 } USER_MODALS_INFO_2
, *PUSER_MODALS_INFO_2
, *LPUSER_MODALS_INFO_2
;
378 typedef struct _USER_MODALS_INFO_3
{
379 DWORD usrmod3_lockout_duration
;
380 DWORD usrmod3_lockout_observation_window
;
381 DWORD usrmod3_lockout_threshold
;
382 } USER_MODALS_INFO_3
, *PUSER_MODALS_INFO_3
, *LPUSER_MODALS_INFO_3
;
384 typedef struct _NET_DISPLAY_USER
{
386 LPWSTR usri1_comment
;
388 LPWSTR usri1_full_name
;
390 DWORD usri1_next_index
;
391 } NET_DISPLAY_USER
, *PNET_DISPLAY_USER
;
393 typedef struct _NET_DISPLAY_MACHINE
{
395 LPWSTR usri2_comment
;
398 DWORD usri2_next_index
;
399 } NET_DISPLAY_MACHINE
, *PNET_DISPLAY_MACHINE
;
401 typedef struct _NET_DISPLAY_GROUP
{
403 LPWSTR grpi3_comment
;
404 DWORD grpi3_group_id
;
405 DWORD grpi3_attributes
;
406 DWORD grpi3_next_index
;
407 } NET_DISPLAY_GROUP
, *PNET_DISPLAY_GROUP
;
409 typedef struct _LOCALGROUP_INFO_0
{
411 } LOCALGROUP_INFO_0
, *PLOCALGROUP_INFO_0
, *LPLOCALGROUP_INFO_0
;
413 typedef struct _LOCALGROUP_INFO_1
{
415 LPWSTR lgrpi1_comment
;
416 } LOCALGROUP_INFO_1
, *PLOCALGROUP_INFO_1
, *LPLOCALGROUP_INFO_1
;
418 typedef struct _LOCALGROUP_INFO_1002
{
419 LPWSTR lgrpi1002_comment
;
420 } LOCALGROUP_INFO_1002
, *PLOCALGROUP_INFO_1002
, *LPLOCALGROUP_INFO_1002
;
422 typedef struct _LOCALGROUP_MEMBERS_INFO_0
{
424 } LOCALGROUP_MEMBERS_INFO_0
, *PLOCALGROUP_MEMBERS_INFO_0
, *LPLOCALGROUP_MEMBERS_INFO_0
;
426 typedef struct _LOCALGROUP_MEMBERS_INFO_1
{
428 SID_NAME_USE lgrmi1_sidusage
;
430 } LOCALGROUP_MEMBERS_INFO_1
, *PLOCALGROUP_MEMBERS_INFO_1
, *LPLOCALGROUP_MEMBERS_INFO_1
;
432 typedef struct _LOCALGROUP_MEMBERS_INFO_2
{
434 SID_NAME_USE lgrmi2_sidusage
;
435 LPWSTR lgrmi2_domainandname
;
436 } LOCALGROUP_MEMBERS_INFO_2
, *PLOCALGROUP_MEMBERS_INFO_2
, *LPLOCALGROUP_MEMBERS_INFO_2
;
438 typedef struct _LOCALGROUP_MEMBERS_INFO_3
{
439 LPWSTR lgrmi3_domainandname
;
440 } LOCALGROUP_MEMBERS_INFO_3
, *PLOCALGROUP_MEMBERS_INFO_3
, *LPLOCALGROUP_MEMBERS_INFO_3
;
442 typedef struct _LOCALGROUP_USERS_INFO_0
{
444 } LOCALGROUP_USERS_INFO_0
, *PLOCALGROUP_USERS_INFO_0
, *LPLOCALGROUP_USERS_INFO_0
;
446 #define USER_PRIV_GUEST 0
447 #define USER_PRIV_USER 1
448 #define USER_PRIV_ADMIN 2
449 #define USER_PRIV_MASK 3
451 #define LOCALGROUP_NAME_PARMNUM 1
452 #define LOCALGROUP_COMMENT_PARMNUM 2
454 NET_API_STATUS WINAPI
NetGetDCName(LPCWSTR
,LPCWSTR
,LPBYTE
*);
455 NET_API_STATUS WINAPI
NetGroupEnum(LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
456 NET_API_STATUS WINAPI
NetLocalGroupAdd(LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
457 NET_API_STATUS WINAPI
NetLocalGroupAddMember(LPCWSTR
,LPCWSTR
,PSID
);
458 NET_API_STATUS WINAPI
NetLocalGroupAddMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
459 NET_API_STATUS WINAPI
NetLocalGroupDel(LPCWSTR
,LPCWSTR
);
460 NET_API_STATUS WINAPI
NetLocalGroupDelMember(LPCWSTR
,LPCWSTR
,PSID
);
461 NET_API_STATUS WINAPI
NetLocalGroupDelMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
462 NET_API_STATUS WINAPI
NetLocalGroupEnum(LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,PDWORD_PTR
);
463 NET_API_STATUS WINAPI
NetLocalGroupGetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*);
464 NET_API_STATUS WINAPI
NetLocalGroupGetMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,PDWORD_PTR
);
465 NET_API_STATUS WINAPI
NetLocalGroupSetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
466 NET_API_STATUS WINAPI
NetLocalGroupSetMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
467 NET_API_STATUS WINAPI
NetQueryDisplayInformation(LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPDWORD
,PVOID
*);
468 NET_API_STATUS WINAPI
NetUserAdd(LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
469 NET_API_STATUS WINAPI
NetUserChangePassword(LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
470 NET_API_STATUS WINAPI
NetUserDel(LPCWSTR
,LPCWSTR
);
471 NET_API_STATUS WINAPI
NetUserEnum(LPCWSTR
,DWORD
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
472 NET_API_STATUS WINAPI
NetUserGetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*);
473 NET_API_STATUS WINAPI
NetUserGetGroups(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
);
474 NET_API_STATUS WINAPI
NetUserGetLocalGroups(LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
);
475 NET_API_STATUS WINAPI
NetUserModalsGet(LPCWSTR
,DWORD
,LPBYTE
*);