2013-03-16 20:25:38 +00:00
|
|
|
/*
|
2008-05-31 19:48:44 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS User Manager Control Panel
|
2009-01-20 07:28:51 +00:00
|
|
|
* FILE: dll/cpl/usrmgr/usrmgr.c
|
2008-05-31 19:48:44 +00:00
|
|
|
* PURPOSE: Main functions
|
|
|
|
*
|
|
|
|
* PROGRAMMERS: Eric Kohl
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "usrmgr.h"
|
|
|
|
|
|
|
|
#define NUM_APPLETS 1
|
|
|
|
|
|
|
|
static LONG APIENTRY UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
HINSTANCE hApplet = 0;
|
|
|
|
|
|
|
|
/* Applets */
|
|
|
|
APPLET Applets[NUM_APPLETS] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IDI_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;
|
|
|
|
}
|
|
|
|
|
2018-12-14 11:06:57 +00:00
|
|
|
static int CALLBACK
|
|
|
|
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
|
|
|
|
{
|
|
|
|
// NOTE: This callback is needed to set large icon correctly.
|
|
|
|
HICON hIcon;
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case PSCB_INITIALIZED:
|
|
|
|
{
|
|
|
|
hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_USRMGR_ICON));
|
|
|
|
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2008-05-31 19:48:44 +00:00
|
|
|
|
|
|
|
/* Display Applet */
|
|
|
|
static LONG APIENTRY
|
|
|
|
UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2018-08-01 20:15:27 +00:00
|
|
|
PROPSHEETPAGE psp[2];
|
2008-05-31 19:48:44 +00:00
|
|
|
PROPSHEETHEADER psh;
|
|
|
|
TCHAR Caption[1024];
|
|
|
|
|
|
|
|
UNREFERENCED_PARAMETER(lParam);
|
|
|
|
UNREFERENCED_PARAMETER(wParam);
|
|
|
|
UNREFERENCED_PARAMETER(uMsg);
|
|
|
|
|
|
|
|
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
|
|
|
|
|
|
|
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
|
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
2018-12-14 11:06:57 +00:00
|
|
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
|
2008-05-31 19:48:44 +00:00
|
|
|
psh.hwndParent = hwnd;
|
|
|
|
psh.hInstance = hApplet;
|
2018-12-14 11:06:57 +00:00
|
|
|
psh.pszIcon = MAKEINTRESOURCEW(IDI_USRMGR_ICON);
|
2008-05-31 19:48:44 +00:00
|
|
|
psh.pszCaption = Caption;
|
|
|
|
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
|
|
|
psh.nStartPage = 0;
|
|
|
|
psh.ppsp = psp;
|
2018-12-14 11:06:57 +00:00
|
|
|
psh.pfnCallback = PropSheetProc;
|
2008-05-31 19:48:44 +00:00
|
|
|
|
2017-10-30 23:37:37 +00:00
|
|
|
InitPropSheetPage(&psp[0], IDD_USERS, UsersPageProc);
|
|
|
|
InitPropSheetPage(&psp[1], IDD_GROUPS, GroupsPageProc);
|
2018-08-01 20:15:27 +00:00
|
|
|
/* InitPropSheetPage(&psp[2], IDD_EXTRA, ExtraPageProc); */
|
2008-05-31 19:48:44 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|