cmd: Updated Korean resource.
[wine/multimedia.git] / dlls / netapi32 / access.c
blob94d8b23adac7798c90996e88e182baeb46fdea62
1 /*
2 * Copyright 2002 Andriy Palamarchuk
4 * netapi32 access functions
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 #include <stdarg.h>
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "lmcons.h"
29 #include "lmaccess.h"
30 #include "lmapibuf.h"
31 #include "lmerr.h"
32 #include "winreg.h"
33 #include "ntsecapi.h"
34 #include "netapi32_misc.h"
35 #include "wine/debug.h"
36 #include "wine/unicode.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
40 static const WCHAR sAdminUserName[] = {'A','d','m','i','n','i','s','t','r','a','t',
41 'o','r',0};
42 static const WCHAR sGuestUserName[] = {'G','u','e','s','t',0};
44 /************************************************************
45 * NETAPI_ValidateServername
47 * Validates server name
49 static NET_API_STATUS NETAPI_ValidateServername(LPCWSTR ServerName)
51 if (ServerName)
53 if (ServerName[0] == 0)
54 return ERROR_BAD_NETPATH;
55 else if (
56 ((ServerName[0] == '\\') &&
57 (ServerName[1] != '\\'))
59 ((ServerName[0] == '\\') &&
60 (ServerName[1] == '\\') &&
61 (ServerName[2] == 0))
63 return ERROR_INVALID_NAME;
65 return NERR_Success;
68 /************************************************************
69 * NETAPI_IsKnownUser
71 * Checks whether the user name indicates current user.
73 static BOOL NETAPI_IsKnownUser(LPCWSTR UserName)
75 DWORD dwSize = UNLEN + 1;
76 BOOL Result;
77 LPWSTR buf;
79 if (!lstrcmpW(UserName, sAdminUserName) ||
80 !lstrcmpW(UserName, sGuestUserName))
81 return TRUE;
82 NetApiBufferAllocate(dwSize * sizeof(WCHAR), (LPVOID *) &buf);
83 Result = GetUserNameW(buf, &dwSize);
85 Result = Result && !lstrcmpW(UserName, buf);
86 NetApiBufferFree(buf);
88 return Result;
91 #define NETAPI_ForceKnownUser(UserName, FailureCode) \
92 if (!NETAPI_IsKnownUser(UserName)) \
93 { \
94 FIXME("Can't find information for user %s\n", \
95 debugstr_w(UserName)); \
96 return FailureCode; \
99 /************************************************************
100 * NetUserAdd (NETAPI32.@)
102 NET_API_STATUS WINAPI NetUserAdd(LPCWSTR servername,
103 DWORD level, LPBYTE bufptr, LPDWORD parm_err)
105 NET_API_STATUS status;
106 FIXME("(%s, %d, %p, %p) stub!\n", debugstr_w(servername), level, bufptr, parm_err);
108 status = NETAPI_ValidateServername(servername);
109 if (status != NERR_Success)
110 return status;
112 if ((bufptr != NULL) && (level > 0) && (level <= 4))
114 PUSER_INFO_1 ui = (PUSER_INFO_1) bufptr;
115 TRACE("usri%d_name: %s\n", level, debugstr_w(ui->usri1_name));
116 TRACE("usri%d_password: %s\n", level, debugstr_w(ui->usri1_password));
117 TRACE("usri%d_comment: %s\n", level, debugstr_w(ui->usri1_comment));
119 return status;
122 /************************************************************
123 * NetUserDel (NETAPI32.@)
125 NET_API_STATUS WINAPI NetUserDel(LPCWSTR servername, LPCWSTR username)
127 NET_API_STATUS status;
128 FIXME("(%s, %s) stub!\n", debugstr_w(servername), debugstr_w(username));
130 status = NETAPI_ValidateServername(servername);
131 if (status != NERR_Success)
132 return status;
134 if (!NETAPI_IsKnownUser(username))
135 return NERR_UserNotFound;
137 /* Delete the user here */
138 return status;
141 /************************************************************
142 * NetUserGetInfo (NETAPI32.@)
144 NET_API_STATUS WINAPI
145 NetUserGetInfo(LPCWSTR servername, LPCWSTR username, DWORD level,
146 LPBYTE* bufptr)
148 NET_API_STATUS status;
149 TRACE("(%s, %s, %d, %p)\n", debugstr_w(servername), debugstr_w(username),
150 level, bufptr);
151 status = NETAPI_ValidateServername(servername);
152 if (status != NERR_Success)
153 return status;
154 NETAPI_ForceLocalComputer(servername, NERR_InvalidComputer);
155 NETAPI_ForceKnownUser(username, NERR_UserNotFound);
157 switch (level)
159 case 0:
161 PUSER_INFO_0 ui;
162 int name_sz;
164 name_sz = lstrlenW(username) + 1;
166 /* set up buffer */
167 NetApiBufferAllocate(sizeof(USER_INFO_0) + name_sz * sizeof(WCHAR),
168 (LPVOID *) bufptr);
170 ui = (PUSER_INFO_0) *bufptr;
171 ui->usri0_name = (LPWSTR) (*bufptr + sizeof(USER_INFO_0));
173 /* get data */
174 lstrcpyW(ui->usri0_name, username);
175 break;
178 case 10:
180 PUSER_INFO_10 ui;
181 PUSER_INFO_0 ui0;
182 NET_API_STATUS status;
183 /* sizes of the field buffers in WCHARS */
184 int name_sz, comment_sz, usr_comment_sz, full_name_sz;
186 comment_sz = 1;
187 usr_comment_sz = 1;
188 full_name_sz = 1;
190 /* get data */
191 status = NetUserGetInfo(servername, username, 0, (LPBYTE *) &ui0);
192 if (status != NERR_Success)
194 NetApiBufferFree(ui0);
195 return status;
197 name_sz = lstrlenW(ui0->usri0_name) + 1;
199 /* set up buffer */
200 NetApiBufferAllocate(sizeof(USER_INFO_10) +
201 (name_sz + comment_sz + usr_comment_sz +
202 full_name_sz) * sizeof(WCHAR),
203 (LPVOID *) bufptr);
204 ui = (PUSER_INFO_10) *bufptr;
205 ui->usri10_name = (LPWSTR) (*bufptr + sizeof(USER_INFO_10));
206 ui->usri10_comment = (LPWSTR) (
207 ((PBYTE) ui->usri10_name) + name_sz * sizeof(WCHAR));
208 ui->usri10_usr_comment = (LPWSTR) (
209 ((PBYTE) ui->usri10_comment) + comment_sz * sizeof(WCHAR));
210 ui->usri10_full_name = (LPWSTR) (
211 ((PBYTE) ui->usri10_usr_comment) + usr_comment_sz * sizeof(WCHAR));
213 /* set data */
214 lstrcpyW(ui->usri10_name, ui0->usri0_name);
215 NetApiBufferFree(ui0);
216 ui->usri10_comment[0] = 0;
217 ui->usri10_usr_comment[0] = 0;
218 ui->usri10_full_name[0] = 0;
219 break;
222 case 1:
224 static const WCHAR homedirW[] = {'H','O','M','E',0};
225 PUSER_INFO_1 ui;
226 PUSER_INFO_0 ui0;
227 NET_API_STATUS status;
228 /* sizes of the field buffers in WCHARS */
229 int name_sz, password_sz, home_dir_sz, comment_sz, script_path_sz;
231 password_sz = 1; /* not filled out for security reasons for NetUserGetInfo*/
232 comment_sz = 1;
233 script_path_sz = 1;
235 /* get data */
236 status = NetUserGetInfo(servername, username, 0, (LPBYTE *) &ui0);
237 if (status != NERR_Success)
239 NetApiBufferFree(ui0);
240 return status;
242 name_sz = lstrlenW(ui0->usri0_name) + 1;
243 home_dir_sz = GetEnvironmentVariableW(homedirW, NULL,0);
244 /* set up buffer */
245 NetApiBufferAllocate(sizeof(USER_INFO_1) +
246 (name_sz + password_sz + home_dir_sz +
247 comment_sz + script_path_sz) * sizeof(WCHAR),
248 (LPVOID *) bufptr);
250 ui = (PUSER_INFO_1) *bufptr;
251 ui->usri1_name = (LPWSTR) (ui + 1);
252 ui->usri1_password = ui->usri1_name + name_sz;
253 ui->usri1_home_dir = ui->usri1_password + password_sz;
254 ui->usri1_comment = ui->usri1_home_dir + home_dir_sz;
255 ui->usri1_script_path = ui->usri1_comment + comment_sz;
256 /* set data */
257 lstrcpyW(ui->usri1_name, ui0->usri0_name);
258 NetApiBufferFree(ui0);
259 ui->usri1_password[0] = 0;
260 ui->usri1_password_age = 0;
261 ui->usri1_priv = 0;
262 GetEnvironmentVariableW(homedirW, ui->usri1_home_dir,home_dir_sz);
263 ui->usri1_comment[0] = 0;
264 ui->usri1_flags = 0;
265 ui->usri1_script_path[0] = 0;
266 break;
268 case 2:
269 case 3:
270 case 4:
271 case 11:
272 case 20:
273 case 23:
274 case 1003:
275 case 1005:
276 case 1006:
277 case 1007:
278 case 1008:
279 case 1009:
280 case 1010:
281 case 1011:
282 case 1012:
283 case 1013:
284 case 1014:
285 case 1017:
286 case 1018:
287 case 1020:
288 case 1023:
289 case 1024:
290 case 1025:
291 case 1051:
292 case 1052:
293 case 1053:
295 FIXME("Level %d is not implemented\n", level);
296 return NERR_InternalError;
298 default:
299 ERR("Invalid level %d is specified\n", level);
300 return ERROR_INVALID_LEVEL;
302 return NERR_Success;
305 /************************************************************
306 * NetUserGetLocalGroups (NETAPI32.@)
308 NET_API_STATUS WINAPI
309 NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
310 DWORD flags, LPBYTE* bufptr, DWORD prefmaxlen,
311 LPDWORD entriesread, LPDWORD totalentries)
313 NET_API_STATUS status;
315 FIXME("(%s, %s, %d, %08x, %p %d, %p, %p) stub!\n",
316 debugstr_w(servername), debugstr_w(username), level, flags, bufptr,
317 prefmaxlen, entriesread, totalentries);
319 status = NETAPI_ValidateServername(servername);
320 if (status != NERR_Success)
321 return status;
323 if (!NETAPI_IsKnownUser(username))
324 return NERR_UserNotFound;
326 if (bufptr) *bufptr = NULL;
327 if (entriesread) *entriesread = 0;
328 if (totalentries) *totalentries = 0;
330 return NERR_Success;
333 /************************************************************
334 * NetUserEnum (NETAPI32.@)
336 NET_API_STATUS WINAPI
337 NetUserEnum(LPCWSTR servername, DWORD level, DWORD filter, LPBYTE* bufptr,
338 DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries,
339 LPDWORD resume_handle)
341 FIXME("(%s,%d, 0x%d,%p,%d,%p,%p,%p) stub!\n", debugstr_w(servername), level,
342 filter, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
344 return ERROR_ACCESS_DENIED;
347 /************************************************************
348 * ACCESS_QueryAdminDisplayInformation
350 * Creates a buffer with information for the Admin User
352 static void ACCESS_QueryAdminDisplayInformation(PNET_DISPLAY_USER *buf, PDWORD pdwSize)
354 static const WCHAR sAdminUserName[] = {
355 'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
357 /* sizes of the field buffers in WCHARS */
358 int name_sz, comment_sz, full_name_sz;
359 PNET_DISPLAY_USER usr;
361 /* set up buffer */
362 name_sz = lstrlenW(sAdminUserName);
363 comment_sz = 1;
364 full_name_sz = 1;
366 *pdwSize = sizeof(NET_DISPLAY_USER);
367 *pdwSize += (name_sz + comment_sz + full_name_sz) * sizeof(WCHAR);
368 NetApiBufferAllocate(*pdwSize, (LPVOID *) buf);
370 usr = *buf;
371 usr->usri1_name = (LPWSTR) ((PBYTE) usr + sizeof(NET_DISPLAY_USER));
372 usr->usri1_comment = (LPWSTR) (
373 ((PBYTE) usr->usri1_name) + name_sz * sizeof(WCHAR));
374 usr->usri1_full_name = (LPWSTR) (
375 ((PBYTE) usr->usri1_comment) + comment_sz * sizeof(WCHAR));
377 /* set data */
378 lstrcpyW(usr->usri1_name, sAdminUserName);
379 usr->usri1_comment[0] = 0;
380 usr->usri1_flags = UF_SCRIPT | UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD;
381 usr->usri1_full_name[0] = 0;
382 usr->usri1_user_id = 500;
383 usr->usri1_next_index = 0;
386 /************************************************************
387 * ACCESS_QueryGuestDisplayInformation
389 * Creates a buffer with information for the Guest User
391 static void ACCESS_QueryGuestDisplayInformation(PNET_DISPLAY_USER *buf, PDWORD pdwSize)
393 static const WCHAR sGuestUserName[] = {
394 'G','u','e','s','t',0 };
396 /* sizes of the field buffers in WCHARS */
397 int name_sz, comment_sz, full_name_sz;
398 PNET_DISPLAY_USER usr;
400 /* set up buffer */
401 name_sz = lstrlenW(sGuestUserName);
402 comment_sz = 1;
403 full_name_sz = 1;
405 *pdwSize = sizeof(NET_DISPLAY_USER);
406 *pdwSize += (name_sz + comment_sz + full_name_sz) * sizeof(WCHAR);
407 NetApiBufferAllocate(*pdwSize, (LPVOID *) buf);
409 usr = *buf;
410 usr->usri1_name = (LPWSTR) ((PBYTE) usr + sizeof(NET_DISPLAY_USER));
411 usr->usri1_comment = (LPWSTR) (
412 ((PBYTE) usr->usri1_name) + name_sz * sizeof(WCHAR));
413 usr->usri1_full_name = (LPWSTR) (
414 ((PBYTE) usr->usri1_comment) + comment_sz * sizeof(WCHAR));
416 /* set data */
417 lstrcpyW(usr->usri1_name, sGuestUserName);
418 usr->usri1_comment[0] = 0;
419 usr->usri1_flags = UF_ACCOUNTDISABLE | UF_SCRIPT | UF_NORMAL_ACCOUNT |
420 UF_DONT_EXPIRE_PASSWD;
421 usr->usri1_full_name[0] = 0;
422 usr->usri1_user_id = 500;
423 usr->usri1_next_index = 0;
426 /************************************************************
427 * NetQueryDisplayInformation (NETAPI32.@)
428 * Copies NET_DISPLAY_USER record.
430 static void ACCESS_CopyDisplayUser(PNET_DISPLAY_USER dest, LPWSTR *dest_buf,
431 PNET_DISPLAY_USER src)
433 LPWSTR str = *dest_buf;
435 src->usri1_name = str;
436 lstrcpyW(src->usri1_name, dest->usri1_name);
437 str = (LPWSTR) (
438 ((PBYTE) str) + (lstrlenW(str) + 1) * sizeof(WCHAR));
440 src->usri1_comment = str;
441 lstrcpyW(src->usri1_comment, dest->usri1_comment);
442 str = (LPWSTR) (
443 ((PBYTE) str) + (lstrlenW(str) + 1) * sizeof(WCHAR));
445 src->usri1_flags = dest->usri1_flags;
447 src->usri1_full_name = str;
448 lstrcpyW(src->usri1_full_name, dest->usri1_full_name);
449 str = (LPWSTR) (
450 ((PBYTE) str) + (lstrlenW(str) + 1) * sizeof(WCHAR));
452 src->usri1_user_id = dest->usri1_user_id;
453 src->usri1_next_index = dest->usri1_next_index;
454 *dest_buf = str;
457 /************************************************************
458 * NetQueryDisplayInformation (NETAPI32.@)
460 * The buffer structure:
461 * - array of fixed size record of the level type
462 * - strings, referenced by the record of the level type
464 NET_API_STATUS WINAPI
465 NetQueryDisplayInformation(
466 LPCWSTR ServerName, DWORD Level, DWORD Index, DWORD EntriesRequested,
467 DWORD PreferredMaximumLength, LPDWORD ReturnedEntryCount,
468 PVOID *SortedBuffer)
470 TRACE("(%s, %d, %d, %d, %d, %p, %p)\n", debugstr_w(ServerName),
471 Level, Index, EntriesRequested, PreferredMaximumLength,
472 ReturnedEntryCount, SortedBuffer);
473 NETAPI_ForceLocalComputer(ServerName, ERROR_ACCESS_DENIED);
474 switch (Level)
476 case 1:
478 /* current record */
479 PNET_DISPLAY_USER inf;
480 /* current available strings buffer */
481 LPWSTR str;
482 PNET_DISPLAY_USER admin, guest;
483 DWORD admin_size, guest_size;
484 LPWSTR name = NULL;
485 DWORD dwSize;
487 /* sizes of the field buffers in WCHARS */
488 int name_sz, comment_sz, full_name_sz;
490 /* number of the records, returned in SortedBuffer
491 3 - for current user, Administrator and Guest users
493 int records = 3;
495 FIXME("Level %d partially implemented\n", Level);
496 *ReturnedEntryCount = records;
497 comment_sz = 1;
498 full_name_sz = 1;
500 /* get data */
501 dwSize = UNLEN + 1;
502 NetApiBufferAllocate(dwSize, (LPVOID *) &name);
503 if (!GetUserNameW(name, &dwSize))
505 NetApiBufferFree(name);
506 return ERROR_ACCESS_DENIED;
508 name_sz = dwSize;
509 ACCESS_QueryAdminDisplayInformation(&admin, &admin_size);
510 ACCESS_QueryGuestDisplayInformation(&guest, &guest_size);
512 /* set up buffer */
513 dwSize = sizeof(NET_DISPLAY_USER) * records;
514 dwSize += (name_sz + comment_sz + full_name_sz) * sizeof(WCHAR);
516 NetApiBufferAllocate(dwSize +
517 admin_size - sizeof(NET_DISPLAY_USER) +
518 guest_size - sizeof(NET_DISPLAY_USER),
519 (LPVOID *) SortedBuffer);
520 inf = (PNET_DISPLAY_USER) *SortedBuffer;
521 str = (LPWSTR) ((PBYTE) inf + sizeof(NET_DISPLAY_USER) * records);
522 inf->usri1_name = str;
523 str = (LPWSTR) (
524 ((PBYTE) str) + name_sz * sizeof(WCHAR));
525 inf->usri1_comment = str;
526 str = (LPWSTR) (
527 ((PBYTE) str) + comment_sz * sizeof(WCHAR));
528 inf->usri1_full_name = str;
529 str = (LPWSTR) (
530 ((PBYTE) str) + full_name_sz * sizeof(WCHAR));
532 /* set data */
533 lstrcpyW(inf->usri1_name, name);
534 NetApiBufferFree(name);
535 inf->usri1_comment[0] = 0;
536 inf->usri1_flags =
537 UF_SCRIPT | UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD;
538 inf->usri1_full_name[0] = 0;
539 inf->usri1_user_id = 0;
540 inf->usri1_next_index = 0;
542 inf++;
543 ACCESS_CopyDisplayUser(admin, &str, inf);
544 NetApiBufferFree(admin);
546 inf++;
547 ACCESS_CopyDisplayUser(guest, &str, inf);
548 NetApiBufferFree(guest);
549 break;
552 case 2:
553 case 3:
555 FIXME("Level %d is not implemented\n", Level);
556 break;
559 default:
560 ERR("Invalid level %d is specified\n", Level);
561 return ERROR_INVALID_LEVEL;
563 return NERR_Success;
566 /************************************************************
567 * NetGetDCName (NETAPI32.@)
569 * Return the name of the primary domain controller (PDC)
572 NET_API_STATUS WINAPI
573 NetGetDCName(LPCWSTR servername, LPCWSTR domainname, LPBYTE *bufptr)
575 FIXME("(%s, %s, %p) stub!\n", debugstr_w(servername),
576 debugstr_w(domainname), bufptr);
577 return NERR_DCNotFound; /* say we can't find a domain controller */
581 /******************************************************************************
582 * NetUserModalsGet (NETAPI32.@)
584 * Retrieves global information for all users and global groups in the security
585 * database.
587 * PARAMS
588 * szServer [I] Specifies the DNS or the NetBIOS name of the remote server
589 * on which the function is to execute.
590 * level [I] Information level of the data.
591 * 0 Return global passwords parameters. bufptr points to a
592 * USER_MODALS_INFO_0 struct.
593 * 1 Return logon server and domain controller information. bufptr
594 * points to a USER_MODALS_INFO_1 struct.
595 * 2 Return domain name and identifier. bufptr points to a
596 * USER_MODALS_INFO_2 struct.
597 * 3 Return lockout information. bufptr points to a USER_MODALS_INFO_3
598 * struct.
599 * pbuffer [I] Buffer that receives the data.
601 * RETURNS
602 * Success: NERR_Success.
603 * Failure:
604 * ERROR_ACCESS_DENIED - the user does not have access to the info.
605 * NERR_InvalidComputer - computer name is invalid.
607 NET_API_STATUS WINAPI NetUserModalsGet(
608 LPCWSTR szServer, DWORD level, LPBYTE *pbuffer)
610 TRACE("(%s %d %p)\n", debugstr_w(szServer), level, pbuffer);
612 switch (level)
614 case 0:
615 /* return global passwords parameters */
616 FIXME("level 0 not implemented!\n");
617 *pbuffer = NULL;
618 return NERR_InternalError;
619 case 1:
620 /* return logon server and domain controller info */
621 FIXME("level 1 not implemented!\n");
622 *pbuffer = NULL;
623 return NERR_InternalError;
624 case 2:
626 /* return domain name and identifier */
627 PUSER_MODALS_INFO_2 umi;
628 LSA_HANDLE policyHandle;
629 LSA_OBJECT_ATTRIBUTES objectAttributes;
630 PPOLICY_ACCOUNT_DOMAIN_INFO domainInfo;
631 NTSTATUS ntStatus;
632 PSID domainIdentifier = NULL;
633 int domainNameLen;
635 ZeroMemory(&objectAttributes, sizeof(objectAttributes));
636 objectAttributes.Length = sizeof(objectAttributes);
638 ntStatus = LsaOpenPolicy(NULL, &objectAttributes,
639 POLICY_VIEW_LOCAL_INFORMATION,
640 &policyHandle);
641 if (ntStatus != STATUS_SUCCESS)
643 WARN("LsaOpenPolicy failed with NT status %x\n",
644 LsaNtStatusToWinError(ntStatus));
645 return ntStatus;
648 ntStatus = LsaQueryInformationPolicy(policyHandle,
649 PolicyAccountDomainInformation,
650 (PVOID *)&domainInfo);
651 if (ntStatus != STATUS_SUCCESS)
653 WARN("LsaQueryInformationPolicy failed with NT status %x\n",
654 LsaNtStatusToWinError(ntStatus));
655 LsaClose(policyHandle);
656 return ntStatus;
659 domainIdentifier = domainInfo->DomainSid;
660 domainNameLen = lstrlenW(domainInfo->DomainName.Buffer) + 1;
661 LsaClose(policyHandle);
663 ntStatus = NetApiBufferAllocate(sizeof(USER_MODALS_INFO_2) +
664 GetLengthSid(domainIdentifier) +
665 domainNameLen * sizeof(WCHAR),
666 (LPVOID *)pbuffer);
668 if (ntStatus != NERR_Success)
670 WARN("NetApiBufferAllocate() failed\n");
671 LsaFreeMemory(domainInfo);
672 return ntStatus;
675 umi = (USER_MODALS_INFO_2 *) *pbuffer;
676 umi->usrmod2_domain_id = (PSID)(*pbuffer +
677 sizeof(USER_MODALS_INFO_2));
678 umi->usrmod2_domain_name = (LPWSTR)(*pbuffer +
679 sizeof(USER_MODALS_INFO_2) + GetLengthSid(domainIdentifier));
681 lstrcpynW(umi->usrmod2_domain_name,
682 domainInfo->DomainName.Buffer,
683 domainNameLen);
684 CopySid(GetLengthSid(domainIdentifier), umi->usrmod2_domain_id,
685 domainIdentifier);
687 LsaFreeMemory(domainInfo);
689 break;
691 case 3:
692 /* return lockout information */
693 FIXME("level 3 not implemented!\n");
694 *pbuffer = NULL;
695 return NERR_InternalError;
696 default:
697 WARN("Invalid level %d is specified\n", level);
698 *pbuffer = NULL;
699 return ERROR_INVALID_LEVEL;
702 return NERR_Success;
705 /******************************************************************************
706 * NetUserChangePassword (NETAPI32.@)
707 * PARAMS
708 * domainname [I] Optional. Domain on which the user resides or the logon
709 * domain of the current user if NULL.
710 * username [I] Optional. Username to change the password for or the name
711 * of the current user if NULL.
712 * oldpassword [I] The user's current password.
713 * newpassword [I] The password that the user will be changed to using.
715 * RETURNS
716 * Success: NERR_Success.
717 * Failure: NERR_* failure code or win error code.
720 NET_API_STATUS WINAPI NetUserChangePassword(LPCWSTR domainname, LPCWSTR username,
721 LPCWSTR oldpassword, LPCWSTR newpassword)
723 FIXME("(%s, %s, ..., ...)\n", debugstr_w(domainname), debugstr_w(username));
724 return NERR_InternalError;