ReactOS 0.4.17-dev-116-ga4b6fe9
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  _UI_CONTEXT
 
struct  _NT_WIN32_PATH_MAPPING
 
struct  _NT_WIN32_PATH_MAPPING_LIST
 
struct  _SETUPDATA
 
struct  _VOL_CREATE_INFO
 Data structure stored when a partition/volume needs to be formatted. More...
 

Macros

#define WIN32_NO_STATUS
 
#define EnableDlgItem(hDlg, nID, bEnable)    EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
 
#define ShowDlgItem(hDlg, nID, nCmdShow)    ShowWindow(GetDlgItem((hDlg), (nID)), (nCmdShow))
 
#define SetDlgItemFont(hDlg, nID, hFont, bRedraw)    SetWindowFont(GetDlgItem((hDlg), (nID)), (hFont), (bRedraw))
 
#define IDS_CLOSE   4160
 
#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 _UI_CONTEXT UI_CONTEXT
 
typedef struct _UI_CONTEXTPUI_CONTEXT
 
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
 
typedef struct _VOL_CREATE_INFO VOL_CREATE_INFO
 Data structure stored when a partition/volume needs to be formatted.
 
typedef struct _VOL_CREATE_INFOPVOL_CREATE_INFO
 

Functions

PVOL_CREATE_INFO FindVolCreateInTreeByVolume (_In_ HWND hTreeList, _In_ PVOLENTRY Volume)
 
BOOL ConvertNtPathToWin32Path (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList, OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
 
INT_PTR CALLBACK DriveDlgProc (_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)
 
size_t LoadAllocStringW (_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen)
 
size_t FormatAllocStringWV (_In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen, _In_ PCWSTR pszFormat, _In_ va_list args)
 
INT DisplayMessageV (_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage, _In_ va_list args)
 
INT __cdecl DisplayMessage (_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
 
INT __cdecl DisplayError (_In_opt_ HWND hWnd, _In_ UINT uIDTitle, _In_ UINT uIDMessage,...)
 
VOID SetWindowResTextW (_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID)
 
VOID SetWindowResPrintfVW (_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
 
VOID __cdecl SetWindowResPrintfW (_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID,...)
 

Variables

UI_CONTEXT UiContext
 
HANDLE ProcessHeap
 
SETUPDATA SetupData
 
PPARTENTRY InstallPartition
 
PPARTENTRY SystemPartition
 

Macro Definition Documentation

◆ EnableDlgItem

#define EnableDlgItem (   hDlg,
  nID,
  bEnable 
)     EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))

Definition at line 31 of file reactos.h.

◆ ID_APPLY_NOW

#define ID_APPLY_NOW   0x3021

Definition at line 45 of file reactos.h.

◆ ID_WIZBACK

#define ID_WIZBACK   0x3023

Definition at line 46 of file reactos.h.

◆ ID_WIZFINISH

#define ID_WIZFINISH   0x3025

Definition at line 48 of file reactos.h.

◆ ID_WIZNEXT

#define ID_WIZNEXT   0x3024

Definition at line 47 of file reactos.h.

◆ IDC_TAB_CONTROL

#define IDC_TAB_CONTROL   0x3020

Definition at line 44 of file reactos.h.

◆ IDS_CLOSE

#define IDS_CLOSE   4160

Definition at line 41 of file reactos.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 56 of file reactos.h.

◆ SetDlgItemFont

#define SetDlgItemFont (   hDlg,
  nID,
  hFont,
  bRedraw 
)     SetWindowFont(GetDlgItem((hDlg), (nID)), (hFont), (bRedraw))

Definition at line 37 of file reactos.h.

◆ ShowDlgItem

#define ShowDlgItem (   hDlg,
  nID,
  nCmdShow 
)     ShowWindow(GetDlgItem((hDlg), (nID)), (nCmdShow))

Definition at line 34 of file reactos.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 19 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

◆ PUI_CONTEXT

◆ PVOL_CREATE_INFO

◆ SETUPDATA

◆ UI_CONTEXT

◆ VOL_CREATE_INFO

Data structure stored when a partition/volume needs to be formatted.

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 2748 of file reactos.c.

2753{
2754 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
2755 PLIST_ENTRY ListEntry;
2757 PCWSTR pwszNtPathToMap = pwszNTPath;
2758 PCWSTR pwszRemaining = NULL;
2759 DWORD cchDrives;
2760 PWCHAR pwszDrive;
2761 WCHAR wszDrives[512];
2762 WCHAR wszNTPath[MAX_PATH];
2763 WCHAR TargetPath[MAX_PATH];
2764
2765 *pwszPath = UNICODE_NULL;
2766
2767 /*
2768 * We find first a mapping inside the MappingList. If one is found, use it
2769 * to build the Win32 path. If there is none, we need to create one by
2770 * checking the Win32 drives (and possibly NT symlinks too).
2771 * In case of success, add the newly found mapping to the list and use it
2772 * to build the Win32 path.
2773 */
2774
2775 for (ListEntry = MappingList->List.Flink;
2776 ListEntry != &MappingList->List;
2777 ListEntry = ListEntry->Flink)
2778 {
2779 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
2780
2781 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
2782
2783 /* Check whether the queried NT path prefixes the user-provided NT path */
2784 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
2785 if (FoundDrive)
2786 {
2787 /* Found it! */
2788
2789 /* Set the pointers and go build the Win32 path */
2790 pwszDrive = Entry->Win32Path;
2791 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
2792 goto Quit;
2793 }
2794 }
2795
2796 /*
2797 * No mapping exists for this path yet: try to find one now.
2798 */
2799
2800 /* Retrieve the mounted drives (available drive letters) */
2801 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2802 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2803 {
2804 /* Buffer too small or failure */
2805 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
2806 return FALSE;
2807 }
2808
2809/* We go back there once if RetryOnce == TRUE */
2810Retry:
2811
2812 /* Enumerate the mounted drives */
2813 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2814 {
2815 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2816 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2817 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2818 pwszDrive[2] = L'\\'; // Restore the backslash
2819
2820 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
2821
2822 /* Check whether the queried NT path prefixes the user-provided NT path */
2823 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2824 if (!FoundDrive)
2825 {
2826 PWCHAR ptr, ptr2;
2827
2828 /*
2829 * Check whether this was a network share that has a drive letter,
2830 * but the user-provided NT path points to this share without
2831 * mentioning the drive letter.
2832 *
2833 * The format is: \Device<network_redirector>\;X:<data>\share\path
2834 * The corresponding drive letter is 'X'.
2835 * A system-provided network redirector (LanManRedirector or Mup)
2836 * or a 3rd-party one may be used.
2837 *
2838 * We check whether the user-provided NT path has the form:
2839 * \Device<network_redirector><data>\share\path
2840 * as it obviously did not have the full form (the previous check
2841 * would have been OK otherwise).
2842 */
2843 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
2844 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
2845 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
2846 {
2847 /*
2848 * Normally the specified drive letter should correspond
2849 * to the one used for the mapping. But we will ignore
2850 * if it happens not to be the case.
2851 */
2852 if (pwszDrive[0] != ptr[1])
2853 {
2854 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
2855 pwszDrive[0], ptr[1]);
2856 }
2857
2858 /* Remove the drive letter from the NT network share path */
2859 ptr2 = ptr + 3;
2860 /* Swallow as many possible consecutive backslashes as there could be */
2861 while (*ptr2 == L'\\') ++ptr2;
2862
2863 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
2864
2865 /* Now do the check again */
2866 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2867 }
2868 }
2869 if (FoundDrive)
2870 {
2871 /* Found it! */
2872
2873 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
2874
2875 if (pwszNtPathToMap == pwszNTPath)
2876 {
2877 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
2878 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
2879 }
2880 break;
2881 }
2882 }
2883
2884 if (FoundDrive)
2885 {
2886 /* A mapping was found, add it to the cache */
2888 if (!Entry)
2889 {
2890 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
2891 return FALSE;
2892 }
2893 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
2894 pwszNTPath, pwszRemaining - pwszNTPath);
2895 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
2896
2897 /* Insert it as the most recent entry */
2898 InsertHeadList(&MappingList->List, &Entry->ListEntry);
2899 MappingList->MappingsCount++;
2900
2901 /* Set the pointers and go build the Win32 path */
2902 pwszDrive = Entry->Win32Path;
2903 goto Quit;
2904 }
2905
2906 /*
2907 * We failed, perhaps because the beginning of the NT path used a symlink.
2908 * Try to see whether this is the case by attempting to resolve it.
2909 * If the symlink resolution gives nothing, or we already failed once,
2910 * there is no hope in converting the path to Win32.
2911 * Otherwise, symlink resolution succeeds but we need to recheck again
2912 * the drives list.
2913 */
2914
2915 /*
2916 * In theory we would have to parse each element in the NT path and going
2917 * until finding a symlink object (otherwise we would fail straight away).
2918 * However here we can use guessing instead, since we know which kind of
2919 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
2920 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
2921 * are supported in setuplib\utils\arcname.c .
2922 *
2923 * But actually, all the supported names in arcname.c are real devices,
2924 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
2925 * just check for it.
2926 */
2927 if (!RetryOnce && !FoundDrive)
2928 {
2929 ULONG DiskNumber, PartitionNumber;
2930 INT Length;
2931
2934 HANDLE LinkHandle;
2935 UNICODE_STRING SymLink, Target;
2936
2937 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
2938 &DiskNumber, &PartitionNumber, &Length) != 2)
2939 {
2940 /* Definitively not a recognized path, bail out */
2941 return FALSE;
2942 }
2943
2944 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
2945 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
2946 SymLink.Length = SymLink.MaximumLength;
2947
2949 &SymLink,
2951 NULL,
2952 NULL);
2953 Status = NtOpenSymbolicLinkObject(&LinkHandle,
2956 if (!NT_SUCCESS(Status))
2957 {
2958 /* Not a symlink, or something else happened: bail out */
2959 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2960 &SymLink, Status);
2961 return FALSE;
2962 }
2963
2964 *TargetPath = UNICODE_NULL;
2965 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
2966
2967 /* Resolve the link and close its handle */
2969 NtClose(LinkHandle);
2970
2971 /* Check for success */
2972 if (!NT_SUCCESS(Status))
2973 {
2974 /* Not a symlink, or something else happened: bail out */
2975 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2976 &SymLink, Status);
2977 return FALSE;
2978 }
2979
2980 /* Set the pointers */
2981 pwszRemaining = pwszNTPath + Length;
2982 pwszNtPathToMap = TargetPath; // Point to our local buffer
2983
2984 /* Retry once */
2985 RetryOnce = TRUE;
2986 goto Retry;
2987 }
2988
2989 ASSERT(!FoundDrive);
2990
2991Quit:
2992 if (FoundDrive)
2993 {
2994 StringCchPrintfW(pwszPath, cchPathMax,
2995 L"%s%s",
2996 pwszDrive,
2997 pwszRemaining);
2998 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
2999 return TRUE;
3000 }
3001
3002 return FALSE;
3003}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
HANDLE ProcessHeap
Definition: reactos.c:23
_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 NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#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 SYMBOLIC_LINK_QUERY
Definition: volume.c:47
_ACRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *,...)
Definition: scanf.c:438
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:195
#define L(x)
Definition: resources.c:13
#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
#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:115
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
short WCHAR
Definition: pedump.c:58
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
Entry
Definition: section.c:5216
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
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
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061

Referenced by SetupOpenInfFileExW().

◆ 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 559 of file reactos.c.

566{
567 UINT i;
568 LVCOLUMN lvC;
569 WCHAR szText[50];
570
571 /* Create the columns */
572 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
573 lvC.pszText = szText;
574
575 /* Load the column labels from the resource file */
576 for (i = 0; i < nNumOfColumns; i++)
577 {
578 lvC.iSubItem = i;
579 lvC.cx = pColsWidth[i];
580 lvC.fmt = pColsAlign[i];
581
582 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
583
584 if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
585 return FALSE;
586 }
587
588 return TRUE;
589}
HINSTANCE hInstance
Definition: charmap.c:19
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVCOLUMN
Definition: commctrl.h:2586
#define LoadStringW
Definition: utils.h:64

Referenced by UpgradeRepairDlgProc().

◆ DisplayError()

INT __cdecl DisplayError ( _In_opt_ HWND  hWnd,
_In_ UINT  uIDTitle,
_In_ UINT  uIDMessage,
  ... 
)

Definition at line 262 of file reactos.c.

267{
268 INT iRes;
270
271 va_start(args, uIDMessage);
273 MAKEINTRESOURCEW(uIDTitle),
274 MAKEINTRESOURCEW(uIDMessage),
275 args);
276 va_end(args);
277
278 return iRes;
279}
HWND hWnd
Definition: settings.c:17
INT DisplayMessageV(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage, _In_ va_list args)
Definition: reactos.c:173
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
#define args
Definition: format.c:66
Definition: match.c:390
#define MB_ICONERROR
Definition: winuser.h:798
#define MB_OK
Definition: winuser.h:801
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by _tWinMain(), FsVolCallback(), and PrepareAndDoCopyThread().

◆ DisplayMessage()

◆ DisplayMessageV()

INT DisplayMessageV ( _In_opt_ HWND  hWnd,
_In_ UINT  uType,
_In_opt_ PCWSTR  pszTitle,
_In_opt_ PCWSTR  pszFormatMessage,
_In_ va_list  args 
)

Definition at line 173 of file reactos.c.

179{
180 INT iRes;
182 MSGBOXPARAMSW mb = {0};
184 WCHAR StaticBuffer[256];
185 PWSTR Buffer = StaticBuffer; // Use the static buffer by default.
186
187 /* We need to retrieve the current module's instance handle if either
188 * the title or the format message is specified by a resource ID */
189 if ((pszTitle && IS_INTRESOURCE(pszTitle)) || IS_INTRESOURCE(pszFormatMessage))
190 hInstance = GetModuleHandleW(NULL); // SetupData.hInstance;
191
192 /* Retrieve the format message string if this is a resource */
193 if (pszFormatMessage && IS_INTRESOURCE(pszFormatMessage))
194 {
195 Format = NULL;
196 (void)LoadAllocStringW(hInstance, PtrToUlong(pszFormatMessage), &Format, 0);
197 }
198 else
199 {
200 Format = (PWSTR)pszFormatMessage;
201 }
202
203 if (Format)
204 {
205 /* Format the message and retrieve its length. If it is too long,
206 * an auxiliary buffer is allocated; otherwise the static buffer
207 * is used. The string is built to be NUL-terminated. */
209 if (!Buffer)
210 {
211 /* Allocation failed, use the original format string verbatim */
212 Buffer = Format;
213 }
214 }
215 else
216 {
217 Format = (PWSTR)pszFormatMessage;
218 Buffer = Format;
219 }
220
221 /* Display the message */
222 mb.cbSize = sizeof(mb);
223 mb.hwndOwner = hWnd;
224 mb.hInstance = hInstance;
225 mb.lpszText = Buffer;
226 mb.lpszCaption = pszTitle;
227 mb.dwStyle = uType;
229 iRes = MessageBoxIndirectW(&mb);
230
231 /* Free the buffers if needed */
232 if ((Buffer != StaticBuffer) && (Buffer != Format))
234
235 if (Format && (Format != pszFormatMessage))
237
238 return iRes;
239}
size_t LoadAllocStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen)
Definition: reactos.c:113
size_t FormatAllocStringWV(_In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen, _In_ PCWSTR pszFormat, _In_ va_list args)
Definition: reactos.c:148
Definition: bufpool.h:45
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define IS_INTRESOURCE(x)
Definition: loader.c:613
#define PtrToUlong(u)
Definition: config.h:107
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD dwLanguageId
Definition: winuser.h:3453
LPCWSTR lpszCaption
Definition: winuser.h:3448
HWND hwndOwner
Definition: winuser.h:3445
LPCWSTR lpszText
Definition: winuser.h:3447
HINSTANCE hInstance
Definition: winuser.h:3446
DWORD dwStyle
Definition: winuser.h:3449
uint16_t * PWSTR
Definition: typedefs.h:56
int WINAPI MessageBoxIndirectW(_In_ CONST MSGBOXPARAMSW *lpmbp)

Referenced by DisplayError(), and DisplayMessage().

◆ DriveDlgProc()

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

Definition at line 1595 of file drivepage.c.

1600{
1601 PSETUPDATA pSetupData;
1602 HWND hList;
1603
1604 /* Retrieve pointer to the global setup data */
1605 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1606
1607 switch (uMsg)
1608 {
1609 case WM_INITDIALOG:
1610 {
1611 /* Save pointer to the global setup data */
1612 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1613 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1614
1615 /* Initially hide and disable all partitioning buttons */
1616 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1617 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1624
1625 /* Initialize the partitions list */
1626 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1628 InitPartitionList(pSetupData->hInstance, hList);
1630
1631 // HACK: Wine "kwality" code doesn't still implement
1632 // PSN_QUERYINITIALFOCUS so we "emulate" its call there...
1633 {
1634 PSHNOTIFY pshn = {{hwndDlg, GetWindowLong(hwndDlg, GWL_ID), PSN_QUERYINITIALFOCUS}, (LPARAM)hList};
1635 SendMessageW(hwndDlg, WM_NOTIFY, (WPARAM)pshn.hdr.idFrom, (LPARAM)&pshn);
1636 }
1637 break;
1638 }
1639
1640 case WM_DESTROY:
1641 {
1642 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1646 return TRUE;
1647 }
1648
1649 case WM_COMMAND:
1650 {
1651 switch (LOWORD(wParam))
1652 {
1653 case IDC_PARTMOREOPTS:
1654 {
1655 DialogBoxParamW(pSetupData->hInstance,
1657 hwndDlg,
1659 (LPARAM)pSetupData);
1660 break;
1661 }
1662
1663 case IDC_INITDISK:
1664 {
1665 // TODO: Implement disk partitioning initialization
1666 break;
1667 }
1668
1669 case IDC_PARTCREATE:
1670 {
1671 HTLITEM hItem;
1672 PPARTITEM PartItem;
1673 PPARTENTRY PartEntry;
1674 ULONGLONG PartSize;
1675 ULONGLONG MaxPartSize;
1676 ULONG MaxSizeMB;
1677 INT_PTR ret;
1678 PARTCREATE_CTX PartCreateCtx = {0};
1679
1680 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1681 PartItem = GetSelectedPartition(hList, &hItem);
1682 if (!PartItem)
1683 {
1684 /* If the button was clicked, an empty disk
1685 * region should have been selected first */
1686 ASSERT(FALSE);
1687 break;
1688 }
1689 PartEntry = PartItem->PartEntry;
1690 if (PartEntry->IsPartitioned)
1691 {
1692 /* Don't create a partition when one already exists */
1693 ASSERT(FALSE);
1694 break;
1695 }
1696 ASSERT(!PartEntry->Volume);
1697
1698 /* Get the partition info stored in the TreeList */
1699 PartCreateCtx.PartItem = PartItem;
1700
1701 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1702 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1703 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1704 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1705
1706 /* Don't force formatting by default */
1707 PartCreateCtx.ForceFormat = FALSE;
1708
1709 /* Show the partitioning dialog */
1710 ret = DialogBoxParamW(pSetupData->hInstance,
1712 hwndDlg,
1714 (LPARAM)&PartCreateCtx);
1715 if (ret != IDOK)
1716 break;
1717
1718 /*
1719 * If the input size, given in MB, specifies the maximum partition
1720 * size, it may slightly under- or over-estimate the latter due to
1721 * rounding error. In this case, use all of the unpartitioned space.
1722 * Otherwise, directly convert the size to bytes.
1723 */
1724 PartSize = PartCreateCtx.PartSizeMB;
1725 if (PartSize == MaxSizeMB)
1726 PartSize = MaxPartSize;
1727 else // if (PartSize < MaxSizeMB)
1728 PartSize *= MB;
1729
1730 ASSERT(PartSize <= MaxPartSize);
1731
1732 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1733 &hItem, &PartItem,
1734 PartSize,
1735 !PartCreateCtx.MBRExtPart
1736 ? 0 : PARTITION_EXTENDED))
1737 {
1738 DisplayError(GetParent(hwndDlg),
1741 }
1742
1743 break;
1744 }
1745
1746 case IDC_PARTFORMAT:
1747 {
1748 HTLITEM hItem;
1749 PPARTITEM PartItem;
1750 PPARTENTRY PartEntry;
1751 INT_PTR ret;
1752 PARTCREATE_CTX PartCreateCtx = {0};
1753
1754 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1755 PartItem = GetSelectedPartition(hList, &hItem);
1756 if (!PartItem)
1757 {
1758 /* If the button was clicked, an empty disk
1759 * region should have been selected first */
1760 ASSERT(FALSE);
1761 break;
1762 }
1763 PartEntry = PartItem->PartEntry;
1764 if (!PartEntry->Volume)
1765 {
1766 /* Don't format an unformattable partition */
1767 ASSERT(FALSE);
1768 break;
1769 }
1770
1771 /* Show the formatting dialog */
1772 PartCreateCtx.PartItem = PartItem;
1773 ret = DialogBoxParamW(pSetupData->hInstance,
1775 hwndDlg,
1777 (LPARAM)&PartCreateCtx);
1779 break;
1780 }
1781
1782 case IDC_PARTDELETE:
1783 {
1784 PPARTITEM PartItem;
1785 PPARTENTRY PartEntry;
1786 HTLITEM hItem;
1787 UINT uIDWarnMsg;
1788
1789 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1790 PartItem = GetSelectedPartition(hList, &hItem);
1791 if (!PartItem)
1792 {
1793 // If the button was clicked, a partition
1794 // should have been selected first...
1795 ASSERT(FALSE);
1796 break;
1797 }
1798 PartEntry = PartItem->PartEntry;
1799 if (!PartEntry->IsPartitioned)
1800 {
1801 /* Don't delete an unpartitioned disk region */
1802 ASSERT(FALSE);
1803 break;
1804 }
1805
1806 /* Choose the correct warning message to display:
1807 * MBR-extended (container) vs. standard partition */
1808 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1810 else
1811 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1812
1813 /* If the user really wants to delete the partition... */
1814 if (DisplayMessage(GetParent(hwndDlg),
1817 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1818 {
1819 /* ... make it so! */
1820 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1821 &hItem, PartItem))
1822 {
1823 // TODO: Show error if partition couldn't be deleted?
1824 }
1825 }
1826
1827 break;
1828 }
1829 }
1830 break;
1831 }
1832
1833 case WM_NOTIFY:
1834 {
1835 LPNMHDR lpnm = (LPNMHDR)lParam;
1836
1837 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1838 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1839 {
1841
1842 // if (!(pnmv->uChanged & TVIF_STATE)) /* The state has changed */
1843 if (!(pnmv->itemNew.mask & TVIF_STATE))
1844 break;
1845
1846 /* The item has been (de)selected */
1847 // if (pnmv->uNewState & TVIS_SELECTED)
1848 if (pnmv->itemNew.state & TVIS_SELECTED)
1849 {
1850 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1851 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1852
1853 if (!hParentItem)
1854 {
1855 /* Hard disk */
1856 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1857 ASSERT(DiskEntry);
1858
1859 /* Show the "Initialize" disk button and hide and disable the others */
1860 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1861
1862#if 0 // FIXME: Init disk not implemented yet!
1863 EnableDlgItem(hwndDlg, IDC_INITDISK,
1864 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1865#else
1866 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1867#endif
1868
1871
1874
1877
1878 /* Disable the "Next" button */
1879 goto DisableWizNext;
1880 }
1881 else
1882 {
1883 /* Partition or unpartitioned space */
1884 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1885 PPARTENTRY PartEntry;
1886 ASSERT(PartItem);
1887 PartEntry = PartItem->PartEntry;
1888 ASSERT(PartEntry);
1889
1890 /* Hide and disable the "Initialize" disk button */
1891 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1892 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1893
1894 if (!PartEntry->IsPartitioned)
1895 {
1896 /* Show and enable the "Create" partition button */
1899
1900 /* Hide and disable the "Format" button */
1903 }
1904 else
1905 {
1906 /* Hide and disable the "Create" partition button */
1909
1910 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
1912 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
1913 }
1914
1915 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
1917 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
1918
1919 /*
1920 * Enable the "Next" button if:
1921 *
1922 * 1. the selected disk region is partitioned:
1923 * it can either have a volume attached (and be either
1924 * formatted or ready to be formatted),
1925 * or it's not yet formatted (the installer will prompt
1926 * for formatting parameters).
1927 *
1928 * 2. Or, the selected disk region is not partitioned but
1929 * can be partitioned according to the disk's partitioning
1930 * scheme (the installer will auto-partition the region
1931 * and prompt for formatting parameters).
1932 *
1933 * In all other cases, the "Next" button is disabled.
1934 */
1935
1936 // TODO: In the future: first test needs to be augmented with:
1937 // (... && PartEntry->Volume->IsSimpleVolume)
1938 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
1939 (!PartEntry->IsPartitioned && (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR)))
1940 {
1941 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1944 }
1945 else
1946 {
1947 goto DisableWizNext;
1948 }
1949 }
1950 }
1951 else
1952 {
1953DisableWizNext:
1954 /* Keep the "Next" button disabled. It will be enabled
1955 * only when the user selects a valid partition. */
1957 }
1958
1959 break;
1960 }
1961
1962 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
1963 {
1964 /* Deleting an item from the partition list */
1966 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
1967 break;
1968 }
1969
1970 switch (lpnm->code)
1971 {
1972 case PSN_SETACTIVE:
1973 {
1974 /* Keep the "Next" button disabled. It will be enabled
1975 * only when the user selects a valid partition. */
1977 break;
1978 }
1979
1981 {
1982 /* Give the focus on and select the first item */
1983 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1984 // TreeList_SetFocusItem(hList, 1, 1);
1987 return TRUE;
1988 }
1989
1990 case PSN_QUERYCANCEL:
1991 {
1992 if (DisplayMessage(GetParent(hwndDlg),
1996 {
1997 /* Go to the Abort page */
1999 }
2000
2001 /* Do not close the wizard too soon */
2003 return TRUE;
2004 }
2005
2006 case PSN_WIZNEXT: /* Set the selected data */
2007 {
2008 HTLITEM hItem;
2009 PPARTITEM PartItem;
2010 PPARTENTRY PartEntry;
2011
2012 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2013 PartItem = GetSelectedPartition(hList, &hItem);
2014 if (!PartItem)
2015 {
2016 /* Fail and don't continue the installation */
2017 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2018 return TRUE;
2019 }
2020 PartEntry = PartItem->PartEntry;
2021 ASSERT(PartEntry);
2022
2023 /*
2024 * Check whether the user wants to install ReactOS on a disk that
2025 * is not recognized by the computer's firmware and if so, display
2026 * a warning since such disks may not be bootable.
2027 */
2028 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
2029 !PartEntry->DiskEntry->BiosFound)
2030 {
2031 INT nRet;
2032
2033 nRet = DisplayMessage(hwndDlg,
2035 L"Warning",
2036 L"The disk you have selected for installing ReactOS\n"
2037 L"is not visible by the firmware of your computer,\n"
2038 L"and so may not be bootable.\n"
2039 L"\nClick on OK to continue anyway."
2040 L"\nClick on CANCEL to go back to the partitions list.");
2041 if (nRet != IDOK)
2042 {
2043 /* Fail and don't continue the installation */
2044 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2045 return TRUE;
2046 }
2047 }
2048
2049 /* If this is an empty region, auto-create the partition if conditions are OK */
2050 if (!PartEntry->IsPartitioned)
2051 {
2052 ULONG Error;
2053
2054 Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
2055 if (Error != NOT_AN_ERROR)
2056 {
2057 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
2059 L"Could not create a partition on the selected disk region");
2060
2061 /* Fail and don't continue the installation */
2062 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2063 return TRUE;
2064 }
2065
2066 /* Automatically create the partition on the whole empty space;
2067 * it will be formatted later with default parameters */
2068 if (!DoCreatePartition(hList, pSetupData->PartitionList,
2069 &hItem, &PartItem,
2070 0ULL,
2071 0))
2072 {
2073 DisplayError(GetParent(hwndDlg),
2076
2077 /* Fail and don't continue the installation */
2078 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2079 return TRUE;
2080 }
2081 /* Update PartEntry */
2082 PartEntry = PartItem->PartEntry;
2083 }
2084
2085 ASSERT(PartEntry->IsPartitioned);
2086 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2088 ASSERT(PartEntry->Volume);
2089
2090#if 0 // TODO: Implement!
2091 if (!IsPartitionLargeEnough(PartEntry))
2092 {
2095
2096 /* Fail and don't continue the installation */
2097 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2098 return TRUE;
2099 }
2100#endif
2101
2102 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
2103 if (PartEntry->Volume &&
2104 ((PartEntry->Volume->FormatState == Formatted) ||
2105 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
2106 {
2107 /*NOTHING*/;
2108 }
2109 else /* Request formatting of the selected region if it's not already formatted */
2110 {
2111 INT_PTR ret;
2112 PARTCREATE_CTX PartCreateCtx = {0};
2113
2114 /* Show the formatting dialog */
2115 PartCreateCtx.PartItem = PartItem;
2116 ret = DialogBoxParamW(pSetupData->hInstance,
2118 hwndDlg,
2120 (LPARAM)&PartCreateCtx);
2121
2122 /* If the user refuses to format the partition,
2123 * fail and don't continue the installation */
2124 if (ret != IDOK)
2125 {
2126 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2127 return TRUE;
2128 }
2129
2130 /* The partition will be formatted */
2131 }
2132
2133 InstallPartition = PartEntry;
2134 break;
2135 }
2136
2137 default:
2138 break;
2139 }
2140 break;
2141 }
2142
2143 default:
2144 break;
2145 }
2146
2147 return FALSE;
2148}
UI_CONTEXT UiContext
Definition: reactos.c:38
PPARTENTRY InstallPartition
Definition: reactos.c:28
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:243
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
struct _SETUPDATA * PSETUPDATA
#define IDS_WARN_DELETE_PARTITION
Definition: resource.h:179
#define IDC_INITDISK
Definition: resource.h:51
#define IDD_ABORTPAGE
Definition: resource.h:78
#define IDC_PARTMOREOPTS
Definition: resource.h:56
#define IDS_ERROR_CREATE_PARTITION_TITLE
Definition: resource.h:175
#define IDC_PARTDELETE
Definition: resource.h:54
#define IDS_WARN_DELETE_PARTITION_TITLE
Definition: resource.h:178
#define IDS_ERROR_CREATE_PARTITION
Definition: resource.h:176
#define IDC_PARTITION
Definition: resource.h:50
#define IDD_FORMAT
Definition: resource.h:93
#define IDD_ADVINSTOPTS
Definition: resource.h:80
#define IDC_PARTFORMAT
Definition: resource.h:53
#define IDC_PARTCREATE
Definition: resource.h:52
#define IDS_ABORTSETUP2
Definition: resource.h:111
#define IDS_ABORTSETUP
Definition: resource.h:110
#define IDD_PARTITION
Definition: resource.h:84
#define IDS_WARN_DELETE_MBR_EXTENDED_PARTITION
Definition: resource.h:180
BOOL Error
Definition: chkdsk.c:66
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1305
struct _PARTITEM * PPARTITEM
static BOOLEAN DoDeletePartition(_In_ HWND hList, _In_ PPARTLIST List, _Inout_ HTLITEM *phItem, _In_ PPARTITEM PartItem)
Delete the selected partition in the partition list, and update the partition list UI.
Definition: drivepage.c:1492
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:610
static BOOLEAN DoCreatePartition(_In_ HWND hList, _In_ PPARTLIST List, _Inout_ HTLITEM *phItem, _Inout_opt_ PPARTITEM *pPartItem, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Create a partition in the selected disk region in the partition list, and update the partition list U...
Definition: drivepage.c:1392
static PPARTITEM GetSelectedPartition(_In_ HWND hTreeList, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:816
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:557
static VOID DrawPartitionList(_In_ HWND hWndList, _In_ PPARTLIST List)
Definition: drivepage.c:1342
static INT_PTR CALLBACK MoreOptDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:214
static VOID CleanupPartitionList(_In_ HWND hWndList)
Definition: drivepage.c:1369
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1133
return ret
Definition: mutex.c:146
@ NOT_AN_ERROR
Definition: errorcode.h:17
@ ERROR_INSUFFICIENT_PARTITION_SIZE
Definition: errorcode.h:57
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
@ Formatted
Definition: partlist.h:37
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:255
struct _DISKENTRY * PDISKENTRY
HWND hList
Definition: livecd.c:10
VOID DisplayError(DWORD dwError)
Definition: logoff.c:33
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
#define ULL(a, b)
Definition: format_msg.c:27
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:330
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:321
@ FixedMedia
Definition: ntdddisk.h:383
#define PARTITION_EXTENDED
Definition: part_mbr.h:55
#define LOWORD(l)
Definition: pedump.c:82
#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 PSN_QUERYINITIALFOCUS
Definition: prsht.h:126
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define PSN_SETACTIVE
Definition: prsht.h:115
#define TVN_DELETEITEM
Definition: commctrl.h:3747
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define LPNMTREEVIEW
Definition: commctrl.h:3648
#define TVIS_SELECTED
Definition: commctrl.h:3285
#define TVIF_STATE
Definition: commctrl.h:3274
#define WM_NOTIFY
Definition: richedit.h:61
ERROR_NUMBER NTAPI PartitionCreateChecks(_In_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2946
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:97
#define MB
Definition: setuplib.h:75
PARTITION_STYLE DiskStyle
Definition: partlist.h:139
Dialog context structure used by PartitionDlgProc() and FormatDlgProc(Worker)().
Definition: drivepage.c:368
BOOLEAN MBRExtPart
Definition: drivepage.c:372
PPARTITEM PartItem
Definition: drivepage.c:369
BOOLEAN ForceFormat
Definition: drivepage.c:373
ULONG PartSizeMB
Definition: drivepage.c:371
BOOLEAN IsPartitioned
Definition: partlist.h:82
UCHAR PartitionType
Definition: partlist.h:73
PVOLENTRY Volume
Definition: partlist.h:95
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
Data structure stored for each partition item in the TreeList. (None for disks items....
Definition: drivepage.c:357
PPARTENTRY PartEntry
Definition: drivepage.c:358
PVOL_CREATE_INFO VolCreate
Definition: drivepage.c:360
NMHDR hdr
Definition: prsht.h:330
HINSTANCE hInstance
Definition: reactos.h:121
PPARTLIST PartitionList
Definition: reactos.h:138
HWND hPartList
Definition: reactos.h:70
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:156
FORMATSTATE FormatState
Definition: partlist.h:48
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:173
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
HWND hwndFrom
Definition: winuser.h:3265
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
#define TLITEMW
Definition: treelist.h:478
HTREEITEM hItem
Definition: treelist.h:37
#define HTLITEM
Definition: treelist.h:466
#define TreeList_GetParent(h, i)
Definition: treelist.h:442
#define TreeList_SelectItem(h, i)
Definition: treelist.h:436
int32_t INT_PTR
Definition: typedefs.h:64
uint64_t ULONGLONG
Definition: typedefs.h:67
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
static USETUP_DATA USetupData
Definition: usetup.c:44
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:123
#define SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define GWL_ID
Definition: winuser.h:870
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_YESNO
Definition: winuser.h:828
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define MB_OKCANCEL
Definition: winuser.h:815
struct tagNMHDR * LPNMHDR
#define GetWindowLong
Definition: winuser.h:5962
#define MB_ICONWARNING
Definition: winuser.h:797
HWND WINAPI GetParent(_In_ HWND)
#define MB_ICONQUESTION
Definition: winuser.h:800
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define MB_DEFBUTTON2
Definition: winuser.h:810
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define IDYES
Definition: winuser.h:846
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by _tWinMain().

◆ FindVolCreateInTreeByVolume()

PVOL_CREATE_INFO FindVolCreateInTreeByVolume ( _In_ HWND  hTreeList,
_In_ PVOLENTRY  Volume 
)

Definition at line 835 of file drivepage.c.

838{
840
841 /* Enumerate every cached data in the TreeList, and for each, check
842 * whether its corresponding PPARTENTRY is the one we are looking for */
843 // for (hItem = TVI_ROOT; hItem; hItem = TreeList_GetNextItem(...)) { }
844 hItem = TVI_ROOT;
845 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
846 {
847 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
848 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
849 continue;
850
851 if (PartItem->Volume == Volume)
852 {
853 /* Found it, return the associated volume-create structure */
854 return PartItem->VolCreate;
855 }
856 }
857
858 /* Nothing was found */
859 return NULL;
860}
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:798
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define TVI_ROOT
Definition: commctrl.h:3373
PVOLENTRY Volume
Definition: drivepage.c:359
#define TreeList_GetNextItem(h, i, c)
Definition: treelist.h:440
#define TVGN_NEXTITEM
Definition: treelist.h:166

Referenced by FsVolCallback().

◆ FormatAllocStringWV()

size_t FormatAllocStringWV ( _In_opt_ _Outptr_ PWSTR pString,
_In_opt_ size_t  cchBufferLen,
_In_ PCWSTR  pszFormat,
_In_ va_list  args 
)

Definition at line 148 of file reactos.c.

153{
154 size_t Length;
155
156 /* Retrieve the message length. If it is too long, allocate
157 * an auxiliary buffer; otherwise use the caller's buffer. */
158 Length = _vscwprintf(pszFormat, args); // Doesn't count the NUL-terminator.
159 if (!*pString || (Length >= cchBufferLen))
160 {
161 /* Allocate a new buffer, adding a NUL-terminator */
163 if (!*pString)
164 return 0;
165 }
166
167 /* Do the printf */
168 StringCchVPrintfW(*pString, Length + 1, pszFormat, args);
169 return Length;
170}
_ACRTIMP int __cdecl _vscwprintf(const wchar_t *, va_list)
Definition: wcs.c:1782
FxString * pString
STRSAFEAPI StringCchVPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
Definition: strsafe.h:490

Referenced by DisplayMessageV(), and SetWindowResPrintfVW().

◆ LoadAllocStringW()

size_t LoadAllocStringW ( _In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID,
_In_opt_ _Outptr_ PWSTR pString,
_In_opt_ size_t  cchBufferLen 
)

Definition at line 113 of file reactos.c.

119{
120 PCWSTR pStr;
121 size_t Length;
122
123 /* Try to load the string from the resource */
124 Length = LoadStringW(hInstance, uID, (PWSTR)&pStr, 0);
125 if (Length == 0)
126 {
127 /* No resource string was found, return NULL */
128 *pString = NULL;
129 return 0;
130 }
131
132 /* If the caller gave a pointer to a buffer on input, verify whether it
133 * is large enough to contain the string. If not, allocate a new buffer. */
134 if (!*pString || (cchBufferLen < Length + 1))
135 {
136 /* Allocate a new buffer, adding a NUL-terminator */
137 *pString = HeapAlloc(GetProcessHeap(), 0, (Length + 1) * sizeof(WCHAR));
138 if (!*pString)
139 return 0;
140 }
141
142 /* Copy the string, NUL-terminated */
143 StringCchCopyNW(*pString, Length + 1, pStr, Length);
144 return Length;
145}
_In_ UINT uID
Definition: shlwapi.h:156

Referenced by DisplayMessageV(), SetWindowResPrintfVW(), and SetWindowResTextW().

◆ SetWindowResPrintfVW()

VOID SetWindowResPrintfVW ( _In_ HWND  hWnd,
_In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID,
_In_ va_list  args 
)

Definition at line 301 of file reactos.c.

306{
307 WCHAR ResBuffer[256];
308 WCHAR szText[256];
309 PWSTR ResFmt = ResBuffer; // Use the static buffers by default.
310 PWSTR String = szText;
311
312 /* Try to load the string from the resource */
313 (void)LoadAllocStringW(hInstance, uID, &ResFmt, _countof(ResBuffer));
314 if (!ResFmt)
315 return;
316
317 /* Format the string and retrieve its length. If it is too long,
318 * an auxiliary buffer is allocated; otherwise the static buffer
319 * is used. The string is built to be NUL-terminated. */
320 (void)FormatAllocStringWV(&String, _countof(szText), ResFmt, args);
321 if (!String)
322 {
323 /* Allocation failed, use the original format string verbatim */
324 String = ResFmt;
325 }
326
328
329 /* Free the buffers if needed */
330 if ((String != szText) && (String != ResFmt))
332
333 if (ResFmt && (ResFmt != ResBuffer))
334 HeapFree(GetProcessHeap(), 0, ResFmt);
335}
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by RegistryStatus(), and SetWindowResPrintfW().

◆ SetWindowResPrintfW()

VOID __cdecl SetWindowResPrintfW ( _In_ HWND  hWnd,
_In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID,
  ... 
)

Definition at line 339 of file reactos.c.

344{
346
347 va_start(args, uID);
349 va_end(args);
350}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:301

Referenced by FileCopyCallback(), FsVolCallback(), and RegistryStatus().

◆ SetWindowResTextW()

VOID SetWindowResTextW ( _In_ HWND  hWnd,
_In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID 
)

Definition at line 282 of file reactos.c.

287{
288 WCHAR szText[256];
289 PWSTR String = szText; // Use the static buffer by default.
290
291 /* Try to load the string from the resource */
293 if (!String)
294 return;
296 if (String != szText)
298}

Referenced by FinishDlgProc(), PrepareAndDoCopyThread(), and SummaryDlgProc().

Variable Documentation

◆ InstallPartition

PPARTENTRY InstallPartition
extern

◆ ProcessHeap

HANDLE ProcessHeap
extern
  • Internal Headers *‍/

Definition at line 15 of file servman.c.

◆ SetupData

◆ SystemPartition

◆ UiContext