ReactOS 0.4.15-dev-5865-g640e228
userprops.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS User Manager Control Panel
4 * FILE: dll/cpl/usrmgr/userprops.c
5 * PURPOSE: User property sheet
6 *
7 * PROGRAMMERS: Eric Kohl
8 */
9
10#include "usrmgr.h"
11
12typedef struct _GENERAL_USER_DATA
13{
18
19#define VALID_GENERAL_FLAGS (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD | UF_ACCOUNTDISABLE | UF_LOCKOUT)
20
21typedef struct _PROFILE_USER_DATA
22{
25
27{
32
33
34static VOID
36 PPROFILE_USER_DATA pUserData)
37{
38 PUSER_INFO_3 userInfo = NULL;
40 BOOL bLocal;
41 TCHAR szDrive[8];
42 INT i;
43 INT nSel;
44
45 status = NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&userInfo);
46 if (status != NERR_Success)
47 return;
48
51
52
53 bLocal = (userInfo->usri3_home_dir_drive == NULL) ||
54 (_tcslen(userInfo->usri3_home_dir_drive) == 0);
57
58 for (i = 0; i < 26; i++)
59 {
60 wsprintf(szDrive, _T("%c:"), (TCHAR)('A' + i));
62 CB_INSERTSTRING, -1, (LPARAM)szDrive);
63 }
64
65 if (bLocal)
66 {
70 }
71 else
72 {
76 }
77
79 CB_SETCURSEL, nSel, 0);
80
81 NetApiBufferFree(userInfo);
82}
83
84
85static BOOL
87 PPROFILE_USER_DATA pUserData)
88{
89 PUSER_INFO_3 pUserInfo = NULL;
90 LPTSTR pszProfilePath = NULL;
91 LPTSTR pszScriptPath = NULL;
92 LPTSTR pszHomeDir = NULL;
93 LPTSTR pszHomeDrive = NULL;
95 DWORD dwIndex;
97 INT nIndex;
98
99 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo);
100
101 /* Get the profile path */
103 if (nLength == 0)
104 {
105 pUserInfo->usri3_profile = NULL;
106 }
107 else
108 {
109 pszProfilePath = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
110 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_PATH, pszProfilePath, nLength + 1);
111 pUserInfo->usri3_profile = pszProfilePath;
112 }
113
114 /* Get the script path */
116 if (nLength == 0)
117 {
118 pUserInfo->usri3_script_path = NULL;
119 }
120 else
121 {
122 pszScriptPath = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
123 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_SCRIPT, pszScriptPath, nLength + 1);
124 pUserInfo->usri3_script_path = pszScriptPath;
125 }
126
128 {
129 /* Local home directory */
131 if (nLength == 0)
132 {
133 pUserInfo->usri3_home_dir = NULL;
134 }
135 else
136 {
137 pszHomeDir = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
138 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH, pszHomeDir, nLength + 1);
139 pUserInfo->usri3_home_dir = pszHomeDir;
140 }
141 }
142 else
143 {
144 /* Remote home directory */
146 if (nLength == 0)
147 {
148 pUserInfo->usri3_home_dir = NULL;
149 }
150 else
151 {
152 pszHomeDir = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
153 GetDlgItemText(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH, pszHomeDir, nLength + 1);
154 pUserInfo->usri3_home_dir = pszHomeDir;
155 }
156
158 if (nIndex != CB_ERR)
159 {
161 pszHomeDrive = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
162 SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), CB_GETLBTEXT, nIndex, (LPARAM)pszHomeDrive);
163 pUserInfo->usri3_home_dir_drive = pszHomeDrive;
164 }
165 }
166
167 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex);
168 if (status != NERR_Success)
169 {
170 ERR("NetUserSetInfo failed. Status: %lu Index: %lu", status, dwIndex);
171 }
172
173 if (pszProfilePath)
174 HeapFree(GetProcessHeap(), 0, pszProfilePath);
175
176 if (pszScriptPath)
177 HeapFree(GetProcessHeap(), 0, pszScriptPath);
178
179 if (pszHomeDir)
180 HeapFree(GetProcessHeap(), 0, pszHomeDir);
181
182 if (pszHomeDrive)
183 HeapFree(GetProcessHeap(), 0, pszHomeDrive);
184
185 NetApiBufferFree(pUserInfo);
186
187 return (status == NERR_Success);
188}
189
190
193 UINT uMsg,
196{
197 PPROFILE_USER_DATA pUserData;
198
201 UNREFERENCED_PARAMETER(hwndDlg);
202
203 pUserData= (PPROFILE_USER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
204
205 switch (uMsg)
206 {
207 case WM_INITDIALOG:
210 sizeof(PROFILE_USER_DATA) +
211 lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR));
212 lstrcpy(pUserData->szUserName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);
213
214 SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData);
215
216 GetUserProfileData(hwndDlg,
217 pUserData);
218 break;
219
220 case WM_COMMAND:
221 switch (LOWORD(wParam))
222 {
225 if (HIWORD(wParam) == EN_CHANGE)
226 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
227 break;
228
233 break;
234
239 break;
240 }
241 break;
242
243 case WM_DESTROY:
244 HeapFree(GetProcessHeap(), 0, pUserData);
245 break;
246
247 case WM_NOTIFY:
248 if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY)
249 {
250 SetUserProfileData(hwndDlg, pUserData);
251 return TRUE;
252 }
253 break;
254 }
255
256 return FALSE;
257}
258
259
260static VOID
262{
264 DWORD dwTotal;
265 DWORD i;
266 HIMAGELIST hImgList;
267 HICON hIcon;
268 LV_ITEM lvi;
269 HWND hwndLV;
271 RECT rect;
272
273
274 hwndLV = GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_LIST);
275
276 /* Create the image list */
277 hImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 5, 5);
279 ImageList_AddIcon(hImgList, hIcon);
281 (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL);
282
283 /* Set the list column */
284 GetClientRect(hwndLV, &rect);
285
286 memset(&column, 0x00, sizeof(column));
288 column.fmt = LVCFMT_LEFT;
289 column.cx = (INT)(rect.right - rect.left);
290 column.iSubItem = 0;
291 (void)ListView_InsertColumn(hwndLV, 0, &column);
292
293
294 status = NetUserGetLocalGroups(NULL, pUserData->szUserName, 0, 0,
295 (LPBYTE*)&pUserData->pGroupData,
297 &pUserData->dwGroupCount,
298 &dwTotal);
299 if (status != NERR_Success)
300 return;
301
302 for (i = 0; i < pUserData->dwGroupCount; i++)
303 {
304 ZeroMemory(&lvi, sizeof(lvi));
305 lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
306 lvi.pszText = pUserData->pGroupData[i].lgrui0_name;
307 lvi.state = 0;
308 lvi.iImage = 0;
309
310 (void)ListView_InsertItem(hwndLV, &lvi);
311 }
312}
313
314
315static VOID
317 PMEMBERSHIP_USER_DATA pUserData)
318{
319 TCHAR szGroupName[UNLEN + 1];
320 TCHAR szText[256];
321 LOCALGROUP_MEMBERS_INFO_3 memberInfo;
322 HWND hwndLV;
323 INT nItem;
325
326 hwndLV = GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_LIST);
327 nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
328 if (nItem == -1)
329 return;
330
331 /* Get the new user name */
333 nItem, 0,
334 szGroupName,
335 UNLEN + 1);
336
337 /* Display a warning message because the remove operation cannot be reverted */
338 wsprintf(szText, TEXT("Do you really want to remove the user \"%s\" from the group \"%s\"?"),
339 pUserData->szUserName, szGroupName);
340 if (MessageBox(NULL, szText, TEXT("User Accounts"), MB_ICONWARNING | MB_YESNO) == IDNO)
341 return;
342
343 memberInfo.lgrmi3_domainandname = pUserData->szUserName;
344
345 status = NetLocalGroupDelMembers(NULL, szGroupName,
346 3, (LPBYTE)&memberInfo, 1);
347 if (status != NERR_Success)
348 {
349 TCHAR szText[256];
350 wsprintf(szText, TEXT("Error: %u"), status);
351 MessageBox(NULL, szText, TEXT("NetLocalGroupDelMembers"), MB_ICONERROR | MB_OK);
352 return;
353 }
354
355 (void)ListView_DeleteItem(hwndLV, nItem);
356
357 if (ListView_GetItemCount(hwndLV) == 0)
359}
360
361
362static VOID
364{
365 HWND hwndLV;
367 RECT rect;
368 TCHAR szStr[32];
369
370 NET_API_STATUS netStatus;
372 DWORD entriesread;
373 DWORD totalentries;
374 DWORD_PTR resume_handle = 0;
375 DWORD i;
376 LV_ITEM lvi;
377 INT iItem;
378
379 HIMAGELIST hImgList;
380 HICON hIcon;
381
382 hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST);
383 GetClientRect(hwndLV, &rect);
384
385 hImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 5, 5);
387 ImageList_AddIcon(hImgList, hIcon);
389
390 (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL);
392
393 memset(&column, 0x00, sizeof(column));
395 column.fmt = LVCFMT_LEFT;
396 column.cx = (INT)((rect.right - rect.left) * 0.40);
397 column.iSubItem = 0;
398 LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
399 column.pszText = szStr;
400 (void)ListView_InsertColumn(hwndLV, 0, &column);
401
402 column.cx = (INT)((rect.right - rect.left) * 0.60);
403 column.iSubItem = 1;
404 LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0]));
405 column.pszText = szStr;
406 (void)ListView_InsertColumn(hwndLV, 1, &column);
407
408 for (;;)
409 {
410 netStatus = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&pBuffer,
411 1024, &entriesread,
412 &totalentries, &resume_handle);
413 if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)
414 break;
415
416 for (i = 0; i < entriesread; i++)
417 {
418 memset(&lvi, 0x00, sizeof(lvi));
419 lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
420 lvi.pszText = pBuffer[i].lgrpi1_name;
421 lvi.state = 0;
422 lvi.iImage = 0;
423 iItem = ListView_InsertItem(hwndLV, &lvi);
424
425 ListView_SetItemText(hwndLV, iItem, 1,
426 pBuffer[i].lgrpi1_comment);
427 }
428
430
431 /* No more data left */
432 if (netStatus != ERROR_MORE_DATA)
433 break;
434 }
435}
436
437
438static BOOL
440 PMEMBERSHIP_USER_DATA pUserData)
441{
442 HWND hwndLV;
443 INT nItem;
444 TCHAR szGroupName[UNLEN + 1];
445 BOOL bResult = FALSE;
446 BOOL bFound;
447 DWORD i;
448 LOCALGROUP_MEMBERS_INFO_3 memberInfo;
450
451 hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST);
452
453 if (ListView_GetSelectedCount(hwndLV) > 0)
454 {
455 nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
456 while (nItem != -1)
457 {
458 /* Get the new user name */
460 nItem, 0,
461 szGroupName,
462 UNLEN + 1);
463
464 bFound = FALSE;
465 for (i = 0; i < pUserData->dwGroupCount; i++)
466 {
467 if (_tcscmp(pUserData->pGroupData[i].lgrui0_name, szGroupName) == 0)
468 bFound = TRUE;
469 }
470
471 if (!bFound)
472 {
473 memberInfo.lgrmi3_domainandname = pUserData->szUserName;
474
475 status = NetLocalGroupAddMembers(NULL, szGroupName, 3,
476 (LPBYTE)&memberInfo, 1);
477 if (status == NERR_Success)
478 {
479 TRACE("Selected group: %s", dbgstrx(szGroupName));
480 bResult = TRUE;
481 }
482 else
483 {
484 TCHAR szText[256];
485 wsprintf(szText, TEXT("Error: %u"), status);
486 MessageBox(NULL, szText, TEXT("NetLocalGroupAddMembers"), MB_ICONERROR | MB_OK);
487 }
488 }
489
490 nItem = ListView_GetNextItem(hwndLV, nItem, LVNI_SELECTED);
491 }
492 }
493
494 return bResult;
495}
496
497
500 UINT uMsg,
503{
504 PMEMBERSHIP_USER_DATA pUserData;
505
507
509
510 switch (uMsg)
511 {
512 case WM_INITDIALOG:
513 pUserData= (PMEMBERSHIP_USER_DATA)lParam;
514 SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData);
515 InitUserGroupsList(hwndDlg);
516 break;
517
518 case WM_COMMAND:
519 switch (LOWORD(wParam))
520 {
521 case IDOK:
522 if (AddSelectedGroupsToUser(hwndDlg, pUserData))
523 EndDialog(hwndDlg, IDOK);
524 else
525 EndDialog(hwndDlg, IDCANCEL);
526 break;
527
528 case IDCANCEL:
529 EndDialog(hwndDlg, IDCANCEL);
530 break;
531 }
532 break;
533
534 default:
535 return FALSE;
536 }
537
538 return TRUE;
539}
540
541
542static VOID
544 PMEMBERSHIP_USER_DATA pUserData)
545{
546 HWND hwndLV;
548 DWORD i;
549 DWORD dwTotal;
550 LV_ITEM lvi;
551
554 hwndDlg,
556 (LPARAM)pUserData) == IDOK)
557 {
558 // TODO: Update Membership list!
559 hwndLV = GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_LIST);
560
561 if (pUserData->pGroupData)
562 NetApiBufferFree(pUserData->pGroupData);
563
565
566 status = NetUserGetLocalGroups(NULL, pUserData->szUserName, 0, 0,
567 (LPBYTE*)&pUserData->pGroupData,
569 &pUserData->dwGroupCount,
570 &dwTotal);
571 if (status != NERR_Success)
572 return;
573
574 for (i = 0; i < pUserData->dwGroupCount; i++)
575 {
576 ZeroMemory(&lvi, sizeof(lvi));
577 lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
578 lvi.pszText = pUserData->pGroupData[i].lgrui0_name;
579 lvi.state = 0;
580 lvi.iImage = 0;
581
582 (void)ListView_InsertItem(hwndLV, &lvi);
583 }
584 }
585}
586
587
588static BOOL
590 PMEMBERSHIP_USER_DATA pUserData,
592{
594
595 switch (((LPNMHDR)lParam)->idFrom)
596 {
598 switch (((LPNMHDR)lParam)->code)
599 {
600 case NM_CLICK:
601 EnableWindow(GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_REMOVE), (lpnmlv->iItem != -1));
602 break;
603
604 case LVN_KEYDOWN:
605 if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
606 {
607 RemoveGroupFromUser(hwndDlg, pUserData);
608 }
609 break;
610
611 }
612 break;
613 }
614
615 return FALSE;
616}
617
618
621 UINT uMsg,
624{
625 PMEMBERSHIP_USER_DATA pUserData;
626
629 UNREFERENCED_PARAMETER(hwndDlg);
630
632
633 switch (uMsg)
634 {
635 case WM_INITDIALOG:
638 sizeof(MEMBERSHIP_USER_DATA) +
639 lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR));
640 lstrcpy(pUserData->szUserName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);
641
642 SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData);
643
644 GetUserMembershipData(hwndDlg, pUserData);
645 break;
646
647 case WM_COMMAND:
648 switch (LOWORD(wParam))
649 {
651 AddGroupToUser(hwndDlg, pUserData);
652 break;
653
655 RemoveGroupFromUser(hwndDlg, pUserData);
656 break;
657 }
658 break;
659
660 case WM_NOTIFY:
661 if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY)
662 {
663 return TRUE;
664 }
665 else
666 {
667 return OnUserPropSheetNotify(hwndDlg, pUserData, lParam);
668 }
669 break;
670
671
672 case WM_DESTROY:
673 if (pUserData->pGroupData)
674 NetApiBufferFree(pUserData->pGroupData);
675
676 HeapFree(GetProcessHeap(), 0, pUserData);
677 break;
678 }
679
680 return FALSE;
681}
682
683
684static VOID
686 PGENERAL_USER_DATA pUserData,
687 BOOL bInit)
688{
690 !pUserData->dwPasswordExpired);
692 !pUserData->dwPasswordExpired);
694 (pUserData->dwFlags & (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD)) == 0);
695
697 (pUserData->dwFlags & UF_LOCKOUT) != 0);
698
699 if (bInit)
700 {
703
706
709
712
714 (pUserData->dwFlags & UF_LOCKOUT) ? BST_CHECKED : BST_UNCHECKED);
715 }
716}
717
718
719static VOID
721 PGENERAL_USER_DATA pUserData)
722{
723 PUSER_INFO_3 pUserInfo = NULL;
724
725 SetDlgItemText(hwndDlg, IDC_USER_GENERAL_NAME, pUserData->szUserName);
726
727 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo);
728
731
732 pUserData->dwFlags = pUserInfo->usri3_flags;
733 pUserData->dwPasswordExpired = pUserInfo->usri3_password_expired;
734
735 NetApiBufferFree(pUserInfo);
736
737 UpdateUserOptions(hwndDlg, pUserData, TRUE);
738}
739
740
741static BOOL
743 PGENERAL_USER_DATA pUserData)
744{
745 PUSER_INFO_3 pUserInfo = NULL;
746 LPTSTR pszFullName = NULL;
747 LPTSTR pszComment = NULL;
749 DWORD dwIndex;
750 INT nLength;
751
752 NetUserGetInfo(NULL, pUserData->szUserName, 3, (LPBYTE*)&pUserInfo);
753
754 pUserInfo->usri3_flags =
755 (pUserData->dwFlags & VALID_GENERAL_FLAGS) |
756 (pUserInfo->usri3_flags & ~VALID_GENERAL_FLAGS);
757
758 pUserInfo->usri3_password_expired = pUserData->dwPasswordExpired;
759
761 if (nLength == 0)
762 {
763 pUserInfo->usri3_full_name = NULL;
764 }
765 else
766 {
767 pszFullName = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
768 GetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, pszFullName, nLength + 1);
769 pUserInfo->usri3_full_name = pszFullName;
770 }
771
773 if (nLength == 0)
774 {
775 pUserInfo->usri3_full_name = NULL;
776 }
777 else
778 {
779 pszComment = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
780 GetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, pszComment, nLength + 1);
781 pUserInfo->usri3_comment = pszComment;
782 }
783
784 status = NetUserSetInfo(NULL, pUserData->szUserName, 3, (LPBYTE)pUserInfo, &dwIndex);
785 if (status != NERR_Success)
786 {
787 ERR("NetUserSetInfo failed. Status: %lu Index: %lu", status, dwIndex);
788 }
789
790 if (pszFullName)
791 HeapFree(GetProcessHeap(), 0, pszFullName);
792
793 if (pszComment)
794 HeapFree(GetProcessHeap(), 0, pszComment);
795
796 NetApiBufferFree(pUserInfo);
797
798 return (status == NERR_Success);
799}
800
801
804 UINT uMsg,
807{
808 PGENERAL_USER_DATA pUserData;
809
812 UNREFERENCED_PARAMETER(hwndDlg);
813
814 pUserData= (PGENERAL_USER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
815
816 switch (uMsg)
817 {
818 case WM_INITDIALOG:
821 sizeof(GENERAL_USER_DATA) +
822 lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR));
823 lstrcpy(pUserData->szUserName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);
824
825 SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData);
826
827 GetUserGeneralData(hwndDlg,
828 pUserData);
829 break;
830
831 case WM_COMMAND:
832 switch (LOWORD(wParam))
833 {
836 if (HIWORD(wParam) == EN_CHANGE)
837 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
838 break;
839
841 pUserData->dwPasswordExpired = !pUserData->dwPasswordExpired;
842 UpdateUserOptions(hwndDlg, pUserData, FALSE);
843 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
844 break;
845
847 pUserData->dwFlags ^= UF_PASSWD_CANT_CHANGE;
848 UpdateUserOptions(hwndDlg, pUserData, FALSE);
849 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
850 break;
851
853 pUserData->dwFlags ^= UF_DONT_EXPIRE_PASSWD;
854 UpdateUserOptions(hwndDlg, pUserData, FALSE);
855 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
856 break;
857
859 pUserData->dwFlags ^= UF_ACCOUNTDISABLE;
860 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
861 break;
862
864 pUserData->dwFlags ^= UF_LOCKOUT;
865 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
866 break;
867 }
868 break;
869
870 case WM_NOTIFY:
871 if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY)
872 {
873 SetUserGeneralData(hwndDlg, pUserData);
874 return TRUE;
875 }
876 break;
877
878 case WM_DESTROY:
879 HeapFree(GetProcessHeap(), 0, pUserData);
880 break;
881 }
882
883 return FALSE;
884}
885
886
887static VOID
889{
890 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
891 psp->dwSize = sizeof(PROPSHEETPAGE);
892 psp->dwFlags = PSP_DEFAULT;
893 psp->hInstance = hApplet;
894 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
895 psp->pfnDlgProc = DlgProc;
896 psp->lParam = (LPARAM)pszUser;
897}
898
899
900BOOL
902{
903 PROPSHEETPAGE psp[3];
904 PROPSHEETHEADER psh;
905 TCHAR szUserName[UNLEN + 1];
906 INT nItem;
907 HWND hwndLV;
908
909 hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST);
910 nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
911 if (nItem == -1)
912 return FALSE;
913
914 /* Get the new user name */
916 nItem, 0,
917 szUserName,
918 UNLEN + 1);
919
920 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
921 psh.dwSize = sizeof(PROPSHEETHEADER);
922 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
923 psh.hwndParent = hwndDlg;
924 psh.hInstance = hApplet;
925 psh.hIcon = NULL;
926 psh.pszCaption = szUserName;
927 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
928 psh.nStartPage = 0;
929 psh.ppsp = psp;
930
934
935 return (PropertySheet(&psh) == IDOK);
936}
#define IDS_DESCRIPTION
Definition: resource.h:4
#define ERR(fmt,...)
Definition: debug.h:110
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define DLGPROC
Definition: maze.c:62
WORD idDlg
Definition: desk.c:110
DLGPROC DlgProc
Definition: desk.c:111
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDD_USER_ADD_MEMBERSHIP
Definition: resource.h:82
#define IDC_USER_PROFILE_LOCAL_PATH
Definition: resource.h:74
#define IDC_USER_PROFILE_DRIVE
Definition: resource.h:75
#define IDC_USER_GENERAL_FULL_NAME
Definition: resource.h:24
#define IDC_USER_MEMBERSHIP_REMOVE
Definition: resource.h:67
#define IDC_USER_PROFILE_REMOTE_PATH
Definition: resource.h:76
#define IDC_USER_GENERAL_CANNOT_CHANGE
Definition: resource.h:27
#define IDC_USER_GENERAL_NAME
Definition: resource.h:23
#define IDC_USER_PROFILE_SCRIPT
Definition: resource.h:71
#define IDC_USER_ADD_MEMBERSHIP_LIST
Definition: resource.h:83
#define IDC_USER_GENERAL_DESCRIPTION
Definition: resource.h:25
#define IDI_GROUP
Definition: resource.h:8
#define IDC_USER_GENERAL_FORCE_CHANGE
Definition: resource.h:26
#define IDD_USER_PROFILE
Definition: resource.h:69
#define IDC_USERS_LIST
Definition: resource.h:14
#define IDC_USER_GENERAL_DISABLED
Definition: resource.h:29
#define IDC_USER_GENERAL_NEVER_EXPIRES
Definition: resource.h:28
#define IDC_USER_PROFILE_REMOTE
Definition: resource.h:73
#define IDS_NAME
Definition: resource.h:90
#define IDD_USER_GENERAL
Definition: resource.h:22
#define IDD_USER_MEMBERSHIP
Definition: resource.h:64
#define IDC_USER_MEMBERSHIP_LIST
Definition: resource.h:65
#define IDC_USER_PROFILE_LOCAL
Definition: resource.h:72
#define IDC_USER_GENERAL_LOCKED
Definition: resource.h:30
#define IDC_USER_MEMBERSHIP_ADD
Definition: resource.h:66
#define IDC_USER_PROFILE_PATH
Definition: resource.h:70
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
NET_API_STATUS WINAPI NetUserGetInfo(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE *bufptr)
Definition: user.c:3147
NET_API_STATUS WINAPI NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level, DWORD flags, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries)
Definition: user.c:3324
NET_API_STATUS WINAPI NetUserSetInfo(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE buf, LPDWORD parm_err)
Definition: user.c:3975
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _tcscmp
Definition: tchar.h:1424
char hdr[14]
Definition: iptest.cpp:33
#define TEXT(s)
Definition: k32.h:26
#define UF_ACCOUNTDISABLE
Definition: lmaccess.h:24
#define UF_DONT_EXPIRE_PASSWD
Definition: lmaccess.h:37
#define UF_PASSWD_CANT_CHANGE
Definition: lmaccess.h:28
#define UF_LOCKOUT
Definition: lmaccess.h:26
#define MAX_PREFERRED_LENGTH
Definition: lmcons.h:48
#define NERR_Success
Definition: lmerr.h:5
NET_API_STATUS WINAPI NetLocalGroupDelMembers(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
Definition: local_group.c:817
NET_API_STATUS WINAPI NetLocalGroupEnum(LPCWSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resumehandle)
Definition: local_group.c:974
NET_API_STATUS WINAPI NetLocalGroupAddMembers(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
Definition: local_group.c:520
static HICON
Definition: imagelist.c:84
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define LOWORD(l)
Definition: pedump.c:82
#define INT
Definition: polytest.cpp:20
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSN_APPLY
Definition: prsht.h:117
#define PropertySheet
Definition: prsht.h:400
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define PROPSHEETPAGE
Definition: prsht.h:389
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVIF_STATE
Definition: commctrl.h:2312
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2684
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define ILC_COLOR32
Definition: commctrl.h:358
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define NM_CLICK
Definition: commctrl.h:130
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define LV_ITEM
Definition: commctrl.h:2337
struct tagNMLISTVIEW * LPNMLISTVIEW
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2691
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVCF_FMT
Definition: commctrl.h:2586
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define ILC_MASK
Definition: commctrl.h:351
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2411
#define LVN_KEYDOWN
Definition: commctrl.h:3184
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LV_COLUMN
Definition: commctrl.h:2547
PVOID pBuffer
#define WM_NOTIFY
Definition: richedit.h:61
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
#define UNLEN
Definition: sspi.c:28
& rect
Definition: startmenu.cpp:1413
DWORD dwPasswordExpired
Definition: userprops.c:15
TCHAR szUserName[1]
Definition: userprops.c:16
PLOCALGROUP_USERS_INFO_0 pGroupData
Definition: userprops.c:28
TCHAR szUserName[1]
Definition: userprops.c:23
LPWSTR usri3_home_dir
Definition: lmaccess.h:243
LPWSTR usri3_script_path
Definition: lmaccess.h:246
LPWSTR usri3_home_dir_drive
Definition: lmaccess.h:266
LPWSTR usri3_comment
Definition: lmaccess.h:244
DWORD usri3_flags
Definition: lmaccess.h:245
DWORD usri3_password_expired
Definition: lmaccess.h:267
LPWSTR usri3_full_name
Definition: lmaccess.h:248
LPWSTR usri3_profile
Definition: lmaccess.h:265
Definition: ps.c:97
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
static VOID InitUserPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPTSTR pszUser)
Definition: userprops.c:888
static VOID InitUserGroupsList(HWND hwndDlg)
Definition: userprops.c:363
static BOOL OnUserPropSheetNotify(HWND hwndDlg, PMEMBERSHIP_USER_DATA pUserData, LPARAM lParam)
Definition: userprops.c:589
static BOOL SetUserGeneralData(HWND hwndDlg, PGENERAL_USER_DATA pUserData)
Definition: userprops.c:742
static VOID UpdateUserOptions(HWND hwndDlg, PGENERAL_USER_DATA pUserData, BOOL bInit)
Definition: userprops.c:685
struct _MEMBERSHIP_USER_DATA * PMEMBERSHIP_USER_DATA
INT_PTR CALLBACK UserMembershipPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprops.c:620
static VOID GetUserGeneralData(HWND hwndDlg, PGENERAL_USER_DATA pUserData)
Definition: userprops.c:720
static VOID AddGroupToUser(HWND hwndDlg, PMEMBERSHIP_USER_DATA pUserData)
Definition: userprops.c:543
INT_PTR CALLBACK UserProfilePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprops.c:192
static VOID RemoveGroupFromUser(HWND hwndDlg, PMEMBERSHIP_USER_DATA pUserData)
Definition: userprops.c:316
static VOID GetUserMembershipData(HWND hwndDlg, PMEMBERSHIP_USER_DATA pUserData)
Definition: userprops.c:261
INT_PTR CALLBACK AddGroupToUserDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprops.c:499
BOOL UserProperties(HWND hwndDlg)
Definition: userprops.c:901
struct _PROFILE_USER_DATA PROFILE_USER_DATA
#define VALID_GENERAL_FLAGS
Definition: userprops.c:19
struct _GENERAL_USER_DATA * PGENERAL_USER_DATA
INT_PTR CALLBACK UserGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprops.c:803
static BOOL AddSelectedGroupsToUser(HWND hwndDlg, PMEMBERSHIP_USER_DATA pUserData)
Definition: userprops.c:439
struct _PROFILE_USER_DATA * PPROFILE_USER_DATA
static VOID GetUserProfileData(HWND hwndDlg, PPROFILE_USER_DATA pUserData)
Definition: userprops.c:35
static BOOL SetUserProfileData(HWND hwndDlg, PPROFILE_USER_DATA pUserData)
Definition: userprops.c:86
struct _GENERAL_USER_DATA GENERAL_USER_DATA
struct _MEMBERSHIP_USER_DATA MEMBERSHIP_USER_DATA
#define dbgstrx(x)
Definition: usrmgr.h:12
#define _T(x)
Definition: vfdio.h:22
#define ZeroMemory
Definition: winbase.h:1670
#define lstrcpy
Definition: winbase.h:3745
#define lstrlen
Definition: winbase.h:3747
_In_ DWORD nLength
Definition: wincon.h:473
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define CB_GETLBTEXTLEN
Definition: winuser.h:1943
#define DWLP_USER
Definition: winuser.h:866
#define CB_GETLBTEXT
Definition: winuser.h:1942
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:825
#define BST_UNCHECKED
Definition: winuser.h:199
#define IMAGE_ICON
Definition: winuser.h:212
#define GetWindowTextLength
Definition: winuser.h:5789
#define GetDlgItemText
Definition: winuser.h:5775
#define WM_COMMAND
Definition: winuser.h:1730
#define CB_ERR
Definition: winuser.h:2425
#define CB_SETCURSEL
Definition: winuser.h:1951
#define DialogBoxParam
Definition: winuser.h:5754
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1930
#define WM_INITDIALOG
Definition: winuser.h:1729
#define MB_YESNO
Definition: winuser.h:811
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:824
#define MB_ICONERROR
Definition: winuser.h:781
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDNO
Definition: winuser.h:830
#define SendMessage
Definition: winuser.h:5833
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MB_OK
Definition: winuser.h:784
#define wsprintf
Definition: winuser.h:5855
#define MB_ICONWARNING
Definition: winuser.h:780
HWND WINAPI GetParent(_In_ HWND)
#define LoadImage
Definition: winuser.h:5805
#define LoadString
Definition: winuser.h:5809
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define MessageBox
Definition: winuser.h:5812
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define VK_DELETE
Definition: winuser.h:2223
#define WM_DESTROY
Definition: winuser.h:1599
#define CB_INSERTSTRING
Definition: winuser.h:1947
#define CB_GETCURSEL
Definition: winuser.h:1933
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define SetDlgItemText
Definition: winuser.h:5839
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define EN_CHANGE
Definition: winuser.h:2012
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcslen
Definition: xmlstorage.h:198