ReactOS  0.4.13-dev-551-gf37fb1f
setup.cpp File Reference
#include "precomp.h"
#include <syssetup/syssetup.h>
Include dependency graph for setup.cpp:

Go to the source code of this file.

Classes

struct  _NETWORKSETUPDATA
 

Macros

#define NETWORK_SETUP_MAGIC   0x50515253
 

Typedefs

typedef struct _NETWORKSETUPDATA NETWORKSETUPDATA
 
typedef struct _NETWORKSETUPDATAPNETWORKSETUPDATA
 

Functions

static VOID SetBoldText (HWND hwndDlg, INT control, PSETUPDATA pSetupData)
 
static HRESULT InstallTypicalNetworkSettings (VOID)
 
static INT_PTR CALLBACK NetworkSettingsPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK NetworkComponentPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK NetworkDomainPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
DWORD WINAPI NetSetupRequestWizardPages (PDWORD pPageCount, HPROPSHEETPAGE *pPages, PSETUPDATA pSetupData)
 

Macro Definition Documentation

◆ NETWORK_SETUP_MAGIC

#define NETWORK_SETUP_MAGIC   0x50515253

Definition at line 13 of file setup.cpp.

Typedef Documentation

◆ NETWORKSETUPDATA

◆ PNETWORKSETUPDATA

Function Documentation

◆ InstallTypicalNetworkSettings()

static HRESULT InstallTypicalNetworkSettings ( VOID  )
static

Definition at line 41 of file setup.cpp.

42 {
43  INetCfg *pNetCfg = NULL;
44  INetCfgLock *pNetCfgLock = NULL;
45  INetCfgComponent *pTcpipComponent = NULL;
46  INetCfgComponent *pNicComponent = NULL;
47  IEnumNetCfgComponent *pEnumNicComponents = NULL;
48  WCHAR *pszNicName;
49  BOOL fWriteLocked = FALSE, fInitialized = FALSE;
50  HRESULT hr;
51 
52  TRACE("InstallTypicalNetworkSettings()\n");
53 
54  hr = CoInitialize(NULL);
55  if (hr != S_OK)
56  {
57  ERR("CoInitialize failed\n");
58  goto exit;
59  }
60 
62  NULL,
63  CLSCTX_INPROC_SERVER,
65  (PVOID*)&pNetCfg);
66  if (hr != S_OK)
67  {
68  ERR("CoCreateInstance failed\n");
69  goto exit;
70  }
71 
72  /* Acquire the write-lock */
73  hr = pNetCfg->QueryInterface(IID_INetCfgLock,
74  (PVOID*)&pNetCfgLock);
75  if (hr != S_OK)
76  {
77  ERR("QueryInterface failed\n");
78  goto exit;
79  }
80 
81  hr = pNetCfgLock->AcquireWriteLock(5000,
82  L"SysSetup",
83  NULL);
84  if (hr != S_OK)
85  {
86  ERR("AcquireWriteLock failed\n");
87  goto exit;
88  }
89 
90  fWriteLocked = TRUE;
91 
92  /* Initialize the network configuration */
93  hr = pNetCfg->Initialize(NULL);
94  if (hr != S_OK)
95  {
96  ERR("Initialize failed\n");
97  goto exit;
98  }
99 
100  fInitialized = TRUE;
101 
102  /* Find the TCP/IP driver */
103  hr = pNetCfg->FindComponent(L"ms_tcpip",
104  &pTcpipComponent);
105  if (hr == S_OK)
106  {
107  FIXME("Found the TCP/IP driver!\n");
108  }
109  else
110  {
111  ERR("Initialize failed\n");
112  goto exit;
113  }
114 
115  hr = pNetCfg->EnumComponents(&GUID_DEVCLASS_NET,
116  &pEnumNicComponents);
117  if (hr != S_OK)
118  {
119  ERR("EnumComponents failed\n");
120  goto exit;
121  }
122 
123  for (;;)
124  {
125  hr = pEnumNicComponents->Next(1,
126  &pNicComponent,
127  NULL);
128  if (hr != S_OK)
129  {
130  TRACE("EnumNicComponents done!\n");
131  break;
132  }
133 
134  hr = pNicComponent->GetDisplayName(&pszNicName);
135  if (hr == S_OK)
136  {
137  FIXME("NIC name: %S\n", pszNicName);
138  CoTaskMemFree(pszNicName);
139  }
140 
141  // FIXME Bind Tcpip to the NIC
142 
143  pNicComponent->Release();
144  pNicComponent = NULL;
145  }
146 
147  TRACE("Done!\n");
148 exit:
149  if (pNicComponent != NULL)
150  pNicComponent->Release();
151 
152  if (pEnumNicComponents != NULL)
153  pEnumNicComponents->Release();
154 
155  if (pTcpipComponent != NULL)
156  pTcpipComponent->Release();
157 
158  if (fInitialized)
159  pNetCfg->Uninitialize();
160 
161  if (fWriteLocked)
162  pNetCfgLock->ReleaseWriteLock();
163 
164  if (pNetCfgLock != NULL)
165  pNetCfgLock->Release();
166 
167  if (pNetCfg != NULL)
168  pNetCfg->Release();
169 
170  CoUninitialize();
171 
172  TRACE("InstallTypicalNetworkSettings() done!\n");
173 
174  return hr;
175 }
#define TRUE
Definition: types.h:120
EXTERN_C const IID IID_INetCfgLock
Definition: netcfgx.h:14
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT hr
Definition: shlfolder.c:183
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
EXTERN_C const IID IID_INetCfg
Definition: netcfgx.h:300
EXTERN_C const GUID CLSID_CNetCfg
Definition: netcfgx.h:299
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
nsrefcnt Release()
static const WCHAR L[]
Definition: oid.c:1250
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
void exit(int exitcode)
Definition: _exit.c:33

Referenced by NetworkSettingsPageDlgProc().

◆ NetSetupRequestWizardPages()

DWORD WINAPI NetSetupRequestWizardPages ( PDWORD  pPageCount,
HPROPSHEETPAGE pPages,
PSETUPDATA  pSetupData 
)

Definition at line 455 of file setup.cpp.

459 {
460  PNETWORKSETUPDATA pNetworkSetupData;
461  PROPSHEETPAGE psp = {0};
462  DWORD dwPageCount = 3;
463  INT nPage = 0;
464 
465  if (pPageCount == NULL)
467 
468  if (pPages == NULL)
469  {
470  *pPageCount = dwPageCount;
471  return ERROR_SUCCESS;
472  }
473 
474  if (*pPageCount < dwPageCount)
475  return ERROR_BUFFER_OVERFLOW;
476 
478 
480  if (pNetworkSetupData == NULL)
481  return ERROR_OUTOFMEMORY;
482 
483  pNetworkSetupData->dwMagic = NETWORK_SETUP_MAGIC;
484  pNetworkSetupData->pSetupData = pSetupData;
485 
486 
487  /* Create the Network Settings page */
488  psp.dwSize = sizeof(PROPSHEETPAGE);
490  psp.lParam = (LPARAM)pNetworkSetupData;
491 
492  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
493  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_NETWORKSETTINGSTITLE);
494  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_NETWORKSETTINGSSUBTITLE);
495  psp.pfnDlgProc = NetworkSettingsPageDlgProc;
496  psp.pszTemplate = MAKEINTRESOURCE(IDD_NETWORKSETTINGSPAGE);
497  pPages[nPage++] = CreatePropertySheetPage(&psp);
498 
499  /* Create the Network Components page */
500  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
501  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_NETWORKCOMPONENTTITLE);
502  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_NETWORKCOMPONENTSUBTITLE);
503  psp.pfnDlgProc = NetworkComponentPageDlgProc;
504  psp.pszTemplate = MAKEINTRESOURCE(IDD_NETWORKCOMPONENTPAGE);
505  pPages[nPage++] = CreatePropertySheetPage(&psp);
506 
507  /* Create the Domain/Workgroup page */
508  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
509  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_NETWORKDOMAINTITLE);
510  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_NETWORKDOMAINSUBTITLE);
511  psp.pfnDlgProc = NetworkDomainPageDlgProc;
512  psp.pszTemplate = MAKEINTRESOURCE(IDD_NETWORKDOMAINPAGE);
513  pPages[nPage++] = CreatePropertySheetPage(&psp);
514 
515  *pPageCount = dwPageCount;
516 
517  return ERROR_SUCCESS;
518 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define MAKEINTRESOURCE
Definition: winuser.h:591
static INT_PTR CALLBACK NetworkDomainPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: setup.cpp:337
#define IDS_NETWORKCOMPONENTTITLE
Definition: resource.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDS_NETWORKDOMAINTITLE
Definition: resource.h:122
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
struct _NETWORKSETUPDATA NETWORKSETUPDATA
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
int32_t INT
Definition: typedefs.h:56
#define IDS_NETWORKSETTINGSTITLE
Definition: resource.h:118
#define NETWORK_SETUP_MAGIC
Definition: setup.cpp:13
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_NETWORKSETTINGSSUBTITLE
Definition: resource.h:119
#define CreatePropertySheetPage
Definition: prsht.h:381
struct _NETWORKSETUPDATA * PNETWORKSETUPDATA
#define PSP_DEFAULT
Definition: prsht.h:22
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IDS_NETWORKDOMAINSUBTITLE
Definition: resource.h:123
HINSTANCE hInstance
Definition: reactos.h:114
UINT uFirstNetworkWizardPage
Definition: syssetup.h:72
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDD_NETWORKSETTINGSPAGE
Definition: resource.h:55
#define IDS_NETWORKCOMPONENTSUBTITLE
Definition: resource.h:121
#define IDD_NETWORKCOMPONENTPAGE
Definition: resource.h:59
static INT_PTR CALLBACK NetworkComponentPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: setup.cpp:269
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define IDD_NETWORKDOMAINPAGE
Definition: resource.h:66
PSETUPDATA pSetupData
Definition: setup.cpp:21
#define PROPSHEETPAGE
Definition: prsht.h:371
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
static INT_PTR CALLBACK NetworkSettingsPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: setup.cpp:181

◆ NetworkComponentPageDlgProc()

static INT_PTR CALLBACK NetworkComponentPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 269 of file setup.cpp.

274 {
275  PNETWORKSETUPDATA pNetworkSetupData;
276  PSETUPDATA pSetupData;
277  LPNMHDR lpnm;
278 
279  /* Retrieve pointer to the global setup data */
280  pNetworkSetupData = (PNETWORKSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
281  if ((pNetworkSetupData != NULL) &&
282  (pNetworkSetupData->dwMagic == NETWORK_SETUP_MAGIC))
283  pSetupData = pNetworkSetupData->pSetupData;
284 
285  switch (uMsg)
286  {
287  case WM_INITDIALOG:
288  /* Save pointer to the global setup data */
289  pNetworkSetupData = (PNETWORKSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
290  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pNetworkSetupData);
291  pSetupData = pNetworkSetupData->pSetupData;
292 
293  SetBoldText(hwndDlg, IDC_NETWORK_DEVICE, pSetupData);
294 
295  if (pSetupData->UnattendSetup)
296  {
297  //...
298  }
299  break;
300 
301  case WM_DESTROY:
302  /* ATTENTION: Free pNetworkSetupData only in one of the page functions!!! */
303  //...
304  break;
305 
306  case WM_NOTIFY:
307  lpnm = (LPNMHDR)lParam;
308 
309  switch (lpnm->code)
310  {
311  case PSN_SETACTIVE:
312  /* Enable the Back and Next buttons */
314  if (pSetupData->UnattendSetup)
315  {
317  return TRUE;
318  }
319  break;
320 
321  case PSN_WIZBACK:
322  pSetupData->UnattendSetup = FALSE;
323  break;
324  }
325  break;
326 
327  default:
328  break;
329  }
330 
331  return FALSE;
332 }
#define TRUE
Definition: types.h:120
#define PSWIZB_NEXT
Definition: prsht.h:154
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3112
#define IDC_NETWORK_DEVICE
Definition: resource.h:61
#define GWLP_USERDATA
Definition: treelist.c:63
#define NETWORK_SETUP_MAGIC
Definition: setup.cpp:13
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define WM_DESTROY
Definition: winuser.h:1591
static VOID SetBoldText(HWND hwndDlg, INT control, PSETUPDATA pSetupData)
Definition: setup.cpp:30
struct _NETWORKSETUPDATA * PNETWORKSETUPDATA
#define PSWIZB_BACK
Definition: prsht.h:153
uint32_t DWORD_PTR
Definition: typedefs.h:63
HWND WINAPI GetParent(_In_ HWND)
#define PSN_WIZBACK
Definition: prsht.h:120
#define IDD_NETWORKDOMAINPAGE
Definition: resource.h:66
BOOL UnattendSetup
Definition: syssetup.h:60
PSETUPDATA pSetupData
Definition: setup.cpp:21
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by NetSetupRequestWizardPages().

◆ NetworkDomainPageDlgProc()

static INT_PTR CALLBACK NetworkDomainPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 337 of file setup.cpp.

342 {
343  PNETWORKSETUPDATA pNetworkSetupData;
344  PSETUPDATA pSetupData;
345  WCHAR DomainName[51];
346  WCHAR Title[64];
347  WCHAR ErrorName[256];
348  LPNMHDR lpnm;
349 
350  /* Retrieve pointer to the global setup data */
351  pNetworkSetupData = (PNETWORKSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
352  if ((pNetworkSetupData != NULL) &&
353  (pNetworkSetupData->dwMagic == NETWORK_SETUP_MAGIC))
354  pSetupData = pNetworkSetupData->pSetupData;
355 
356  switch (uMsg)
357  {
358  case WM_INITDIALOG:
359  /* Save pointer to the global setup data */
360  pNetworkSetupData = (PNETWORKSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
361  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pNetworkSetupData);
362  pSetupData = pNetworkSetupData->pSetupData;
363 
364  /* Set the workgroup option as the default */
366 
367  wcscpy(DomainName, L"WORKGROUP");
368 
369  /* Display current computer name */
370  SetDlgItemTextW(hwndDlg, IDC_DOMAIN_NAME, DomainName);
371 
372  /* Set focus to owner name */
374 
375  if (pSetupData->UnattendSetup)
376  {
377  //...
378  }
379  break;
380 
381  case WM_DESTROY:
382  //...
383  /* ATTENTION: Free pNetworkSetupData only in one of the page functions!!! */
384  if (pNetworkSetupData != NULL)
385  {
386  if ((!IsBadReadPtr(pNetworkSetupData, sizeof(NETWORKSETUPDATA))) &&
387  (pNetworkSetupData->dwMagic == NETWORK_SETUP_MAGIC))
388  HeapFree(GetProcessHeap(), 0, pNetworkSetupData);
389 
391  }
392  break;
393 
394  case WM_NOTIFY:
395  lpnm = (LPNMHDR)lParam;
396 
397  switch (lpnm->code)
398  {
399  case PSN_SETACTIVE:
400  /* Enable the Back and Next buttons */
402  if (pSetupData->UnattendSetup)
403  {
405  return TRUE;
406  }
407  break;
408 
409  case PSN_WIZNEXT:
410  DomainName[0] = 0;
411  if (GetDlgItemTextW(hwndDlg, IDC_DOMAIN_NAME, DomainName, 50) == 0)
412  {
413  if (0 == LoadStringW(netshell_hInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0])))
414  {
415  wcscpy(Title, L"ReactOS Setup");
416  }
417  if (0 == LoadStringW(netshell_hInstance, IDS_WZD_DOMAIN_NAME, ErrorName, sizeof(ErrorName) / sizeof(ErrorName[0])))
418  {
419  wcscpy(ErrorName, L"Setup cannot continue until you\nenter the name of your domain/workgroup.");
420  }
421  MessageBoxW(hwndDlg, ErrorName, Title, MB_ICONERROR | MB_OK);
422 
424  SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
425 
426  //TODO: Implement setting the Domain/Workgroup
427 
428  return TRUE;
429  }
430  break;
431 
432  case PSN_WIZBACK:
433  pSetupData->UnattendSetup = FALSE;
434 
435  /* If the Typical setup chosen, then skip back to the Settings Page */
436  if (pNetworkSetupData->bTypicalNetworkSetup == TRUE)
437  {
439  return TRUE;
440  }
441  break;
442  }
443  break;
444 
445  default:
446  break;
447  }
448 
449  return FALSE;
450 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2195
#define TRUE
Definition: types.h:120
#define IDS_REACTOS_SETUP
Definition: resource.h:124
#define PSWIZB_NEXT
Definition: prsht.h:154
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5708
#define PSN_SETACTIVE
Definition: prsht.h:115
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL bTypicalNetworkSetup
Definition: setup.cpp:18
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
UINT code
Definition: winuser.h:3112
#define IDC_SELECT_WORKGROUP
Definition: resource.h:67
#define GWLP_USERDATA
Definition: treelist.c:63
#define NETWORK_SETUP_MAGIC
Definition: setup.cpp:13
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define WM_DESTROY
Definition: winuser.h:1591
struct _NETWORKSETUPDATA * PNETWORKSETUPDATA
#define BM_SETCHECK
Definition: winuser.h:1882
UINT uPostNetworkWizardPage
Definition: syssetup.h:73
static const WCHAR Title[]
Definition: oid.c:1259
#define GetProcessHeap()
Definition: compat.h:395
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PSWIZB_BACK
Definition: prsht.h:153
#define IDD_NETWORKSETTINGSPAGE
Definition: resource.h:55
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
uint32_t DWORD_PTR
Definition: typedefs.h:63
HWND WINAPI GetParent(_In_ HWND)
#define IDS_WZD_DOMAIN_NAME
Definition: resource.h:125
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
#define MB_OK
Definition: winuser.h:784
#define IDC_DOMAIN_NAME
Definition: resource.h:69
#define BST_CHECKED
Definition: winuser.h:197
#define PSN_WIZBACK
Definition: prsht.h:120
BOOL UnattendSetup
Definition: syssetup.h:60
PSETUPDATA pSetupData
Definition: setup.cpp:21
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:394
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by NetSetupRequestWizardPages().

◆ NetworkSettingsPageDlgProc()

static INT_PTR CALLBACK NetworkSettingsPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 181 of file setup.cpp.

186 {
187  PNETWORKSETUPDATA pNetworkSetupData;
188  PSETUPDATA pSetupData;
189  LPNMHDR lpnm;
190 
191  /* Retrieve pointer to the global setup data */
192  pNetworkSetupData = (PNETWORKSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
193  if ((pNetworkSetupData != NULL) &&
194  (pNetworkSetupData->dwMagic == NETWORK_SETUP_MAGIC))
195  pSetupData = pNetworkSetupData->pSetupData;
196 
197  switch (uMsg)
198  {
199  case WM_INITDIALOG:
200  /* Save pointer to the global setup data */
201  pNetworkSetupData = (PNETWORKSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
202  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pNetworkSetupData);
203  pSetupData = pNetworkSetupData->pSetupData;
204 
205  /* Set the fonts of both the options to bold */
206  SetBoldText(hwndDlg, IDC_NETWORK_TYPICAL, pSetupData);
207  SetBoldText(hwndDlg, IDC_NETWORK_CUSTOM, pSetupData);
208 
209  /* Set the typical settings option as the default */
211 
212  if (pSetupData->UnattendSetup)
213  {
214  //...
215  }
216  break;
217 
218  case WM_DESTROY:
219  /* ATTENTION: Free pNetworkSetupData only in one of the page functions!!! */
220  //...
221  break;
222 
223  case WM_NOTIFY:
224  lpnm = (LPNMHDR)lParam;
225 
226  switch (lpnm->code)
227  {
228  case PSN_SETACTIVE:
229  /* Enable the Back and Next buttons */
231  if (pSetupData->UnattendSetup)
232  {
234  return TRUE;
235  }
236  break;
237 
238  case PSN_WIZNEXT:
239  pNetworkSetupData->bTypicalNetworkSetup = FALSE;
240 
241  /* If the Typical Settings button is chosen, then skip to the Domain Page */
243  {
244  pNetworkSetupData->bTypicalNetworkSetup = TRUE;
245 
247 
249  return TRUE;
250  }
251  break;
252 
253  case PSN_WIZBACK:
254  pSetupData->UnattendSetup = FALSE;
255  break;
256  }
257  break;
258 
259  default:
260  break;
261  }
262 
263  return FALSE;
264 }
#define TRUE
Definition: types.h:120
#define IDC_NETWORK_CUSTOM
Definition: resource.h:57
#define PSWIZB_NEXT
Definition: prsht.h:154
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5708
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL bTypicalNetworkSetup
Definition: setup.cpp:18
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
static HRESULT InstallTypicalNetworkSettings(VOID)
Definition: setup.cpp:41
UINT code
Definition: winuser.h:3112
#define GWLP_USERDATA
Definition: treelist.c:63
#define NETWORK_SETUP_MAGIC
Definition: setup.cpp:13
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_DESTROY
Definition: winuser.h:1591
static VOID SetBoldText(HWND hwndDlg, INT control, PSETUPDATA pSetupData)
Definition: setup.cpp:30
struct _NETWORKSETUPDATA * PNETWORKSETUPDATA
#define BM_SETCHECK
Definition: winuser.h:1882
#define PSWIZB_BACK
Definition: prsht.h:153
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define IDC_NETWORK_TYPICAL
Definition: resource.h:56
HWND WINAPI GetParent(_In_ HWND)
#define IDD_NETWORKCOMPONENTPAGE
Definition: resource.h:59
#define BST_CHECKED
Definition: winuser.h:197
#define PSN_WIZBACK
Definition: prsht.h:120
#define IDD_NETWORKDOMAINPAGE
Definition: resource.h:66
BOOL UnattendSetup
Definition: syssetup.h:60
PSETUPDATA pSetupData
Definition: setup.cpp:21
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by NetSetupRequestWizardPages().

◆ SetBoldText()

static VOID SetBoldText ( HWND  hwndDlg,
INT  control,
PSETUPDATA  pSetupData 
)
static

Definition at line 30 of file setup.cpp.

34 {
35  SendDlgItemMessageW(hwndDlg, control, WM_SETFONT, (WPARAM)pSetupData->hBoldFont, MAKELPARAM(TRUE, 0));
36 }
#define TRUE
Definition: types.h:120
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HFONT hBoldFont
Definition: syssetup.h:51
#define WM_SETFONT
Definition: winuser.h:1632

Referenced by NetworkComponentPageDlgProc(), and NetworkSettingsPageDlgProc().