ReactOS  r76032
reactos.c File Reference
#include "reactos.h"
#include "resource.h"
Include dependency graph for reactos.c:

Go to the source code of this file.

Functions

LONG LoadGenentry (HINF hinf, PCTSTR name, PGENENTRY *gen, PINFCONTEXT context)
 
static VOID CenterWindow (HWND hWnd)
 
static HFONT CreateTitleFont (VOID)
 
static INT_PTR CALLBACK StartDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TypeDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK DeviceDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK SummaryDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK ProcessDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK RestartDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL LoadSetupData (PSETUPDATA pSetupData)
 
BOOL isUnattendSetup (VOID)
 
int WINAPI _tWinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow)
 

Function Documentation

int WINAPI _tWinMain ( HINSTANCE  hInst,
HINSTANCE  hPrevInstance,
LPTSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 791 of file reactos.c.

795 {
796  PSETUPDATA pSetupData = NULL;
797  PROPSHEETHEADER psh;
798  HPROPSHEETPAGE ahpsp[8];
799  PROPSHEETPAGE psp = {0};
800  UINT nPages = 0;
801 
802  pSetupData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SETUPDATA));
803  if (pSetupData == NULL)
804  {
805  return 1;
806  }
807 
808  pSetupData->hInstance = hInst;
809  pSetupData->bUnattend = isUnattendSetup();
810 
811  LoadString(hInst,IDS_ABORTSETUP, pSetupData->szAbortMessage, sizeof(pSetupData->szAbortMessage)/sizeof(TCHAR));
812  LoadString(hInst,IDS_ABORTSETUP2, pSetupData->szAbortTitle, sizeof(pSetupData->szAbortTitle)/sizeof(TCHAR));
813 
814  /* Create title font */
815  pSetupData->hTitleFont = CreateTitleFont();
816 
817  if (!pSetupData->bUnattend)
818  {
819  if (!LoadSetupData(pSetupData))
820  {
821  HeapFree(GetProcessHeap(), 0, pSetupData);
822  return 0;
823  }
824 
825  /* Create the Start page, until setup is working */
826  psp.dwSize = sizeof(PROPSHEETPAGE);
827  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
828  psp.hInstance = hInst;
829  psp.lParam = (LPARAM)pSetupData;
830  psp.pfnDlgProc = StartDlgProc;
831  psp.pszTemplate = MAKEINTRESOURCE(IDD_STARTPAGE);
832  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
833 
834  /* Create install type selection page */
835  psp.dwSize = sizeof(PROPSHEETPAGE);
836  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
837  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_TYPETITLE);
838  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_TYPESUBTITLE);
839  psp.hInstance = hInst;
840  psp.lParam = (LPARAM)pSetupData;
841  psp.pfnDlgProc = TypeDlgProc;
842  psp.pszTemplate = MAKEINTRESOURCE(IDD_TYPEPAGE);
843  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
844 
845  /* Create device settings page */
846  psp.dwSize = sizeof(PROPSHEETPAGE);
847  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
848  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DEVICETITLE);
849  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DEVICESUBTITLE);
850  psp.hInstance = hInst;
851  psp.lParam = (LPARAM)pSetupData;
852  psp.pfnDlgProc = DeviceDlgProc;
853  psp.pszTemplate = MAKEINTRESOURCE(IDD_DEVICEPAGE);
854  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
855 
856  /* Create install device settings page / boot method / install directory */
857  psp.dwSize = sizeof(PROPSHEETPAGE);
858  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
859  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DRIVETITLE);
860  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DRIVESUBTITLE);
861  psp.hInstance = hInst;
862  psp.lParam = (LPARAM)pSetupData;
863  psp.pfnDlgProc = DriveDlgProc;
864  psp.pszTemplate = MAKEINTRESOURCE(IDD_DRIVEPAGE);
865  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
866 
867  /* Create summary page */
868  psp.dwSize = sizeof(PROPSHEETPAGE);
869  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
870  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SUMMARYTITLE);
871  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUMMARYSUBTITLE);
872  psp.hInstance = hInst;
873  psp.lParam = (LPARAM)pSetupData;
874  psp.pfnDlgProc = SummaryDlgProc;
875  psp.pszTemplate = MAKEINTRESOURCE(IDD_SUMMARYPAGE);
876  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
877  }
878 
879  /* Create installation progress page */
880  psp.dwSize = sizeof(PROPSHEETPAGE);
881  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
882  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
883  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
884  psp.hInstance = hInst;
885  psp.lParam = (LPARAM)pSetupData;
886  psp.pfnDlgProc = ProcessDlgProc;
887  psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
888  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
889 
890  /* Create finish to reboot page */
891  psp.dwSize = sizeof(PROPSHEETPAGE);
892  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
893  psp.hInstance = hInst;
894  psp.lParam = (LPARAM)pSetupData;
895  psp.pfnDlgProc = RestartDlgProc;
896  psp.pszTemplate = MAKEINTRESOURCE(IDD_RESTARTPAGE);
897  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
898 
899  /* Create the property sheet */
900  psh.dwSize = sizeof(PROPSHEETHEADER);
901  psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
902  psh.hInstance = hInst;
903  psh.hwndParent = NULL;
904  psh.nPages = nPages;
905  psh.nStartPage = 0;
906  psh.phpage = ahpsp;
907  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
908  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
909 
910  /* Display the wizard */
911  PropertySheet(&psh);
912 
913  if (pSetupData->hTitleFont)
914  DeleteObject(pSetupData->hTitleFont);
915 
916  HeapFree(GetProcessHeap(), 0, pSetupData);
917 
918 #if 0
919  EnableShutdownPrivilege();
921 #endif
922 
923  return 0;
924 }
#define IDS_DEVICESUBTITLE
Definition: resource.h:62
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDD_DRIVEPAGE
Definition: resource.h:29
#define IDS_ABORTSETUP2
Definition: resource.h:70
BOOL LoadSetupData(PSETUPDATA pSetupData)
Definition: reactos.c:499
#define IDS_PROCESSTITLE
Definition: resource.h:65
static INT_PTR CALLBACK TypeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:140
#define IDD_STARTPAGE
Definition: resource.h:14
#define IDS_ABORTSETUP
Definition: resource.h:69
TCHAR szAbortMessage[512]
Definition: reactos.h:72
static INT_PTR CALLBACK DeviceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:205
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define EWX_REBOOT
Definition: winuser.h:633
#define IDB_HEADER
Definition: resource.h:30
#define IDD_PROCESSPAGE
Definition: resource.h:38
static INT_PTR CALLBACK ProcessDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:373
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDS_DRIVETITLE
Definition: resource.h:63
#define IDS_PROCESSSUBTITLE
Definition: resource.h:66
BOOL bUnattend
Definition: reactos.h:68
BOOL isUnattendSetup(VOID)
Definition: reactos.c:706
smooth NULL
Definition: ftsmooth.c:557
#define PROPSHEETHEADER
Definition: prsht.h:374
#define IDS_DEVICETITLE
Definition: resource.h:61
#define IDD_DEVICEPAGE
Definition: resource.h:23
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:87
#define CreatePropertySheetPage
Definition: prsht.h:381
char TCHAR
Definition: xmlstorage.h:189
#define IDS_TYPETITLE
Definition: resource.h:59
#define PSP_DEFAULT
Definition: prsht.h:22
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HINSTANCE hInstance
Definition: reactos.h:67
#define IDD_RESTARTPAGE
Definition: resource.h:43
#define IDD_TYPEPAGE
Definition: resource.h:17
static HFONT CreateTitleFont(VOID)
Definition: reactos.c:62
INT_PTR CALLBACK DriveDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drivepage.c:145
TCHAR szAbortTitle[64]
Definition: reactos.h:73
#define IDS_DRIVESUBTITLE
Definition: resource.h:64
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
HINSTANCE hInst
Definition: dxdiag.c:13
#define IDS_SUMMARYSUBTITLE
Definition: resource.h:72
#define IDS_SUMMARYTITLE
Definition: resource.h:71
static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:323
#define IDB_WATERMARK
Definition: resource.h:4
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define PropertySheet
Definition: prsht.h:382
HFONT hTitleFont
Definition: reactos.h:70
#define IDS_TYPESUBTITLE
Definition: resource.h:60
static INT_PTR CALLBACK RestartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:425
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDD_SUMMARYPAGE
Definition: resource.h:55
#define LoadString
Definition: winuser.h:5664
#define PROPSHEETPAGE
Definition: prsht.h:371
#define LPARAM
Definition: msvc.h:38
static VOID CenterWindow ( HWND  hWnd)
static

Definition at line 39 of file reactos.c.

Referenced by ExplorerAboutDlg::ExplorerAboutDlg(), FindProgramDlg::FindProgramDlg(), MdiSdiDlg::MdiSdiDlg(), and StartDlgProc().

40 {
42  RECT rcParent;
43  RECT rcWindow;
44 
45  hWndParent = GetParent(hWnd);
46  if (hWndParent == NULL)
47  hWndParent = GetDesktopWindow();
48 
49  GetWindowRect(hWndParent, &rcParent);
50  GetWindowRect(hWnd, &rcWindow);
51 
53  HWND_TOP,
54  ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
55  ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
56  0,
57  0,
58  SWP_NOSIZE);
59 }
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:320
HANDLE HWND
Definition: compat.h:13
#define HWND_TOP
Definition: winuser.h:1183
LONG left
Definition: windef.h:319
LONG right
Definition: windef.h:321
smooth NULL
Definition: ftsmooth.c:557
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:623
#define SWP_NOSIZE
Definition: winuser.h:1220
HWND WINAPI GetParent(_In_ HWND)
LONG bottom
Definition: windef.h:322
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
static HFONT CreateTitleFont ( VOID  )
static

Definition at line 62 of file reactos.c.

Referenced by _tWinMain().

63 {
64  NONCLIENTMETRICS ncm;
65  LOGFONT LogFont;
66  HDC hdc;
67  INT FontSize;
68  HFONT hFont;
69 
70  ncm.cbSize = sizeof(NONCLIENTMETRICS);
71  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
72 
73  LogFont = ncm.lfMessageFont;
74  LogFont.lfWeight = FW_BOLD;
75  _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg"));
76 
77  hdc = GetDC(NULL);
78  FontSize = 12;
79  LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
80  hFont = CreateFontIndirect(&LogFont);
81  ReleaseDC(NULL, hdc);
82 
83  return hFont;
84 }
#define HDC
Definition: msvc.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
#define SystemParametersInfo
Definition: winuser.h:5703
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
#define _T(x)
Definition: tchar.h:1542
LONG lfHeight
Definition: dimm.idl:42
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
LONG lfWeight
Definition: dimm.idl:46
smooth NULL
Definition: ftsmooth.c:557
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:376
#define CreateFontIndirect
Definition: wingdi.h:4421
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define LOGPIXELSY
Definition: wingdi.h:717
static INT_PTR CALLBACK DeviceDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 205 of file reactos.c.

Referenced by _tWinMain().

209 {
210  PSETUPDATA pSetupData;
211  LONG i;
212  LRESULT tindex;
213  HWND hList;
214 
215  /* Retrieve pointer to the global setup data */
216  pSetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
217 
218  switch (uMsg)
219  {
220  case WM_INITDIALOG:
221  /* Save pointer to the global setup data */
222  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
223  SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pSetupData);
224 
225  hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
226 
227  for (i=0; i < pSetupData->CompCount; i++)
228  {
229  tindex = SendMessage(hList, CB_ADDSTRING, (WPARAM) 0, (LPARAM) pSetupData->pComputers[i].Value);
230  SendMessage(hList, CB_SETITEMDATA, tindex, i);
231  }
232  SendMessage(hList, CB_SETCURSEL, 0, 0); // set first as default
233 
234  hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
235 
236  for (i=0; i < pSetupData->DispCount; i++)
237  {
238  tindex = SendMessage(hList, CB_ADDSTRING, (WPARAM) 0, (LPARAM) pSetupData->pDisplays[i].Value);
239  SendMessage(hList, CB_SETITEMDATA, tindex, i);
240  }
241  SendMessage(hList, CB_SETCURSEL, 0, 0); // set first as default
242 
243  hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
244 
245  for (i=0; i < pSetupData->KeybCount; i++)
246  {
247  tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)pSetupData->pKeyboards[i].Value);
248  SendMessage(hList,CB_SETITEMDATA,tindex,i);
249  }
250  SendMessage(hList,CB_SETCURSEL,0,0); // set first as default
251  break;
252 
253  case WM_NOTIFY:
254  {
255  LPNMHDR lpnm = (LPNMHDR)lParam;
256 
257  switch (lpnm->code)
258  {
259  case PSN_SETACTIVE:
261  break;
262 
263  case PSN_QUERYCANCEL:
264  SetWindowLongPtr(hwndDlg,
266  MessageBox(GetParent(hwndDlg),
267  pSetupData->szAbortMessage,
268  pSetupData->szAbortTitle,
270  return TRUE;
271 
272  case PSN_WIZNEXT: // set the selected data
273  {
274  hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
275 
276  tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
277  if (tindex != CB_ERR)
278  {
279  pSetupData->SelectedComputer = SendMessage(hList,
281  (WPARAM) tindex,
282  (LPARAM) 0);
283  }
284 
285  hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
286 
287  tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
288  if (tindex != CB_ERR)
289  {
290  pSetupData->SelectedDisplay = SendMessage(hList,
292  (WPARAM) tindex,
293  (LPARAM) 0);
294  }
295 
296  hList =GetDlgItem(hwndDlg, IDC_KEYBOARD);
297 
298  tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
299  if (tindex != CB_ERR)
300  {
301  pSetupData->SelectedKeyboard = SendMessage(hList,
303  (WPARAM) tindex,
304  (LPARAM) 0);
305  }
306  return TRUE;
307  }
308 
309  default:
310  break;
311  }
312  }
313  break;
314 
315  default:
316  break;
317 
318  }
319  return FALSE;
320 }
#define CB_SETITEMDATA
Definition: winuser.h:1917
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
LONG SelectedComputer
Definition: reactos.h:85
#define CB_GETITEMDATA
Definition: winuser.h:1901
TCHAR szAbortMessage[512]
Definition: reactos.h:72
UINT uMsg
Definition: precomp.h:53
#define PSWIZB_NEXT
Definition: prsht.h:154
HANDLE HWND
Definition: compat.h:13
#define GWL_USERDATA
Definition: winuser.h:850
TCHAR Value[128]
Definition: reactos.h:61
#define PSN_SETACTIVE
Definition: prsht.h:115
#define CB_GETCURSEL
Definition: winuser.h:1894
struct tagNMHDR * LPNMHDR
#define IDC_COMPUTER
Definition: resource.h:24
UINT_PTR WPARAM
Definition: windef.h:230
LONG SelectedDisplay
Definition: reactos.h:86
#define PSN_QUERYCANCEL
Definition: prsht.h:123
UINT code
Definition: winuser.h:3102
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:231
#define CB_ADDSTRING
Definition: winuser.h:1887
#define LPPROPSHEETPAGE
Definition: prsht.h:372
#define MB_ICONQUESTION
Definition: winuser.h:783
#define PSN_WIZNEXT
Definition: prsht.h:121
PGENENTRY pDisplays
Definition: reactos.h:98
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
PGENENTRY pComputers
Definition: reactos.h:96
PGENENTRY pKeyboards
Definition: reactos.h:100
#define CB_ERR
Definition: winuser.h:2379
LONG DispCount
Definition: reactos.h:99
#define DWL_MSGRESULT
Definition: winuser.h:854
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PSWIZB_BACK
Definition: prsht.h:153
LONG KeybCount
Definition: reactos.h:101
#define IDC_DISPLAY
Definition: resource.h:19
#define IDC_KEYBOARD
Definition: resource.h:26
TCHAR szAbortTitle[64]
Definition: reactos.h:73
#define MessageBox
Definition: winuser.h:5667
#define CB_SETCURSEL
Definition: winuser.h:1912
#define SetWindowLongPtr
Definition: winuser.h:5699
uint32_t DWORD_PTR
Definition: typedefs.h:63
HWND hList
Definition: livecd.c:10
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define SendMessage
Definition: winuser.h:5688
LONG CompCount
Definition: reactos.h:97
#define GetWindowLongPtr
Definition: winuser.h:5642
LONG_PTR LRESULT
Definition: windef.h:232
LONG SelectedKeyboard
Definition: reactos.h:87
#define WM_INITDIALOG
Definition: winuser.h:1705
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETUPDATA * PSETUPDATA
BOOL isUnattendSetup ( VOID  )

Definition at line 706 of file reactos.c.

Referenced by _tWinMain().

707 {
709  WCHAR *ch;
710  HINF hUnattendedInf;
711  INFCONTEXT InfContext;
712  TCHAR szValue[MAX_PATH];
713  DWORD LineLength;
714  //HKEY hKey;
715  BOOL result = 0;
716 
717  GetModuleFileNameW(NULL, szPath, MAX_PATH);
718  ch = strrchrW(szPath, L'\\');
719  if (ch != NULL)
720  *ch = L'\0';
721 
722  wcscat(szPath, L"\\unattend.inf");
723  hUnattendedInf = SetupOpenInfFileW(szPath, NULL, INF_STYLE_OLDNT, NULL);
724 
725  if (hUnattendedInf != INVALID_HANDLE_VALUE)
726  {
727  if (SetupFindFirstLine(hUnattendedInf, _T("Unattend"), _T("UnattendSetupEnabled"),&InfContext))
728  {
729  if (SetupGetStringField(&InfContext,
730  1,
731  szValue,
732  sizeof(szValue) / sizeof(TCHAR),
733  &LineLength) && (_tcsicmp(szValue, _T("yes")) == 0))
734  {
735  result = 1; // unattendSetup enabled
736  // read values and store in SetupData
737  }
738  }
739  SetupCloseInfFile(hUnattendedInf);
740  }
741 
742  return result;
743 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:606
Definition: bidi.c:75
#define _tcsicmp
Definition: xmlstorage.h:205
#define SetupFindFirstLine
Definition: setupapi.h:2618
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
DWORD DWORD
Definition: winlogon.h:75
#define _T(x)
Definition: tchar.h:1542
smooth NULL
Definition: ftsmooth.c:557
char TCHAR
Definition: xmlstorage.h:189
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAX_PATH
Definition: compat.h:26
#define INF_STYLE_OLDNT
Definition: setupapi.h:439
#define SetupGetStringField
Definition: setupapi.h:2633
PULONG HINF
Definition: inffile.h:37
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
LPCWSTR szPath
Definition: env.c:35
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
GLuint64EXT * result
Definition: glext.h:11304
void WINAPI SetupCloseInfFile(HINF hinf)
Definition: parser.c:1393
LONG LoadGenentry ( HINF  hinf,
PCTSTR  name,
PGENENTRY gen,
PINFCONTEXT  context 
)

Definition at line 669 of file reactos.c.

Referenced by LoadSetupData().

670 {
671  LONG TotalCount;
672  DWORD LineLength;
673 
674  TotalCount = SetupGetLineCount(hinf, name);
675  if (TotalCount > 0)
676  {
677  *gen = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * TotalCount);
678  if (*gen != NULL)
679  {
680  if (SetupFindFirstLine(hinf, name, NULL, context))
681  {
682  LONG Count = 0;
683  do
684  {
685  SetupGetStringField(context,
686  0,
687  (*gen)[Count].Id,
688  sizeof((*gen)[Count].Id) / sizeof(TCHAR),
689  &LineLength);
690 
691  SetupGetStringField(context,
692  1,
693  (*gen)[Count].Value,
694  sizeof((*gen)[Count].Value) / sizeof(TCHAR),
695  &LineLength);
696  ++Count;
697  }
698  while (SetupFindNextLine(context, context) && Count < TotalCount);
699  }
700  }
701  else return 0;
702  }
703  return TotalCount;
704 }
#define SetupFindFirstLine
Definition: setupapi.h:2618
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
DWORD DWORD
Definition: winlogon.h:75
DWORD Id
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:557
char TCHAR
Definition: xmlstorage.h:189
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetupGetStringField
Definition: setupapi.h:2633
UINTN UINT8 Value
Definition: acefiex.h:751
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: name.c:23
#define SetupGetLineCount
Definition: setupapi.h:2627
BOOL WINAPI SetupFindNextLine(PINFCONTEXT context_in, PINFCONTEXT context_out)
Definition: parser.c:1631
BOOL LoadSetupData ( PSETUPDATA  pSetupData)

Definition at line 499 of file reactos.c.

Referenced by _tWinMain().

501 {
503  TCHAR tmp[10];
504  WCHAR *ch;
505  HINF hTxtsetupSif = INVALID_HANDLE_VALUE;
506  INFCONTEXT InfContext;
507  //TCHAR szValue[MAX_PATH];
508  DWORD LineLength;
509  LONG Count;
510  BOOL ret = TRUE;
511 
513  ch = strrchrW(szPath,L'\\');
514  if (ch != NULL)
515  *ch = L'\0';
516 
517  wcscat(szPath, L"\\txtsetup.sif");
518  hTxtsetupSif = SetupOpenInfFileW(szPath, NULL, INF_STYLE_OLDNT, NULL);
519  if (hTxtsetupSif == INVALID_HANDLE_VALUE)
520  {
521  TCHAR message[512], caption[64];
522 
523  // txtsetup.sif cannot be found
524  LoadString(pSetupData->hInstance, IDS_NO_TXTSETUP_SIF, message, sizeof(message)/sizeof(TCHAR));
525  LoadString(pSetupData->hInstance, IDS_CAPTION, caption, sizeof(caption)/sizeof(TCHAR));
526 
527  MessageBox(NULL, message, caption, MB_OK | MB_ICONERROR);
528  return FALSE;
529  }
530 
531  // get language list
532  pSetupData->LangCount = SetupGetLineCount(hTxtsetupSif, _T("Language"));
533  if (pSetupData->LangCount > 0)
534  {
535  pSetupData->pLanguages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LANG) * pSetupData->LangCount);
536  if (pSetupData->pLanguages == NULL)
537  {
538  ret = FALSE;
539  goto done;
540  }
541 
542  Count = 0;
543  if (SetupFindFirstLine(hTxtsetupSif, _T("Language"), NULL, &InfContext))
544  {
545  do
546  {
547  SetupGetStringField(&InfContext,
548  0,
549  pSetupData->pLanguages[Count].LangId,
550  sizeof(pSetupData->pLanguages[Count].LangId) / sizeof(TCHAR),
551  &LineLength);
552 
553  SetupGetStringField(&InfContext,
554  1,
555  pSetupData->pLanguages[Count].LangName,
556  sizeof(pSetupData->pLanguages[Count].LangName) / sizeof(TCHAR),
557  &LineLength);
558  ++Count;
559  }
560  while (SetupFindNextLine(&InfContext, &InfContext) && Count < pSetupData->LangCount);
561  }
562  }
563 
564  // get keyboard layout list
565  pSetupData->KbLayoutCount = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout"));
566  if (pSetupData->KbLayoutCount > 0)
567  {
568  pSetupData->pKbLayouts = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KBLAYOUT) * pSetupData->KbLayoutCount);
569  if (pSetupData->pKbLayouts == NULL)
570  {
571  ret = FALSE;
572  goto done;
573  }
574 
575  Count = 0;
576  if (SetupFindFirstLine(hTxtsetupSif, _T("KeyboardLayout"), NULL, &InfContext))
577  {
578  do
579  {
580  SetupGetStringField(&InfContext,
581  0,
582  pSetupData->pKbLayouts[Count].LayoutId,
583  sizeof(pSetupData->pKbLayouts[Count].LayoutId) / sizeof(TCHAR),
584  &LineLength);
585 
586  SetupGetStringField(&InfContext,
587  1,
588  pSetupData->pKbLayouts[Count].LayoutName,
589  sizeof(pSetupData->pKbLayouts[Count].LayoutName) / sizeof(TCHAR),
590  &LineLength);
591  ++Count;
592  }
593  while (SetupFindNextLine(&InfContext, &InfContext) && Count < pSetupData->KbLayoutCount);
594  }
595  }
596 
597  // get default for keyboard and language
598  pSetupData->DefaultKBLayout = -1;
599  pSetupData->DefaultLang = -1;
600 
601  // TODO: get defaults from underlaying running system
602  if (SetupFindFirstLine(hTxtsetupSif, _T("NLS"), _T("DefaultLayout"), &InfContext))
603  {
604  SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(TCHAR), &LineLength);
605  for (Count = 0; Count < pSetupData->KbLayoutCount; Count++)
606  {
607  if (_tcscmp(tmp, pSetupData->pKbLayouts[Count].LayoutId) == 0)
608  {
609  pSetupData->DefaultKBLayout = Count;
610  break;
611  }
612  }
613  }
614 
615  if (SetupFindFirstLine(hTxtsetupSif, _T("NLS"), _T("DefaultLanguage"), &InfContext))
616  {
617  SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(TCHAR), &LineLength);
618  for (Count = 0; Count < pSetupData->LangCount; Count++)
619  {
620  if (_tcscmp(tmp, pSetupData->pLanguages[Count].LangId) == 0)
621  {
622  pSetupData->DefaultLang = Count;
623  break;
624  }
625  }
626  }
627 
628  // get computers list
629  pSetupData->CompCount = LoadGenentry(hTxtsetupSif,_T("Computer"),&pSetupData->pComputers,&InfContext);
630 
631  // get display list
632  pSetupData->DispCount = LoadGenentry(hTxtsetupSif,_T("Display"),&pSetupData->pDisplays,&InfContext);
633 
634  // get keyboard list
635  pSetupData->KeybCount = LoadGenentry(hTxtsetupSif, _T("Keyboard"),&pSetupData->pKeyboards,&InfContext);
636 
637  // get install directory
638  if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"), _T("DefaultPath"), &InfContext))
639  {
640  SetupGetStringField(&InfContext,
641  1,
642  pSetupData->InstallDir,
643  sizeof(pSetupData->InstallDir) / sizeof(TCHAR),
644  &LineLength);
645  }
646 
647 done:
648  if (ret == FALSE)
649  {
650  if (pSetupData->pKbLayouts != NULL)
651  {
652  HeapFree(GetProcessHeap(), 0, pSetupData->pKbLayouts);
653  pSetupData->pKbLayouts = NULL;
654  }
655 
656  if (pSetupData->pLanguages != NULL)
657  {
658  HeapFree(GetProcessHeap(), 0, pSetupData->pLanguages);
659  pSetupData->pLanguages = NULL;
660  }
661  }
662 
663  if (hTxtsetupSif != INVALID_HANDLE_VALUE)
664  SetupCloseInfFile(hTxtsetupSif);
665 
666  return ret;
667 }
LONG LoadGenentry(HINF hinf, PCTSTR name, PGENENTRY *gen, PINFCONTEXT context)
Definition: reactos.c:669
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:606
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
TCHAR LangId[9]
Definition: reactos.h:45
Definition: bidi.c:75
#define SetupFindFirstLine
Definition: setupapi.h:2618
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_NO_TXTSETUP_SIF
Definition: resource.h:73
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
LONG DefaultKBLayout
Definition: reactos.h:93
DWORD DWORD
Definition: winlogon.h:75
TCHAR LangName[128]
Definition: reactos.h:46
#define IDS_CAPTION
Definition: resource.h:74
PKBLAYOUT pKbLayouts
Definition: reactos.h:94
LONG KbLayoutCount
Definition: reactos.h:95
TCHAR LayoutId[9]
Definition: reactos.h:51
LONG DefaultLang
Definition: reactos.h:90
#define _T(x)
Definition: tchar.h:1542
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:557
PGENENTRY pDisplays
Definition: reactos.h:98
TCHAR LayoutName[128]
Definition: reactos.h:52
PGENENTRY pComputers
Definition: reactos.h:96
PGENENTRY pKeyboards
Definition: reactos.h:100
LONG DispCount
Definition: reactos.h:99
char TCHAR
Definition: xmlstorage.h:189
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG KeybCount
Definition: reactos.h:101
HINSTANCE hInstance
Definition: reactos.h:67
#define MAX_PATH
Definition: compat.h:26
#define INF_STYLE_OLDNT
Definition: setupapi.h:439
TCHAR InstallDir[MAX_PATH]
Definition: reactos.h:84
Definition: reactos.h:43
#define SetupGetStringField
Definition: setupapi.h:2633
int ret
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5667
PULONG HINF
Definition: inffile.h:37
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
PLANG pLanguages
Definition: reactos.h:91
LPCWSTR szPath
Definition: env.c:35
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SetupGetLineCount
Definition: setupapi.h:2627
LONG CompCount
Definition: reactos.h:97
BOOL WINAPI SetupFindNextLine(PINFCONTEXT context_in, PINFCONTEXT context_out)
Definition: parser.c:1631
#define HeapFree(x, y, z)
Definition: compat.h:394
LONG LangCount
Definition: reactos.h:92
#define LoadString
Definition: winuser.h:5664
void WINAPI SetupCloseInfFile(HINF hinf)
Definition: parser.c:1393
static INT_PTR CALLBACK ProcessDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 373 of file reactos.c.

Referenced by _tWinMain().

377 {
378  PSETUPDATA pSetupData;
379 
380  /* Retrieve pointer to the global setup data */
381  pSetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
382 
383  switch (uMsg)
384  {
385  case WM_INITDIALOG:
386  /* Save pointer to the global setup data */
387  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
388  SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pSetupData);
389  break;
390 
391  case WM_NOTIFY:
392  {
393  LPNMHDR lpnm = (LPNMHDR)lParam;
394 
395  switch (lpnm->code)
396  {
397  case PSN_SETACTIVE:
399  // disable all buttons during installation process
400  // PropSheet_SetWizButtons(GetParent(hwndDlg), 0 );
401  break;
402  case PSN_QUERYCANCEL:
403  SetWindowLongPtr(hwndDlg,
405  MessageBox(GetParent(hwndDlg),
406  pSetupData->szAbortMessage,
407  pSetupData->szAbortTitle,
409  return TRUE;
410  default:
411  break;
412  }
413  }
414  break;
415 
416  default:
417  break;
418 
419  }
420 
421  return FALSE;
422 }
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
TCHAR szAbortMessage[512]
Definition: reactos.h:72
UINT uMsg
Definition: precomp.h:53
#define PSWIZB_NEXT
Definition: prsht.h:154
#define GWL_USERDATA
Definition: winuser.h:850
#define PSN_SETACTIVE
Definition: prsht.h:115
struct tagNMHDR * LPNMHDR
#define PSN_QUERYCANCEL
Definition: prsht.h:123
UINT code
Definition: winuser.h:3102
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define LPPROPSHEETPAGE
Definition: prsht.h:372
#define MB_ICONQUESTION
Definition: winuser.h:783
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define DWL_MSGRESULT
Definition: winuser.h:854
TCHAR szAbortTitle[64]
Definition: reactos.h:73
#define MessageBox
Definition: winuser.h:5667
#define SetWindowLongPtr
Definition: winuser.h:5699
uint32_t DWORD_PTR
Definition: typedefs.h:63
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define GetWindowLongPtr
Definition: winuser.h:5642
#define WM_INITDIALOG
Definition: winuser.h:1705
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETUPDATA * PSETUPDATA
static INT_PTR CALLBACK RestartDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 425 of file reactos.c.

Referenced by _tWinMain().

429 {
430  PSETUPDATA pSetupData;
431 
432  /* Retrieve pointer to the global setup data */
433  pSetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
434 
435  switch (uMsg)
436  {
437  case WM_INITDIALOG:
438  /* Save pointer to the global setup data */
439  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
440  SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pSetupData);
441 
442  /* Set title font */
443  /*SendDlgItemMessage(hwndDlg,
444  IDC_STARTTITLE,
445  WM_SETFONT,
446  (WPARAM)hTitleFont,
447  (LPARAM)TRUE);*/
448  break;
449 
450  case WM_TIMER:
451  {
452  INT Position;
453  HWND hWndProgress;
454 
455  hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
456  Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0);
457  if (Position == 300)
458  {
459  KillTimer(hwndDlg, 1);
461  }
462  else
463  {
464  SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0);
465  }
466  return TRUE;
467  }
468 
469  case WM_DESTROY:
470  return TRUE;
471 
472  case WM_NOTIFY:
473  {
474  LPNMHDR lpnm = (LPNMHDR)lParam;
475 
476  switch (lpnm->code)
477  {
478  case PSN_SETACTIVE: // Only "Finish" for closing the App
482  SetTimer(hwndDlg, 1, 50, NULL);
483  break;
484 
485  default:
486  break;
487  }
488  }
489  break;
490 
491  default:
492  break;
493 
494  }
495 
496  return FALSE;
497 }
#define TRUE
Definition: types.h:120
#define MAKELPARAM(l, h)
Definition: winuser.h:3894
UINT uMsg
Definition: precomp.h:53
HANDLE HWND
Definition: compat.h:13
#define GWL_USERDATA
Definition: winuser.h:850
#define PBM_SETPOS
Definition: commctrl.h:2154
#define PSBTN_FINISH
Definition: prsht.h:148
#define SendDlgItemMessage
Definition: winuser.h:5687
#define PSN_SETACTIVE
Definition: prsht.h:115
int32_t INT
Definition: typedefs.h:56
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3102
#define PBM_SETRANGE
Definition: commctrl.h:2153
#define FALSE
Definition: types.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:557
#define IDC_RESTART_PROGRESS
Definition: resource.h:44
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1581
#define PSWIZB_FINISH
Definition: prsht.h:155
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_TIMER
Definition: winuser.h:1708
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtr
Definition: winuser.h:5699
uint32_t DWORD_PTR
Definition: typedefs.h:63
UINT64 Position
Definition: acefiex.h:384
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define SendMessage
Definition: winuser.h:5688
#define GetWindowLongPtr
Definition: winuser.h:5642
#define PropSheet_PressButton(d, i)
Definition: prsht.h:330
#define WM_INITDIALOG
Definition: winuser.h:1705
#define PBM_GETPOS
Definition: commctrl.h:2164
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETUPDATA * PSETUPDATA
static INT_PTR CALLBACK StartDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 87 of file reactos.c.

Referenced by _tWinMain().

91 {
92  PSETUPDATA pSetupData;
93 
94  /* Retrieve pointer to the global setup data */
95  pSetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
96 
97  switch (uMsg)
98  {
99  case WM_INITDIALOG:
100  /* Save pointer to the global setup data */
101  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
102  SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pSetupData);
103 
104  /* Center the wizard window */
105  CenterWindow(GetParent(hwndDlg));
106 
107  /* Set title font */
108  SendDlgItemMessage(hwndDlg,
110  WM_SETFONT,
111  (WPARAM)pSetupData->hTitleFont,
112  (LPARAM)TRUE);
113  break;
114 
115  case WM_NOTIFY:
116  {
117  LPNMHDR lpnm = (LPNMHDR)lParam;
118 
119  switch (lpnm->code)
120  {
121  case PSN_SETACTIVE:
123  break;
124 
125  default:
126  break;
127  }
128  }
129  break;
130 
131  default:
132  break;
133 
134  }
135 
136  return FALSE;
137 }
#define TRUE
Definition: types.h:120
#define IDC_STARTTITLE
Definition: resource.h:15
UINT uMsg
Definition: precomp.h:53
#define PSWIZB_NEXT
Definition: prsht.h:154
#define GWL_USERDATA
Definition: winuser.h:850
#define SendDlgItemMessage
Definition: winuser.h:5687
#define PSN_SETACTIVE
Definition: prsht.h:115
struct tagNMHDR * LPNMHDR
UINT_PTR WPARAM
Definition: windef.h:230
UINT code
Definition: winuser.h:3102
#define FALSE
Definition: types.h:117
LONG_PTR LPARAM
Definition: windef.h:231
#define LPPROPSHEETPAGE
Definition: prsht.h:372
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define SetWindowLongPtr
Definition: winuser.h:5699
uint32_t DWORD_PTR
Definition: typedefs.h:63
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:39
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define WM_SETFONT
Definition: winuser.h:1622
HFONT hTitleFont
Definition: reactos.h:70
#define GetWindowLongPtr
Definition: winuser.h:5642
#define WM_INITDIALOG
Definition: winuser.h:1705
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETUPDATA * PSETUPDATA
static INT_PTR CALLBACK SummaryDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 323 of file reactos.c.

Referenced by _tWinMain().

327 {
328  PSETUPDATA pSetupData;
329 
330  /* Retrieve pointer to the global setup data */
331  pSetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
332 
333  switch (uMsg)
334  {
335  case WM_INITDIALOG:
336  /* Save pointer to the global setup data */
337  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
338  SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pSetupData);
339  break;
340 
341  case WM_NOTIFY:
342  {
343  LPNMHDR lpnm = (LPNMHDR)lParam;
344 
345  switch (lpnm->code)
346  {
347  case PSN_SETACTIVE:
349  break;
350 
351  case PSN_QUERYCANCEL:
352  SetWindowLongPtr(hwndDlg,
354  MessageBox(GetParent(hwndDlg),
355  pSetupData->szAbortMessage,
356  pSetupData->szAbortTitle,
358  return TRUE;
359  default:
360  break;
361  }
362  }
363  break;
364 
365  default:
366  break;
367  }
368 
369  return FALSE;
370 }
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
TCHAR szAbortMessage[512]
Definition: reactos.h:72
UINT uMsg
Definition: precomp.h:53
#define PSWIZB_NEXT
Definition: prsht.h:154
#define GWL_USERDATA
Definition: winuser.h:850
#define PSN_SETACTIVE
Definition: prsht.h:115
struct tagNMHDR * LPNMHDR
#define PSN_QUERYCANCEL
Definition: prsht.h:123
UINT code
Definition: winuser.h:3102
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define LPPROPSHEETPAGE
Definition: prsht.h:372
#define MB_ICONQUESTION
Definition: winuser.h:783
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define DWL_MSGRESULT
Definition: winuser.h:854
#define PSWIZB_BACK
Definition: prsht.h:153
TCHAR szAbortTitle[64]
Definition: reactos.h:73
#define MessageBox
Definition: winuser.h:5667
#define SetWindowLongPtr
Definition: winuser.h:5699
uint32_t DWORD_PTR
Definition: typedefs.h:63
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define GetWindowLongPtr
Definition: winuser.h:5642
#define WM_INITDIALOG
Definition: winuser.h:1705
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETUPDATA * PSETUPDATA
static INT_PTR CALLBACK TypeDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 140 of file reactos.c.

Referenced by _tWinMain().

144 {
145  PSETUPDATA pSetupData;
146 
147  /* Retrieve pointer to the global setup data */
148  pSetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
149 
150  switch (uMsg)
151  {
152  case WM_INITDIALOG:
153  /* Save pointer to the global setup data */
154  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
155  SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pSetupData);
156 
157  /* Check the 'install' radio button */
159 
160  /* Disable the 'update' radio button and text */
163  break;
164 
165  case WM_NOTIFY:
166  {
167  LPNMHDR lpnm = (LPNMHDR)lParam;
168 
169  switch (lpnm->code)
170  {
171  case PSN_SETACTIVE:
173  break;
174 
175  case PSN_QUERYCANCEL:
176  SetWindowLongPtr(hwndDlg,
178  MessageBox(GetParent(hwndDlg),
179  pSetupData->szAbortMessage,
180  pSetupData->szAbortTitle,
182  return TRUE;
183 
184  case PSN_WIZNEXT: // set the selected data
185  pSetupData->RepairUpdateFlag = !(SendMessage(GetDlgItem(hwndDlg, IDC_INSTALL),
186  BM_GETCHECK,
187  (WPARAM) 0,
188  (LPARAM) 0) == BST_CHECKED);
189  return TRUE;
190 
191  default:
192  break;
193  }
194  }
195  break;
196 
197  default:
198  break;
199 
200  }
201  return FALSE;
202 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
TCHAR szAbortMessage[512]
Definition: reactos.h:72
UINT uMsg
Definition: precomp.h:53
#define PSWIZB_NEXT
Definition: prsht.h:154
#define GWL_USERDATA
Definition: winuser.h:850
#define PSN_SETACTIVE
Definition: prsht.h:115
BOOLEAN RepairUpdateFlag
Definition: reactos.h:88
struct tagNMHDR * LPNMHDR
UINT_PTR WPARAM
Definition: windef.h:230
#define PSN_QUERYCANCEL
Definition: prsht.h:123
UINT code
Definition: winuser.h:3102
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
LONG_PTR LPARAM
Definition: windef.h:231
#define LPPROPSHEETPAGE
Definition: prsht.h:372
#define MB_ICONQUESTION
Definition: winuser.h:783
#define PSN_WIZNEXT
Definition: prsht.h:121
#define IDC_UPDATETEXT
Definition: resource.h:21
#define BM_GETCHECK
Definition: winuser.h:1869
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define DWL_MSGRESULT
Definition: winuser.h:854
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PSWIZB_BACK
Definition: prsht.h:153
TCHAR szAbortTitle[64]
Definition: reactos.h:73
#define MessageBox
Definition: winuser.h:5667
#define IDC_UPDATE
Definition: resource.h:20
#define SetWindowLongPtr
Definition: winuser.h:5699
uint32_t DWORD_PTR
Definition: typedefs.h:63
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define BST_CHECKED
Definition: winuser.h:197
#define SendMessage
Definition: winuser.h:5688
#define GetWindowLongPtr
Definition: winuser.h:5642
#define IDC_INSTALL
Definition: fontview.h:13
#define WM_INITDIALOG
Definition: winuser.h:1705
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETUPDATA * PSETUPDATA