ReactOS 0.4.15-dev-7076-gc00d41d
reactos.c File Reference
#include "reactos.h"
#include <ndk/obfuncs.h>
#include "resource.h"
#include <debug.h>
Include dependency graph for reactos.c:

Go to the source code of this file.

Classes

struct  _COPYCONTEXT
 

Macros

#define NTOS_MODE_USER
 
#define NDEBUG
 
#define IDS_LIST_COLUMN_FIRST   IDS_INSTALLATION_NAME
 
#define IDS_LIST_COLUMN_LAST   IDS_INSTALLATION_VENDOR
 
#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
 

Typedefs

typedef VOID(NTAPIPGET_ENTRY_DESCRIPTION) (IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
typedef VOID(NTAPIPADD_ENTRY_ITEM) (IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
typedef struct _COPYCONTEXT COPYCONTEXT
 
typedef struct _COPYCONTEXTPCOPYCONTEXT
 

Functions

static VOID CenterWindow (HWND hWnd)
 
static HFONT CreateTitleFont (VOID)
 
INT DisplayError (IN HWND hParentWnd OPTIONAL, IN UINT uIDTitle, IN UINT uIDMessage)
 
static INT_PTR CALLBACK StartDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK TypeDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL CreateListViewColumns (IN HINSTANCE hInstance, IN HWND hWndListView, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
 
VOID InitGenericComboList (IN HWND hWndList, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
 
PVOID GetSelectedComboListItem (IN HWND hWndList)
 
VOID InitGenericListView (IN HWND hWndList, IN PGENERIC_LIST List, IN PADD_ENTRY_ITEM AddEntryItemProc)
 
PVOID GetSelectedListViewItem (IN HWND hWndList)
 
static VOID NTAPI GetSettingDescription (IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
static VOID NTAPI AddNTOSInstallationItem (IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
static INT_PTR CALLBACK UpgradeRepairDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK DeviceDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK SummaryDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static UINT CALLBACK FileCopyCallback (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static DWORD WINAPI PrepareAndDoCopyThread (IN LPVOID Param)
 
static INT_PTR CALLBACK ProcessDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK RestartDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL LoadSetupData (IN OUT PSETUPDATA pSetupData)
 
VOID InitNtToWin32PathMappingList (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
 
VOID FreeNtToWin32PathMappingList (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
 
BOOL ConvertNtPathToWin32Path (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList, OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
 
BOOL EnablePrivilege (IN LPCWSTR lpszPrivilegeName, IN BOOL bEnablePrivilege)
 
static DWORD CALLBACK HotkeyThread (LPVOID Parameter)
 
int WINAPI _tWinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow)
 

Variables

HANDLE ProcessHeap
 
BOOLEAN IsUnattendedSetup = FALSE
 
SETUPDATA SetupData
 
static const UINT column_ids [MAX_LIST_COLUMNS] = {IDS_LIST_COLUMN_FIRST, IDS_LIST_COLUMN_FIRST + 1, IDS_LIST_COLUMN_FIRST + 2}
 
static const INT column_widths [MAX_LIST_COLUMNS] = {200, 150, 100}
 
static const INT column_alignment [MAX_LIST_COLUMNS] = {LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT}
 

Macro Definition Documentation

◆ IDS_LIST_COLUMN_FIRST

#define IDS_LIST_COLUMN_FIRST   IDS_INSTALLATION_NAME

Definition at line 518 of file reactos.c.

◆ IDS_LIST_COLUMN_LAST

#define IDS_LIST_COLUMN_LAST   IDS_INSTALLATION_VENDOR

Definition at line 519 of file reactos.c.

◆ MAX_LIST_COLUMNS

#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)

Definition at line 521 of file reactos.c.

◆ NDEBUG

#define NDEBUG

Definition at line 34 of file reactos.c.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 29 of file reactos.c.

Typedef Documentation

◆ COPYCONTEXT

◆ PADD_ENTRY_ITEM

typedef VOID(NTAPI * PADD_ENTRY_ITEM) (IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)

Definition at line 385 of file reactos.c.

◆ PCOPYCONTEXT

◆ PGET_ENTRY_DESCRIPTION

typedef VOID(NTAPI * PGET_ENTRY_DESCRIPTION) (IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)

Definition at line 328 of file reactos.c.

Function Documentation

◆ _tWinMain()

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

Definition at line 1835 of file reactos.c.

1839{
1840 ULONG Error;
1841 HANDLE hHotkeyThread;
1843 PROPSHEETHEADER psh;
1844 HPROPSHEETPAGE ahpsp[8];
1845 PROPSHEETPAGE psp = {0};
1846 UINT nPages = 0;
1847
1849
1854
1855 /* Initialize the NT to Win32 path prefix mapping list */
1857
1858 /* Initialize Setup, phase 0 */
1860
1861 /* Initialize Setup, phase 1 */
1863 if (Error != ERROR_SUCCESS)
1864 {
1865 //
1866 // TODO: Write an error mapper (much like the MUIDisplayError of USETUP)
1867 //
1869 MessageBoxW(NULL, L"GetSourcePaths failed!", L"Error", MB_ICONERROR);
1870 else if (Error == ERROR_LOAD_TXTSETUPSIF)
1872 else // FIXME!!
1873 MessageBoxW(NULL, L"Unknown error!", L"Error", MB_ICONERROR);
1874
1875 goto Quit;
1876 }
1877
1878 /* Load extra setup data (HW lists etc...) */
1879 if (!LoadSetupData(&SetupData))
1880 goto Quit;
1881
1882 hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1883
1885 SetupData.bUnattend = IsUnattendedSetup; // FIXME :-)
1886
1887 /* Cache commonly-used strings */
1890
1891 /* Whenever any of the common controls are used in your app,
1892 * you must call InitCommonControlsEx() to register the classes
1893 * for those controls. */
1894 iccx.dwSize = sizeof(iccx);
1896 InitCommonControlsEx(&iccx);
1897
1898 /* Register the TreeList control */
1899 // RegisterTreeListClass(hInst);
1901
1902 /* Create title font */
1904
1905 if (!SetupData.bUnattend)
1906 {
1907 /* Create the Start page, until setup is working */
1908 // NOTE: What does "until setup is working" mean??
1909 psp.dwSize = sizeof(PROPSHEETPAGE);
1910 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
1911 psp.hInstance = hInst;
1912 psp.lParam = (LPARAM)&SetupData;
1913 psp.pfnDlgProc = StartDlgProc;
1914 psp.pszTemplate = MAKEINTRESOURCEW(IDD_STARTPAGE);
1915 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1916
1917 /* Create the install type selection page */
1918 psp.dwSize = sizeof(PROPSHEETPAGE);
1919 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
1920 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_TYPETITLE);
1921 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_TYPESUBTITLE);
1922 psp.hInstance = hInst;
1923 psp.lParam = (LPARAM)&SetupData;
1924 psp.pfnDlgProc = TypeDlgProc;
1925 psp.pszTemplate = MAKEINTRESOURCEW(IDD_TYPEPAGE);
1926 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1927
1928 /* Create the upgrade/repair selection page */
1929 psp.dwSize = sizeof(PROPSHEETPAGE);
1930 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
1931 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_TYPETITLE);
1932 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_TYPESUBTITLE);
1933 psp.hInstance = hInst;
1934 psp.lParam = (LPARAM)&SetupData;
1935 psp.pfnDlgProc = UpgradeRepairDlgProc;
1936 psp.pszTemplate = MAKEINTRESOURCEW(IDD_UPDATEREPAIRPAGE);
1937 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1938
1939 /* Create the device settings page */
1940 psp.dwSize = sizeof(PROPSHEETPAGE);
1941 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
1942 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_DEVICETITLE);
1943 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_DEVICESUBTITLE);
1944 psp.hInstance = hInst;
1945 psp.lParam = (LPARAM)&SetupData;
1946 psp.pfnDlgProc = DeviceDlgProc;
1947 psp.pszTemplate = MAKEINTRESOURCEW(IDD_DEVICEPAGE);
1948 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1949
1950 /* Create the install device settings page / boot method / install directory */
1951 psp.dwSize = sizeof(PROPSHEETPAGE);
1952 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
1953 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_DRIVETITLE);
1954 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_DRIVESUBTITLE);
1955 psp.hInstance = hInst;
1956 psp.lParam = (LPARAM)&SetupData;
1957 psp.pfnDlgProc = DriveDlgProc;
1958 psp.pszTemplate = MAKEINTRESOURCEW(IDD_DRIVEPAGE);
1959 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1960
1961 /* Create the summary page */
1962 psp.dwSize = sizeof(PROPSHEETPAGE);
1963 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
1964 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_SUMMARYTITLE);
1965 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_SUMMARYSUBTITLE);
1966 psp.hInstance = hInst;
1967 psp.lParam = (LPARAM)&SetupData;
1968 psp.pfnDlgProc = SummaryDlgProc;
1969 psp.pszTemplate = MAKEINTRESOURCEW(IDD_SUMMARYPAGE);
1970 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1971 }
1972
1973 /* Create the installation progress page */
1974 psp.dwSize = sizeof(PROPSHEETPAGE);
1975 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
1976 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_PROCESSTITLE);
1977 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_PROCESSSUBTITLE);
1978 psp.hInstance = hInst;
1979 psp.lParam = (LPARAM)&SetupData;
1980 psp.pfnDlgProc = ProcessDlgProc;
1981 psp.pszTemplate = MAKEINTRESOURCEW(IDD_PROCESSPAGE);
1982 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1983
1984 /* Create the finish-and-reboot page */
1985 psp.dwSize = sizeof(PROPSHEETPAGE);
1986 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
1987 psp.hInstance = hInst;
1988 psp.lParam = (LPARAM)&SetupData;
1989 psp.pfnDlgProc = RestartDlgProc;
1990 psp.pszTemplate = MAKEINTRESOURCEW(IDD_RESTARTPAGE);
1991 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
1992
1993 /* Create the property sheet */
1994 psh.dwSize = sizeof(PROPSHEETHEADER);
1995 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
1996 psh.hInstance = hInst;
1997 psh.hwndParent = NULL;
1998 psh.nPages = nPages;
1999 psh.nStartPage = 0;
2000 psh.phpage = ahpsp;
2001 psh.pszbmWatermark = MAKEINTRESOURCEW(IDB_WATERMARK);
2002 psh.pszbmHeader = MAKEINTRESOURCEW(IDB_HEADER);
2003
2004 /* Display the wizard */
2005 PropertySheet(&psh);
2006
2007 /* Wait for any pending installation */
2013
2016
2017 /* Unregister the TreeList control */
2018 // UnregisterTreeListClass(hInst);
2020
2021 if (hHotkeyThread)
2022 {
2023 PostThreadMessageW(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
2024 CloseHandle(hHotkeyThread);
2025 }
2026
2027Quit:
2028 /* Setup has finished */
2030
2031 /* Free the NT to Win32 path prefix mapping list */
2033
2034#if 0 // NOTE: Disabled for testing purposes only!
2038#endif
2039
2040 return 0;
2041}
#define IDB_HEADER
Definition: resource.h:30
static HFONT CreateTitleFont(VOID)
Definition: reactos.c:70
static INT_PTR CALLBACK ProcessDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:1201
static INT_PTR CALLBACK TypeDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:164
static INT_PTR CALLBACK RestartDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:1320
HANDLE ProcessHeap
Definition: reactos.c:39
BOOL LoadSetupData(IN OUT PSETUPDATA pSetupData)
Definition: reactos.c:1401
static INT_PTR CALLBACK UpgradeRepairDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:527
VOID FreeNtToWin32PathMappingList(IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
Definition: reactos.c:1477
static INT_PTR CALLBACK DeviceDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:713
static INT_PTR CALLBACK SummaryDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:816
VOID InitNtToWin32PathMappingList(IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
Definition: reactos.c:1469
BOOLEAN IsUnattendedSetup
Definition: reactos.c:40
static INT_PTR CALLBACK StartDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:108
SETUPDATA SetupData
Definition: reactos.c:41
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: reactos.c:1787
BOOL EnablePrivilege(IN LPCWSTR lpszPrivilegeName, IN BOOL bEnablePrivilege)
Definition: reactos.c:1757
INT DisplayError(IN HWND hParentWnd OPTIONAL, IN UINT uIDTitle, IN UINT uIDMessage)
Definition: reactos.c:94
#define IDS_TYPETITLE
Definition: resource.h:78
#define IDD_DRIVEPAGE
Definition: resource.h:37
#define IDS_DRIVESUBTITLE
Definition: resource.h:83
#define IDS_PROCESSSUBTITLE
Definition: resource.h:85
#define IDS_TYPESUBTITLE
Definition: resource.h:79
#define IDS_PROCESSTITLE
Definition: resource.h:84
#define IDD_RESTARTPAGE
Definition: resource.h:59
#define IDS_CAPTION
Definition: resource.h:93
#define IDS_DEVICETITLE
Definition: resource.h:80
#define IDD_SUMMARYPAGE
Definition: resource.h:43
#define IDS_DRIVETITLE
Definition: resource.h:82
#define IDB_WATERMARK
Definition: resource.h:4
#define IDD_PROCESSPAGE
Definition: resource.h:54
#define IDS_NO_TXTSETUP_SIF
Definition: resource.h:92
#define IDD_UPDATEREPAIRPAGE
Definition: resource.h:27
#define IDS_SUMMARYTITLE
Definition: resource.h:90
#define IDS_DEVICESUBTITLE
Definition: resource.h:81
#define IDS_SUMMARYSUBTITLE
Definition: resource.h:91
#define IDS_ABORTSETUP2
Definition: resource.h:89
#define IDD_TYPEPAGE
Definition: resource.h:21
#define IDD_DEVICEPAGE
Definition: resource.h:31
#define IDS_ABORTSETUP
Definition: resource.h:88
#define IDD_STARTPAGE
Definition: resource.h:18
BOOL Error
Definition: chkdsk.c:66
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:913
INT_PTR CALLBACK DriveDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drivepage.c:613
#define INFINITE
Definition: serial.h:102
HINSTANCE hInst
Definition: dxdiag.c:13
@ ERROR_LOAD_TXTSETUPSIF
Definition: errorcode.h:24
@ ERROR_NO_SOURCE_DRIVE
Definition: errorcode.h:23
pKey DeleteObject()
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define PROPSHEETHEADER
Definition: prsht.h:392
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSP_DEFAULT
Definition: prsht.h:22
#define PropertySheet
Definition: prsht.h:400
#define PROPSHEETPAGE
Definition: prsht.h:389
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
VOID FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:867
VOID CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:28
ERROR_NUMBER InitializeSetup(IN OUT PUSETUP_DATA pSetupData, IN ULONG InitPhase)
Definition: setuplib.c:784
USETUP_DATA USetupData
Definition: reactos.h:128
HINSTANCE hInstance
Definition: reactos.h:114
HFONT hTitleFont
Definition: reactos.h:117
BOOL bStopInstall
Definition: reactos.h:121
HANDLE hInstallThread
Definition: reactos.h:119
TCHAR szAbortMessage[512]
Definition: reactos.h:123
HANDLE hHaltInstallEvent
Definition: reactos.h:120
NT_WIN32_PATH_MAPPING_LIST MappingList
Definition: reactos.h:126
BOOL bUnattend
Definition: reactos.h:115
TCHAR szAbortTitle[64]
Definition: reactos.h:124
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
int TreeListRegister(HINSTANCE hInstance)
Definition: treelist.c:394
BOOL TreeListUnregister(HINSTANCE hInstance)
Definition: treelist.c:429
uint32_t ULONG
Definition: typedefs.h:59
LONG_PTR LPARAM
Definition: windef.h:208
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
#define WM_QUIT
Definition: winuser.h:1622
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)
#define MB_ICONERROR
Definition: winuser.h:786
#define EWX_REBOOT
Definition: winuser.h:638
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ AddNTOSInstallationItem()

static VOID NTAPI AddNTOSInstallationItem ( IN HWND  hWndList,
IN LVITEM plvItem,
IN PGENERIC_LIST_ENTRY  Entry,
IN OUT PWSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 462 of file reactos.c.

468{
470 PPARTENTRY PartEntry = NtOsInstall->PartEntry;
471
472 if (PartEntry && PartEntry->DriveLetter)
473 {
474 /* We have retrieved a partition that is mounted */
475 StringCchPrintfW(Buffer, cchBufferSize,
476 L"%c:%s",
477 PartEntry->DriveLetter,
478 NtOsInstall->PathComponent);
479 }
480 else
481 {
482 /* We failed somewhere, just show the NT path */
483 StringCchPrintfW(Buffer, cchBufferSize,
484 L"%wZ",
485 &NtOsInstall->SystemNtPath);
486 }
487
488 plvItem->mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
489 plvItem->iItem = 0;
490 plvItem->iSubItem = 0;
491 plvItem->lParam = (LPARAM)Entry;
492 plvItem->pszText = NtOsInstall->InstallationName;
493
494 /* Associate vendor icon */
495 if (FindSubStrI(NtOsInstall->VendorName, VENDOR_REACTOS))
496 {
497 plvItem->mask |= LVIF_IMAGE;
498 plvItem->iImage = 0;
499 }
500 else if (FindSubStrI(NtOsInstall->VendorName, VENDOR_MICROSOFT))
501 {
502 plvItem->mask |= LVIF_IMAGE;
503 plvItem->iImage = 1;
504 }
505
506 plvItem->iItem = SendMessageW(hWndList, LVM_INSERTITEMW, 0, (LPARAM)plvItem);
507
508 plvItem->iSubItem = 1;
509 plvItem->pszText = Buffer; // SystemRootPath;
510 SendMessageW(hWndList, LVM_SETITEMTEXTW, plvItem->iItem, (LPARAM)plvItem);
511
512 plvItem->iSubItem = 2;
513 plvItem->pszText = NtOsInstall->VendorName;
514 SendMessageW(hWndList, LVM_SETITEMTEXTW, plvItem->iItem, (LPARAM)plvItem);
515}
static HWND hWndList[5+1]
Definition: SetParent.c:10
Definition: bufpool.h:45
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
#define VENDOR_MICROSOFT
Definition: osdetect.h:13
struct _NTOS_INSTALLATION * PNTOS_INSTALLATION
#define VENDOR_REACTOS
Definition: osdetect.h:12
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2687
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define LVM_INSERTITEMW
Definition: commctrl.h:2404
LPTSTR FindSubStrI(LPCTSTR str, LPCTSTR strSearch)
Definition: stringutils.c:183
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
base of all file and directory entries
Definition: entries.h:83
WCHAR InstallationName[MAX_PATH]
Definition: osdetect.h:26
UNICODE_STRING SystemNtPath
Definition: osdetect.h:21
WCHAR VendorName[MAX_PATH]
Definition: osdetect.h:27
PPARTENTRY PartEntry
Definition: osdetect.h:25
PCWSTR PathComponent
Definition: osdetect.h:22
WCHAR DriveLetter
Definition: partlist.h:58
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by UpgradeRepairDlgProc().

◆ CenterWindow()

static VOID CenterWindow ( HWND  hWnd)
static

Definition at line 47 of file reactos.c.

48{
50 RECT rcParent;
51 RECT rcWindow;
52
54 if (hWndParent == NULL)
56
57 GetWindowRect(hWndParent, &rcParent);
58 GetWindowRect(hWnd, &rcWindow);
59
62 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
63 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
64 0,
65 0,
67}
HWND hWnd
Definition: settings.c:17
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
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)
#define SWP_NOSIZE
Definition: winuser.h:1244
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define HWND_TOP
Definition: winuser.h:1206
HWND WINAPI GetParent(_In_ HWND)

Referenced by ExplorerAboutDlg::ExplorerAboutDlg(), FindProgramDlg::FindProgramDlg(), MdiSdiDlg::MdiSdiDlg(), CEditCompatModes::OnInitDialog(), CConfirmReplace::OnInitDialog(), CZipPassword::OnInitDialog(), and StartDlgProc().

◆ ConvertNtPathToWin32Path()

BOOL ConvertNtPathToWin32Path ( IN OUT PNT_WIN32_PATH_MAPPING_LIST  MappingList,
OUT PWSTR  pwszPath,
IN DWORD  cchPathMax,
IN PCWSTR  pwszNTPath 
)

Definition at line 1498 of file reactos.c.

1503{
1504 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
1505 PLIST_ENTRY ListEntry;
1507 PCWSTR pwszNtPathToMap = pwszNTPath;
1508 PCWSTR pwszRemaining = NULL;
1509 DWORD cchDrives;
1510 PWCHAR pwszDrive;
1511 WCHAR wszDrives[512];
1512 WCHAR wszNTPath[MAX_PATH];
1513 WCHAR TargetPath[MAX_PATH];
1514
1515 *pwszPath = UNICODE_NULL;
1516
1517 /*
1518 * We find first a mapping inside the MappingList. If one is found, use it
1519 * to build the Win32 path. If there is none, we need to create one by
1520 * checking the Win32 drives (and possibly NT symlinks too).
1521 * In case of success, add the newly found mapping to the list and use it
1522 * to build the Win32 path.
1523 */
1524
1525 for (ListEntry = MappingList->List.Flink;
1526 ListEntry != &MappingList->List;
1527 ListEntry = ListEntry->Flink)
1528 {
1529 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
1530
1531 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
1532
1533 /* Check whether the queried NT path prefixes the user-provided NT path */
1534 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
1535 if (FoundDrive)
1536 {
1537 /* Found it! */
1538
1539 /* Set the pointers and go build the Win32 path */
1540 pwszDrive = Entry->Win32Path;
1541 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
1542 goto Quit;
1543 }
1544 }
1545
1546 /*
1547 * No mapping exists for this path yet: try to find one now.
1548 */
1549
1550 /* Retrieve the mounted drives (available drive letters) */
1551 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
1552 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
1553 {
1554 /* Buffer too small or failure */
1555 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
1556 return FALSE;
1557 }
1558
1559/* We go back there once if RetryOnce == TRUE */
1560Retry:
1561
1562 /* Enumerate the mounted drives */
1563 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
1564 {
1565 /* Retrieve the NT path corresponding to the current Win32 DOS path */
1566 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
1567 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
1568 pwszDrive[2] = L'\\'; // Restore the backslash
1569
1570 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
1571
1572 /* Check whether the queried NT path prefixes the user-provided NT path */
1573 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
1574 if (!FoundDrive)
1575 {
1576 PWCHAR ptr, ptr2;
1577
1578 /*
1579 * Check whether this was a network share that has a drive letter,
1580 * but the user-provided NT path points to this share without
1581 * mentioning the drive letter.
1582 *
1583 * The format is: \Device<network_redirector>\;X:<data>\share\path
1584 * The corresponding drive letter is 'X'.
1585 * A system-provided network redirector (LanManRedirector or Mup)
1586 * or a 3rd-party one may be used.
1587 *
1588 * We check whether the user-provided NT path has the form:
1589 * \Device<network_redirector><data>\share\path
1590 * as it obviously did not have the full form (the previous check
1591 * would have been OK otherwise).
1592 */
1593 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
1594 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
1595 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
1596 {
1597 /*
1598 * Normally the specified drive letter should correspond
1599 * to the one used for the mapping. But we will ignore
1600 * if it happens not to be the case.
1601 */
1602 if (pwszDrive[0] != ptr[1])
1603 {
1604 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
1605 pwszDrive[0], ptr[1]);
1606 }
1607
1608 /* Remove the drive letter from the NT network share path */
1609 ptr2 = ptr + 3;
1610 /* Swallow as many possible consecutive backslashes as there could be */
1611 while (*ptr2 == L'\\') ++ptr2;
1612
1613 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
1614
1615 /* Now do the check again */
1616 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
1617 }
1618 }
1619 if (FoundDrive)
1620 {
1621 /* Found it! */
1622
1623 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
1624
1625 if (pwszNtPathToMap == pwszNTPath)
1626 {
1627 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
1628 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
1629 }
1630 break;
1631 }
1632 }
1633
1634 if (FoundDrive)
1635 {
1636 /* A mapping was found, add it to the cache */
1638 if (!Entry)
1639 {
1640 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
1641 return FALSE;
1642 }
1643 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
1644 pwszNTPath, pwszRemaining - pwszNTPath);
1645 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
1646
1647 /* Insert it as the most recent entry */
1648 InsertHeadList(&MappingList->List, &Entry->ListEntry);
1649 MappingList->MappingsCount++;
1650
1651 /* Set the pointers and go build the Win32 path */
1652 pwszDrive = Entry->Win32Path;
1653 goto Quit;
1654 }
1655
1656 /*
1657 * We failed, perhaps because the beginning of the NT path used a symlink.
1658 * Try to see whether this is the case by attempting to resolve it.
1659 * If the symlink resolution gives nothing, or we already failed once,
1660 * there is no hope in converting the path to Win32.
1661 * Otherwise, symlink resolution succeeds but we need to recheck again
1662 * the drives list.
1663 */
1664
1665 /*
1666 * In theory we would have to parse each element in the NT path and going
1667 * until finding a symlink object (otherwise we would fail straight away).
1668 * However here we can use guessing instead, since we know which kind of
1669 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
1670 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
1671 * are supported in setuplib\utils\arcname.c .
1672 *
1673 * But actually, all the supported names in arcname.c are real devices,
1674 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
1675 * just check for it.
1676 */
1677 if (!RetryOnce && !FoundDrive)
1678 {
1679 ULONG DiskNumber, PartitionNumber;
1680 INT Length;
1681
1684 HANDLE LinkHandle;
1685 UNICODE_STRING SymLink, Target;
1686
1687 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
1688 &DiskNumber, &PartitionNumber, &Length) != 2)
1689 {
1690 /* Definitively not a recognized path, bail out */
1691 return FALSE;
1692 }
1693
1694 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
1695 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
1696 SymLink.Length = SymLink.MaximumLength;
1697
1699 &SymLink,
1701 NULL,
1702 NULL);
1703 Status = NtOpenSymbolicLinkObject(&LinkHandle,
1706 if (!NT_SUCCESS(Status))
1707 {
1708 /* Not a symlink, or something else happened: bail out */
1709 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
1710 &SymLink, Status);
1711 return FALSE;
1712 }
1713
1714 *TargetPath = UNICODE_NULL;
1715 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
1716
1717 /* Resolve the link and close its handle */
1719 NtClose(LinkHandle);
1720
1721 /* Check for success */
1722 if (!NT_SUCCESS(Status))
1723 {
1724 /* Not a symlink, or something else happened: bail out */
1725 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
1726 &SymLink, Status);
1727 return FALSE;
1728 }
1729
1730 /* Set the pointers */
1731 pwszRemaining = pwszNTPath + Length;
1732 pwszNtPathToMap = TargetPath; // Point to our local buffer
1733
1734 /* Retry once */
1735 RetryOnce = TRUE;
1736 goto Retry;
1737 }
1738
1739 ASSERT(!FoundDrive);
1740
1741Quit:
1742 if (FoundDrive)
1743 {
1744 StringCchPrintfW(pwszPath, cchPathMax,
1745 L"%s%s",
1746 pwszDrive,
1747 pwszRemaining);
1748 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
1749 return TRUE;
1750 }
1751
1752 return FALSE;
1753}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define wcschr
Definition: compat.h:17
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73
#define InsertHeadList(ListHead, Entry)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ASSERT(a)
Definition: mode.c:44
static PVOID ptr
Definition: dispmode.c:27
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define DPRINT
Definition: sndvol32.h:71
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
USHORT MaximumLength
Definition: env_spec_w32.h:370
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SetupOpenInfFileExW(), SpFileQueueCopy_NtToWin32(), SpFileQueueDelete_NtToWin32(), and SpFileQueueRename_NtToWin32().

◆ CreateListViewColumns()

BOOL CreateListViewColumns ( IN HINSTANCE  hInstance,
IN HWND  hWndListView,
IN const UINT pIDs,
IN const INT pColsWidth,
IN const INT pColsAlign,
IN UINT  nNumOfColumns 
)

Definition at line 296 of file reactos.c.

303{
304 UINT i;
305 LVCOLUMN lvC;
306 WCHAR szText[50];
307
308 /* Create the columns */
309 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
310 lvC.pszText = szText;
311
312 /* Load the column labels from the resource file */
313 for (i = 0; i < nNumOfColumns; i++)
314 {
315 lvC.iSubItem = i;
316 lvC.cx = pColsWidth[i];
317 lvC.fmt = pColsAlign[i];
318
319 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
320
321 if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
322 return FALSE;
323 }
324
325 return TRUE;
326}
HINSTANCE hInstance
Definition: charmap.c:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVCOLUMN
Definition: commctrl.h:2581

Referenced by UpgradeRepairDlgProc().

◆ CreateTitleFont()

static HFONT CreateTitleFont ( VOID  )
static

Definition at line 70 of file reactos.c.

71{
72 NONCLIENTMETRICS ncm;
73 LOGFONT LogFont;
74 HDC hdc;
75 INT FontSize;
77
78 ncm.cbSize = sizeof(NONCLIENTMETRICS);
79 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
80
81 LogFont = ncm.lfMessageFont;
82 LogFont.lfWeight = FW_BOLD;
83 _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg"));
84
85 hdc = GetDC(NULL);
86 FontSize = 12;
87 LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
88 hFont = CreateFontIndirect(&LogFont);
90
91 return hFont;
92}
HFONT hFont
Definition: main.c:53
#define _tcscpy
Definition: tchar.h:623
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG lfHeight
Definition: dimm.idl:42
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define _T(x)
Definition: vfdio.h:22
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
#define CreateFontIndirect
Definition: wingdi.h:4444
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
#define SystemParametersInfo
Definition: winuser.h:5857

Referenced by _tWinMain().

◆ DeviceDlgProc()

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

Definition at line 713 of file reactos.c.

718{
719 PSETUPDATA pSetupData;
720 HWND hList;
721
722 /* Retrieve pointer to the global setup data */
723 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
724
725 switch (uMsg)
726 {
727 case WM_INITDIALOG:
728 {
729 /* Save pointer to the global setup data */
730 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
731 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
732
733 hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
735
736 hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
738
739 hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
741
742 // hList = GetDlgItem(hwndDlg, IDC_KEYBOARD_LAYOUT);
743 // InitGenericComboList(hList, pSetupData->USetupData.LayoutList, GetSettingDescription);
744
745 break;
746 }
747
748 case WM_NOTIFY:
749 {
750 LPNMHDR lpnm = (LPNMHDR)lParam;
751
752 switch (lpnm->code)
753 {
754 case PSN_SETACTIVE:
756 break;
757
759 {
760 /* Focus on "Computer" list */
762 return TRUE;
763 }
764
765 case PSN_QUERYCANCEL:
766 {
767 if (MessageBoxW(GetParent(hwndDlg),
768 pSetupData->szAbortMessage,
769 pSetupData->szAbortTitle,
771 {
772 /* Go to the Terminate page */
774 }
775
776 /* Do not close the wizard too soon */
778 return TRUE;
779 }
780
781 case PSN_WIZNEXT: /* Set the selected data */
782 {
783 hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
786
787 hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
790
791 hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
794
795 // hList = GetDlgItem(hwndDlg, IDC_KEYBOARD_LAYOUT);
796 // SetCurrentListEntry(pSetupData->USetupData.LayoutList,
797 // GetSelectedComboListItem(hList));
798
799 return TRUE;
800 }
801
802 default:
803 break;
804 }
805 }
806 break;
807
808 default:
809 break;
810
811 }
812 return FALSE;
813}
#define IDC_DISPLAY
Definition: resource.h:19
PVOID GetSelectedComboListItem(IN HWND hWndList)
Definition: reactos.c:373
static VOID NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
Definition: reactos.c:451
VOID InitGenericComboList(IN HWND hWndList, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: reactos.c:335
struct _SETUPDATA * PSETUPDATA
#define IDC_KEYBOARD
Definition: resource.h:34
#define IDC_COMPUTER
Definition: resource.h:32
LPARAM lParam
Definition: combotst.c:139
VOID SetCurrentListEntry(IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:87
HWND hList
Definition: livecd.c:10
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PSWIZB_NEXT
Definition: prsht.h:154
#define PSWIZB_BACK
Definition: prsht.h:153
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
PGENERIC_LIST DisplayList
Definition: setuplib.h:120
PGENERIC_LIST ComputerList
Definition: setuplib.h:119
PGENERIC_LIST KeyboardList
Definition: setuplib.h:121
UINT code
Definition: winuser.h:3158
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define GetWindowLongPtrW
Definition: winuser.h:4828
#define WM_INITDIALOG
Definition: winuser.h:1738
#define MB_YESNO
Definition: winuser.h:816
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
struct tagNMHDR * LPNMHDR
#define MB_ICONQUESTION
Definition: winuser.h:788
#define DWLP_MSGRESULT
Definition: winuser.h:869
#define IDYES
Definition: winuser.h:834
#define SetWindowLongPtrW
Definition: winuser.h:5345

Referenced by _tWinMain().

◆ DisplayError()

INT DisplayError ( IN HWND hParentWnd  OPTIONAL,
IN UINT  uIDTitle,
IN UINT  uIDMessage 
)

Definition at line 94 of file reactos.c.

98{
99 WCHAR message[512], caption[64];
100
102 LoadStringW(SetupData.hInstance, uIDTitle, caption, ARRAYSIZE(caption));
103
104 return MessageBoxW(hParentWnd, message, caption, MB_OK | MB_ICONERROR);
105}
Definition: tftpd.h:60
#define MB_OK
Definition: winuser.h:789

Referenced by _tWinMain().

◆ EnablePrivilege()

BOOL EnablePrivilege ( IN LPCWSTR  lpszPrivilegeName,
IN BOOL  bEnablePrivilege 
)

Definition at line 1757 of file reactos.c.

1760{
1761 BOOL Success;
1762 HANDLE hToken;
1764
1767 &hToken);
1768 if (!Success) return Success;
1769
1771 lpszPrivilegeName,
1772 &tp.Privileges[0].Luid);
1773 if (!Success) goto Quit;
1774
1775 tp.PrivilegeCount = 1;
1776 tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
1777
1778 Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
1779
1780Quit:
1781 CloseHandle(hToken);
1782 return Success;
1783}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define GetCurrentProcess()
Definition: compat.h:759
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
@ Success
Definition: eventcreate.c:712
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:930
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63

Referenced by _tWinMain().

◆ FileCopyCallback()

static UINT CALLBACK FileCopyCallback ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 986 of file reactos.c.

990{
991 PCOPYCONTEXT CopyContext = (PCOPYCONTEXT)Context;
992 PFILEPATHS_W FilePathInfo;
993 PCWSTR SrcFileName, DstFileName;
994 WCHAR Status[1024];
995
997 if (CopyContext->pSetupData->bStopInstall)
998 return FILEOP_ABORT; // Stop committing files
999
1000 switch (Notification)
1001 {
1003 {
1004 CopyContext->TotalOperations = (ULONG)Param2;
1005 CopyContext->CompletedOperations = 0;
1006
1007 SendMessageW(CopyContext->hWndProgress,
1008 PBM_SETRANGE, 0,
1009 MAKELPARAM(0, CopyContext->TotalOperations));
1010 SendMessageW(CopyContext->hWndProgress,
1011 PBM_SETSTEP, 1, 0);
1012 break;
1013 }
1014
1018 {
1019 FilePathInfo = (PFILEPATHS_W)Param1;
1020
1022 {
1023 /* Display delete message */
1024 ASSERT(Param2 == FILEOP_DELETE);
1025
1026 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1027 if (DstFileName) ++DstFileName;
1028 else DstFileName = FilePathInfo->Target;
1029
1030 // STRING_DELETING
1031 StringCchPrintfW(Status, ARRAYSIZE(Status), L"Deleting %s", DstFileName);
1032 SetWindowTextW(CopyContext->hWndItem, Status);
1033 }
1035 {
1036 /* Display move/rename message */
1037 ASSERT(Param2 == FILEOP_RENAME);
1038
1039 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
1040 if (SrcFileName) ++SrcFileName;
1041 else SrcFileName = FilePathInfo->Source;
1042
1043 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1044 if (DstFileName) ++DstFileName;
1045 else DstFileName = FilePathInfo->Target;
1046
1047 // STRING_MOVING or STRING_RENAMING
1048 if (!wcsicmp(SrcFileName, DstFileName))
1049 StringCchPrintfW(Status, ARRAYSIZE(Status), L"Moving %s to %s", SrcFileName, DstFileName);
1050 else
1051 StringCchPrintfW(Status, ARRAYSIZE(Status), L"Renaming %s to %s", SrcFileName, DstFileName);
1052
1053 SetWindowTextW(CopyContext->hWndItem, Status);
1054 }
1056 {
1057 /* Display copy message */
1058 ASSERT(Param2 == FILEOP_COPY);
1059
1060 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1061 if (DstFileName) ++DstFileName;
1062 else DstFileName = FilePathInfo->Target;
1063
1064 // STRING_COPYING
1065 StringCchPrintfW(Status, ARRAYSIZE(Status), L"Copying %s", DstFileName);
1066 SetWindowTextW(CopyContext->hWndItem, Status);
1067 }
1068 break;
1069 }
1070
1074 {
1075 CopyContext->CompletedOperations++;
1076
1077 /* SYSREG checkpoint */
1078 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
1079 DPRINT1("CHECKPOINT:HALF_COPIED\n");
1080
1081 SendMessageW(CopyContext->hWndProgress, PBM_STEPIT, 0, 0);
1082 break;
1083 }
1084 }
1085
1086 return FILEOP_DOIT;
1087}
struct _COPYCONTEXT * PCOPYCONTEXT
#define wcsrchr
Definition: compat.h:16
#define wcsicmp
Definition: compat.h:15
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define FILEOP_COPY
Definition: fileqsup.h:42
struct _FILEPATHS_W * PFILEPATHS_W
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define SPFILENOTIFY_ENDCOPY
Definition: fileqsup.h:36
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
#define FILEOP_RENAME
Definition: fileqsup.h:43
#define SPFILENOTIFY_STARTRENAME
Definition: fileqsup.h:31
#define SPFILENOTIFY_ENDRENAME
Definition: fileqsup.h:32
#define FILEOP_DELETE
Definition: fileqsup.h:44
#define FILEOP_ABORT
Definition: fileqsup.h:47
#define PBM_SETSTEP
Definition: commctrl.h:2186
#define PBM_SETRANGE
Definition: commctrl.h:2183
#define PBM_STEPIT
Definition: commctrl.h:2187
HWND hWndProgress
Definition: reactos.c:979
HWND hWndItem
Definition: reactos.c:978
ULONG TotalOperations
Definition: reactos.c:980
ULONG CompletedOperations
Definition: reactos.c:981
PSETUPDATA pSetupData
Definition: reactos.c:977
PCWSTR Source
Definition: fileqsup.h:61
PCWSTR Target
Definition: fileqsup.h:60
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
#define MAKELPARAM(l, h)
Definition: winuser.h:4007
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by PrepareAndDoCopyThread().

◆ FreeNtToWin32PathMappingList()

VOID FreeNtToWin32PathMappingList ( IN OUT PNT_WIN32_PATH_MAPPING_LIST  MappingList)

Definition at line 1477 of file reactos.c.

1479{
1480 PLIST_ENTRY ListEntry;
1481 PVOID Entry;
1482
1483 while (!IsListEmpty(&MappingList->List))
1484 {
1485 ListEntry = RemoveHeadList(&MappingList->List);
1486 Entry = (PVOID)CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
1488 }
1489
1490 MappingList->MappingsCount = 0;
1491}
#define HeapFree(x, y, z)
Definition: compat.h:735
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
void * PVOID
Definition: typedefs.h:50

Referenced by _tWinMain().

◆ GetSelectedComboListItem()

PVOID GetSelectedComboListItem ( IN HWND  hWndList)

Definition at line 373 of file reactos.c.

375{
376 INT Index;
377
379 if (Index == CB_ERR)
380 return NULL;
381
383}
_In_ WDFCOLLECTION _In_ ULONG Index
#define ComboBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:54
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:49
#define CB_ERR
Definition: winuser.h:2434

Referenced by DeviceDlgProc().

◆ GetSelectedListViewItem()

PVOID GetSelectedListViewItem ( IN HWND  hWndList)

Definition at line 431 of file reactos.c.

433{
434 INT Index;
435 LVITEM item;
436
438 if (Index == LB_ERR)
439 return NULL;
440
441 item.mask = LVIF_PARAM;
442 item.iItem = Index;
444
445 return (PVOID)item.lParam;
446}
static ATOM item
Definition: dde.c:856
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define LVITEM
Definition: commctrl.h:2375
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LB_ERR
Definition: winuser.h:2431

Referenced by UpgradeRepairDlgProc().

◆ GetSettingDescription()

static VOID NTAPI GetSettingDescription ( IN PGENERIC_LIST_ENTRY  Entry,
OUT PWSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 451 of file reactos.c.

455{
456 StringCchCopyW(Buffer, cchBufferSize,
458}
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by DeviceDlgProc(), and SummaryDlgProc().

◆ HotkeyThread()

static DWORD CALLBACK HotkeyThread ( LPVOID  Parameter)
static

Definition at line 1787 of file reactos.c.

1788{
1789 ATOM hotkey;
1790 MSG msg;
1791
1792 DPRINT("HotkeyThread start\n");
1793
1794 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
1795
1796 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
1797 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
1798
1799 while (GetMessageW(&msg, NULL, 0, 0))
1800 {
1801 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
1802 {
1803 STARTUPINFOW si = { sizeof(si) };
1805
1806 if (CreateProcessW(L"cmd.exe",
1807 NULL,
1808 NULL,
1809 NULL,
1810 FALSE,
1812 NULL,
1813 NULL,
1814 &si,
1815 &pi))
1816 {
1817 CloseHandle(pi.hProcess);
1818 CloseHandle(pi.hThread);
1819 }
1820 else
1821 {
1822 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1823 }
1824 }
1825 }
1826
1827 UnregisterHotKey(NULL, hotkey);
1828 GlobalDeleteAtom(hotkey);
1829
1830 DPRINT("HotkeyThread terminate\n");
1831 return 0;
1832}
#define msg(x)
Definition: auth_time.c:54
WORD ATOM
Definition: dimm.idl:113
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4592
#define MOD_SHIFT
Definition: imm.h:334
static refpint_t pi[]
Definition: server.c:96
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CREATE_NEW_CONSOLE
Definition: winbase.h:180
#define VK_F10
Definition: winuser.h:2263
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define WM_HOTKEY
Definition: winuser.h:1878

Referenced by _tWinMain().

◆ InitGenericComboList()

VOID InitGenericComboList ( IN HWND  hWndList,
IN PGENERIC_LIST  List,
IN PGET_ENTRY_DESCRIPTION  GetEntryDescriptionProc 
)

Definition at line 335 of file reactos.c.

339{
340 INT Index, CurrentEntryIndex = 0;
341 PGENERIC_LIST_ENTRY ListEntry;
343 WCHAR CurrentItemText[256];
344
345 for (Entry = List->ListHead.Flink;
346 Entry != &List->ListHead;
347 Entry = Entry->Flink)
348 {
350
351 if (GetEntryDescriptionProc)
352 {
353 GetEntryDescriptionProc(ListEntry,
354 CurrentItemText,
355 ARRAYSIZE(CurrentItemText));
356 Index = SendMessageW(hWndList, CB_ADDSTRING, 0, (LPARAM)CurrentItemText);
357 }
358 else
359 {
361 }
362
363 if (ListEntry == List->CurrentEntry)
364 CurrentEntryIndex = Index;
365
367 }
368
369 SendMessageW(hWndList, CB_SETCURSEL, CurrentEntryIndex, 0);
370}
Definition: genlist.h:11
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define CB_SETITEMDATA
Definition: winuser.h:1965
#define CB_SETCURSEL
Definition: winuser.h:1960
#define CB_ADDSTRING
Definition: winuser.h:1935

Referenced by DeviceDlgProc().

◆ InitGenericListView()

VOID InitGenericListView ( IN HWND  hWndList,
IN PGENERIC_LIST  List,
IN PADD_ENTRY_ITEM  AddEntryItemProc 
)

Definition at line 394 of file reactos.c.

398{
399 INT CurrentEntryIndex = 0;
400 LVITEM lvItem;
401 PGENERIC_LIST_ENTRY ListEntry;
403 WCHAR CurrentItemText[256];
404
405 for (Entry = List->ListHead.Flink;
406 Entry != &List->ListHead;
407 Entry = Entry->Flink)
408 {
410
411 if (!AddEntryItemProc)
412 continue;
413
414 AddEntryItemProc(hWndList,
415 &lvItem,
416 ListEntry,
417 CurrentItemText,
418 ARRAYSIZE(CurrentItemText));
419
420 if (ListEntry == List->CurrentEntry)
421 CurrentEntryIndex = lvItem.iItem;
422 }
423
424 ListView_EnsureVisible(hWndList, CurrentEntryIndex, FALSE);
425 ListView_SetItemState(hWndList, CurrentEntryIndex,
428}
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2519

Referenced by UpgradeRepairDlgProc().

◆ InitNtToWin32PathMappingList()

VOID InitNtToWin32PathMappingList ( IN OUT PNT_WIN32_PATH_MAPPING_LIST  MappingList)

Definition at line 1469 of file reactos.c.

1471{
1472 InitializeListHead(&MappingList->List);
1473 MappingList->MappingsCount = 0;
1474}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by _tWinMain().

◆ LoadSetupData()

BOOL LoadSetupData ( IN OUT PSETUPDATA  pSetupData)

Definition at line 1401 of file reactos.c.

1403{
1404 BOOL ret = TRUE;
1405 // INFCONTEXT InfContext;
1406 // TCHAR tmp[10];
1407 // DWORD LineLength;
1408 // LONG Count;
1409
1410 /* Load the hardware, language and keyboard layout lists */
1411
1412 pSetupData->USetupData.ComputerList = CreateComputerTypeList(pSetupData->USetupData.SetupInf);
1413 pSetupData->USetupData.DisplayList = CreateDisplayDriverList(pSetupData->USetupData.SetupInf);
1414 pSetupData->USetupData.KeyboardList = CreateKeyboardDriverList(pSetupData->USetupData.SetupInf);
1415
1416 pSetupData->USetupData.LanguageList = CreateLanguageList(pSetupData->USetupData.SetupInf, pSetupData->DefaultLanguage);
1417
1418 pSetupData->PartitionList = CreatePartitionList();
1419
1420 pSetupData->NtOsInstallsList = CreateNTOSInstallationsList(pSetupData->PartitionList);
1421 if (!pSetupData->NtOsInstallsList)
1422 DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
1423
1424
1425 /* new part */
1426 pSetupData->SelectedLanguageId = pSetupData->DefaultLanguage;
1427 wcscpy(pSetupData->DefaultLanguage, pSetupData->USetupData.LocaleID);
1428 pSetupData->USetupData.LanguageId = (LANGID)(wcstol(pSetupData->SelectedLanguageId, NULL, 16) & 0xFFFF);
1429
1430 pSetupData->USetupData.LayoutList = CreateKeyboardLayoutList(pSetupData->USetupData.SetupInf, pSetupData->SelectedLanguageId, pSetupData->DefaultKBLayout);
1431
1432#if 0
1433 // get default for keyboard and language
1434 pSetupData->DefaultKBLayout = -1;
1435 pSetupData->DefaultLang = -1;
1436
1437 // TODO: get defaults from underlaying running system
1438 if (SetupFindFirstLine(pSetupData->USetupData.SetupInf, _T("NLS"), _T("DefaultLayout"), &InfContext))
1439 {
1440 SetupGetStringField(&InfContext, 1, tmp, ARRAYSIZE(tmp), &LineLength);
1441 for (Count = 0; Count < pSetupData->KbLayoutCount; Count++)
1442 {
1443 if (_tcscmp(tmp, pSetupData->pKbLayouts[Count].LayoutId) == 0)
1444 {
1445 pSetupData->DefaultKBLayout = Count;
1446 break;
1447 }
1448 }
1449 }
1450
1451 if (SetupFindFirstLine(pSetupData->USetupData.SetupInf, _T("NLS"), _T("DefaultLanguage"), &InfContext))
1452 {
1453 SetupGetStringField(&InfContext, 1, tmp, ARRAYSIZE(tmp), &LineLength);
1454 for (Count = 0; Count < pSetupData->LangCount; Count++)
1455 {
1456 if (_tcscmp(tmp, pSetupData->pLanguages[Count].LangId) == 0)
1457 {
1458 pSetupData->DefaultLang = Count;
1459 break;
1460 }
1461 }
1462 }
1463#endif
1464
1465 return ret;
1466}
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1093
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:524
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:708
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1230
PGENERIC_LIST CreateLanguageList(IN HINF InfFile, OUT PWSTR DefaultLanguage)
Definition: settings.c:1180
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define _tcscmp
Definition: tchar.h:1424
int Count
Definition: noreturn.cpp:7
PGENERIC_LIST CreateNTOSInstallationsList(IN PPARTLIST PartList)
Definition: osdetect.c:777
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
PPARTLIST CreatePartitionList(VOID)
Definition: partlist.c:1847
#define SetupFindFirstLine
Definition: setupapi.h:2624
#define SetupGetStringField
Definition: setupapi.h:2639
WORD LANGID
Definition: typedefs.h:81
int ret

Referenced by _tWinMain().

◆ PrepareAndDoCopyThread()

static DWORD WINAPI PrepareAndDoCopyThread ( IN LPVOID  Param)
static

Definition at line 1091 of file reactos.c.

1093{
1094 PSETUPDATA pSetupData;
1095 HWND hwndDlg = (HWND)Param;
1096 HWND hWndProgress;
1097 LONG_PTR dwStyle;
1098 // ERROR_NUMBER ErrorNumber;
1100 COPYCONTEXT CopyContext;
1101
1102 /* Retrieve pointer to the global setup data */
1103 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1104
1105 /* Get the progress handle */
1106 hWndProgress = GetDlgItem(hwndDlg, IDC_PROCESSPROGRESS);
1107
1108
1109 /*
1110 * Preparation of the list of files to be copied
1111 */
1112
1113 /* Set status text */
1114 SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"Preparing the list of files to be copied, please wait...");
1115 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1116
1117 /* Set progress marquee style */
1118 dwStyle = GetWindowLongPtrW(hWndProgress, GWL_STYLE);
1119 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle | PBS_MARQUEE);
1120
1121 /* Start it up */
1122 SendMessageW(hWndProgress, PBM_SETMARQUEE, TRUE, 0);
1123
1124 /* Prepare the list of files */
1125 /* ErrorNumber = */ Success = PrepareFileCopy(&pSetupData->USetupData, NULL);
1126 if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
1127 {
1128 /* Display an error only if an unexpected failure happened, and not because the user cancelled the installation */
1129 if (!pSetupData->bStopInstall)
1130 MessageBoxW(GetParent(hwndDlg), L"Failed to prepare the list of files!", L"Error", MB_ICONERROR);
1131
1132 /* Stop it */
1133 SendMessageW(hWndProgress, PBM_SETMARQUEE, FALSE, 0);
1134
1135 /* Restore progress style */
1136 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle);
1137
1138 /*
1139 * If we failed due to an unexpected error, keep on the copy page to view the current state,
1140 * but enable the "Next" button to allow the user to continue to the terminate page.
1141 * Otherwise we have been cancelled by the user, who has already switched to the Terminate page.
1142 */
1143 if (!pSetupData->bStopInstall)
1145 return 1;
1146 }
1147
1148 /* Stop it */
1149 SendMessageW(hWndProgress, PBM_SETMARQUEE, FALSE, 0);
1150
1151 /* Restore progress style */
1152 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle);
1153
1154
1155 /*
1156 * Perform the file copy
1157 */
1158
1159 /* Set status text */
1160 SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"Copying the files...");
1161 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1162
1163 /* Create context for the copy process */
1164 CopyContext.pSetupData = pSetupData;
1165 CopyContext.hWndItem = GetDlgItem(hwndDlg, IDC_ITEM);
1166 CopyContext.hWndProgress = hWndProgress;
1167 CopyContext.TotalOperations = 0;
1168 CopyContext.CompletedOperations = 0;
1169
1170 /* Do the file copying - The callback handles whether or not we should stop file copying */
1171 if (!DoFileCopy(&pSetupData->USetupData, FileCopyCallback, &CopyContext))
1172 {
1173 /* Display an error only if an unexpected failure happened, and not because the user cancelled the installation */
1174 if (!pSetupData->bStopInstall)
1175 MessageBoxW(GetParent(hwndDlg), L"Failed to copy the files!", L"Error", MB_ICONERROR);
1176
1177 /*
1178 * If we failed due to an unexpected error, keep on the copy page to view the current state,
1179 * but enable the "Next" button to allow the user to continue to the terminate page.
1180 * Otherwise we have been cancelled by the user, who has already switched to the Terminate page.
1181 */
1182 if (!pSetupData->bStopInstall)
1184 return 1;
1185 }
1186
1187 /* Set status text */
1188 SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"Finalizing the installation...");
1189 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1190
1191 /* Create the $winnt$.inf file */
1192 InstallSetupInfFile(&pSetupData->USetupData);
1193
1194 /* We are done! Switch to the Terminate page */
1196 return 0;
1197}
unsigned char BOOLEAN
BOOLEAN DoFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
Definition: install.c:818
BOOLEAN PrepareFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
Definition: install.c:676
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: reactos.c:986
#define IDC_PROCESSPROGRESS
Definition: resource.h:57
#define IDC_ACTIVITY
Definition: resource.h:55
#define IDC_ITEM
Definition: resource.h:56
HANDLE HWND
Definition: compat.h:19
#define PBS_MARQUEE
Definition: commctrl.h:2198
#define PBM_SETMARQUEE
Definition: commctrl.h:2199
VOID InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:214
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define GWL_STYLE
Definition: winuser.h:851

Referenced by ProcessDlgProc().

◆ ProcessDlgProc()

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

Definition at line 1201 of file reactos.c.

1206{
1207 PSETUPDATA pSetupData;
1208
1209 /* Retrieve pointer to the global setup data */
1210 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1211
1212 switch (uMsg)
1213 {
1214 case WM_INITDIALOG:
1215 {
1216 /* Save pointer to the global setup data */
1217 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1218 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
1219
1220 /* Reset status text */
1221 SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"");
1222 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1223
1224 break;
1225 }
1226
1227 case WM_NOTIFY:
1228 {
1229 LPNMHDR lpnm = (LPNMHDR)lParam;
1230
1231 switch (lpnm->code)
1232 {
1233 case PSN_SETACTIVE:
1234 {
1235 /* Create the file-copy halt (manual-reset) event */
1236 pSetupData->hHaltInstallEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
1237 if (!pSetupData->hHaltInstallEvent)
1238 break;
1239 pSetupData->bStopInstall = FALSE;
1240
1241 /* Start the prepare-and-copy files thread */
1242 pSetupData->hInstallThread =
1243 CreateThread(NULL, 0,
1245 (PVOID)hwndDlg,
1247 NULL);
1248 if (!pSetupData->hInstallThread)
1249 {
1250 CloseHandle(pSetupData->hHaltInstallEvent);
1251 pSetupData->hHaltInstallEvent = NULL;
1252
1253 MessageBoxW(GetParent(hwndDlg), L"Cannot create the prepare-and-copy files thread!", L"Error", MB_ICONERROR);
1254 break;
1255 }
1256
1257 /* Disable all buttons during installation process - buttons will be reenabled by the installation thread */
1259
1260 /* Resume the installation thread */
1261 ResumeThread(pSetupData->hInstallThread);
1262
1263 break;
1264 }
1265
1266 case PSN_QUERYCANCEL:
1267 {
1268 /* Halt the on-going file copy */
1269 ResetEvent(pSetupData->hHaltInstallEvent);
1270
1271 if (MessageBoxW(GetParent(hwndDlg),
1272 pSetupData->szAbortMessage,
1273 pSetupData->szAbortTitle,
1275 {
1276 /* Stop the file copy thread */
1277 pSetupData->bStopInstall = TRUE;
1278 SetEvent(pSetupData->hHaltInstallEvent);
1279
1280#if 0
1281 /* Wait for any pending installation */
1283 CloseHandle(pSetupData->hInstallThread);
1284 pSetupData->hInstallThread = NULL;
1285 CloseHandle(pSetupData->hHaltInstallEvent);
1286 pSetupData->hHaltInstallEvent = NULL;
1287#endif
1288
1289 // TODO: Unwind installation?!
1290
1291 /* Go to the Terminate page */
1293 }
1294 else
1295 {
1296 /* We don't stop installation, resume file copy */
1297 SetEvent(pSetupData->hHaltInstallEvent);
1298 }
1299
1300 /* Do not close the wizard too soon */
1302 return TRUE;
1303 }
1304
1305 default:
1306 break;
1307 }
1308 }
1309 break;
1310
1311 default:
1312 break;
1313
1314 }
1315
1316 return FALSE;
1317}
static DWORD WINAPI PrepareAndDoCopyThread(IN LPVOID Param)
Definition: reactos.c:1091
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:567
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
#define CREATE_SUSPENDED
Definition: winbase.h:178

Referenced by _tWinMain().

◆ RestartDlgProc()

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

Definition at line 1320 of file reactos.c.

1325{
1326 PSETUPDATA pSetupData;
1327
1328 /* Retrieve pointer to the global setup data */
1329 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1330
1331 switch (uMsg)
1332 {
1333 case WM_INITDIALOG:
1334 /* Save pointer to the global setup data */
1335 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1336 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
1337
1338 /* Set title font */
1339 SendDlgItemMessage(hwndDlg,
1341 WM_SETFONT,
1342 (WPARAM)pSetupData->hTitleFont,
1343 (LPARAM)TRUE);
1344 break;
1345
1346 case WM_TIMER:
1347 {
1348 INT Position;
1349 HWND hWndProgress;
1350
1351 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
1352 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
1353 if (Position == 300)
1354 {
1355 KillTimer(hwndDlg, 1);
1357 }
1358 else
1359 {
1360 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
1361 }
1362 return TRUE;
1363 }
1364
1365 case WM_DESTROY:
1366 return TRUE;
1367
1368 case WM_NOTIFY:
1369 {
1370 LPNMHDR lpnm = (LPNMHDR)lParam;
1371
1372 switch (lpnm->code)
1373 {
1374 case PSN_SETACTIVE:
1375 {
1376 /* Only "Finish" for closing the wizard */
1379
1380 /* Set up the reboot progress bar */
1383 SetTimer(hwndDlg, 1, 50, NULL);
1384 break;
1385 }
1386
1387 default:
1388 break;
1389 }
1390 }
1391 break;
1392
1393 default:
1394 break;
1395
1396 }
1397
1398 return FALSE;
1399}
#define IDC_FINISHTITLE
Definition: resource.h:60
#define IDC_RESTART_PROGRESS
Definition: resource.h:61
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#define PSWIZB_FINISH
Definition: prsht.h:155
#define PSBTN_FINISH
Definition: prsht.h:148
#define PBM_GETPOS
Definition: commctrl.h:2194
#define PBM_SETPOS
Definition: commctrl.h:2184
static COORD Position
Definition: mouse.c:34
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_HIDE
Definition: winuser.h:767
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:830
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_SETFONT
Definition: winuser.h:1649
#define WM_TIMER
Definition: winuser.h:1741
#define WM_DESTROY
Definition: winuser.h:1608
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SendDlgItemMessage
Definition: winuser.h:5841

Referenced by _tWinMain().

◆ StartDlgProc()

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

Definition at line 108 of file reactos.c.

113{
114 PSETUPDATA pSetupData;
115
116 /* Retrieve pointer to the global setup data */
117 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
118
119 switch (uMsg)
120 {
121 case WM_INITDIALOG:
122 {
123 /* Save pointer to the global setup data */
124 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
125 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
126
127 /* Set title font */
128 SendDlgItemMessage(hwndDlg,
131 (WPARAM)pSetupData->hTitleFont,
132 (LPARAM)TRUE);
133
134 /* Center the wizard window */
135 CenterWindow(GetParent(hwndDlg));
136 break;
137 }
138
139 case WM_NOTIFY:
140 {
141 LPNMHDR lpnm = (LPNMHDR)lParam;
142
143 switch (lpnm->code)
144 {
145 case PSN_SETACTIVE:
147 break;
148
149 default:
150 break;
151 }
152 }
153 break;
154
155 default:
156 break;
157
158 }
159
160 return FALSE;
161}
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:47
#define IDC_STARTTITLE
Definition: resource.h:19

Referenced by _tWinMain().

◆ SummaryDlgProc()

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

Definition at line 816 of file reactos.c.

821{
822 static WCHAR szOrgWizNextBtnText[260]; // TODO: Make it dynamic
823
824 PSETUPDATA pSetupData;
825
826 /* Retrieve pointer to the global setup data */
827 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
828
829 switch (uMsg)
830 {
831 case WM_INITDIALOG:
832 {
833 /* Save pointer to the global setup data */
834 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
835 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
836 break;
837 }
838
839 case WM_COMMAND:
840 {
842 {
845 else
847 }
848 break;
849 }
850
851 case WM_NOTIFY:
852 {
853 LPNMHDR lpnm = (LPNMHDR)lParam;
854
855 switch (lpnm->code)
856 {
857 case PSN_SETACTIVE:
858 {
859 WCHAR CurrentItemText[256];
860
861 /* Show the current selected settings */
862
863 // FIXME! Localize
864 if (pSetupData->RepairUpdateFlag)
865 {
866 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
867 L"Upgrading/Repairing \"%s\" from \"%s\"",
869 pSetupData->CurrentInstallation->VendorName);
870 }
871 else
872 {
873 StringCchCopyW(CurrentItemText, ARRAYSIZE(CurrentItemText),
874 L"New ReactOS installation");
875 }
876 SetDlgItemTextW(hwndDlg, IDC_INSTALLTYPE, CurrentItemText);
877
878 SetDlgItemTextW(hwndDlg, IDC_INSTALLSOURCE, L"n/a");
879 SetDlgItemTextW(hwndDlg, IDC_ARCHITECTURE, L"n/a");
880
882 CurrentItemText,
883 ARRAYSIZE(CurrentItemText));
884 SetDlgItemTextW(hwndDlg, IDC_COMPUTER, CurrentItemText);
885
887 CurrentItemText,
888 ARRAYSIZE(CurrentItemText));
889 SetDlgItemTextW(hwndDlg, IDC_DISPLAY, CurrentItemText);
890
892 CurrentItemText,
893 ARRAYSIZE(CurrentItemText));
894 SetDlgItemTextW(hwndDlg, IDC_KEYBOARD, CurrentItemText);
895
896 if (L'C') // FIXME!
897 {
898 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
899 L"%c: \x2014 %wZ",
900 L'C', // FIXME!
901 &pSetupData->USetupData.DestinationRootPath);
902 }
903 else
904 {
905 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
906 L"%wZ",
907 &pSetupData->USetupData.DestinationRootPath);
908 }
909 SetDlgItemTextW(hwndDlg, IDC_DESTDRIVE, CurrentItemText);
910
911 SetDlgItemTextW(hwndDlg, IDC_PATH,
912 /*pSetupData->USetupData.InstallationDirectory*/
913 pSetupData->USetupData.InstallPath.Buffer);
914
915
916 /* Change the "Next" button text to "Install" */
917 // PropSheet_SetNextText(GetParent(hwndDlg), ...);
919 szOrgWizNextBtnText, ARRAYSIZE(szOrgWizNextBtnText));
920 SetDlgItemTextW(GetParent(hwndDlg), ID_WIZNEXT, L"Install"); // FIXME: Localize!
921
922 /*
923 * Keep the "Next" button disabled. It will be enabled only
924 * when the user clicks on the installation approval checkbox.
925 */
928 break;
929 }
930
932 {
933 /* Focus on the confirmation check-box */
935 return TRUE;
936 }
937
938 case PSN_KILLACTIVE:
939 {
940 /* Restore the original "Next" button text */
941 SetDlgItemTextW(GetParent(hwndDlg), ID_WIZNEXT, szOrgWizNextBtnText);
942 break;
943 }
944
945 case PSN_QUERYCANCEL:
946 {
947 if (MessageBoxW(GetParent(hwndDlg),
948 pSetupData->szAbortMessage,
949 pSetupData->szAbortTitle,
951 {
952 /* Go to the Terminate page */
954 }
955
956 /* Do not close the wizard too soon */
958 return TRUE;
959 }
960
961 default:
962 break;
963 }
964 break;
965 }
966
967 default:
968 break;
969 }
970
971 return FALSE;
972}
#define ID_WIZNEXT
Definition: reactos.h:53
#define IDC_CONFIRM_INSTALL
Definition: resource.h:52
#define IDC_ARCHITECTURE
Definition: resource.h:46
#define IDC_PATH
Definition: resource.h:65
#define IDC_DESTDRIVE
Definition: resource.h:50
#define IDC_INSTALLTYPE
Definition: resource.h:44
#define IDC_INSTALLSOURCE
Definition: resource.h:45
WPARAM wParam
Definition: combotst.c:138
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
#define LOWORD(l)
Definition: pedump.c:82
#define PSN_KILLACTIVE
Definition: prsht.h:116
PNTOS_INSTALLATION CurrentInstallation
Definition: reactos.h:133
BOOLEAN RepairUpdateFlag
Definition: reactos.h:130
UNICODE_STRING DestinationRootPath
Definition: setuplib.h:105
UNICODE_STRING InstallPath
Definition: setuplib.h:108
#define HIWORD(l)
Definition: typedefs.h:247
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_COMMAND
Definition: winuser.h:1739
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define BN_CLICKED
Definition: winuser.h:1924
#define BST_CHECKED
Definition: winuser.h:197

Referenced by _tWinMain().

◆ TypeDlgProc()

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

Definition at line 164 of file reactos.c.

169{
170 PSETUPDATA pSetupData;
171
172 /* Retrieve pointer to the global setup data */
173 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
174
175 switch (uMsg)
176 {
177 case WM_INITDIALOG:
178 {
179 /* Save pointer to the global setup data */
180 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
181 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
182
183 /* Check the 'install' radio button */
185
186 /*
187 * Enable the 'update' radio button and text only if we have
188 * available NT installations, otherwise disable them.
189 */
190 if (pSetupData->NtOsInstallsList &&
192 {
195 }
196 else
197 {
200 }
201
202 break;
203 }
204
205 case WM_NOTIFY:
206 {
207 LPNMHDR lpnm = (LPNMHDR)lParam;
208
209 switch (lpnm->code)
210 {
211 case PSN_SETACTIVE:
213 break;
214
216 {
217 /* Focus on "Install ReactOS" */
219 return TRUE;
220 }
221
222 case PSN_QUERYCANCEL:
223 {
224 if (MessageBoxW(GetParent(hwndDlg),
225 pSetupData->szAbortMessage,
226 pSetupData->szAbortTitle,
228 {
229 /* Go to the Terminate page */
231 }
232
233 /* Do not close the wizard too soon */
235 return TRUE;
236 }
237
238 case PSN_WIZNEXT: /* Set the selected data */
239 {
240 /*
241 * Go update only if we have available NT installations
242 * and we choose to do so.
243 */
244 if (pSetupData->NtOsInstallsList &&
245 GetNumberOfListEntries(pSetupData->NtOsInstallsList) != 0 &&
247 {
248 pSetupData->RepairUpdateFlag = TRUE;
249
250 /*
251 * Display the existing NT installations page only
252 * if we have more than one available NT installations.
253 */
254 if (GetNumberOfListEntries(pSetupData->NtOsInstallsList) > 1)
255 {
256 /* pSetupData->CurrentInstallation will be set from within IDD_UPDATEREPAIRPAGE */
257
258 /* Actually the best would be to dynamically insert the page only when needed */
260 }
261 else
262 {
263 /* Retrieve the current installation */
264 pSetupData->CurrentInstallation =
266
268 }
269 }
270 else
271 {
272 pSetupData->CurrentInstallation = NULL;
273 pSetupData->RepairUpdateFlag = FALSE;
275 }
276
277 return TRUE;
278 }
279
280 default:
281 break;
282 }
283 }
284 break;
285
286 default:
287 break;
288
289 }
290 return FALSE;
291}
#define IDC_UPDATE
Definition: resource.h:24
#define IDC_UPDATETEXT
Definition: resource.h:25
#define IDC_INSTALL
Definition: fontview.h:13
ULONG GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:140
PGENERIC_LIST NtOsInstallsList
Definition: reactos.h:134
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by _tWinMain().

◆ UpgradeRepairDlgProc()

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

Definition at line 527 of file reactos.c.

532{
533 PSETUPDATA pSetupData;
534 HWND hList;
535 HIMAGELIST hSmall;
536
537 /* Retrieve pointer to the global setup data */
538 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
539
540 switch (uMsg)
541 {
542 case WM_INITDIALOG:
543 {
544 /* Save pointer to the global setup data */
545 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
546 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
547
548 /*
549 * Keep the "Next" button disabled. It will be enabled only
550 * when the user selects an installation to upgrade.
551 */
553
554 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
555
557
559 hList,
564
565 /* Create the ImageList */
568 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
569 1, 1);
570
571 /* Add event type icons to the ImageList */
574
575 /* Assign the ImageList to the List View */
577
579 break;
580 }
581
582 case WM_DESTROY:
583 {
584 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
587 ImageList_Destroy(hSmall);
588 return TRUE;
589 }
590
591 case WM_COMMAND:
592 switch (LOWORD(wParam))
593 {
594 case IDC_SKIPUPGRADE:
595 {
596 /* Skip the upgrade and do the usual new-installation workflow */
597 pSetupData->CurrentInstallation = NULL;
598 pSetupData->RepairUpdateFlag = FALSE;
600 return TRUE;
601 }
602 }
603 break;
604
605 case WM_NOTIFY:
606 {
607 LPNMHDR lpnm = (LPNMHDR)lParam;
608
609 if (lpnm->idFrom == IDC_NTOSLIST && lpnm->code == LVN_ITEMCHANGED)
610 {
612
613 if (pnmv->uChanged & LVIF_STATE) /* The state has changed */
614 {
615 /* The item has been (de)selected */
616 if (pnmv->uNewState & (LVIS_FOCUSED | LVIS_SELECTED))
617 {
619 }
620 else
621 {
622 /*
623 * Keep the "Next" button disabled. It will be enabled only
624 * when the user selects an installation to upgrade.
625 */
627 }
628 }
629
630 break;
631 }
632
633 switch (lpnm->code)
634 {
635#if 0
636 case PSN_SETACTIVE:
637 {
638 /*
639 * Keep the "Next" button disabled. It will be enabled only
640 * when the user selects an installation to upgrade.
641 */
643 break;
644 }
645#endif
646
648 {
649 /* Give the focus on and select the first item */
650 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
653 return TRUE;
654 }
655
656 case PSN_QUERYCANCEL:
657 {
658 if (MessageBoxW(GetParent(hwndDlg),
659 pSetupData->szAbortMessage,
660 pSetupData->szAbortTitle,
662 {
663 /* Go to the Terminate page */
665 }
666
667 /* Do not close the wizard too soon */
669 return TRUE;
670 }
671
672 case PSN_WIZNEXT: /* Set the selected data */
673 {
674 /*
675 * Go update only if we have available NT installations
676 * and we choose to do so.
677 */
678 if (!pSetupData->NtOsInstallsList ||
680 {
681 pSetupData->CurrentInstallation = NULL;
682 pSetupData->RepairUpdateFlag = FALSE;
683 break;
684 }
685
686 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
689
690 /* Retrieve the current installation */
691 pSetupData->CurrentInstallation =
693
694 /* We perform an upgrade */
695 pSetupData->RepairUpdateFlag = TRUE;
696 return TRUE;
697 }
698
699 default:
700 break;
701 }
702 }
703 break;
704
705 default:
706 break;
707
708 }
709 return FALSE;
710}
PVOID GetSelectedListViewItem(IN HWND hWndList)
Definition: reactos.c:431
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: reactos.c:523
#define MAX_LIST_COLUMNS
Definition: reactos.c:521
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: reactos.c:524
VOID InitGenericListView(IN HWND hWndList, IN PGENERIC_LIST List, IN PADD_ENTRY_ITEM AddEntryItemProc)
Definition: reactos.c:394
BOOL CreateListViewColumns(IN HINSTANCE hInstance, IN HWND hWndListView, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
Definition: reactos.c:296
static VOID NTAPI AddNTOSInstallationItem(IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
Definition: reactos.c:462
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: reactos.c:522
#define IDI_WINICON
Definition: resource.h:10
#define IDI_ROSICON
Definition: resource.h:9
#define IDC_SKIPUPGRADE
Definition: resource.h:29
#define IDC_NTOSLIST
Definition: resource.h:28
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)
Definition: commctrl.h:2726
#define LVIF_STATE
Definition: commctrl.h:2312
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define ListView_GetImageList(hwnd, iImageList)
Definition: commctrl.h:2296
#define ILC_COLOR32
Definition: commctrl.h:358
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
struct tagNMLISTVIEW * LPNMLISTVIEW
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define ILC_MASK
Definition: commctrl.h:351
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
UINT_PTR idFrom
Definition: winuser.h:3157
UINT uNewState
Definition: commctrl.h:3036
#define SM_CYSMICON
Definition: winuser.h:1012
#define SM_CXSMICON
Definition: winuser.h:1011
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2044
int WINAPI GetSystemMetrics(_In_ int)

Referenced by _tWinMain().

Variable Documentation

◆ column_alignment

const INT column_alignment[MAX_LIST_COLUMNS] = {LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT}
static

Definition at line 524 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ column_ids

Definition at line 522 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ column_widths

const INT column_widths[MAX_LIST_COLUMNS] = {200, 150, 100}
static

Definition at line 523 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ IsUnattendedSetup

BOOLEAN IsUnattendedSetup = FALSE

Definition at line 40 of file reactos.c.

Referenced by _tWinMain().

◆ ProcessHeap

HANDLE ProcessHeap
  • Internal Headers *‍/

Definition at line 39 of file reactos.c.

Referenced by _tWinMain(), ConvertNtPathToWin32Path(), and FreeNtToWin32PathMappingList().

◆ SetupData