Add the general user properties page. Settings are visible but cannot be changed yet.

svn path=/trunk/; revision=33696
This commit is contained in:
Eric Kohl 2008-05-25 11:50:56 +00:00
parent e1ae479d5a
commit d53c67dc50
6 changed files with 1006 additions and 821 deletions

View file

@ -41,8 +41,16 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "General"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", IDC_USER_NAME, 7, 7, 112, 8
LTEXT "", IDC_USER_GENERAL_NAME, 7, 7, 112, 8
LTEXT "Full name:", -1, 7, 46, 63, 8
EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL
LTEXT "Description:", -1, 7, 64, 63, 8
EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL
AUTOCHECKBOX "User must change the password upon first logon",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10
AUTOCHECKBOX "User cannot change the password",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10
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
@ -131,7 +139,7 @@ BEGIN
MENUITEM "Delete", IDM_USER_DELETE
MENUITEM "Rename", IDM_USER_RENAME
MENUITEM SEPARATOR
MENUITEM "Properties", IDM_USER_PROPERTIES, GRAYED
MENUITEM "Properties", IDM_USER_PROPERTIES
END
END

View file

@ -1,98 +1,98 @@
#ifndef __CPL_USRMGR_RESOURCE_H__
#define __CPL_USRMGR_RESOURCE_H__
#include <commctrl.h>
/* metrics */
#define PROPSHEETWIDTH 246
#define PROPSHEETHEIGHT 228
#define PROPSHEETPADDING 6
#define SYSTEM_COLUMN (18 * PROPSHEETPADDING)
#define LABELLINE(x) (((PROPSHEETPADDING + 2) * x) + (x + 2))
#define ICONSIZE 16
/* Icons */
#define IDI_USRMGR_ICON 40
#define IDI_USRMGR_ICON2 100 // Needed for theme compatibility with Windows.
#define IDI_USER 41
#define IDI_LOCKED_USER 42
#define IDI_GROUP 43
#define IDD_USERS 100
#define IDD_GROUPS 101
#define IDD_EXTRA 102
#define IDC_USERS_LIST 200
#define IDC_GROUPS_LIST 300
#define IDC_STATIC -1
/* Dialogs */
#define IDD_USER_GENERAL 310
#define IDC_USER_NAME 311
#define IDC_USER_FULLNAME 312
#define IDC_USER_DESCRIPTION 313
#define IDC_USER_PW_CHANGE 314
#define IDC_USER_PW_NOCHANGE 315
#define IDC_USER_PW_EXPIRE 316
#define IDC_USER_DEACTIVATE 317
#define IDC_USER_LOCK 318
#define IDD_CHANGE_PASSWORD 350
#define IDC_EDIT_PASSWORD1 351
#define IDC_EDIT_PASSWORD2 352
#define IDD_USER_NEW 360
#define IDC_USER_NEW_NAME 361
#define IDC_USER_NEW_FULL_NAME 362
#define IDC_USER_NEW_DESCRIPTION 363
#define IDC_USER_NEW_PASSWORD1 364
#define IDC_USER_NEW_PASSWORD2 365
#define IDC_USER_NEW_FORCE_CHANGE 366
#define IDC_USER_NEW_CANNOT_CHANGE 367
#define IDC_USER_NEW_NEVER_EXPIRES 368
#define IDC_USER_NEW_DISABLED 369
#define IDD_GROUP_NEW 370
#define IDC_GROUP_NEW_NAME 371
#define IDC_GROUP_NEW_DESCRIPTION 372
/* Strings */
#define IDS_CPLNAME 2000
#define IDS_CPLDESCRIPTION 2001
#define IDS_NAME 2100
#define IDS_FULLNAME 2101
#define IDS_DESCRIPTION 2102
/* Menus */
#define IDM_POPUP_GROUP 120
#define IDM_GROUP_ADD_MEMBER 121
#define IDM_GROUP_NEW 122
#define IDM_GROUP_DELETE 123
#define IDM_GROUP_RENAME 124
#define IDM_GROUP_PROPERTIES 125
#define IDM_POPUP_USER 130
#define IDM_USER_CHANGE_PASSWORD 131
#define IDM_USER_NEW 132
#define IDM_USER_DELETE 133
#define IDM_USER_RENAME 134
#define IDM_USER_PROPERTIES 135
#endif /* __CPL_USRMGR_RESOURCE_H__ */
#ifndef __CPL_USRMGR_RESOURCE_H__
#define __CPL_USRMGR_RESOURCE_H__
#include <commctrl.h>
/* metrics */
#define PROPSHEETWIDTH 246
#define PROPSHEETHEIGHT 228
#define PROPSHEETPADDING 6
#define SYSTEM_COLUMN (18 * PROPSHEETPADDING)
#define LABELLINE(x) (((PROPSHEETPADDING + 2) * x) + (x + 2))
#define ICONSIZE 16
/* Icons */
#define IDI_USRMGR_ICON 40
#define IDI_USRMGR_ICON2 100 // Needed for theme compatibility with Windows.
#define IDI_USER 41
#define IDI_LOCKED_USER 42
#define IDI_GROUP 43
#define IDD_USERS 100
#define IDD_GROUPS 101
#define IDD_EXTRA 102
#define IDC_USERS_LIST 200
#define IDC_GROUPS_LIST 300
#define IDC_STATIC -1
/* Dialogs */
#define IDD_USER_GENERAL 310
#define IDC_USER_GENERAL_NAME 311
#define IDC_USER_GENERAL_FULL_NAME 312
#define IDC_USER_GENERAL_DESCRIPTION 313
#define IDC_USER_GENERAL_FORCE_CHANGE 314
#define IDC_USER_GENERAL_CANNOT_CHANGE 315
#define IDC_USER_GENERAL_NEVER_EXPIRES 316
#define IDC_USER_GENERAL_DISABLED 317
#define IDC_USER_GENERAL_LOCKED 318
#define IDD_CHANGE_PASSWORD 350
#define IDC_EDIT_PASSWORD1 351
#define IDC_EDIT_PASSWORD2 352
#define IDD_USER_NEW 360
#define IDC_USER_NEW_NAME 361
#define IDC_USER_NEW_FULL_NAME 362
#define IDC_USER_NEW_DESCRIPTION 363
#define IDC_USER_NEW_PASSWORD1 364
#define IDC_USER_NEW_PASSWORD2 365
#define IDC_USER_NEW_FORCE_CHANGE 366
#define IDC_USER_NEW_CANNOT_CHANGE 367
#define IDC_USER_NEW_NEVER_EXPIRES 368
#define IDC_USER_NEW_DISABLED 369
#define IDD_GROUP_NEW 370
#define IDC_GROUP_NEW_NAME 371
#define IDC_GROUP_NEW_DESCRIPTION 372
/* Strings */
#define IDS_CPLNAME 2000
#define IDS_CPLDESCRIPTION 2001
#define IDS_NAME 2100
#define IDS_FULLNAME 2101
#define IDS_DESCRIPTION 2102
/* Menus */
#define IDM_POPUP_GROUP 120
#define IDM_GROUP_ADD_MEMBER 121
#define IDM_GROUP_NEW 122
#define IDM_GROUP_DELETE 123
#define IDM_GROUP_RENAME 124
#define IDM_GROUP_PROPERTIES 125
#define IDM_POPUP_USER 130
#define IDM_USER_CHANGE_PASSWORD 131
#define IDM_USER_NEW 132
#define IDM_USER_DELETE 133
#define IDM_USER_RENAME 134
#define IDM_USER_PROPERTIES 135
#endif /* __CPL_USRMGR_RESOURCE_H__ */

View file

@ -0,0 +1,167 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User Manager Control Panel
* FILE: dll/cpl/usrmgr/users.c
* PURPOSE: Users property page
*
* PROGRAMMERS: Eric Kohl
*/
#include "usrmgr.h"
static VOID
UpdateUserOptions(HWND hwndDlg,
PUSER_INFO_3 userInfo,
BOOL bInit)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_CANNOT_CHANGE),
!userInfo->usri3_password_expired);
EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_NEVER_EXPIRES),
!userInfo->usri3_password_expired);
EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_FORCE_CHANGE),
(userInfo->usri3_flags & (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD)) == 0);
if (bInit)
{
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_FORCE_CHANGE,
userInfo->usri3_password_expired ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_CANNOT_CHANGE,
(userInfo->usri3_flags & UF_PASSWD_CANT_CHANGE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_NEVER_EXPIRES,
(userInfo->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_DISABLED,
(userInfo->usri3_flags & UF_ACCOUNTDISABLE) ? BST_CHECKED : BST_UNCHECKED);
}
}
static VOID
GetUserData(HWND hwndDlg, LPTSTR lpUserName, PUSER_INFO_3 *usrInfo)
{
PUSER_INFO_3 userInfo = NULL;
SetDlgItemText(hwndDlg, IDC_USER_GENERAL_NAME, lpUserName);
NetUserGetInfo(NULL, lpUserName, 3, (LPBYTE*)&userInfo);
SetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, userInfo->usri3_full_name);
SetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, userInfo->usri3_comment);
UpdateUserOptions(hwndDlg, userInfo, TRUE);
*usrInfo = userInfo;
}
INT_PTR CALLBACK
UserGeneralPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
PUSER_INFO_3 userInfo;
UNREFERENCED_PARAMETER(lParam);
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(hwndDlg);
userInfo = (PUSER_INFO_3)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg)
{
case WM_INITDIALOG:
GetUserData(hwndDlg,
(LPTSTR)((PROPSHEETPAGE *)lParam)->lParam,
&userInfo);
SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)userInfo);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_USER_GENERAL_FORCE_CHANGE:
userInfo->usri3_password_expired = !userInfo->usri3_password_expired;
UpdateUserOptions(hwndDlg, userInfo, FALSE);
break;
case IDC_USER_GENERAL_CANNOT_CHANGE:
userInfo->usri3_flags ^= UF_PASSWD_CANT_CHANGE;
UpdateUserOptions(hwndDlg, userInfo, FALSE);
break;
case IDC_USER_GENERAL_NEVER_EXPIRES:
userInfo->usri3_flags ^= UF_DONT_EXPIRE_PASSWD;
UpdateUserOptions(hwndDlg, userInfo, FALSE);
break;
case IDC_USER_GENERAL_DISABLED:
userInfo->usri3_flags ^= UF_ACCOUNTDISABLE;
break;
case IDC_USER_GENERAL_LOCKED:
break;
}
break;
case WM_DESTROY:
NetApiBufferFree(userInfo);
break;
}
return FALSE;
}
static VOID
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPTSTR pszUser)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
psp->dwSize = sizeof(PROPSHEETPAGE);
psp->dwFlags = PSP_DEFAULT;
psp->hInstance = hApplet;
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
psp->pfnDlgProc = DlgProc;
psp->lParam = (LPARAM)pszUser;
}
VOID
UserProperties(HWND hwndDlg)
{
PROPSHEETPAGE psp[1];
PROPSHEETHEADER psh;
TCHAR szUserName[UNLEN];
INT nItem;
HWND hwndLV;
hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST);
nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
if (nItem == -1)
return;
/* Get the new user name */
ListView_GetItemText(hwndLV,
nItem, 0,
szUserName,
UNLEN);
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
psh.hwndParent = hwndDlg;
psh.hInstance = hApplet;
psh.hIcon = NULL;
psh.pszCaption = szUserName;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
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);
PropertySheet(&psh);
}

File diff suppressed because it is too large Load diff

View file

@ -1,39 +1,43 @@
#ifndef __CPL_DESK_H__
#define __CPL_DESK_H__
#include <windows.h>
#include <commctrl.h>
#include <commdlg.h>
#include <cpl.h>
#include <tchar.h>
#include <setupapi.h>
#include <lmaccess.h>
#include <lmapibuf.h>
#include <lmerr.h>
#include <stdio.h>
#include "resource.h"
typedef struct _APPLET
{
int idIcon;
int idName;
int idDescription;
APPLET_PROC AppletProc;
} APPLET, *PAPPLET;
extern HINSTANCE hApplet;
INT_PTR CALLBACK UsersPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK GroupsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
/* misc.c */
BOOL
CheckAccountName(HWND hwndDlg,
INT nIdDlgItem,
LPTSTR lpAccountName);
#endif /* __CPL_DESK_H__ */
#ifndef __CPL_DESK_H__
#define __CPL_DESK_H__
#include <windows.h>
#include <commctrl.h>
#include <commdlg.h>
#include <cpl.h>
#include <tchar.h>
#include <setupapi.h>
#include <lmaccess.h>
#include <lmapibuf.h>
#include <lmerr.h>
#include <stdio.h>
#include "resource.h"
typedef struct _APPLET
{
int idIcon;
int idName;
int idDescription;
APPLET_PROC AppletProc;
} APPLET, *PAPPLET;
extern HINSTANCE hApplet;
INT_PTR CALLBACK UsersPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK GroupsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
/* misc.c */
BOOL
CheckAccountName(HWND hwndDlg,
INT nIdDlgItem,
LPTSTR lpAccountName);
/* userprops.c */
VOID
UserProperties(HWND hwndDlg);
#endif /* __CPL_DESK_H__ */

View file

@ -1,22 +1,23 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes">
<importlibrary definition="usrmgr.def" />
<include base="usrmgr">.</include>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x609</define>
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>
<library>comctl32</library>
<library>ntdll</library>
<library>netapi32</library>
<library>msvcrt</library>
<file>extra.c</file>
<file>groups.c</file>
<file>misc.c</file>
<file>users.c</file>
<file>usrmgr.c</file>
<file>usrmgr.rc</file>
</module>
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes">
<importlibrary definition="usrmgr.def" />
<include base="usrmgr">.</include>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x609</define>
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>
<library>comctl32</library>
<library>ntdll</library>
<library>netapi32</library>
<library>msvcrt</library>
<file>extra.c</file>
<file>groups.c</file>
<file>misc.c</file>
<file>userprops.c</file>
<file>users.c</file>
<file>usrmgr.c</file>
<file>usrmgr.rc</file>
</module>