ReactOS  0.4.15-dev-1018-g0695ecb
sysdm.c File Reference
#include "precomp.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

static LONG APIENTRY SystemApplet (HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 
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
 
APPLET Applets [NUM_APPLETS]
 

Macro Definition Documentation

◆ MAX_SYSTEM_PAGES

#define MAX_SYSTEM_PAGES   32

Definition at line 23 of file sysdm.c.

Typedef Documentation

◆ PCreateNetIDPropertyPage

typedef HPROPSHEETPAGE(WINAPI * PCreateNetIDPropertyPage) (VOID)

Definition at line 85 of file sysdm.c.

Function Documentation

◆ AddNetIdPage()

static HMODULE AddNetIdPage ( PROPSHEETHEADER ppsh)
static

Definition at line 88 of file sysdm.c.

89 {
90  HPROPSHEETPAGE hPage;
91  HMODULE hMod;
92  PCreateNetIDPropertyPage pCreateNetIdPage;
93 
94  hMod = LoadLibrary(TEXT("netid.dll"));
95  if (hMod != NULL)
96  {
97  pCreateNetIdPage = (PCreateNetIDPropertyPage)GetProcAddress(hMod,
98  "CreateNetIDPropertyPage");
99  if (pCreateNetIdPage != NULL)
100  {
101  hPage = pCreateNetIdPage();
102  if (hPage == NULL)
103  goto Fail;
104 
105  if (!PropSheetAddPage(hPage, (LPARAM)ppsh))
106  {
108  goto Fail;
109  }
110  }
111  else
112  {
113 Fail:
114  FreeLibrary(hMod);
115  hMod = NULL;
116  }
117  }
118 
119  return hMod;
120 }
#define LoadLibrary
Definition: winbase.h:3702
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3144
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:496
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: sysdm.c:48
HPROPSHEETPAGE(WINAPI * PCreateNetIDPropertyPage)(VOID)
Definition: sysdm.c:85
Definition: hiveinit.c:368
#define TEXT(s)
Definition: k32.h:26
#define GetProcAddress(x, y)
Definition: compat.h:501

Referenced by SystemApplet().

◆ CPlApplet()

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

Definition at line 201 of file sysdm.c.

205 {
206  INT i = (INT)lParam1;
207 
208  UNREFERENCED_PARAMETER(hwndCPl);
209 
210  switch (uMsg)
211  {
212  case CPL_INIT:
213  return TRUE;
214 
215  case CPL_GETCOUNT:
216  return NUM_APPLETS;
217 
218  case CPL_INQUIRE:
219  {
220  CPLINFO *CPlInfo = (CPLINFO*)lParam2;
221  CPlInfo->lData = 0;
222  CPlInfo->idIcon = Applets[i].idIcon;
223  CPlInfo->idName = Applets[i].idName;
224  CPlInfo->idInfo = Applets[i].idDescription;
225  }
226  break;
227 
228  case CPL_DBLCLK:
229  Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
230  break;
231 
232  case CPL_STARTWPARMSW:
233  return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
234 
235  }
236 
237  return FALSE;
238 }
Definition: cpl.h:24
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
int idName
Definition: hotplug.h:36
#define INT
Definition: polytest.cpp:20
int idIcon
Definition: hotplug.h:35
int idInfo
Definition: cpl.h:27
int32_t INT
Definition: typedefs.h:58
int idIcon
Definition: cpl.h:25
int idDescription
Definition: hotplug.h:37
#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
#define FALSE
Definition: types.h:117
APPLET_PROC AppletProc
Definition: hotplug.h:38
#define CPL_STARTWPARMSW
Definition: cpl.h:21
#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
#define NUM_APPLETS
Definition: access.c:14
#define CPL_GETCOUNT
Definition: cpl.h:13
APPLET Applets[NUM_APPLETS]
Definition: sysdm.c:18

◆ DllMain()

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

Definition at line 242 of file sysdm.c.

245 {
247 
248  switch (dwReason)
249  {
250  case DLL_PROCESS_ATTACH:
251  case DLL_THREAD_ATTACH:
252  hApplet = hinstDLL;
253  break;
254  }
255 
256  return TRUE;
257 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DLL_THREAD_ATTACH
Definition: compat.h:132
HINSTANCE hApplet
Definition: sysdm.c:15
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
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 61 of file sysdm.c.

62 {
63  HPROPSHEETPAGE hPage;
64  PROPSHEETPAGE psp;
65 
66  if (ppsh->nPages < MAX_SYSTEM_PAGES)
67  {
68  ZeroMemory(&psp, sizeof(psp));
69  psp.dwSize = sizeof(psp);
70  psp.dwFlags = PSP_DEFAULT;
71  psp.hInstance = hApplet;
72  psp.pszTemplate = MAKEINTRESOURCE(idDlg);
73  psp.pfnDlgProc = DlgProc;
74 
75  hPage = CreatePropertySheetPage(&psp);
76  if (hPage != NULL)
77  {
78  return PropSheetAddPage(hPage, (LPARAM)ppsh);
79  }
80  }
81 
82  return FALSE;
83 }
WORD idDlg
Definition: desk.c:110
#define MAKEINTRESOURCE
Definition: winuser.h:591
HINSTANCE hApplet
Definition: sysdm.c:15
#define ZeroMemory
Definition: winbase.h:1648
#define FALSE
Definition: types.h:117
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:399
#define PSP_DEFAULT
Definition: prsht.h:22
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:23
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: sysdm.c:48
DLGPROC DlgProc
Definition: desk.c:111
#define PROPSHEETPAGE
Definition: prsht.h:389

Referenced by SystemApplet().

◆ PropSheetAddPage()

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

Definition at line 48 of file sysdm.c.

49 {
51  if (ppsh != NULL && ppsh->nPages < MAX_SYSTEM_PAGES)
52  {
53  ppsh->phpage[ppsh->nPages++] = hpage;
54  return TRUE;
55  }
56 
57  return FALSE;
58 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:392
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:23
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 123 of file sysdm.c.

124 {
125  // NOTE: This callback is needed to set large icon correctly.
126  HICON hIcon;
127  switch (uMsg)
128  {
129  case PSCB_INITIALIZED:
130  {
132  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
133  break;
134  }
135  }
136  return 0;
137 }
static HICON
Definition: imagelist.c:84
#define IDI_CPLSYSTEM
Definition: resource.h:4
HINSTANCE hApplet
Definition: sysdm.c:15
LONG_PTR LPARAM
Definition: windef.h:208
#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 27 of file sysdm.c.

33 {
34  WCHAR szCaption[256];
35  WCHAR szText[256];
36 
37  LoadStringW(hInstance, uCaption, szCaption, 256);
38  LoadStringW(hInstance, uText, szText, 256);
39 
40  return MessageBoxW(hwnd,
41  szText,
42  szCaption,
43  uType);
44 }
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()

static LONG APIENTRY SystemApplet ( HWND  hwnd,
UINT  uMsg,
LPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 141 of file sysdm.c.

142 {
144  PROPSHEETHEADER psh;
145  HMODULE hNetIdDll;
146  HPSXA hpsxa = NULL;
147  INT nPage = 0;
148  LONG Ret;
150 
151  if (!InitCommonControlsEx(&icc))
152  return 0;
153 
154  if (uMsg == CPL_STARTWPARMSW && lParam != 0)
155  {
156  nPage = _wtoi((PWSTR)lParam);
157  }
158 
159  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
160  psh.dwSize = sizeof(PROPSHEETHEADER);
161  psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
162  psh.hwndParent = hwnd;
163  psh.hInstance = hApplet;
164  psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLSYSTEM);
165  psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
166  psh.nPages = 0;
167  psh.nStartPage = 0;
168  psh.phpage = hpsp;
169  psh.pfnCallback = PropSheetProc;
170 
172  hNetIdDll = AddNetIdPage(&psh);
175 
176  /* Load additional pages provided by shell extensions */
178  if (hpsxa != NULL)
179  {
181  }
182 
183  if (nPage != 0 && nPage <= psh.nPages)
184  psh.nStartPage = nPage;
185 
186  Ret = (LONG)(PropertySheet(&psh) != -1);
187 
188  if (hpsxa != NULL)
189  {
191  }
192 
193  if (hNetIdDll != NULL)
194  FreeLibrary(hNetIdDll);
195 
196  return Ret;
197 }
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2162
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDI_CPLSYSTEM
Definition: resource.h:4
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:1984
uint16_t * PWSTR
Definition: typedefs.h:56
HINSTANCE hApplet
Definition: sysdm.c:15
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define REGSTR_PATH_CONTROLSFOLDER
Definition: regstr.h:76
#define ZeroMemory
Definition: winbase.h:1648
static HMODULE AddNetIdPage(PROPSHEETHEADER *ppsh)
Definition: sysdm.c:88
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: sysdm.c:123
#define PSH_USECALLBACK
Definition: prsht.h:48
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
int32_t INT
Definition: typedefs.h:58
#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:61
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:392
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define FreeLibrary(x)
Definition: compat.h:496
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:23
#define PSH_PROPTITLE
Definition: prsht.h:40
#define CPL_STARTWPARMSW
Definition: cpl.h:21
#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:48
#define TEXT(s)
Definition: k32.h:26
#define PropertySheet
Definition: prsht.h:400
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:2014
#define IDD_PROPPAGEADVANCED
Definition: resource.h:18
LPARAM lParam
Definition: combotst.c:139
INT_PTR CALLBACK AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advanced.c:422
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define IDD_PROPPAGEHARDWARE
Definition: resource.h:81
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Variable Documentation

◆ Applets

APPLET Applets[NUM_APPLETS]
Initial value:
=
{
}
#define IDI_CPLSYSTEM
Definition: resource.h:4
static LONG APIENTRY SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
Definition: sysdm.c:141
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define IDS_CPLSYSTEMDESCRIPTION
Definition: resource.h:24

Definition at line 18 of file sysdm.c.

Referenced by CPlApplet().

◆ hApplet

HINSTANCE hApplet = 0

Definition at line 15 of file sysdm.c.

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