ReactOS 0.4.16-dev-1946-g52006dd
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 __cdecl ResourceMessageBox (_In_opt_ HINSTANCE hInstance, _In_opt_ 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 93 of file sysdm.c.

Function Documentation

◆ AddNetIdPage()

static HMODULE AddNetIdPage ( PROPSHEETHEADER ppsh)
static

Definition at line 96 of file sysdm.c.

97{
98 HPROPSHEETPAGE hPage;
99 HMODULE hMod;
100 PCreateNetIDPropertyPage pCreateNetIdPage;
101
102 hMod = LoadLibrary(TEXT("netid.dll"));
103 if (hMod != NULL)
104 {
105 pCreateNetIdPage = (PCreateNetIDPropertyPage)GetProcAddress(hMod,
106 "CreateNetIDPropertyPage");
107 if (pCreateNetIdPage != NULL)
108 {
109 hPage = pCreateNetIdPage();
110 if (hPage == NULL)
111 goto Fail;
112
113 if (!PropSheetAddPage(hPage, (LPARAM)ppsh))
114 {
116 goto Fail;
117 }
118 }
119 else
120 {
121Fail:
122 FreeLibrary(hMod);
123 hMod = NULL;
124 }
125 }
126
127 return hMod;
128}
#define NULL
Definition: types.h:112
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
int Fail
Definition: ehthrow.cxx:24
#define TEXT(s)
Definition: k32.h:28
LONG_PTR LPARAM
Definition: minwindef.h:175
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: sysdm.c:56
HPROPSHEETPAGE(WINAPI * PCreateNetIDPropertyPage)(VOID)
Definition: sysdm.c:93
#define LoadLibrary
Definition: winbase.h:3611

Referenced by SystemApplet().

◆ CPlApplet()

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

Definition at line 215 of file sysdm.c.

219{
220 UINT i = (UINT)lParam1;
221
222 UNREFERENCED_PARAMETER(hwndCPl);
223
224 switch (uMsg)
225 {
226 case CPL_INIT:
227 return TRUE;
228
229 case CPL_GETCOUNT:
230 return NUM_APPLETS;
231
232 case CPL_INQUIRE:
233 if (i < NUM_APPLETS)
234 {
235 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
236 CPlInfo->lData = 0;
237 CPlInfo->idIcon = Applets[i].idIcon;
238 CPlInfo->idName = Applets[i].idName;
239 CPlInfo->idInfo = Applets[i].idDescription;
240 }
241 else
242 {
243 return TRUE;
244 }
245 break;
246
247 case CPL_DBLCLK:
248 if (i < NUM_APPLETS)
249 Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
250 else
251 return TRUE;
252 break;
253
254 case CPL_STARTWPARMSW:
255 if (i < NUM_APPLETS)
256 return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
257 break;
258 }
259
260 return FALSE;
261}
#define CPL_INQUIRE
Definition: cpl.h:14
#define CPL_DBLCLK
Definition: cpl.h:16
#define CPL_STARTWPARMSW
Definition: cpl.h:21
#define CPL_INIT
Definition: cpl.h:12
#define CPL_GETCOUNT
Definition: cpl.h:13
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NUM_APPLETS
Definition: access.c:14
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
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
int idDescription
Definition: hotplug.h:37
int idName
Definition: hotplug.h:36
int idIcon
Definition: hotplug.h:35
APPLET_PROC AppletProc
Definition: hotplug.h:38
Definition: cpl.h:24
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
int idInfo
Definition: cpl.h:27
int idIcon
Definition: cpl.h:25
APPLET Applets[NUM_APPLETS]
Definition: sysdm.c:18

◆ DllMain()

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

Definition at line 265 of file sysdm.c.

268{
270
271 switch (dwReason)
272 {
275 hApplet = hinstDLL;
276 break;
277 }
278
279 return TRUE;
280}
DWORD dwReason
Definition: misc.cpp:135
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_THREAD_ATTACH
Definition: compat.h:132
static IN DWORD IN LPVOID lpvReserved
HINSTANCE hApplet
Definition: sysdm.c:15

◆ InitPropSheetPage()

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

Definition at line 69 of file sysdm.c.

70{
71 HPROPSHEETPAGE hPage;
72 PROPSHEETPAGE psp;
73
74 if (ppsh->nPages < MAX_SYSTEM_PAGES)
75 {
76 ZeroMemory(&psp, sizeof(psp));
77 psp.dwSize = sizeof(psp);
78 psp.dwFlags = PSP_DEFAULT;
79 psp.hInstance = hApplet;
80 psp.pszTemplate = MAKEINTRESOURCE(idDlg);
81 psp.pfnDlgProc = DlgProc;
82
83 hPage = CreatePropertySheetPage(&psp);
84 if (hPage != NULL)
85 {
86 return PropSheetAddPage(hPage, (LPARAM)ppsh);
87 }
88 }
89
90 return FALSE;
91}
WORD idDlg
Definition: desk.c:121
DLGPROC DlgProc
Definition: desk.c:122
#define ZeroMemory
Definition: minwinbase.h:31
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSP_DEFAULT
Definition: prsht.h:22
#define PROPSHEETPAGE
Definition: prsht.h:389
#define MAX_SYSTEM_PAGES
Definition: sysdm.c:23

Referenced by SystemApplet().

◆ PropSheetAddPage()

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

Definition at line 56 of file sysdm.c.

57{
59 if (ppsh != NULL && ppsh->nPages < MAX_SYSTEM_PAGES)
60 {
61 ppsh->phpage[ppsh->nPages++] = hpage;
62 return TRUE;
63 }
64
65 return FALSE;
66}
LPARAM lParam
Definition: combotst.c:139
#define PROPSHEETHEADER
Definition: prsht.h:392

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

◆ PropSheetProc()

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

Definition at line 131 of file sysdm.c.

132{
133 // NOTE: This callback is needed to set large icon correctly.
134 HICON hIcon;
135 switch (uMsg)
136 {
137 case PSCB_INITIALIZED:
138 {
140 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
141 break;
142 }
143 }
144 return 0;
145}
#define IDI_CPLSYSTEM
Definition: resource.h:4
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ICON_BIG
Definition: tnclass.cpp:51
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2427
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by SystemApplet().

◆ ResourceMessageBox()

INT __cdecl ResourceMessageBox ( _In_opt_ HINSTANCE  hInstance,
_In_opt_ HWND  hwnd,
_In_ UINT  uType,
_In_ UINT  uCaption,
_In_ UINT  uText,
  ... 
)

Definition at line 27 of file sysdm.c.

34{
36 WCHAR szCaption[MAX_STR_LENGTH];
37 WCHAR szText[MAX_STR_LENGTH];
38 WCHAR szCookedText[2*MAX_STR_LENGTH];
39
40 LoadStringW(hInstance, uCaption, szCaption, _countof(szCaption));
41 LoadStringW(hInstance, uText, szText, _countof(szText));
42
43 va_start(args, uText);
44 StringCchVPrintfW(szCookedText, _countof(szCookedText),
45 szText, args);
46 va_end(args);
47
48 return MessageBoxW(hwnd,
49 szCookedText,
50 szCaption,
51 uType);
52}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
HINSTANCE hInstance
Definition: charmap.c:19
#define MAX_STR_LENGTH
Definition: precomp.h:60
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
#define args
Definition: format.c:66
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchVPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
Definition: strsafe.h:490
Definition: match.c:390
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ SystemApplet()

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

Definition at line 149 of file sysdm.c.

150{
152 PROPSHEETHEADER psh;
153 HMODULE hNetIdDll;
154 HPSXA hpsxa = NULL;
155 INT nPage = 0;
156 LONG Ret;
158
159 if (!InitCommonControlsEx(&icc))
160 return 0;
161
162 if (uMsg == CPL_STARTWPARMSW && lParam != 0)
163 {
164 nPage = _wtoi((PWSTR)lParam);
165 }
166
167 if (nPage == -1)
168 {
170 return TRUE;
171 }
172
173 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
174 psh.dwSize = sizeof(PROPSHEETHEADER);
176 psh.hwndParent = hwnd;
177 psh.hInstance = hApplet;
178 psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLSYSTEM);
179 psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
180 psh.nPages = 0;
181 psh.nStartPage = 0;
182 psh.phpage = hpsp;
183 psh.pfnCallback = PropSheetProc;
184
186 hNetIdDll = AddNetIdPage(&psh);
189
190 /* Load additional pages provided by shell extensions */
192 if (hpsxa != NULL)
193 {
195 }
196
197 if (nPage != 0 && nPage <= psh.nPages)
198 psh.nStartPage = nPage;
199
200 Ret = (LONG)(PropertySheet(&psh) != -1);
201
202 if (hpsxa != NULL)
203 {
205 }
206
207 if (hNetIdDll != NULL)
208 FreeLibrary(hNetIdDll);
209
210 return Ret;
211}
INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define IDD_PROPPAGEGENERAL
Definition: resource.h:10
INT_PTR CALLBACK AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advanced.c:422
#define IDD_PROPPAGEADVANCED
Definition: resource.h:57
INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardware.c:68
#define IDD_PROPPAGEHARDWARE
Definition: resource.h:88
long LONG
Definition: pedump.c:60
VOID ShowPerformanceOptions(HWND hDlg)
Definition: performance.c:137
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PropertySheet
Definition: prsht.h:400
#define PSH_USEICONID
Definition: prsht.h:42
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define REGSTR_PATH_CONTROLSFOLDER
Definition: regstr.h:76
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2396
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:2219
HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface)
Definition: shellord.c:2249
static BOOL InitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc)
Definition: sysdm.c:69
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: sysdm.c:131
static HMODULE AddNetIdPage(PROPSHEETHEADER *ppsh)
Definition: sysdm.c:96
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Variable Documentation

◆ Applets

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

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().