ReactOS  0.4.14-dev-49-gfb4591c
sysdm.c File Reference
#include "precomp.h"
#include <cpl.h>
#include <regstr.h>
Include dependency graph for sysdm.c:

Go to the source code of this file.

Macros

#define MAX_SYSTEM_PAGES   32
 

Typedefs

typedef HPROPSHEETPAGE(WINAPIPCreateNetIDPropertyPage) (VOID)
 

Functions

LONG CALLBACK SystemApplet (VOID)
 
INT ResourceMessageBox (IN HINSTANCE hInstance, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
 
static BOOL CALLBACK PropSheetAddPage (HPROPSHEETPAGE hpage, LPARAM lParam)
 
static BOOL InitPropSheetPage (PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc)
 
static HMODULE AddNetIdPage (PROPSHEETHEADER *ppsh)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
LONG CALLBACK CPlApplet (HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
 

Variables

HINSTANCE hApplet = 0
 
HWND hCPLWindow
 
APPLET Applets [NUM_APPLETS]
 

Macro Definition Documentation

◆ MAX_SYSTEM_PAGES

#define MAX_SYSTEM_PAGES   32

Definition at line 25 of file sysdm.c.

Typedef Documentation

◆ PCreateNetIDPropertyPage

typedef HPROPSHEETPAGE(WINAPI * PCreateNetIDPropertyPage) (VOID)

Definition at line 87 of file sysdm.c.

Function Documentation

◆ AddNetIdPage()

static HMODULE AddNetIdPage ( PROPSHEETHEADER ppsh)
static

Definition at line 90 of file sysdm.c.

91 {
92  HPROPSHEETPAGE hPage;
93  HMODULE hMod;
94  PCreateNetIDPropertyPage pCreateNetIdPage;
95 
96  hMod = LoadLibrary(TEXT("netid.dll"));
97  if (hMod != NULL)
98  {
99  pCreateNetIdPage = (PCreateNetIDPropertyPage)GetProcAddress(hMod,
100  "CreateNetIDPropertyPage");
101  if (pCreateNetIdPage != NULL)
102  {
103  hPage = pCreateNetIdPage();
104  if (hPage == NULL)
105  goto Fail;
106 
107  if (!PropSheetAddPage(hPage, (LPARAM)ppsh))
108  {
110  goto Fail;
111  }
112  }
113  else
114  {
115 Fail:
116  FreeLibrary(hMod);
117  hMod = NULL;
118  }
119  }
120 
121  return hMod;
122 }
#define LoadLibrary
Definition: winbase.h:3679
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3141
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define FreeLibrary(x)
Definition: compat.h:405
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: sysdm.c:50
HPROPSHEETPAGE(WINAPI * PCreateNetIDPropertyPage)(VOID)
Definition: sysdm.c:87
Definition: hiveinit.c:368
#define TEXT(s)
Definition: k32.h:26
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by SystemApplet().

◆ CPlApplet()

LONG CALLBACK CPlApplet ( HWND  hwndCPl,
UINT  uMsg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 194 of file sysdm.c.

198 {
199  INT i = (INT)lParam1;
200 
201  UNREFERENCED_PARAMETER(hwndCPl);
202 
203  switch (uMsg)
204  {
205  case CPL_INIT:
206  return TRUE;
207 
208  case CPL_GETCOUNT:
209  return NUM_APPLETS;
210 
211  case CPL_INQUIRE:
212  {
213  CPLINFO *CPlInfo = (CPLINFO*)lParam2;
214  CPlInfo->lData = 0;
215  CPlInfo->idIcon = Applets[i].idIcon;
216  CPlInfo->idName = Applets[i].idName;
217  CPlInfo->idInfo = Applets[i].idDescription;
218  }
219  break;
220 
221  case CPL_DBLCLK:
222  hCPLWindow = hwndCPl;
223  Applets[i].AppletProc();
224  break;
225  }
226 
227  return FALSE;
228 }
#define TRUE
Definition: types.h:120
Definition: cpl.h:24
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
int idName
Definition: hotplug.h:27
#define INT
Definition: polytest.cpp:20
int idIcon
Definition: hotplug.h:26
int idInfo
Definition: cpl.h:27
int32_t INT
Definition: typedefs.h:56
int idIcon
Definition: cpl.h:25
int idDescription
Definition: hotplug.h:28
#define CPL_DBLCLK
Definition: cpl.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
APPLET_PROC AppletProc
Definition: hotplug.h:29
#define CPL_INIT
Definition: cpl.h:12
#define CPL_INQUIRE
Definition: cpl.h:14
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
HWND hCPLWindow
Definition: sysdm.c:17
#define NUM_APPLETS
Definition: access.c:14
#define CPL_GETCOUNT
Definition: cpl.h:13
APPLET Applets[NUM_APPLETS]
Definition: sysdm.c:20

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  dwReason,
LPVOID  lpvReserved 
)

Definition at line 232 of file sysdm.c.

235 {
237 
238  switch (dwReason)
239  {
240  case DLL_PROCESS_ATTACH:
241  case DLL_THREAD_ATTACH:
242  hApplet = hinstDLL;
243  break;
244  }
245 
246  return TRUE;
247 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DLL_THREAD_ATTACH
Definition: compat.h:121
HINSTANCE hApplet
Definition: sysdm.c:16
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static IN DWORD IN LPVOID lpvReserved
DWORD dwReason
Definition: misc.cpp:154

◆ InitPropSheetPage()

static BOOL InitPropSheetPage ( PROPSHEETHEADER ppsh,
WORD  idDlg,
DLGPROC  DlgProc 
)
static

Definition at line 63 of file sysdm.c.

64 {
65  HPROPSHEETPAGE hPage;
66  PROPSHEETPAGE psp;
67 
68  if (ppsh->nPages < MAX_SYSTEM_PAGES)
69  {
70  ZeroMemory(&psp, sizeof(psp));
71  psp.dwSize = sizeof(psp);
72  psp.dwFlags = PSP_DEFAULT;
73  psp.hInstance = hApplet;
74  psp.pszTemplate = MAKEINTRESOURCE(idDlg);
75  psp.pfnDlgProc = DlgProc;
76 
77  hPage = CreatePropertySheetPage(&psp);
78  if (hPage != NULL)
79  {
80  return PropSheetAddPage(hPage, (LPARAM)ppsh);
81  }
82  }
83 
84  return FALSE;
85 }
WORD idDlg
Definition: desk.c:109
#define MAKEINTRESOURCE
Definition: winuser.h:591
HINSTANCE hApplet
Definition: sysdm.c:16
#define ZeroMemory
Definition: winbase.h:1635
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CreatePropertySheetPage
Definition: prsht.h:381
#define PSP_DEFAULT
Definition: prsht.h:22
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:25
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: sysdm.c:50
DLGPROC DlgProc
Definition: desk.c:110
#define PROPSHEETPAGE
Definition: prsht.h:371

Referenced by SystemApplet().

◆ PropSheetAddPage()

static BOOL CALLBACK PropSheetAddPage ( HPROPSHEETPAGE  hpage,
LPARAM  lParam 
)
static

Definition at line 50 of file sysdm.c.

51 {
53  if (ppsh != NULL && ppsh->nPages < MAX_SYSTEM_PAGES)
54  {
55  ppsh->phpage[ppsh->nPages++] = hpage;
56  return TRUE;
57  }
58 
59  return FALSE;
60 }
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:25
LPARAM lParam
Definition: combotst.c:139

Referenced by AddNetIdPage(), InitPropSheetPage(), and SystemApplet().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 125 of file sysdm.c.

126 {
127  // NOTE: This callback is needed to set large icon correctly.
128  HICON hIcon;
129  switch (uMsg)
130  {
131  case PSCB_INITIALIZED:
132  {
134  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
135  break;
136  }
137  }
138  return 0;
139 }
static HICON
Definition: imagelist.c:84
HINSTANCE hApplet
Definition: sysdm.c:16
LONG_PTR LPARAM
Definition: windef.h:208
#define IDI_USERPROF
Definition: resource.h:8
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by SystemApplet().

◆ ResourceMessageBox()

INT ResourceMessageBox ( IN HINSTANCE  hInstance,
IN HWND  hwnd,
IN UINT  uType,
IN UINT  uCaption,
IN UINT  uText 
)

Definition at line 29 of file sysdm.c.

35 {
36  WCHAR szCaption[256];
37  WCHAR szText[256];
38 
39  LoadStringW(hInstance, uCaption, szCaption, 256);
40  LoadStringW(hInstance, uText, szText, 256);
41 
42  return MessageBoxW(hwnd,
43  szText,
44  szCaption,
45  uType);
46 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: charmap.c:20
static const WCHAR szText[]
Definition: dialog.c:139
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ SystemApplet()

LONG CALLBACK SystemApplet ( VOID  )

Definition at line 143 of file sysdm.c.

144 {
146  PROPSHEETHEADER psh;
147  HMODULE hNetIdDll;
148  HPSXA hpsxa = NULL;
149  LONG Ret;
151 
152  if (!InitCommonControlsEx(&icc))
153  return 0;
154 
155  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
156  psh.dwSize = sizeof(PROPSHEETHEADER);
157  psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
158  psh.hwndParent = hCPLWindow;
159  psh.hInstance = hApplet;
160  psh.pszIcon = MAKEINTRESOURCEW(IDI_USERPROF);
161  psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
162  psh.nPages = 0;
163  psh.nStartPage = 0;
164  psh.phpage = hpsp;
165  psh.pfnCallback = PropSheetProc;
166 
168  hNetIdDll = AddNetIdPage(&psh);
171 
172  /* Load additional pages provided by shell extensions */
174  if (hpsxa != NULL)
175  {
177  }
178 
179  Ret = (LONG)(PropertySheet(&psh) != -1);
180 
181  if (hpsxa != NULL)
182  {
184  }
185 
186  if (hNetIdDll != NULL)
187  FreeLibrary(hNetIdDll);
188 
189  return Ret;
190 }
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:1755
#define MAKEINTRESOURCE
Definition: winuser.h:591
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:1577
HINSTANCE hApplet
Definition: sysdm.c:16
#define REGSTR_PATH_CONTROLSFOLDER
Definition: regstr.h:76
#define ZeroMemory
Definition: winbase.h:1635
static HMODULE AddNetIdPage(PROPSHEETHEADER *ppsh)
Definition: sysdm.c:90
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: sysdm.c:125
#define PSH_USECALLBACK
Definition: prsht.h:48
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define PSH_USEICONID
Definition: prsht.h:42
INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
long LONG
Definition: pedump.c:60
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static BOOL InitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc)
Definition: sysdm.c:63
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define FreeLibrary(x)
Definition: compat.h:405
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:25
#define PSH_PROPTITLE
Definition: prsht.h:40
#define IDD_PROPPAGEGENERAL
Definition: resource.h:10
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: sysdm.c:50
#define IDI_USERPROF
Definition: resource.h:8
#define TEXT(s)
Definition: k32.h:26
HWND hCPLWindow
Definition: sysdm.c:17
#define PropertySheet
Definition: prsht.h:382
INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardware.c:68
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface)
Definition: shellord.c:1607
#define IDD_PROPPAGEADVANCED
Definition: resource.h:18
INT_PTR CALLBACK AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advanced.c:423
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define IDD_PROPPAGEHARDWARE
Definition: resource.h:80
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Variable Documentation

◆ Applets

APPLET Applets[NUM_APPLETS]
Initial value:
=
{
}
#define IDI_CPLSYSTEM
Definition: resource.h:4
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define IDS_CPLSYSTEMDESCRIPTION
Definition: resource.h:24
LONG CALLBACK SystemApplet(VOID)
Definition: sysdm.c:143

Definition at line 20 of file sysdm.c.

Referenced by CPlApplet().

◆ hApplet

HINSTANCE hApplet = 0

Definition at line 16 of file sysdm.c.

Referenced by DllMain(), InitPropSheetPage(), PropSheetProc(), and SystemApplet().

◆ hCPLWindow

HWND hCPLWindow

Definition at line 17 of file sysdm.c.

Referenced by CPlApplet(), and SystemApplet().