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 UF_SCRIPT 0x000001
31 #define UF_ACCOUNTDISABLE 0x000002
32 #define UF_HOMEDIR_REQUIRED 0x000008
33 #define UF_LOCKOUT 0x000010
34 #define UF_PASSWD_NOTREQD 0x000020
35 #define UF_PASSWD_CANT_CHANGE 0x000040
36 #define UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 0x000080
37 #define UF_TEMP_DUPLICATE_ACCOUNT 0x000100
38 #define UF_NORMAL_ACCOUNT 0x000200
39 #define UF_INTERDOMAIN_TRUST_ACCOUNT 0x000800
40 #define UF_WORKSTATION_TRUST_ACCOUNT 0x001000
41 #define UF_SERVER_TRUST_ACCOUNT 0x002000
42 #define UF_DONT_EXPIRE_PASSWD 0x010000
43 #define UF_MNS_LOGON_ACCOUNT 0x020000
44 #define UF_SMARTCARD_REQUIRED 0x040000
45 #define UF_TRUSTED_FOR_DELEGATION 0x080000
46 #define UF_NOT_DELEGATED 0x100000
47 #define UF_USE_DES_KEY_ONLY 0x200000
48 #define UF_DONT_REQUIRE_PREAUTH 0x400000
49 #define UF_PASSWORD_EXPIRED 0x800000
52 #define UF_MACHINE_ACCOUNT_MASK ( \
53 UF_INTERDOMAIN_TRUST_ACCOUNT | \
54 UF_WORKSTATION_TRUST_ACCOUNT | \
55 UF_SERVER_TRUST_ACCOUNT)
57 #define UF_ACCOUNT_TYPE_MASK ( \
58 UF_TEMP_DUPLICATE_ACCOUNT | \
60 UF_INTERDOMAIN_TRUST_ACCOUNT | \
61 UF_WORKSTATION_TRUST_ACCOUNT | \
62 UF_SERVER_TRUST_ACCOUNT)
64 #define UF_SETTABLE_BITS ( \
68 UF_HOMEDIR_REQUIRED | \
70 UF_PASSWD_CANT_CHANGE | \
71 UF_ACCOUNT_TYPE_MASK | \
72 UF_DONT_EXPIRE_PASSWD | \
73 UF_MNS_LOGON_ACCOUNT |\
74 UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED |\
75 UF_SMARTCARD_REQUIRED | \
76 UF_TRUSTED_FOR_DELEGATION | \
78 UF_USE_DES_KEY_ONLY | \
79 UF_DONT_REQUIRE_PREAUTH |\
83 # define GROUP_SPECIALGRP_USERS (const WCHAR []){ 'U','S','E','R','S',0 }
84 #elif defined(_MSC_VER)
85 # define GROUP_SPECIALGRP_USERS L"USERS"
87 static const WCHAR GROUP_SPECIALGRP_USERS
[] = { 'U','S','E','R','S',0 };
91 # define GROUP_SPECIALGRP_ADMINS (const WCHAR []){ 'A','D','M','I','N','S',0 }
92 #elif defined(_MSC_VER)
93 # define GROUP_SPECIALGRP_ADMINS L"ADMINS"
95 static const WCHAR GROUP_SPECIALGRP_ADMINS
[] = { 'A','D','M','I','N','S',0 };
99 # define GROUP_SPECIALGRP_GUESTS (const WCHAR []){ 'G','U','E','S','T','S',0 }
100 #elif defined(_MSC_VER)
101 # define GROUP_SPECIALGRP_GUESTS L"GUESTS"
103 static const WCHAR GROUP_SPECIALGRP_GUESTS
[] = { 'G','U','E','S','T','S',0 };
106 #if defined(__GNUC__)
107 # define GROUP_SPECIALGRP_LOCAL (const WCHAR []){ 'L','O','C','A','L',0 }
108 #elif defined(_MSC_VER)
109 # define GROUP_SPECIALGRP_LOCAL L"LOCAL"
111 static const WCHAR GROUP_SPECIALGRP_LOCAL
[] = { 'L','O','C','A','L',0 };
114 #ifndef WINE_NTSTATUS_DECLARED
115 #define WINE_NTSTATUS_DECLARED
116 typedef LONG NTSTATUS
;
118 #ifndef WINE_PNTSTATUS_DECLARED
119 #define WINE_PNTSTATUS_DECLARED
120 typedef NTSTATUS
*PNTSTATUS
;
123 /* NetGetUserInfo structures */
124 typedef struct _USER_INFO_0
{
126 } USER_INFO_0
, *PUSER_INFO_0
, *LPUSER_INFO_0
;
128 typedef struct _USER_INFO_1
{
130 LPWSTR usri1_password
;
131 DWORD usri1_password_age
;
133 LPWSTR usri1_home_dir
;
134 LPWSTR usri1_comment
;
136 LPWSTR usri1_script_path
;
137 } USER_INFO_1
, *PUSER_INFO_1
, *LPUSER_INFO_1
;
139 typedef struct _USER_INFO_2
{
141 LPWSTR usri2_password
;
142 DWORD usri2_password_age
;
144 LPWSTR usri2_home_dir
;
145 LPWSTR usri2_comment
;
147 LPWSTR usri2_script_path
;
148 DWORD usri2_auth_flags
;
149 LPWSTR usri2_full_name
;
150 LPWSTR usri2_usr_comment
;
152 LPWSTR usri2_workstations
;
153 DWORD usri2_last_logon
;
154 DWORD usri2_last_logoff
;
155 DWORD usri2_acct_expires
;
156 DWORD usri2_max_storage
;
157 DWORD usri2_units_per_week
;
158 PBYTE usri2_logon_hours
;
159 DWORD usri2_bad_pw_count
;
160 DWORD usri2_num_logons
;
161 LPWSTR usri2_logon_server
;
162 DWORD usri2_country_code
;
163 DWORD usri2_code_page
;
164 } USER_INFO_2
, *PUSER_INFO_2
, *LPUSER_INFO_2
;
166 typedef struct _USER_INFO_3
{
168 LPWSTR usri3_password
;
169 DWORD usri3_password_age
;
171 LPWSTR usri3_home_dir
;
172 LPWSTR usri3_comment
;
174 LPWSTR usri3_script_path
;
175 DWORD usri3_auth_flags
;
176 LPWSTR usri3_full_name
;
177 LPWSTR usri3_usr_comment
;
179 LPWSTR usri3_workstations
;
180 DWORD usri3_last_logon
;
181 DWORD usri3_last_logoff
;
182 DWORD usri3_acct_expires
;
183 DWORD usri3_max_storage
;
184 DWORD usri3_units_per_week
;
185 PBYTE usri3_logon_hours
;
186 DWORD usri3_bad_pw_count
;
187 DWORD usri3_num_logons
;
188 LPWSTR usri3_logon_server
;
189 DWORD usri3_country_code
;
190 DWORD usri3_code_page
;
192 DWORD usri3_primary_group_id
;
193 LPWSTR usri3_profile
;
194 LPWSTR usri3_home_dir_drive
;
195 DWORD usri3_password_expired
;
196 } USER_INFO_3
, *PUSER_INFO_3
, *LPUSER_INFO_3
;
198 typedef struct _USER_INFO_4
{
200 LPWSTR usri4_password
;
201 DWORD usri4_password_age
;
203 LPWSTR usri4_home_dir
;
204 LPWSTR usri4_comment
;
206 LPWSTR usri4_script_path
;
207 DWORD usri4_auth_flags
;
208 LPWSTR usri4_full_name
;
209 LPWSTR usri4_usr_comment
;
211 LPWSTR usri4_workstations
;
212 DWORD usri4_last_logon
;
213 DWORD usri4_last_logoff
;
214 DWORD usri4_acct_expires
;
215 DWORD usri4_max_storage
;
216 DWORD usri4_units_per_week
;
217 PBYTE usri4_logon_hours
;
218 DWORD usri4_bad_pw_count
;
219 DWORD usri4_num_logons
;
220 LPWSTR usri4_logon_server
;
221 DWORD usri4_country_code
;
222 DWORD usri4_code_page
;
224 DWORD usri4_primary_group_id
;
225 LPWSTR usri4_profile
;
226 LPWSTR usri4_home_dir_drive
;
227 DWORD usri4_password_expired
;
228 } USER_INFO_4
, *PUSER_INFO_4
, *LPUSER_INFO_4
;
230 typedef struct _USER_INFO_10
{
232 LPWSTR usri10_comment
;
233 LPWSTR usri10_usr_comment
;
234 LPWSTR usri10_full_name
;
235 } USER_INFO_10
, *PUSER_INFO_10
, *LPUSER_INFO_10
;
237 typedef struct _USER_INFO_11
{
239 LPWSTR usri11_comment
;
240 LPWSTR usri11_usr_comment
;
241 LPWSTR usri11_full_name
;
243 DWORD usri11_auth_flags
;
244 DWORD usri11_password_age
;
245 LPWSTR usri11_home_dir
;
247 DWORD usri11_last_logon
;
248 DWORD usri11_last_logoff
;
249 DWORD usri11_bad_pw_count
;
250 DWORD usri11_num_logons
;
251 LPWSTR usri11_logon_server
;
252 DWORD usri11_country_code
;
253 LPWSTR usri11_workstations
;
254 DWORD usri11_max_storage
;
255 DWORD usri11_units_per_week
;
256 PBYTE usri11_logon_hours
;
257 DWORD usri11_code_page
;
258 } USER_INFO_11
, *PUSER_INFO_11
, *LPUSER_INFO_11
;
260 typedef struct _USER_INFO_20
{
262 LPWSTR usri20_full_name
;
263 LPWSTR usri20_comment
;
265 DWORD usri20_user_id
;
266 } USER_INFO_20
, *PUSER_INFO_20
, *LPUSER_INFO_20
;
268 typedef struct _USER_INFO_23
{
270 LPWSTR usri23_full_name
;
271 LPWSTR usri23_comment
;
273 PSID usri23_user_sid
;
274 } USER_INFO_23
, *PUSER_INFO_23
, *LPUSER_INFO_23
;
276 typedef struct _USER_INFO_1003
{
277 LPWSTR usri1003_password
;
278 } USER_INFO_1003
, *PUSER_INFO_1003
, *LPUSER_INFO_1003
;
280 typedef struct _USER_INFO_1005
{
282 } USER_INFO_1005
, *PUSER_INFO_1005
, *LPUSER_INFO_1005
;
284 typedef struct _USER_INFO_1006
{
285 LPWSTR usri1006_home_dir
;
286 } USER_INFO_1006
, *PUSER_INFO_1006
, *LPUSER_INFO_1006
;
288 typedef struct _USER_INFO_1007
{
289 LPWSTR usri1007_comment
;
290 } USER_INFO_1007
, *PUSER_INFO_1007
, *LPUSER_INFO_1007
;
292 typedef struct _USER_INFO_1008
{
293 DWORD usri1008_flags
;
294 } USER_INFO_1008
, *PUSER_INFO_1008
, *LPUSER_INFO_1008
;
296 typedef struct _USER_INFO_1009
{
297 LPWSTR usri1009_script_path
;
298 } USER_INFO_1009
, *PUSER_INFO_1009
, *LPUSER_INFO_1009
;
300 typedef struct _USER_INFO_1010
{
301 DWORD usri1010_auth_flags
;
302 } USER_INFO_1010
, *PUSER_INFO_1010
, *LPUSER_INFO_1010
;
304 typedef struct _USER_INFO_1011
{
305 LPWSTR usri1011_full_name
;
306 } USER_INFO_1011
, *PUSER_INFO_1011
, *LPUSER_INFO_1011
;
308 typedef struct _USER_INFO_1012
{
309 LPWSTR usri1012_usr_comment
;
310 } USER_INFO_1012
, *PUSER_INFO_1012
, *LPUSER_INFO_1012
;
312 typedef struct _USER_INFO_1013
{
313 LPWSTR usri1013_parms
;
314 } USER_INFO_1013
, *PUSER_INFO_1013
, *LPUSER_INFO_1013
;
316 typedef struct _USER_INFO_1014
{
317 LPWSTR usri1014_workstations
;
318 } USER_INFO_1014
, *PUSER_INFO_1014
, *LPUSER_INFO_1014
;
320 typedef struct _USER_INFO_1017
{
321 DWORD usri1017_acct_expires
;
322 } USER_INFO_1017
, *PUSER_INFO_1017
, *LPUSER_INFO_1017
;
324 typedef struct _USER_INFO_1018
{
325 DWORD usri1018_max_storage
;
326 } USER_INFO_1018
, *PUSER_INFO_1018
, *LPUSER_INFO_1018
;
328 typedef struct _USER_INFO_1020
{
329 DWORD usri1020_units_per_week
;
330 LPBYTE usri1020_logon_hours
;
331 } USER_INFO_1020
, *PUSER_INFO_1020
, *LPUSER_INFO_1020
;
333 typedef struct _USER_INFO_1023
{
334 LPWSTR usri1023_logon_server
;
335 } USER_INFO_1023
, *PUSER_INFO_1023
, *LPUSER_INFO_1023
;
337 typedef struct _USER_INFO_1024
{
338 DWORD usri1024_country_code
;
339 } USER_INFO_1024
, *PUSER_INFO_1024
, *LPUSER_INFO_1024
;
341 typedef struct _USER_INFO_1025
{
342 DWORD usri1025_code_page
;
343 } USER_INFO_1025
, *PUSER_INFO_1025
, *LPUSER_INFO_1025
;
345 typedef struct _USER_INFO_1051
{
346 DWORD usri1051_primary_group_id
;
347 } USER_INFO_1051
, *PUSER_INFO_1051
, *LPUSER_INFO_1051
;
349 typedef struct _USER_INFO_1052
{
350 LPWSTR usri1052_profile
;
351 } USER_INFO_1052
, *PUSER_INFO_1052
, *LPUSER_INFO_1052
;
353 typedef struct _USER_INFO_1053
{
354 LPWSTR usri1053_home_dir_drive
;
355 } USER_INFO_1053
, *PUSER_INFO_1053
, *LPUSER_INFO_1053
;
357 typedef struct _USER_MODALS_INFO_0
{
358 DWORD usrmod0_min_passwd_len
;
359 DWORD usrmod0_max_passwd_age
;
360 DWORD usrmod0_min_passwd_age
;
361 DWORD usrmod0_force_logoff
;
362 DWORD usrmod0_password_hist_len
;
363 } USER_MODALS_INFO_0
, *PUSER_MODALS_INFO_0
, *LPUSER_MODALS_INFO_0
;
365 typedef struct _USER_MODALS_INFO_1
{
367 LPWSTR usrmod1_primary
;
368 } USER_MODALS_INFO_1
, *PUSER_MODALS_INFO_1
, *LPUSER_MODALS_INFO_1
;
370 typedef struct _USER_MODALS_INFO_2
{
371 LPWSTR usrmod2_domain_name
;
372 PSID usrmod2_domain_id
;
373 } USER_MODALS_INFO_2
, *PUSER_MODALS_INFO_2
, *LPUSER_MODALS_INFO_2
;
375 typedef struct _USER_MODALS_INFO_3
{
376 DWORD usrmod3_lockout_duration
;
377 DWORD usrmod3_lockout_observation_window
;
378 DWORD usrmod3_lockout_threshold
;
379 } USER_MODALS_INFO_3
, *PUSER_MODALS_INFO_3
, *LPUSER_MODALS_INFO_3
;
381 typedef struct _NET_DISPLAY_USER
{
383 LPWSTR usri1_comment
;
385 LPWSTR usri1_full_name
;
387 DWORD usri1_next_index
;
388 } NET_DISPLAY_USER
, *PNET_DISPLAY_USER
;
390 typedef struct _NET_DISPLAY_MACHINE
{
392 LPWSTR usri2_comment
;
395 DWORD usri2_next_index
;
396 } NET_DISPLAY_MACHINE
, *PNET_DISPLAY_MACHINE
;
398 typedef struct _NET_DISPLAY_GROUP
{
400 LPWSTR grpi3_comment
;
401 DWORD grpi3_group_id
;
402 DWORD grpi3_attributes
;
403 DWORD grpi3_next_index
;
404 } NET_DISPLAY_GROUP
, *PNET_DISPLAY_GROUP
;
406 typedef struct _LOCALGROUP_INFO_0
{
408 } LOCALGROUP_INFO_0
, *PLOCALGROUP_INFO_0
, *LPLOCALGROUP_INFO_0
;
410 typedef struct _LOCALGROUP_INFO_1
{
412 LPWSTR lgrpi1_comment
;
413 } LOCALGROUP_INFO_1
, *PLOCALGROUP_INFO_1
, *LPLOCALGROUP_INFO_1
;
415 typedef struct _LOCALGROUP_INFO_1002
{
416 LPWSTR lgrpi1002_comment
;
417 } LOCALGROUP_INFO_1002
, *PLOCALGROUP_INFO_1002
, *LPLOCALGROUP_INFO_1002
;
419 typedef struct _LOCALGROUP_MEMBERS_INFO_0
{
421 } LOCALGROUP_MEMBERS_INFO_0
, *PLOCALGROUP_MEMBERS_INFO_0
, *LPLOCALGROUP_MEMBERS_INFO_0
;
423 typedef struct _LOCALGROUP_MEMBERS_INFO_1
{
425 SID_NAME_USE lgrmi1_sidusage
;
427 } LOCALGROUP_MEMBERS_INFO_1
, *PLOCALGROUP_MEMBERS_INFO_1
, *LPLOCALGROUP_MEMBERS_INFO_1
;
429 typedef struct _LOCALGROUP_MEMBERS_INFO_2
{
431 SID_NAME_USE lgrmi2_sidusage
;
432 LPWSTR lgrmi2_domainandname
;
433 } LOCALGROUP_MEMBERS_INFO_2
, *PLOCALGROUP_MEMBERS_INFO_2
, *LPLOCALGROUP_MEMBERS_INFO_2
;
435 typedef struct _LOCALGROUP_MEMBERS_INFO_3
{
436 LPWSTR lgrmi3_domainandname
;
437 } LOCALGROUP_MEMBERS_INFO_3
, *PLOCALGROUP_MEMBERS_INFO_3
, *LPLOCALGROUP_MEMBERS_INFO_3
;
439 typedef struct _LOCALGROUP_USERS_INFO_0
{
441 } LOCALGROUP_USERS_INFO_0
, *PLOCALGROUP_USERS_INFO_0
, *LPLOCALGROUP_USERS_INFO_0
;
443 #define USER_PRIV_GUEST 0
444 #define USER_PRIV_USER 1
445 #define USER_PRIV_ADMIN 2
446 #define USER_PRIV_MASK 3
448 #define LOCALGROUP_NAME_PARMNUM 1
449 #define LOCALGROUP_COMMENT_PARMNUM 2
451 NET_API_STATUS WINAPI
NetGetDCName(LPCWSTR
,LPCWSTR
,LPBYTE
*);
452 NET_API_STATUS WINAPI
NetLocalGroupAdd(LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
453 NET_API_STATUS WINAPI
NetLocalGroupAddMember(LPCWSTR
,LPCWSTR
,PSID
);
454 NET_API_STATUS WINAPI
NetLocalGroupAddMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
455 NET_API_STATUS WINAPI
NetLocalGroupDel(LPCWSTR
,LPCWSTR
);
456 NET_API_STATUS WINAPI
NetLocalGroupDelMember(LPCWSTR
,LPCWSTR
,PSID
);
457 NET_API_STATUS WINAPI
NetLocalGroupDelMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
458 NET_API_STATUS WINAPI
NetLocalGroupEnum(LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,PDWORD_PTR
);
459 NET_API_STATUS WINAPI
NetLocalGroupGetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*);
460 NET_API_STATUS WINAPI
NetLocalGroupGetMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,PDWORD_PTR
);
461 NET_API_STATUS WINAPI
NetLocalGroupSetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
462 NET_API_STATUS WINAPI
NetLocalGroupSetMembers(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
,DWORD
);
463 NET_API_STATUS WINAPI
NetQueryDisplayInformation(LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPDWORD
,PVOID
*);
464 NET_API_STATUS WINAPI
NetUserAdd(LPCWSTR
,DWORD
,LPBYTE
,LPDWORD
);
465 NET_API_STATUS WINAPI
NetUserChangePassword(LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
466 NET_API_STATUS WINAPI
NetUserDel(LPCWSTR
,LPCWSTR
);
467 NET_API_STATUS WINAPI
NetUserEnum(LPCWSTR
,DWORD
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
468 NET_API_STATUS WINAPI
NetUserGetInfo(LPCWSTR
,LPCWSTR
,DWORD
,LPBYTE
*);
469 NET_API_STATUS WINAPI
NetUserGetLocalGroups(LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,LPBYTE
*,DWORD
,LPDWORD
,LPDWORD
);
470 NET_API_STATUS WINAPI
NetUserModalsGet(LPCWSTR
,DWORD
,LPBYTE
*);