ReactOS 0.4.15-dev-7931-gfd331f1
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:3152
#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:26
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:3862
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by SystemApplet().

◆ CPlApplet()

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

Definition at line 209 of file sysdm.c.

213{
214 UINT i = (UINT)lParam1;
215
216 UNREFERENCED_PARAMETER(hwndCPl);
217
218 switch (uMsg)
219 {
220 case CPL_INIT:
221 return TRUE;
222
223 case CPL_GETCOUNT:
224 return NUM_APPLETS;
225
226 case CPL_INQUIRE:
227 if (i < NUM_APPLETS)
228 {
229 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
230 CPlInfo->lData = 0;
231 CPlInfo->idIcon = Applets[i].idIcon;
232 CPlInfo->idName = Applets[i].idName;
233 CPlInfo->idInfo = Applets[i].idDescription;
234 }
235 else
236 {
237 return TRUE;
238 }
239 break;
240
241 case CPL_DBLCLK:
242 if (i < NUM_APPLETS)
243 Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
244 else
245 return TRUE;
246 break;
247
248 case CPL_STARTWPARMSW:
249 if (i < NUM_APPLETS)
250 return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
251 break;
252 }
253
254 return FALSE;
255}
#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:317
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 259 of file sysdm.c.

262{
264
265 switch (dwReason)
266 {
269 hApplet = hinstDLL;
270 break;
271 }
272
273 return TRUE;
274}
DWORD dwReason
Definition: misc.cpp:154
#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 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
#define ZeroMemory
Definition: winbase.h:1712
#define MAKEINTRESOURCE
Definition: winuser.h:591

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:84
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:2075
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:58
#define args
Definition: format.c:66
#define _countof(array)
Definition: sndvol32.h:68
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 LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
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 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
168 psh.dwSize = sizeof(PROPSHEETHEADER);
170 psh.hwndParent = hwnd;
171 psh.hInstance = hApplet;
172 psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLSYSTEM);
173 psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
174 psh.nPages = 0;
175 psh.nStartPage = 0;
176 psh.phpage = hpsp;
177 psh.pfnCallback = PropSheetProc;
178
180 hNetIdDll = AddNetIdPage(&psh);
183
184 /* Load additional pages provided by shell extensions */
186 if (hpsxa != NULL)
187 {
189 }
190
191 if (nPage != 0 && nPage <= psh.nPages)
192 psh.nStartPage = nPage;
193
194 Ret = (LONG)(PropertySheet(&psh) != -1);
195
196 if (hpsxa != NULL)
197 {
199 }
200
201 if (hNetIdDll != NULL)
202 FreeLibrary(hNetIdDll);
203
204 return Ret;
205}
INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#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:18
INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardware.c:68
#define IDD_PROPPAGEHARDWARE
Definition: resource.h:86
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
long LONG
Definition: pedump.c:60
#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
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2190
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:2013
HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface)
Definition: shellord.c:2043
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().