ReactOS  0.4.14-dev-77-gd9e7c48
reactos.h File Reference
#include <stdlib.h>
#include <stdarg.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <strsafe.h>
#include <commctrl.h>
#include <windowsx.h>
#include "treelist.h"
#include <setupapi.h>
#include <devguid.h>
#include <ndk/cmtypes.h>
#include <ndk/iofuncs.h>
#include <ndk/rtlfuncs.h>
#include <../lib/setuplib.h>
Include dependency graph for reactos.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _NT_WIN32_PATH_MAPPING
 
struct  _NT_WIN32_PATH_MAPPING_LIST
 
struct  _SETUPDATA
 

Macros

#define WIN32_NO_STATUS
 
#define IDC_TAB_CONTROL   0x3020
 
#define ID_APPLY_NOW   0x3021
 
#define ID_WIZBACK   0x3023
 
#define ID_WIZNEXT   0x3024
 
#define ID_WIZFINISH   0x3025
 
#define NTOS_MODE_USER
 

Typedefs

typedef struct _NT_WIN32_PATH_MAPPING NT_WIN32_PATH_MAPPING
 
typedef struct _NT_WIN32_PATH_MAPPINGPNT_WIN32_PATH_MAPPING
 
typedef struct _NT_WIN32_PATH_MAPPING_LIST NT_WIN32_PATH_MAPPING_LIST
 
typedef struct _NT_WIN32_PATH_MAPPING_LISTPNT_WIN32_PATH_MAPPING_LIST
 
typedef struct _SETUPDATA SETUPDATA
 
typedef struct _SETUPDATAPSETUPDATA
 

Functions

BOOL ConvertNtPathToWin32Path (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList, OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
 
BOOL CreateListViewColumns (IN HINSTANCE hInstance, IN HWND hWndListView, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
 
INT_PTR CALLBACK DriveDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

HANDLE ProcessHeap
 
BOOLEAN IsUnattendedSetup
 
SETUPDATA SetupData
 

Macro Definition Documentation

◆ ID_APPLY_NOW

#define ID_APPLY_NOW   0x3021

Definition at line 51 of file reactos.h.

◆ ID_WIZBACK

#define ID_WIZBACK   0x3023

Definition at line 52 of file reactos.h.

◆ ID_WIZFINISH

#define ID_WIZFINISH   0x3025

Definition at line 54 of file reactos.h.

◆ ID_WIZNEXT

#define ID_WIZNEXT   0x3024

Definition at line 53 of file reactos.h.

◆ IDC_TAB_CONTROL

#define IDC_TAB_CONTROL   0x3020

Definition at line 50 of file reactos.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 62 of file reactos.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 36 of file reactos.h.

Typedef Documentation

◆ NT_WIN32_PATH_MAPPING

◆ NT_WIN32_PATH_MAPPING_LIST

◆ PNT_WIN32_PATH_MAPPING

◆ PNT_WIN32_PATH_MAPPING_LIST

◆ PSETUPDATA

◆ SETUPDATA

Function Documentation

◆ 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 */
1560 Retry:
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 
1682  NTSTATUS Status;
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,
1705  &ObjectAttributes);
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 */
1718  Status = NtQuerySymbolicLinkObject(LinkHandle, &Target, NULL);
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 
1741 Quit:
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 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
USHORT MaximumLength
Definition: env_spec_w32.h:370
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
#define _countof(array)
Definition: fontsub.cpp:30
LONG NTSTATUS
Definition: precomp.h:26
_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)
uint16_t * PWCHAR
Definition: typedefs.h:54
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
int32_t INT
Definition: typedefs.h:56
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
IN PSCSI_REQUEST_BLOCK IN OUT NTSTATUS IN OUT BOOLEAN * Retry
Definition: class2.h:49
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
HANDLE ProcessHeap
Definition: reactos.c:39
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
base of all file and directory entries
Definition: entries.h:82
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73

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 
320 
321  if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
322  return FALSE;
323  }
324 
325  return TRUE;
326 }
#define TRUE
Definition: types.h:120
#define LVCF_WIDTH
Definition: commctrl.h:2559
#define LVCF_TEXT
Definition: commctrl.h:2560
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LVCF_SUBITEM
Definition: commctrl.h:2561
#define LVCOLUMN
Definition: commctrl.h:2553
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
HINSTANCE hInstance
Definition: charmap.c:20
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2608
static const WCHAR szText[]
Definition: dialog.c:139
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LVCF_FMT
Definition: commctrl.h:2558
unsigned int UINT
Definition: ndis.h:50

Referenced by UpgradeRepairDlgProc().

◆ DriveDlgProc()

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

Definition at line 596 of file drivepage.c.

601 {
602  PSETUPDATA pSetupData;
603  HWND hList;
604  HIMAGELIST hSmall;
605 
606  /* Retrieve pointer to the global setup data */
607  pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
608 
609  switch (uMsg)
610  {
611  case WM_INITDIALOG:
612  {
613  /* Save pointer to the global setup data */
614  pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
615  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
616 
617  /*
618  * Keep the "Next" button disabled. It will be enabled only
619  * when the user selects a valid partition.
620  */
622 
623  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
624 
626  // TreeList_SetExtendedStyleEx(hList, TVS_EX_FULLROWITEMS, TVS_EX_FULLROWITEMS);
627 
628  CreateTreeListColumns(pSetupData->hInstance,
629  hList,
630  column_ids,
634 
635  /* Create the ImageList */
638  ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
639  1, 1);
640 
641  /* Add event type icons to the ImageList */
644 
645  /* Assign the ImageList to the List View */
647 
648  // DisplayStuffUsingWin32Setup(hwndDlg);
649  DrawPartitionList(hList, pSetupData->PartitionList);
650  break;
651  }
652 
653  case WM_DESTROY:
654  {
655  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
658  ImageList_Destroy(hSmall);
659  return TRUE;
660  }
661 
662  case WM_COMMAND:
663  {
664  switch (LOWORD(wParam))
665  {
666  case IDC_PARTMOREOPTS:
667  DialogBoxParamW(pSetupData->hInstance,
669  hwndDlg,
671  (LPARAM)pSetupData);
672  break;
673 
674  case IDC_PARTCREATE:
675  DialogBoxW(pSetupData->hInstance,
677  hwndDlg,
679  break;
680 
681  case IDC_PARTDELETE:
682  break;
683  }
684  break;
685  }
686 
687  case WM_NOTIFY:
688  {
689  LPNMHDR lpnm = (LPNMHDR)lParam;
690 
691  // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
692  if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
693  {
695 
696  // if (pnmv->uChanged & TVIF_STATE) /* The state has changed */
697  if (pnmv->itemNew.mask & TVIF_STATE)
698  {
699  /* The item has been (de)selected */
700  // if (pnmv->uNewState & TVIS_SELECTED)
701  if (pnmv->itemNew.state & TVIS_SELECTED)
702  {
703  HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
704  /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
705  PPARTENTRY PartEntry = (PPARTENTRY)pnmv->itemNew.lParam;
706 
707  if (!hParentItem || !PartEntry)
708  {
711  goto DisableWizNext;
712  }
713  else // if (hParentItem && PartEntry)
714  {
715  EnableWindow(GetDlgItem(hwndDlg, IDC_PARTCREATE), !PartEntry->IsPartitioned);
716  EnableWindow(GetDlgItem(hwndDlg, IDC_PARTDELETE), PartEntry->IsPartitioned);
717 
718  if (PartEntry->IsPartitioned &&
719  !IsContainerPartition(PartEntry->PartitionType) /* alternatively: PartEntry->PartitionNumber != 0 */ &&
720  // !PartEntry->New &&
721  (PartEntry->FormatState == Preformatted /* || PartEntry->FormatState == Formatted */))
722  {
724  }
725  else
726  {
727  goto DisableWizNext;
728  }
729  }
730  }
731  else
732  {
733 DisableWizNext:
734  /*
735  * Keep the "Next" button disabled. It will be enabled only
736  * when the user selects a valid partition.
737  */
739  }
740  }
741 
742  break;
743  }
744 
745  switch (lpnm->code)
746  {
747 #if 0
748  case PSN_SETACTIVE:
749  {
750  /*
751  * Keep the "Next" button disabled. It will be enabled only
752  * when the user selects a valid partition.
753  */
755  break;
756  }
757 #endif
758 
760  {
761  /* Give the focus on and select the first item */
762  hList = GetDlgItem(hwndDlg, IDC_PARTITION);
763  // TreeList_SetFocusItem(hList, 1, 1);
766  return TRUE;
767  }
768 
769  case PSN_QUERYCANCEL:
770  {
771  if (MessageBoxW(GetParent(hwndDlg),
772  pSetupData->szAbortMessage,
773  pSetupData->szAbortTitle,
775  {
776  /* Go to the Terminate page */
778  }
779 
780  /* Do not close the wizard too soon */
782  return TRUE;
783  }
784 
785  case PSN_WIZNEXT: /* Set the selected data */
786  {
788 
789  /****/
790  // FIXME: This is my test disk encoding!
791  DISKENTRY DiskEntry;
792  PARTENTRY PartEntry;
793  DiskEntry.DiskNumber = 0;
794  DiskEntry.HwDiskNumber = 0;
795  DiskEntry.HwFixedDiskNumber = 0;
796  PartEntry.DiskEntry = &DiskEntry;
797  PartEntry.PartitionNumber = 1; // 4;
798  /****/
799 
800  Status = InitDestinationPaths(&pSetupData->USetupData,
801  NULL, // pSetupData->USetupData.InstallationDirectory,
802  &PartEntry);
803 
804  if (!NT_SUCCESS(Status))
805  {
806  DPRINT1("InitDestinationPaths() failed with status 0x%08lx\n", Status);
807  }
808 
809  break;
810  }
811 
812  default:
813  break;
814  }
815  }
816  break;
817 
818  default:
819  break;
820  }
821 
822  return FALSE;
823 }
#define IDC_PARTITION
Definition: resource.h:38
static INT_PTR CALLBACK PartitionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drivepage.c:99
#define TreeList_SelectItem(h, i)
Definition: treelist.h:430
ULONG PartitionNumber
Definition: partlist.h:48
#define TRUE
Definition: types.h:120
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDYES
Definition: winuser.h:829
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: drivepage.c:47
#define TVIS_SELECTED
Definition: commctrl.h:3252
LONG NTSTATUS
Definition: precomp.h:26
#define IDI_DISKDRIVE
Definition: resource.h:11
BOOL CreateTreeListColumns(IN HINSTANCE hInstance, IN HWND hWndTreeList, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
Definition: drivepage.c:127
TCHAR szAbortMessage[512]
Definition: reactos.h:123
#define PSWIZB_NEXT
Definition: prsht.h:154
#define IDC_PARTMOREOPTS
Definition: resource.h:62
ULONG DiskNumber
Definition: partlist.h:104
#define LPNMTREEVIEW
Definition: commctrl.h:3615
#define SM_CYSMICON
Definition: winuser.h:1003
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:245
#define TreeList_GetParent(h, i)
Definition: treelist.h:436
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:343
#define PSN_QUERYCANCEL
Definition: prsht.h:123
UINT code
Definition: winuser.h:3133
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define MB_YESNO
Definition: winuser.h:811
#define TreeList_GetImageList(h, i)
Definition: treelist.h:397
FORMATSTATE FormatState
Definition: partlist.h:54
UINT_PTR idFrom
Definition: winuser.h:3132
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
#define MB_ICONQUESTION
Definition: winuser.h:783
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
VOID DrawPartitionList(IN HWND hWndList, IN PPARTLIST List)
Definition: drivepage.c:574
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:339
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4300
#define WM_DESTROY
Definition: winuser.h:1591
#define IDC_PARTCREATE
Definition: resource.h:39
#define IDI_PARTITION
Definition: resource.h:12
UCHAR PartitionType
Definition: partlist.h:46
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PSWIZB_BACK
Definition: prsht.h:153
#define TVN_SELCHANGED
Definition: commctrl.h:3707
HINSTANCE hInstance
Definition: reactos.h:114
#define IDC_PARTDELETE
Definition: resource.h:40
PPARTLIST PartitionList
Definition: reactos.h:132
int WINAPI GetSystemMetrics(_In_ int)
#define IDD_RESTARTPAGE
Definition: resource.h:59
ULONG HwDiskNumber
Definition: partlist.h:98
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define TreeList_SetImageList(h, l, i)
Definition: treelist.h:407
#define SM_CXSMICON
Definition: winuser.h:1002
#define TreeList_SetExtendedStyleEx(h, d, m)
Definition: treelist.h:377
#define MAX_LIST_COLUMNS
Definition: drivepage.c:44
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:336
#define ILC_MASK
Definition: commctrl.h:336
TCHAR szAbortTitle[64]
Definition: reactos.h:124
#define WM_COMMAND
Definition: winuser.h:1722
HWND hwndFrom
Definition: winuser.h:3131
uint32_t DWORD_PTR
Definition: typedefs.h:63
Status
Definition: gdiplustypes.h:24
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND hList
Definition: livecd.c:10
HWND WINAPI GetParent(_In_ HWND)
struct _PARTENTRY * PPARTENTRY
static INT_PTR CALLBACK MoreOptDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drivepage.c:52
ULONG HwFixedDiskNumber
Definition: partlist.h:99
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
USETUP_DATA USetupData
Definition: reactos.h:128
#define IDD_PARTITION
Definition: resource.h:70
#define DPRINT1
Definition: precomp.h:8
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: drivepage.c:46
#define IDD_BOOTOPTIONS
Definition: resource.h:64
#define TVSIL_NORMAL
Definition: commctrl.h:3415
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define TVIF_STATE
Definition: commctrl.h:3241
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: drivepage.c:45
NTSTATUS InitDestinationPaths(IN OUT PUSETUP_DATA pSetupData, IN PCWSTR InstallationDir, IN PPARTENTRY PartEntry)
Definition: setuplib.c:624
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define TVS_EX_FULLROWMARK
Definition: treelist.h:272
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
#define HTLITEM
Definition: treelist.h:460
#define WM_NOTIFY
Definition: richedit.h:61
BOOLEAN IsPartitioned
Definition: partlist.h:59
struct _SETUPDATA * PSETUPDATA

Referenced by _tWinMain().

Variable Documentation

◆ IsUnattendedSetup

BOOLEAN IsUnattendedSetup

Definition at line 40 of file reactos.c.

◆ ProcessHeap

HANDLE ProcessHeap
  • Internal Headers */

Definition at line 15 of file servman.c.

◆ SetupData