Author: ekohl Date: Sun Jun 1 10:05:22 2008 New Revision: 33808
URL: http://svn.reactos.org/svn/reactos?rev=33808&view=rev Log: Add the Membership and Profile pages to the users property sheet. Changing the settings is not implemented yet.
Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc trunk/reactos/dll/cpl/usrmgr/resource.h trunk/reactos/dll/cpl/usrmgr/userprops.c
Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/lang/en-US.r... ============================================================================== --- trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] Sun Jun 1 10:05:22 2008 @@ -51,6 +51,38 @@ AUTOCHECKBOX "Password never expires",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 AUTOCHECKBOX "Account is disabled",IDC_USER_GENERAL_DISABLED,7,121,210,10 AUTOCHECKBOX "Account is locked",IDC_USER_GENERAL_LOCKED,7,134,210,10,WS_DISABLED +END + + +IDD_USER_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Membership" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Member of:", -1, 7, 7, 56, 8 + CONTROL "", IDC_USER_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, + 7, 18, 238, 173, WS_EX_CLIENTEDGE +END + + +IDD_USER_PROFILE DIALOGEX DISCARDABLE 0, 0, 252, 223 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Profile" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "User profile", -1, 7, 7, 238, 54 + LTEXT "Profile path:", -1, 16, 22, 55, 8 + EDITTEXT IDC_USER_PROFILE_PATH, 78, 19, 160, 13, ES_AUTOHSCROLL + LTEXT "Logon script:", -1, 16, 40, 55, 8 + EDITTEXT IDC_USER_PROFILE_SCRIPT, 78, 37, 160, 13, ES_AUTOHSCROLL + + GROUPBOX "Home directory", -1, 7, 68, 238, 54 + AUTORADIOBUTTON "Local path:", IDC_USER_PROFILE_LOCAL, 16, 83, 60, 10 + AUTORADIOBUTTON "Connect:", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 + EDITTEXT IDC_USER_PROFILE_LOCAL_PATH, 78, 81, 160, 13, ES_AUTOHSCROLL + COMBOBOX IDC_USER_PROFILE_DRIVE, 78, 99, 26, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL + LTEXT "to:", -1, 112, 101, 12, 8 + EDITTEXT IDC_USER_PROFILE_REMOTE_PATH, 130, 99, 108, 13, ES_AUTOHSCROLL END
Modified: trunk/reactos/dll/cpl/usrmgr/resource.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resource.h?r... ============================================================================== --- trunk/reactos/dll/cpl/usrmgr/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/resource.h [iso-8859-1] Sun Jun 1 10:05:22 2008 @@ -67,10 +67,21 @@ #define IDC_USER_NEW_NEVER_EXPIRES 368 #define IDC_USER_NEW_DISABLED 369
+#define IDD_USER_MEMBERSHIP 370 +#define IDC_USER_MEMBERSHIP_LIST 371
-#define IDD_GROUP_NEW 370 -#define IDC_GROUP_NEW_NAME 371 -#define IDC_GROUP_NEW_DESCRIPTION 372 +#define IDD_USER_PROFILE 380 +#define IDC_USER_PROFILE_PATH 381 +#define IDC_USER_PROFILE_SCRIPT 382 +#define IDC_USER_PROFILE_LOCAL 383 +#define IDC_USER_PROFILE_REMOTE 384 +#define IDC_USER_PROFILE_LOCAL_PATH 385 +#define IDC_USER_PROFILE_DRIVE 386 +#define IDC_USER_PROFILE_REMOTE_PATH 387 + +#define IDD_GROUP_NEW 390 +#define IDC_GROUP_NEW_NAME 391 +#define IDC_GROUP_NEW_DESCRIPTION 392
/* Strings */
Modified: trunk/reactos/dll/cpl/usrmgr/userprops.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/userprops.c?... ============================================================================== --- trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/userprops.c [iso-8859-1] Sun Jun 1 10:05:22 2008 @@ -1,13 +1,189 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS User Manager Control Panel - * FILE: dll/cpl/usrmgr/users.c + * FILE: dll/cpl/usrmgr/userprops.c * PURPOSE: User property sheet * * PROGRAMMERS: Eric Kohl */
#include "usrmgr.h" + + +static VOID +GetProfileData(HWND hwndDlg, LPTSTR lpUserName) +{ + PUSER_INFO_3 userInfo = NULL; + NET_API_STATUS status; + BOOL bLocal; + TCHAR szDrive[8]; + INT i; + INT nSel; + + status = NetUserGetInfo(NULL, lpUserName, 3, (LPBYTE*)&userInfo); + if (status != NERR_Success) + return; + + SetDlgItemText(hwndDlg, IDC_USER_PROFILE_PATH, userInfo->usri3_profile); + SetDlgItemText(hwndDlg, IDC_USER_PROFILE_SCRIPT, userInfo->usri3_script_path); + + + bLocal = (userInfo->usri3_home_dir_drive == NULL) || + (_tcslen(userInfo->usri3_home_dir_drive) == 0); + CheckRadioButton(hwndDlg, IDC_USER_PROFILE_LOCAL, IDC_USER_PROFILE_REMOTE, + bLocal ? IDC_USER_PROFILE_LOCAL : IDC_USER_PROFILE_REMOTE); + + for (i = 0; i < 26; i++) + { + wsprintf(szDrive, _T("%c:"), (TCHAR)('A' + i)); + nSel = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), + CB_INSERTSTRING, -1, (LPARAM)szDrive); + } + + if (bLocal) + { + SetDlgItemText(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH, userInfo->usri3_home_dir); + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH), FALSE); + } + else + { + SetDlgItemText(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH, userInfo->usri3_home_dir); + nSel = SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), + CB_FINDSTRINGEXACT, -1, (LPARAM)userInfo->usri3_home_dir_drive); + } + + SendMessage(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), + CB_SETCURSEL, nSel, 0); + + NetApiBufferFree(userInfo); +} + + +INT_PTR CALLBACK +UserProfilePageProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + + UNREFERENCED_PARAMETER(lParam); + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(hwndDlg); + + switch (uMsg) + { + case WM_INITDIALOG: + GetProfileData(hwndDlg, + (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_USER_PROFILE_LOCAL: + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH), FALSE); + break; + + case IDC_USER_PROFILE_REMOTE: + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_LOCAL_PATH), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_DRIVE), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USER_PROFILE_REMOTE_PATH), TRUE); + break; + } + break; + } + + return FALSE; +} + + +static VOID +GetMembershipData(HWND hwndDlg, LPTSTR lpUserName) +{ + PLOCALGROUP_USERS_INFO_0 usersInfo = NULL; + NET_API_STATUS status; + DWORD dwRead; + DWORD dwTotal; + DWORD i; + HIMAGELIST hImgList; + HICON hIcon; + LV_ITEM lvi; + HWND hwndLV; + LV_COLUMN column; + RECT rect; + + + hwndLV = GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_LIST); + + /* Create the image list */ + hImgList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 5, 5); + hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_GROUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgList, hIcon); + DestroyIcon(hIcon); + (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL); + + /* Set the list column */ + GetClientRect(hwndLV, &rect); + + memset(&column, 0x00, sizeof(column)); + column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; + column.fmt = LVCFMT_LEFT; + column.cx = (INT)(rect.right - rect.left); + column.iSubItem = 0; + (void)ListView_InsertColumn(hwndLV, 0, &column); + + + status = NetUserGetLocalGroups(NULL, lpUserName, 0, 0, + (LPBYTE*)&usersInfo, + MAX_PREFERRED_LENGTH, + &dwRead, + &dwTotal); + if (status != NERR_Success) + return; + + for (i = 0; i < dwRead; i++) + { + ZeroMemory(&lvi, sizeof(lvi)); + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = usersInfo[i].lgrui0_name; + lvi.state = 0; + lvi.iImage = 0; + + (void)ListView_InsertItem(hwndLV, &lvi); + } + + + NetApiBufferFree(usersInfo); + +} + + +INT_PTR CALLBACK +UserMembershipPageProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + + UNREFERENCED_PARAMETER(lParam); + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(hwndDlg); + + switch (uMsg) + { + case WM_INITDIALOG: + GetMembershipData(hwndDlg, + (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam); + break; + + } + + return FALSE; +} +
static VOID UpdateUserOptions(HWND hwndDlg, @@ -131,7 +307,7 @@ VOID UserProperties(HWND hwndDlg) { - PROPSHEETPAGE psp[1]; + PROPSHEETPAGE psp[3]; PROPSHEETHEADER psh; TCHAR szUserName[UNLEN]; INT nItem; @@ -160,8 +336,8 @@ psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_USER_GENERAL, (DLGPROC)UserGeneralPageProc, szUserName); -// InitPropSheetPage(&psp[1], IDD_USER_MEMBERSHIP, (DLGPROC)UserMembershipPageProc); -// InitPropSheetPage(&psp[2], IDD_USER_PROFILE, (DLGPROC)UserProfilePageProc); + InitPropSheetPage(&psp[1], IDD_USER_MEMBERSHIP, (DLGPROC)UserMembershipPageProc, szUserName); + InitPropSheetPage(&psp[2], IDD_USER_PROFILE, (DLGPROC)UserProfilePageProc, szUserName);
PropertySheet(&psh); }