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
7 * PROGRAMMERS: Eric Kohl
12 typedef struct _GENERAL_USER_DATA
15 DWORD dwPasswordExpired
;
17 } GENERAL_USER_DATA
, *PGENERAL_USER_DATA
;
19 #define VALID_GENERAL_FLAGS (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD | UF_ACCOUNTDISABLE | UF_LOCKOUT)
21 typedef struct _PROFILE_USER_DATA
24 } PROFILE_USER_DATA
, *PPROFILE_USER_DATA
;
26 typedef struct _MEMBERSHIP_USER_DATA
28 PLOCALGROUP_USERS_INFO_0 pGroupData
;
31 } MEMBERSHIP_USER_DATA
, *PMEMBERSHIP_USER_DATA
;
35 GetUserProfileData(HWND hwndDlg
,
36 PPROFILE_USER_DATA pUserData
)
38 PUSER_INFO_3 userInfo
= NULL
;
39 NET_API_STATUS status
;
45 status
= NetUserGetInfo(NULL
, pUserData
->szUserName
, 3, (LPBYTE
*)&userInfo
);
46 if (status
!= NERR_Success
)
49 SetDlgItemText(hwndDlg
, IDC_USER_PROFILE_PATH
, userInfo
->usri3_profile
);
50 SetDlgItemText(hwndDlg
, IDC_USER_PROFILE_SCRIPT
, userInfo
->usri3_script_path
);
53 bLocal
= (userInfo
->usri3_home_dir_drive
== NULL
) ||
54 (_tcslen(userInfo
->usri3_home_dir_drive
) == 0);
55 CheckRadioButton(hwndDlg
, IDC_USER_PROFILE_LOCAL
, IDC_USER_PROFILE_REMOTE
,
56 bLocal
? IDC_USER_PROFILE_LOCAL
: IDC_USER_PROFILE_REMOTE
);
58 for (i
= 0; i
< 26; i
++)
60 wsprintf(szDrive
, _T("%c:"), (TCHAR
)('A' + i
));
61 nSel
= SendMessage(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
),
62 CB_INSERTSTRING
, -1, (LPARAM
)szDrive
);
67 SetDlgItemText(hwndDlg
, IDC_USER_PROFILE_LOCAL_PATH
, userInfo
->usri3_home_dir
);
68 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
), FALSE
);
69 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_REMOTE_PATH
), FALSE
);
73 SetDlgItemText(hwndDlg
, IDC_USER_PROFILE_REMOTE_PATH
, userInfo
->usri3_home_dir
);
74 nSel
= SendMessage(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
),
75 CB_FINDSTRINGEXACT
, -1, (LPARAM
)userInfo
->usri3_home_dir_drive
);
78 SendMessage(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
),
79 CB_SETCURSEL
, nSel
, 0);
81 NetApiBufferFree(userInfo
);
86 SetUserProfileData(HWND hwndDlg
,
87 PPROFILE_USER_DATA pUserData
)
89 PUSER_INFO_3 pUserInfo
= NULL
;
90 LPTSTR pszProfilePath
= NULL
;
91 LPTSTR pszScriptPath
= NULL
;
92 LPTSTR pszHomeDir
= NULL
;
93 LPTSTR pszHomeDrive
= NULL
;
94 NET_API_STATUS status
;
101 NetUserGetInfo(NULL
, pUserData
->szUserName
, 3, (LPBYTE
*)&pUserInfo
);
103 /* Get the profile path */
104 nLength
= GetWindowTextLength(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_PATH
));
107 pUserInfo
->usri3_profile
= NULL
;
111 pszProfilePath
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
112 GetDlgItemText(hwndDlg
, IDC_USER_PROFILE_PATH
, pszProfilePath
, nLength
+ 1);
113 pUserInfo
->usri3_profile
= pszProfilePath
;
116 /* Get the script path */
117 nLength
= GetWindowTextLength(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_SCRIPT
));
120 pUserInfo
->usri3_script_path
= NULL
;
124 pszScriptPath
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
125 GetDlgItemText(hwndDlg
, IDC_USER_PROFILE_SCRIPT
, pszScriptPath
, nLength
+ 1);
126 pUserInfo
->usri3_script_path
= pszScriptPath
;
129 if (IsDlgButtonChecked(hwndDlg
, IDC_USER_PROFILE_LOCAL
) == BST_CHECKED
)
131 /* Local home directory */
132 nLength
= GetWindowTextLength(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_LOCAL_PATH
));
135 pUserInfo
->usri3_home_dir
= NULL
;
139 pszHomeDir
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
140 GetDlgItemText(hwndDlg
, IDC_USER_PROFILE_LOCAL_PATH
, pszHomeDir
, nLength
+ 1);
141 pUserInfo
->usri3_home_dir
= pszHomeDir
;
146 /* Remote home directory */
147 nLength
= GetWindowTextLength(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_REMOTE_PATH
));
150 pUserInfo
->usri3_home_dir
= NULL
;
154 pszHomeDir
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
155 GetDlgItemText(hwndDlg
, IDC_USER_PROFILE_REMOTE_PATH
, pszHomeDir
, nLength
+ 1);
156 pUserInfo
->usri3_home_dir
= pszHomeDir
;
159 nIndex
= SendMessage(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
), CB_GETCURSEL
, 0, 0);
160 if (nIndex
!= CB_ERR
)
162 nLength
= SendMessage(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
), CB_GETLBTEXTLEN
, nIndex
, 0);
163 pszHomeDrive
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
164 SendMessage(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
), CB_GETLBTEXT
, nIndex
, (LPARAM
)pszHomeDrive
);
165 pUserInfo
->usri3_home_dir_drive
= pszHomeDrive
;
170 status
= NetUserSetInfo(NULL
, pUserData
->szUserName
, 3, (LPBYTE
)pUserInfo
, &dwIndex
);
171 if (status
!= NERR_Success
)
173 DebugPrintf(_T("Status: %lu Index: %lu"), status
, dwIndex
);
176 status
= NERR_Success
;
180 HeapFree(GetProcessHeap(), 0, pszProfilePath
);
183 HeapFree(GetProcessHeap(), 0, pszScriptPath
);
186 HeapFree(GetProcessHeap(), 0, pszHomeDir
);
189 HeapFree(GetProcessHeap(), 0, pszHomeDrive
);
191 NetApiBufferFree(pUserInfo
);
193 return (status
== NERR_Success
);
198 UserProfilePageProc(HWND hwndDlg
,
203 PPROFILE_USER_DATA pUserData
;
205 UNREFERENCED_PARAMETER(lParam
);
206 UNREFERENCED_PARAMETER(wParam
);
207 UNREFERENCED_PARAMETER(hwndDlg
);
209 pUserData
= (PPROFILE_USER_DATA
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
214 pUserData
= (PPROFILE_USER_DATA
)HeapAlloc(GetProcessHeap(),
216 sizeof(PROFILE_USER_DATA
) +
217 lstrlen((LPTSTR
)((PROPSHEETPAGE
*)lParam
)->lParam
) * sizeof(TCHAR
));
218 lstrcpy(pUserData
->szUserName
, (LPTSTR
)((PROPSHEETPAGE
*)lParam
)->lParam
);
220 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (INT_PTR
)pUserData
);
222 GetUserProfileData(hwndDlg
,
227 switch (LOWORD(wParam
))
229 case IDC_USER_PROFILE_PATH
:
230 case IDC_USER_PROFILE_SCRIPT
:
231 if (HIWORD(wParam
) == EN_CHANGE
)
232 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
235 case IDC_USER_PROFILE_LOCAL
:
236 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_LOCAL_PATH
), TRUE
);
237 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
), FALSE
);
238 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_REMOTE_PATH
), FALSE
);
241 case IDC_USER_PROFILE_REMOTE
:
242 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_LOCAL_PATH
), FALSE
);
243 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_DRIVE
), TRUE
);
244 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_PROFILE_REMOTE_PATH
), TRUE
);
250 HeapFree(GetProcessHeap(), 0, pUserData
);
254 if (((LPPSHNOTIFY
)lParam
)->hdr
.code
== PSN_APPLY
)
256 SetUserProfileData(hwndDlg
, pUserData
);
267 GetUserMembershipData(HWND hwndDlg
, PMEMBERSHIP_USER_DATA pUserData
)
269 NET_API_STATUS status
;
280 hwndLV
= GetDlgItem(hwndDlg
, IDC_USER_MEMBERSHIP_LIST
);
282 /* Create the image list */
283 hImgList
= ImageList_Create(16, 16, ILC_COLOR8
| ILC_MASK
, 5, 5);
284 hIcon
= LoadImage(hApplet
, MAKEINTRESOURCE(IDI_GROUP
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
285 ImageList_AddIcon(hImgList
, hIcon
);
287 (void)ListView_SetImageList(hwndLV
, hImgList
, LVSIL_SMALL
);
289 /* Set the list column */
290 GetClientRect(hwndLV
, &rect
);
292 memset(&column
, 0x00, sizeof(column
));
293 column
.mask
= LVCF_FMT
| LVCF_WIDTH
| LVCF_SUBITEM
;
294 column
.fmt
= LVCFMT_LEFT
;
295 column
.cx
= (INT
)(rect
.right
- rect
.left
);
297 (void)ListView_InsertColumn(hwndLV
, 0, &column
);
300 status
= NetUserGetLocalGroups(NULL
, pUserData
->szUserName
, 0, 0,
301 (LPBYTE
*)&pUserData
->pGroupData
,
302 MAX_PREFERRED_LENGTH
,
303 &pUserData
->dwGroupCount
,
305 if (status
!= NERR_Success
)
308 for (i
= 0; i
< pUserData
->dwGroupCount
; i
++)
310 ZeroMemory(&lvi
, sizeof(lvi
));
311 lvi
.mask
= LVIF_TEXT
| LVIF_STATE
| LVIF_IMAGE
;
312 lvi
.pszText
= pUserData
->pGroupData
[i
].lgrui0_name
;
316 (void)ListView_InsertItem(hwndLV
, &lvi
);
322 RemoveGroupFromUser(HWND hwndDlg
,
323 PMEMBERSHIP_USER_DATA pUserData
)
325 TCHAR szGroupName
[UNLEN
];
327 LOCALGROUP_MEMBERS_INFO_3 memberInfo
;
330 NET_API_STATUS status
;
332 hwndLV
= GetDlgItem(hwndDlg
, IDC_USER_MEMBERSHIP_LIST
);
333 nItem
= ListView_GetNextItem(hwndLV
, -1, LVNI_SELECTED
);
337 /* Get the new user name */
338 ListView_GetItemText(hwndLV
,
343 /* Display a warning message because the remove operation cannot be reverted */
344 wsprintf(szText
, TEXT("Do you really want to remove the user \"%s\" from the group \"%s\"?"),
345 pUserData
->szUserName
, szGroupName
);
346 if (MessageBox(NULL
, szText
, TEXT("User Accounts"), MB_ICONWARNING
| MB_YESNO
) == IDNO
)
349 memberInfo
.lgrmi3_domainandname
= pUserData
->szUserName
;
351 status
= NetLocalGroupDelMembers(NULL
, szGroupName
,
352 3, (LPBYTE
)&memberInfo
, 1);
353 if (status
!= NERR_Success
)
356 wsprintf(szText
, TEXT("Error: %u"), status
);
357 MessageBox(NULL
, szText
, TEXT("NetLocalGroupDelMembers"), MB_ICONERROR
| MB_OK
);
361 (void)ListView_DeleteItem(hwndLV
, nItem
);
363 if (ListView_GetItemCount(hwndLV
) == 0)
364 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_MEMBERSHIP_REMOVE
), FALSE
);
369 OnNotify(HWND hwndDlg
,
370 PMEMBERSHIP_USER_DATA pUserData
,
373 LPNMLISTVIEW lpnmlv
= (LPNMLISTVIEW
)lParam
;
375 switch (((LPNMHDR
)lParam
)->idFrom
)
377 case IDC_USER_MEMBERSHIP_LIST
:
378 switch (((LPNMHDR
)lParam
)->code
)
381 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_MEMBERSHIP_REMOVE
), (lpnmlv
->iItem
!= -1));
385 if (((LPNMLVKEYDOWN
)lParam
)->wVKey
== VK_DELETE
)
387 RemoveGroupFromUser(hwndDlg
, pUserData
);
400 UserMembershipPageProc(HWND hwndDlg
,
405 PMEMBERSHIP_USER_DATA pUserData
;
407 UNREFERENCED_PARAMETER(lParam
);
408 UNREFERENCED_PARAMETER(wParam
);
409 UNREFERENCED_PARAMETER(hwndDlg
);
411 pUserData
= (PMEMBERSHIP_USER_DATA
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
416 pUserData
= (PMEMBERSHIP_USER_DATA
)HeapAlloc(GetProcessHeap(),
418 sizeof(MEMBERSHIP_USER_DATA
) +
419 lstrlen((LPTSTR
)((PROPSHEETPAGE
*)lParam
)->lParam
) * sizeof(TCHAR
));
420 lstrcpy(pUserData
->szUserName
, (LPTSTR
)((PROPSHEETPAGE
*)lParam
)->lParam
);
422 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (INT_PTR
)pUserData
);
424 GetUserMembershipData(hwndDlg
, pUserData
);
428 switch (LOWORD(wParam
))
430 case IDC_USER_MEMBERSHIP_REMOVE
:
431 RemoveGroupFromUser(hwndDlg
, pUserData
);
437 if (((LPPSHNOTIFY
)lParam
)->hdr
.code
== PSN_APPLY
)
443 return OnNotify(hwndDlg
, pUserData
, lParam
);
449 if (pUserData
->pGroupData
)
450 NetApiBufferFree(pUserData
->pGroupData
);
452 HeapFree(GetProcessHeap(), 0, pUserData
);
461 UpdateUserOptions(HWND hwndDlg
,
462 PGENERAL_USER_DATA pUserData
,
465 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_GENERAL_CANNOT_CHANGE
),
466 !pUserData
->dwPasswordExpired
);
467 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_GENERAL_NEVER_EXPIRES
),
468 !pUserData
->dwPasswordExpired
);
469 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_GENERAL_FORCE_CHANGE
),
470 (pUserData
->dwFlags
& (UF_PASSWD_CANT_CHANGE
| UF_DONT_EXPIRE_PASSWD
)) == 0);
472 EnableWindow(GetDlgItem(hwndDlg
, IDC_USER_GENERAL_LOCKED
),
473 (pUserData
->dwFlags
& UF_LOCKOUT
) != 0);
477 CheckDlgButton(hwndDlg
, IDC_USER_GENERAL_FORCE_CHANGE
,
478 pUserData
->dwPasswordExpired
? BST_CHECKED
: BST_UNCHECKED
);
480 CheckDlgButton(hwndDlg
, IDC_USER_GENERAL_CANNOT_CHANGE
,
481 (pUserData
->dwFlags
& UF_PASSWD_CANT_CHANGE
) ? BST_CHECKED
: BST_UNCHECKED
);
483 CheckDlgButton(hwndDlg
, IDC_USER_GENERAL_NEVER_EXPIRES
,
484 (pUserData
->dwFlags
& UF_DONT_EXPIRE_PASSWD
) ? BST_CHECKED
: BST_UNCHECKED
);
486 CheckDlgButton(hwndDlg
, IDC_USER_GENERAL_DISABLED
,
487 (pUserData
->dwFlags
& UF_ACCOUNTDISABLE
) ? BST_CHECKED
: BST_UNCHECKED
);
489 CheckDlgButton(hwndDlg
, IDC_USER_GENERAL_LOCKED
,
490 (pUserData
->dwFlags
& UF_LOCKOUT
) ? BST_CHECKED
: BST_UNCHECKED
);
496 GetUserGeneralData(HWND hwndDlg
,
497 PGENERAL_USER_DATA pUserData
)
499 PUSER_INFO_3 pUserInfo
= NULL
;
501 SetDlgItemText(hwndDlg
, IDC_USER_GENERAL_NAME
, pUserData
->szUserName
);
503 NetUserGetInfo(NULL
, pUserData
->szUserName
, 3, (LPBYTE
*)&pUserInfo
);
505 SetDlgItemText(hwndDlg
, IDC_USER_GENERAL_FULL_NAME
, pUserInfo
->usri3_full_name
);
506 SetDlgItemText(hwndDlg
, IDC_USER_GENERAL_DESCRIPTION
, pUserInfo
->usri3_comment
);
508 pUserData
->dwFlags
= pUserInfo
->usri3_flags
;
509 pUserData
->dwPasswordExpired
= pUserInfo
->usri3_password_expired
;
511 NetApiBufferFree(pUserInfo
);
513 UpdateUserOptions(hwndDlg
, pUserData
, TRUE
);
518 SetUserGeneralData(HWND hwndDlg
,
519 PGENERAL_USER_DATA pUserData
)
521 PUSER_INFO_3 pUserInfo
= NULL
;
522 LPTSTR pszFullName
= NULL
;
523 LPTSTR pszComment
= NULL
;
524 NET_API_STATUS status
;
530 NetUserGetInfo(NULL
, pUserData
->szUserName
, 3, (LPBYTE
*)&pUserInfo
);
532 pUserInfo
->usri3_flags
=
533 (pUserData
->dwFlags
& VALID_GENERAL_FLAGS
) |
534 (pUserInfo
->usri3_flags
& ~VALID_GENERAL_FLAGS
);
536 pUserInfo
->usri3_password_expired
= pUserData
->dwPasswordExpired
;
538 nLength
= GetWindowTextLength(GetDlgItem(hwndDlg
, IDC_USER_GENERAL_FULL_NAME
));
541 pUserInfo
->usri3_full_name
= NULL
;
545 pszFullName
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
546 GetDlgItemText(hwndDlg
, IDC_USER_GENERAL_FULL_NAME
, pszFullName
, nLength
+ 1);
547 pUserInfo
->usri3_full_name
= pszFullName
;
550 nLength
= GetWindowTextLength(GetDlgItem(hwndDlg
, IDC_USER_GENERAL_DESCRIPTION
));
553 pUserInfo
->usri3_full_name
= NULL
;
557 pszComment
= HeapAlloc(GetProcessHeap(), 0, (nLength
+ 1) * sizeof(TCHAR
));
558 GetDlgItemText(hwndDlg
, IDC_USER_GENERAL_DESCRIPTION
, pszComment
, nLength
+ 1);
559 pUserInfo
->usri3_comment
= pszComment
;
563 status
= NetUserSetInfo(NULL
, pUserData
->szUserName
, 3, (LPBYTE
)pUserInfo
, &dwIndex
);
564 if (status
!= NERR_Success
)
566 DebugPrintf(_T("Status: %lu Index: %lu"), status
, dwIndex
);
569 status
= NERR_Success
;
573 HeapFree(GetProcessHeap(), 0, pszFullName
);
576 HeapFree(GetProcessHeap(), 0, pszComment
);
578 NetApiBufferFree(pUserInfo
);
580 return (status
== NERR_Success
);
585 UserGeneralPageProc(HWND hwndDlg
,
590 PGENERAL_USER_DATA pUserData
;
592 UNREFERENCED_PARAMETER(lParam
);
593 UNREFERENCED_PARAMETER(wParam
);
594 UNREFERENCED_PARAMETER(hwndDlg
);
596 pUserData
= (PGENERAL_USER_DATA
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
601 pUserData
= (PGENERAL_USER_DATA
)HeapAlloc(GetProcessHeap(),
603 sizeof(GENERAL_USER_DATA
) +
604 lstrlen((LPTSTR
)((PROPSHEETPAGE
*)lParam
)->lParam
) * sizeof(TCHAR
));
605 lstrcpy(pUserData
->szUserName
, (LPTSTR
)((PROPSHEETPAGE
*)lParam
)->lParam
);
607 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (INT_PTR
)pUserData
);
609 GetUserGeneralData(hwndDlg
,
614 switch (LOWORD(wParam
))
616 case IDC_USER_GENERAL_FULL_NAME
:
617 case IDC_USER_GENERAL_DESCRIPTION
:
618 if (HIWORD(wParam
) == EN_CHANGE
)
619 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
622 case IDC_USER_GENERAL_FORCE_CHANGE
:
623 pUserData
->dwPasswordExpired
= !pUserData
->dwPasswordExpired
;
624 UpdateUserOptions(hwndDlg
, pUserData
, FALSE
);
625 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
628 case IDC_USER_GENERAL_CANNOT_CHANGE
:
629 pUserData
->dwFlags
^= UF_PASSWD_CANT_CHANGE
;
630 UpdateUserOptions(hwndDlg
, pUserData
, FALSE
);
631 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
634 case IDC_USER_GENERAL_NEVER_EXPIRES
:
635 pUserData
->dwFlags
^= UF_DONT_EXPIRE_PASSWD
;
636 UpdateUserOptions(hwndDlg
, pUserData
, FALSE
);
637 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
640 case IDC_USER_GENERAL_DISABLED
:
641 pUserData
->dwFlags
^= UF_ACCOUNTDISABLE
;
642 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
645 case IDC_USER_GENERAL_LOCKED
:
646 pUserData
->dwFlags
^= UF_LOCKOUT
;
647 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
653 if (((LPPSHNOTIFY
)lParam
)->hdr
.code
== PSN_APPLY
)
655 SetUserGeneralData(hwndDlg
, pUserData
);
661 HeapFree(GetProcessHeap(), 0, pUserData
);
670 InitPropSheetPage(PROPSHEETPAGE
*psp
, WORD idDlg
, DLGPROC DlgProc
, LPTSTR pszUser
)
672 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
673 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
674 psp
->dwFlags
= PSP_DEFAULT
;
675 psp
->hInstance
= hApplet
;
676 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
677 psp
->pfnDlgProc
= DlgProc
;
678 psp
->lParam
= (LPARAM
)pszUser
;
683 UserProperties(HWND hwndDlg
)
685 PROPSHEETPAGE psp
[3];
687 TCHAR szUserName
[UNLEN
];
691 hwndLV
= GetDlgItem(hwndDlg
, IDC_USERS_LIST
);
692 nItem
= ListView_GetNextItem(hwndLV
, -1, LVNI_SELECTED
);
696 /* Get the new user name */
697 ListView_GetItemText(hwndLV
,
702 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
703 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
704 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
705 psh
.hwndParent
= hwndDlg
;
706 psh
.hInstance
= hApplet
;
708 psh
.pszCaption
= szUserName
;
709 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
713 InitPropSheetPage(&psp
[0], IDD_USER_GENERAL
, (DLGPROC
)UserGeneralPageProc
, szUserName
);
714 InitPropSheetPage(&psp
[1], IDD_USER_MEMBERSHIP
, (DLGPROC
)UserMembershipPageProc
, szUserName
);
715 InitPropSheetPage(&psp
[2], IDD_USER_PROFILE
, (DLGPROC
)UserProfilePageProc
, szUserName
);
717 return (PropertySheet(&psh
) == IDOK
);