mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
Add a user manager control panel application since the 0.3.2 release has been canceled.
svn path=/trunk/; revision=27097
This commit is contained in:
parent
472b0cb7f3
commit
f2d0f12dc0
12 changed files with 770 additions and 0 deletions
|
@ -37,3 +37,6 @@
|
|||
<directory name="timedate">
|
||||
<xi:include href="timedate/timedate.rbuild" />
|
||||
</directory>
|
||||
<directory name="usrmgr">
|
||||
<xi:include href="usrmgr/usrmgr.rbuild" />
|
||||
</directory>
|
||||
|
|
33
reactos/dll/cpl/usrmgr/extra.c
Normal file
33
reactos/dll/cpl/usrmgr/extra.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User Manager Control Panel
|
||||
* FILE: dll/cpl/usrmgr/extra.c
|
||||
* PURPOSE: Extra property page
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
*/
|
||||
|
||||
#include "usrmgr.h"
|
||||
|
||||
INT_PTR CALLBACK
|
||||
ExtraPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
185
reactos/dll/cpl/usrmgr/groups.c
Normal file
185
reactos/dll/cpl/usrmgr/groups.c
Normal file
|
@ -0,0 +1,185 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User Manager Control Panel
|
||||
* FILE: dll/cpl/usrmgr/groups.c
|
||||
* PURPOSE: Groups property page
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
*/
|
||||
|
||||
#include "usrmgr.h"
|
||||
|
||||
typedef struct _GROUP_DATA
|
||||
{
|
||||
HMENU hPopupMenu;
|
||||
|
||||
INT iCurrentItem;
|
||||
|
||||
} GROUP_DATA, *PGROUP_DATA;
|
||||
|
||||
|
||||
static VOID
|
||||
SetGroupsListColumns(HWND hwndListView)
|
||||
{
|
||||
LV_COLUMN column;
|
||||
RECT rect;
|
||||
TCHAR szStr[32];
|
||||
|
||||
GetClientRect(hwndListView, &rect);
|
||||
|
||||
memset(&column, 0x00, sizeof(column));
|
||||
column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
|
||||
column.fmt=LVCFMT_LEFT;
|
||||
column.cx = (INT)((rect.right - rect.left) * 0.40);
|
||||
column.iSubItem = 0;
|
||||
LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
|
||||
column.pszText = szStr;
|
||||
(void)ListView_InsertColumn(hwndListView, 0, &column);
|
||||
|
||||
column.cx = (INT)((rect.right - rect.left) * 0.60);
|
||||
column.iSubItem = 1;
|
||||
LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0]));
|
||||
column.pszText = szStr;
|
||||
(void)ListView_InsertColumn(hwndListView, 1, &column);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
UpdateGroupsList(HWND hwndListView)
|
||||
{
|
||||
NET_API_STATUS netStatus;
|
||||
PLOCALGROUP_INFO_1 pBuffer;
|
||||
DWORD entriesread;
|
||||
DWORD totalentries;
|
||||
DWORD resume_handle = 0;
|
||||
DWORD i;
|
||||
|
||||
LV_ITEM lvi;
|
||||
INT iItem;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
netStatus = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&pBuffer,
|
||||
1024, &entriesread,
|
||||
&totalentries, &resume_handle);
|
||||
if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)
|
||||
break;
|
||||
|
||||
for (i = 0; i < entriesread; i++)
|
||||
{
|
||||
memset(&lvi, 0x00, sizeof(lvi));
|
||||
lvi.mask = LVIF_TEXT | LVIF_STATE; // | LVIF_PARAM;
|
||||
// lvi.lParam = (LPARAM)VarData;
|
||||
lvi.pszText = pBuffer[i].lgrpi1_name;
|
||||
lvi.state = 0; //(i == 0) ? LVIS_SELECTED : 0;
|
||||
iItem = ListView_InsertItem(hwndListView, &lvi);
|
||||
|
||||
ListView_SetItemText(hwndListView, iItem, 1,
|
||||
pBuffer[i].lgrpi1_comment);
|
||||
}
|
||||
|
||||
NetApiBufferFree(&pBuffer);
|
||||
|
||||
/* No more data left */
|
||||
if (netStatus != ERROR_MORE_DATA)
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
OnInitDialog(HWND hwndDlg)
|
||||
{
|
||||
HWND hwndListView;
|
||||
|
||||
hwndListView = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
|
||||
|
||||
(void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);
|
||||
|
||||
SetGroupsListColumns(hwndListView);
|
||||
|
||||
UpdateGroupsList(hwndListView);
|
||||
|
||||
// (void)ListView_SetColumnWidth(hwndListView, 3, LVSCW_AUTOSIZE_USEHEADER);
|
||||
// (void)ListView_Update(hwndListView, 0);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
OnNotify(HWND hwndDlg, PGROUP_DATA pGroupData, NMHDR *phdr)
|
||||
{
|
||||
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
|
||||
|
||||
switch (phdr->idFrom)
|
||||
{
|
||||
case IDC_GROUPS_LIST:
|
||||
switch(phdr->code)
|
||||
{
|
||||
case NM_CLICK:
|
||||
pGroupData->iCurrentItem = lpnmlv->iItem;
|
||||
if (lpnmlv->iItem == -1)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_DBLCLK:
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
ClientToScreen(GetDlgItem(hwndDlg, IDC_GROUPS_LIST), &lpnmlv->ptAction);
|
||||
TrackPopupMenu(GetSubMenu(pGroupData->hPopupMenu, (lpnmlv->iItem == -1) ? 0 : 1),
|
||||
TPM_LEFTALIGN, lpnmlv->ptAction.x, lpnmlv->ptAction.y, 0, hwndDlg, NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK
|
||||
GroupsPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
PGROUP_DATA pGroupData;
|
||||
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
|
||||
|
||||
pGroupData = (PGROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
pGroupData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GROUP_DATA));
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGroupData);
|
||||
|
||||
pGroupData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_GROUP));
|
||||
|
||||
OnInitDialog(hwndDlg);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
OnNotify(hwndDlg, pGroupData, (NMHDR *)lParam);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
DestroyMenu(pGroupData->hPopupMenu);
|
||||
HeapFree(GetProcessHeap(), 0, pGroupData);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
90
reactos/dll/cpl/usrmgr/lang/en-US.rc
Normal file
90
reactos/dll/cpl/usrmgr/lang/en-US.rc
Normal file
|
@ -0,0 +1,90 @@
|
|||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
/*
|
||||
* Attention Translators:
|
||||
* DO NOT TRANSLATE THESE RESOURCES YET!
|
||||
*/
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
IDD_USERS DIALOGEX DISCARDABLE 0, 0, 252, 223
|
||||
STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Users"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
|
||||
7, 7, 238, 85, WS_EX_CLIENTEDGE
|
||||
END
|
||||
|
||||
|
||||
IDD_GROUPS DIALOGEX DISCARDABLE 0, 0, 252, 223
|
||||
STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Groups"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
|
||||
7, 7, 238, 85, WS_EX_CLIENTEDGE
|
||||
END
|
||||
|
||||
|
||||
IDD_EXTRA DIALOGEX DISCARDABLE 0, 0, 252, 223
|
||||
STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Extra"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "This space is intentionally left blank", IDC_STATIC, 66, 90, 112, 8
|
||||
END
|
||||
|
||||
|
||||
/* Menus */
|
||||
|
||||
IDM_POPUP_GROUP MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "New Group...", IDM_GROUP_NEW
|
||||
END
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "Add Member", IDM_GROUP_ADD_MEMBER
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Delete", IDM_GROUP_DELETE
|
||||
MENUITEM "Rename", IDM_GROUP_RENAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties", IDM_GROUP_PROPERTIES
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
IDM_POPUP_USER MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "New User...", IDM_USER_NEW
|
||||
END
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "Change Password", IDM_USER_CHANGE_PASSWORD
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Delete", IDM_USER_DELETE
|
||||
MENUITEM "Rename", IDM_USER_RENAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties", IDM_USER_PROPERTIES
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/* Strings */
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CPLNAME "User Accounts"
|
||||
IDS_CPLDESCRIPTION "Manages Users and Groups."
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_NAME "Name"
|
||||
IDS_FULLNAME "Full Name"
|
||||
IDS_DESCRIPTION "Description"
|
||||
END
|
55
reactos/dll/cpl/usrmgr/resource.h
Normal file
55
reactos/dll/cpl/usrmgr/resource.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#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
|
||||
|
||||
/* ids */
|
||||
|
||||
#define IDC_USRMGR_ICON 40
|
||||
#define IDC_USRMGR_ICON2 100 // Needed for theme compatability with Windows.
|
||||
|
||||
#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
|
||||
|
||||
|
||||
#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__ */
|
||||
|
BIN
reactos/dll/cpl/usrmgr/resources/applet.ico
Normal file
BIN
reactos/dll/cpl/usrmgr/resources/applet.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
200
reactos/dll/cpl/usrmgr/users.c
Normal file
200
reactos/dll/cpl/usrmgr/users.c
Normal file
|
@ -0,0 +1,200 @@
|
|||
/* $Id$
|
||||
*
|
||||
* 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"
|
||||
|
||||
|
||||
typedef struct _USER_DATA
|
||||
{
|
||||
HMENU hPopupMenu;
|
||||
|
||||
INT iCurrentItem;
|
||||
|
||||
} USER_DATA, *PUSER_DATA;
|
||||
|
||||
|
||||
static VOID
|
||||
SetUsersListColumns(HWND hwndListView)
|
||||
{
|
||||
LV_COLUMN column;
|
||||
RECT rect;
|
||||
TCHAR szStr[32];
|
||||
|
||||
GetClientRect(hwndListView, &rect);
|
||||
|
||||
memset(&column, 0x00, sizeof(column));
|
||||
column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
|
||||
column.fmt=LVCFMT_LEFT;
|
||||
column.cx = (INT)((rect.right - rect.left) * 0.25);
|
||||
column.iSubItem = 0;
|
||||
LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
|
||||
column.pszText = szStr;
|
||||
(void)ListView_InsertColumn(hwndListView, 0, &column);
|
||||
|
||||
column.cx = (INT)((rect.right - rect.left) * 0.50);
|
||||
column.iSubItem = 1;
|
||||
LoadString(hApplet, IDS_FULLNAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
|
||||
column.pszText = szStr;
|
||||
(void)ListView_InsertColumn(hwndListView, 1, &column);
|
||||
|
||||
column.cx = (INT)((rect.right - rect.left) * 0.25);
|
||||
column.iSubItem = 2;
|
||||
LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0]));
|
||||
column.pszText = szStr;
|
||||
(void)ListView_InsertColumn(hwndListView, 2, &column);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
UpdateUsersList(HWND hwndListView)
|
||||
{
|
||||
NET_API_STATUS netStatus;
|
||||
PUSER_INFO_20 pBuffer;
|
||||
DWORD entriesread;
|
||||
DWORD totalentries;
|
||||
DWORD resume_handle = 0;
|
||||
DWORD i;
|
||||
|
||||
LV_ITEM lvi;
|
||||
INT iItem;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
netStatus = NetUserEnum(NULL, 20, FILTER_NORMAL_ACCOUNT,
|
||||
(LPBYTE*)&pBuffer,
|
||||
1024, &entriesread,
|
||||
&totalentries, &resume_handle);
|
||||
if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)
|
||||
break;
|
||||
|
||||
for (i = 0; i < entriesread; i++)
|
||||
{
|
||||
memset(&lvi, 0x00, sizeof(lvi));
|
||||
lvi.mask = LVIF_TEXT | LVIF_STATE; // | LVIF_PARAM;
|
||||
// lvi.lParam = (LPARAM)VarData;
|
||||
lvi.pszText = pBuffer[i].usri20_name;
|
||||
lvi.state = 0; //(i == 0) ? LVIS_SELECTED : 0;
|
||||
iItem = ListView_InsertItem(hwndListView, &lvi);
|
||||
|
||||
ListView_SetItemText(hwndListView, iItem, 1,
|
||||
pBuffer[i].usri20_full_name);
|
||||
|
||||
ListView_SetItemText(hwndListView, iItem, 2,
|
||||
pBuffer[i].usri20_comment);
|
||||
}
|
||||
|
||||
NetApiBufferFree(&pBuffer);
|
||||
|
||||
/* No more data left */
|
||||
if (netStatus != ERROR_MORE_DATA)
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
OnInitDialog(HWND hwndDlg)
|
||||
{
|
||||
HWND hwndListView;
|
||||
|
||||
/* Set user environment variables */
|
||||
hwndListView = GetDlgItem(hwndDlg, IDC_USERS_LIST);
|
||||
|
||||
(void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);
|
||||
|
||||
SetUsersListColumns(hwndListView);
|
||||
|
||||
UpdateUsersList(hwndListView);
|
||||
|
||||
// (void)ListView_SetColumnWidth(hwndListView, 3, LVSCW_AUTOSIZE_USEHEADER);
|
||||
// (void)ListView_Update(hwndListView, 0);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
|
||||
{
|
||||
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
|
||||
|
||||
switch (phdr->idFrom)
|
||||
{
|
||||
case IDC_USERS_LIST:
|
||||
switch(phdr->code)
|
||||
{
|
||||
case NM_CLICK:
|
||||
pUserData->iCurrentItem = lpnmlv->iItem;
|
||||
if (lpnmlv->iItem == -1)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_DBLCLK:
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
ClientToScreen(GetDlgItem(hwndDlg, IDC_USERS_LIST), &lpnmlv->ptAction);
|
||||
TrackPopupMenu(GetSubMenu(pUserData->hPopupMenu, (lpnmlv->iItem == -1) ? 0 : 1),
|
||||
TPM_LEFTALIGN, lpnmlv->ptAction.x, lpnmlv->ptAction.y, 0, hwndDlg, NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK
|
||||
UsersPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
PUSER_DATA pUserData;
|
||||
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
|
||||
pUserData = (PUSER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
pUserData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(USER_DATA));
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pUserData);
|
||||
|
||||
pUserData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_USER));
|
||||
|
||||
OnInitDialog(hwndDlg);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_USER_PROPERTIES:
|
||||
MessageBeep(-1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
OnNotify(hwndDlg, pUserData, (NMHDR *)lParam);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
DestroyMenu(pUserData->hPopupMenu);
|
||||
HeapFree(GetProcessHeap(), 0, pUserData);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
123
reactos/dll/cpl/usrmgr/usrmgr.c
Normal file
123
reactos/dll/cpl/usrmgr/usrmgr.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User Manager Control Panel
|
||||
* FILE: dll/cpl/usrmgr/extra.c
|
||||
* PURPOSE: Main functions
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
*/
|
||||
|
||||
#include "usrmgr.h"
|
||||
|
||||
#define NUM_APPLETS 1
|
||||
|
||||
LONG APIENTRY UsrmgrApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
|
||||
|
||||
HINSTANCE hApplet = 0;
|
||||
|
||||
/* Applets */
|
||||
APPLET Applets[NUM_APPLETS] =
|
||||
{
|
||||
{
|
||||
IDC_USRMGR_ICON,
|
||||
IDS_CPLNAME,
|
||||
IDS_CPLDESCRIPTION,
|
||||
UsrmgrApplet
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
|
||||
{
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp->dwFlags = PSP_DEFAULT;
|
||||
psp->hInstance = hApplet;
|
||||
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
||||
psp->pfnDlgProc = DlgProc;
|
||||
}
|
||||
|
||||
|
||||
/* Display Applet */
|
||||
LONG APIENTRY
|
||||
UsrmgrApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
||||
{
|
||||
PROPSHEETPAGE psp[3];
|
||||
PROPSHEETHEADER psh;
|
||||
TCHAR Caption[1024];
|
||||
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(uMsg);
|
||||
UNREFERENCED_PARAMETER(hwnd);
|
||||
|
||||
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE;
|
||||
psh.hwndParent = NULL;
|
||||
psh.hInstance = hApplet;
|
||||
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_USRMGR_ICON));
|
||||
psh.pszCaption = Caption;
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = psp;
|
||||
|
||||
InitPropSheetPage(&psp[0], IDD_USERS, (DLGPROC)UsersPageProc);
|
||||
InitPropSheetPage(&psp[1], IDD_GROUPS, (DLGPROC)GroupsPageProc);
|
||||
InitPropSheetPage(&psp[2], IDD_EXTRA, (DLGPROC)ExtraPageProc);
|
||||
|
||||
return (LONG)(PropertySheet(&psh) != -1);
|
||||
}
|
||||
|
||||
|
||||
/* Control Panel Callback */
|
||||
LONG CALLBACK
|
||||
CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
int i = (int)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case CPL_INIT:
|
||||
return TRUE;
|
||||
|
||||
case CPL_GETCOUNT:
|
||||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lpvReserved);
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
hApplet = hinstDLL;
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
6
reactos/dll/cpl/usrmgr/usrmgr.def
Normal file
6
reactos/dll/cpl/usrmgr/usrmgr.def
Normal file
|
@ -0,0 +1,6 @@
|
|||
LIBRARY usrmgr.cpl
|
||||
|
||||
EXPORTS
|
||||
CPlApplet
|
||||
|
||||
; EOF
|
34
reactos/dll/cpl/usrmgr/usrmgr.h
Normal file
34
reactos/dll/cpl/usrmgr/usrmgr.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#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);
|
||||
|
||||
|
||||
#endif /* __CPL_DESK_H__ */
|
||||
|
24
reactos/dll/cpl/usrmgr/usrmgr.rbuild
Normal file
24
reactos/dll/cpl/usrmgr/usrmgr.rbuild
Normal file
|
@ -0,0 +1,24 @@
|
|||
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl">
|
||||
<importlibrary definition="usrmgr.def" />
|
||||
<include base="usrmgr">.</include>
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<!-- <define name="WINVER">0x501</define> -->
|
||||
<!-- <define name="_WIN32" /> -->
|
||||
<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>users.c</file>
|
||||
<file>usrmgr.c</file>
|
||||
<file>usrmgr.rc</file>
|
||||
</module>
|
17
reactos/dll/cpl/usrmgr/usrmgr.rc
Normal file
17
reactos/dll/cpl/usrmgr/usrmgr.rc
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS User Manager Panel\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "usrmgr\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "usrmgr.cpl\0"
|
||||
|
||||
#include <reactos/version.rc>
|
||||
|
||||
IDC_USRMGR_ICON ICON "resources/applet.ico"
|
||||
IDC_USRMGR_ICON2 ICON "resources/applet.ico"
|
||||
|
||||
|
||||
#include "lang/en-US.rc"
|
Loading…
Reference in a new issue