localspl: Avoid sizeof in a trace.
[wine] / include / lmaccess.h
1 /*
2  * Copyright 2002 Andriy Palamarchuk
3  *
4  * User information Net API.
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_LMACCESS_H
22 #define __WINE_LMACCESS_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <lmcons.h>
29
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
50
51
52 #define UF_MACHINE_ACCOUNT_MASK ( \
53     UF_INTERDOMAIN_TRUST_ACCOUNT | \
54     UF_WORKSTATION_TRUST_ACCOUNT | \
55     UF_SERVER_TRUST_ACCOUNT)
56
57 #define UF_ACCOUNT_TYPE_MASK ( \
58     UF_TEMP_DUPLICATE_ACCOUNT | \
59     UF_NORMAL_ACCOUNT | \
60     UF_INTERDOMAIN_TRUST_ACCOUNT | \
61     UF_WORKSTATION_TRUST_ACCOUNT | \
62     UF_SERVER_TRUST_ACCOUNT)
63
64 #define UF_SETTABLE_BITS ( \
65     UF_SCRIPT | \
66     UF_ACCOUNTDISABLE | \
67     UF_LOCKOUT | \
68     UF_HOMEDIR_REQUIRED  | \
69     UF_PASSWD_NOTREQD | \
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 | \
77     UF_NOT_DELEGATED | \
78     UF_USE_DES_KEY_ONLY  | \
79     UF_DONT_REQUIRE_PREAUTH |\
80     UF_PASSWORD_EXPIRED)
81
82 #if defined(__GNUC__)
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"
86 #else
87 static const WCHAR GROUP_SPECIALGRP_USERS[] = { 'U','S','E','R','S',0 };
88 #endif
89
90 #if defined(__GNUC__)
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"
94 #else
95 static const WCHAR GROUP_SPECIALGRP_ADMINS[] = { 'A','D','M','I','N','S',0 };
96 #endif
97
98 #if defined(__GNUC__)
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"
102 #else
103 static const WCHAR GROUP_SPECIALGRP_GUESTS[] = { 'G','U','E','S','T','S',0 };
104 #endif
105
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"
110 #else
111 static const WCHAR GROUP_SPECIALGRP_LOCAL[] = { 'L','O','C','A','L',0 };
112 #endif
113
114 #ifndef WINE_NTSTATUS_DECLARED
115 #define WINE_NTSTATUS_DECLARED
116 typedef LONG NTSTATUS;
117 #endif
118 #ifndef WINE_PNTSTATUS_DECLARED
119 #define WINE_PNTSTATUS_DECLARED
120 typedef NTSTATUS *PNTSTATUS;
121 #endif
122
123 /* NetGetUserInfo structures */
124 typedef struct _USER_INFO_0 {
125     LPWSTR usri0_name;
126 } USER_INFO_0, *PUSER_INFO_0, *LPUSER_INFO_0;
127
128 typedef struct _USER_INFO_1 {
129     LPWSTR usri1_name;
130     LPWSTR usri1_password;
131     DWORD usri1_password_age;
132     DWORD usri1_priv;
133     LPWSTR usri1_home_dir;
134     LPWSTR usri1_comment;
135     DWORD usri1_flags;
136     LPWSTR usri1_script_path;
137 } USER_INFO_1, *PUSER_INFO_1, *LPUSER_INFO_1;
138
139 typedef struct _USER_INFO_2 {
140     LPWSTR usri2_name;
141     LPWSTR usri2_password;
142     DWORD usri2_password_age;
143     DWORD usri2_priv;
144     LPWSTR usri2_home_dir;
145     LPWSTR usri2_comment;
146     DWORD usri2_flags;
147     LPWSTR usri2_script_path;
148     DWORD usri2_auth_flags;
149     LPWSTR usri2_full_name;
150     LPWSTR usri2_usr_comment;
151     LPWSTR usri2_parms;
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;
165
166 typedef struct _USER_INFO_3 {
167     LPWSTR usri3_name;
168     LPWSTR usri3_password;
169     DWORD usri3_password_age;
170     DWORD usri3_priv;
171     LPWSTR usri3_home_dir;
172     LPWSTR usri3_comment;
173     DWORD usri3_flags;
174     LPWSTR usri3_script_path;
175     DWORD usri3_auth_flags;
176     LPWSTR usri3_full_name;
177     LPWSTR usri3_usr_comment;
178     LPWSTR usri3_parms;
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;
191     DWORD usri3_user_id;
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;
197
198 typedef struct _USER_INFO_4 {
199     LPWSTR usri4_name;
200     LPWSTR usri4_password;
201     DWORD usri4_password_age;
202     DWORD usri4_priv;
203     LPWSTR usri4_home_dir;
204     LPWSTR usri4_comment;
205     DWORD usri4_flags;
206     LPWSTR usri4_script_path;
207     DWORD usri4_auth_flags;
208     LPWSTR usri4_full_name;
209     LPWSTR usri4_usr_comment;
210     LPWSTR usri4_parms;
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;
223     PSID usri4_user_sid;
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;
229
230 typedef struct _USER_INFO_10 {
231     LPWSTR usri10_name;
232     LPWSTR usri10_comment;
233     LPWSTR usri10_usr_comment;
234     LPWSTR usri10_full_name;
235 } USER_INFO_10, *PUSER_INFO_10, *LPUSER_INFO_10;
236
237 typedef struct _USER_INFO_11 {
238     LPWSTR usri11_name;
239     LPWSTR usri11_comment;
240     LPWSTR usri11_usr_comment;
241     LPWSTR usri11_full_name;
242     DWORD usri11_priv;
243     DWORD usri11_auth_flags;
244     DWORD usri11_password_age;
245     LPWSTR usri11_home_dir;
246     LPWSTR usri11_parms;
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;
259
260 typedef struct _USER_INFO_20 {
261     LPWSTR usri20_name;
262     LPWSTR usri20_full_name;
263     LPWSTR usri20_comment;
264     DWORD usri20_flags;
265     DWORD usri20_user_id;
266 } USER_INFO_20, *PUSER_INFO_20, *LPUSER_INFO_20;
267
268 typedef struct _USER_INFO_23 {
269     LPWSTR usri23_name;
270     LPWSTR usri23_full_name;
271     LPWSTR usri23_comment;
272     DWORD usri23_flags;
273     PSID usri23_user_sid;
274 } USER_INFO_23, *PUSER_INFO_23, *LPUSER_INFO_23;
275
276 typedef struct _USER_INFO_1003 {
277     LPWSTR  usri1003_password;
278 } USER_INFO_1003, *PUSER_INFO_1003, *LPUSER_INFO_1003;
279
280 typedef struct _USER_INFO_1005 {
281     DWORD   usri1005_priv;
282 } USER_INFO_1005, *PUSER_INFO_1005, *LPUSER_INFO_1005;
283
284 typedef struct _USER_INFO_1006 {
285     LPWSTR  usri1006_home_dir;
286 } USER_INFO_1006, *PUSER_INFO_1006, *LPUSER_INFO_1006;
287
288 typedef struct _USER_INFO_1007 {
289     LPWSTR  usri1007_comment;
290 } USER_INFO_1007, *PUSER_INFO_1007, *LPUSER_INFO_1007;
291
292 typedef struct _USER_INFO_1008 {
293     DWORD   usri1008_flags;
294 } USER_INFO_1008, *PUSER_INFO_1008, *LPUSER_INFO_1008;
295
296 typedef struct _USER_INFO_1009 {
297     LPWSTR  usri1009_script_path;
298 } USER_INFO_1009, *PUSER_INFO_1009, *LPUSER_INFO_1009;
299
300 typedef struct _USER_INFO_1010 {
301     DWORD   usri1010_auth_flags;
302 } USER_INFO_1010, *PUSER_INFO_1010, *LPUSER_INFO_1010;
303
304 typedef struct _USER_INFO_1011 {
305     LPWSTR  usri1011_full_name;
306 } USER_INFO_1011, *PUSER_INFO_1011, *LPUSER_INFO_1011;
307
308 typedef struct _USER_INFO_1012 {
309     LPWSTR  usri1012_usr_comment;
310 } USER_INFO_1012, *PUSER_INFO_1012, *LPUSER_INFO_1012;
311
312 typedef struct _USER_INFO_1013 {
313     LPWSTR  usri1013_parms;
314 } USER_INFO_1013, *PUSER_INFO_1013, *LPUSER_INFO_1013;
315
316 typedef struct _USER_INFO_1014 {
317     LPWSTR  usri1014_workstations;
318 } USER_INFO_1014, *PUSER_INFO_1014, *LPUSER_INFO_1014;
319
320 typedef struct _USER_INFO_1017 {
321     DWORD   usri1017_acct_expires;
322 } USER_INFO_1017, *PUSER_INFO_1017, *LPUSER_INFO_1017;
323
324 typedef struct _USER_INFO_1018 {
325     DWORD   usri1018_max_storage;
326 } USER_INFO_1018, *PUSER_INFO_1018, *LPUSER_INFO_1018;
327
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;
332
333 typedef struct _USER_INFO_1023 {
334     LPWSTR  usri1023_logon_server;
335 } USER_INFO_1023, *PUSER_INFO_1023, *LPUSER_INFO_1023;
336
337 typedef struct _USER_INFO_1024 {
338     DWORD   usri1024_country_code;
339 } USER_INFO_1024, *PUSER_INFO_1024, *LPUSER_INFO_1024;
340
341 typedef struct _USER_INFO_1025 {
342     DWORD   usri1025_code_page;
343 } USER_INFO_1025, *PUSER_INFO_1025, *LPUSER_INFO_1025;
344
345 typedef struct _USER_INFO_1051 {
346     DWORD   usri1051_primary_group_id;
347 } USER_INFO_1051, *PUSER_INFO_1051, *LPUSER_INFO_1051;
348
349 typedef struct _USER_INFO_1052 {
350     LPWSTR  usri1052_profile;
351 } USER_INFO_1052, *PUSER_INFO_1052, *LPUSER_INFO_1052;
352
353 typedef struct _USER_INFO_1053 {
354     LPWSTR  usri1053_home_dir_drive;
355 } USER_INFO_1053, *PUSER_INFO_1053, *LPUSER_INFO_1053;
356
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;
364
365 typedef struct _USER_MODALS_INFO_1 {
366     DWORD usrmod1_role;
367     LPWSTR usrmod1_primary;
368 } USER_MODALS_INFO_1, *PUSER_MODALS_INFO_1, *LPUSER_MODALS_INFO_1;
369
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;
374
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;
380
381 typedef struct _NET_DISPLAY_USER {
382     LPWSTR usri1_name;
383     LPWSTR usri1_comment;
384     DWORD usri1_flags;
385     LPWSTR usri1_full_name;
386     DWORD usri1_user_id;
387     DWORD usri1_next_index;
388 } NET_DISPLAY_USER, *PNET_DISPLAY_USER;
389
390 typedef struct _NET_DISPLAY_MACHINE {
391     LPWSTR usri2_name;
392     LPWSTR usri2_comment;
393     DWORD usri2_flags;
394     DWORD usri2_user_id;
395     DWORD usri2_next_index;
396 } NET_DISPLAY_MACHINE, *PNET_DISPLAY_MACHINE;
397
398 typedef struct _NET_DISPLAY_GROUP {
399     LPWSTR grpi3_name;
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;
405
406 typedef struct _LOCALGROUP_INFO_0 {
407     LPWSTR lgrpi0_name;
408 } LOCALGROUP_INFO_0, *PLOCALGROUP_INFO_0, *LPLOCALGROUP_INFO_0;
409
410 typedef struct _LOCALGROUP_INFO_1 {
411     LPWSTR lgrpi1_name;
412     LPWSTR lgrpi1_comment;
413 } LOCALGROUP_INFO_1, *PLOCALGROUP_INFO_1, *LPLOCALGROUP_INFO_1;
414
415 typedef struct _LOCALGROUP_INFO_1002 {
416     LPWSTR lgrpi1002_comment;
417 } LOCALGROUP_INFO_1002, *PLOCALGROUP_INFO_1002, *LPLOCALGROUP_INFO_1002;
418
419 typedef struct _LOCALGROUP_MEMBERS_INFO_0 {
420     PSID lgrmi0_sid;
421 } LOCALGROUP_MEMBERS_INFO_0, *PLOCALGROUP_MEMBERS_INFO_0, *LPLOCALGROUP_MEMBERS_INFO_0;
422
423 typedef struct _LOCALGROUP_MEMBERS_INFO_1 {
424     PSID lgrmi1_sid;
425     SID_NAME_USE lgrmi1_sidusage;
426     LPWSTR lgrmi1_name;
427 } LOCALGROUP_MEMBERS_INFO_1, *PLOCALGROUP_MEMBERS_INFO_1, *LPLOCALGROUP_MEMBERS_INFO_1;
428
429 typedef struct _LOCALGROUP_MEMBERS_INFO_2 {
430     PSID lgrmi2_sid;
431     SID_NAME_USE lgrmi2_sidusage;
432     LPWSTR lgrmi2_domainandname;
433 } LOCALGROUP_MEMBERS_INFO_2, *PLOCALGROUP_MEMBERS_INFO_2, *LPLOCALGROUP_MEMBERS_INFO_2;
434
435 typedef struct _LOCALGROUP_MEMBERS_INFO_3 {
436     LPWSTR lgrmi3_domainandname;
437 } LOCALGROUP_MEMBERS_INFO_3, *PLOCALGROUP_MEMBERS_INFO_3, *LPLOCALGROUP_MEMBERS_INFO_3;
438
439 typedef struct _LOCALGROUP_USERS_INFO_0 {
440     LPWSTR lgrui0_name;
441 } LOCALGROUP_USERS_INFO_0, *PLOCALGROUP_USERS_INFO_0, *LPLOCALGROUP_USERS_INFO_0;
442
443 #define USER_PRIV_GUEST   0
444 #define USER_PRIV_USER    1
445 #define USER_PRIV_ADMIN   2
446 #define USER_PRIV_MASK    3
447
448 #define LOCALGROUP_NAME_PARMNUM         1
449 #define LOCALGROUP_COMMENT_PARMNUM      2
450
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*);
471
472 #ifdef __cplusplus
473 }
474 #endif
475
476 #endif