ReactOS 0.4.17-dev-684-ga6524ef
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
 
#define InterlockedFlagsTestAndSet8(Target, Flags)    !!(InterlockedOr8((PCHAR)(Target), (Flags)) & (Flags))
 
#define InterlockedFlagsTestAndReset8(Target, Flags)    !!(InterlockedAnd8((PCHAR)(Target), ~(Flags)) & (Flags))
 
#define SETUP_ABORT_INSTALL   1
 
#define SETUP_IS_CANCELLING   4
 
#define SETUP_PAGE_SWITCHING   16
 

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.

◆ InterlockedFlagsTestAndReset8

#define InterlockedFlagsTestAndReset8 (   Target,
  Flags 
)     !!(InterlockedAnd8((PCHAR)(Target), ~(Flags)) & (Flags))

Definition at line 121 of file reactos.h.

◆ InterlockedFlagsTestAndSet8

#define InterlockedFlagsTestAndSet8 (   Target,
  Flags 
)     !!(InterlockedOr8((PCHAR)(Target), (Flags)) & (Flags))

Definition at line 118 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.

◆ SETUP_ABORT_INSTALL

#define SETUP_ABORT_INSTALL   1

Definition at line 140 of file reactos.h.

◆ SETUP_IS_CANCELLING

#define SETUP_IS_CANCELLING   4

Definition at line 143 of file reactos.h.

◆ SETUP_PAGE_SWITCHING

#define SETUP_PAGE_SWITCHING   16

Definition at line 146 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 3043 of file reactos.c.

3048{
3049 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
3050 PLIST_ENTRY ListEntry;
3052 PCWSTR pwszNtPathToMap = pwszNTPath;
3053 PCWSTR pwszRemaining = NULL;
3054 DWORD cchDrives;
3055 PWCHAR pwszDrive;
3056 WCHAR wszDrives[512];
3057 WCHAR wszNTPath[MAX_PATH];
3058 WCHAR TargetPath[MAX_PATH];
3059
3060 *pwszPath = UNICODE_NULL;
3061
3062 /*
3063 * We find first a mapping inside the MappingList. If one is found, use it
3064 * to build the Win32 path. If there is none, we need to create one by
3065 * checking the Win32 drives (and possibly NT symlinks too).
3066 * In case of success, add the newly found mapping to the list and use it
3067 * to build the Win32 path.
3068 */
3069
3070 for (ListEntry = MappingList->List.Flink;
3071 ListEntry != &MappingList->List;
3072 ListEntry = ListEntry->Flink)
3073 {
3074 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
3075
3076 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
3077
3078 /* Check whether the queried NT path prefixes the user-provided NT path */
3079 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
3080 if (FoundDrive)
3081 {
3082 /* Found it! */
3083
3084 /* Set the pointers and go build the Win32 path */
3085 pwszDrive = Entry->Win32Path;
3086 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
3087 goto Quit;
3088 }
3089 }
3090
3091 /*
3092 * No mapping exists for this path yet: try to find one now.
3093 */
3094
3095 /* Retrieve the mounted drives (available drive letters) */
3096 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
3097 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
3098 {
3099 /* Buffer too small or failure */
3100 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
3101 return FALSE;
3102 }
3103
3104/* We go back there once if RetryOnce == TRUE */
3105Retry:
3106
3107 /* Enumerate the mounted drives */
3108 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
3109 {
3110 /* Retrieve the NT path corresponding to the current Win32 DOS path */
3111 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
3112 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
3113 pwszDrive[2] = L'\\'; // Restore the backslash
3114
3115 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
3116
3117 /* Check whether the queried NT path prefixes the user-provided NT path */
3118 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
3119 if (!FoundDrive)
3120 {
3121 PWCHAR ptr, ptr2;
3122
3123 /*
3124 * Check whether this was a network share that has a drive letter,
3125 * but the user-provided NT path points to this share without
3126 * mentioning the drive letter.
3127 *
3128 * The format is: \Device<network_redirector>\;X:<data>\share\path
3129 * The corresponding drive letter is 'X'.
3130 * A system-provided network redirector (LanManRedirector or Mup)
3131 * or a 3rd-party one may be used.
3132 *
3133 * We check whether the user-provided NT path has the form:
3134 * \Device<network_redirector><data>\share\path
3135 * as it obviously did not have the full form (the previous check
3136 * would have been OK otherwise).
3137 */
3138 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
3139 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
3140 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
3141 {
3142 /*
3143 * Normally the specified drive letter should correspond
3144 * to the one used for the mapping. But we will ignore
3145 * if it happens not to be the case.
3146 */
3147 if (pwszDrive[0] != ptr[1])
3148 {
3149 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
3150 pwszDrive[0], ptr[1]);
3151 }
3152
3153 /* Remove the drive letter from the NT network share path */
3154 ptr2 = ptr + 3;
3155 /* Swallow as many possible consecutive backslashes as there could be */
3156 while (*ptr2 == L'\\') ++ptr2;
3157
3158 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
3159
3160 /* Now do the check again */
3161 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
3162 }
3163 }
3164 if (FoundDrive)
3165 {
3166 /* Found it! */
3167
3168 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
3169
3170 if (pwszNtPathToMap == pwszNTPath)
3171 {
3172 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
3173 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
3174 }
3175 break;
3176 }
3177 }
3178
3179 if (FoundDrive)
3180 {
3181 /* A mapping was found, add it to the cache */
3183 if (!Entry)
3184 {
3185 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
3186 return FALSE;
3187 }
3188 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
3189 pwszNTPath, pwszRemaining - pwszNTPath);
3190 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
3191
3192 /* Insert it as the most recent entry */
3193 InsertHeadList(&MappingList->List, &Entry->ListEntry);
3194 MappingList->MappingsCount++;
3195
3196 /* Set the pointers and go build the Win32 path */
3197 pwszDrive = Entry->Win32Path;
3198 goto Quit;
3199 }
3200
3201 /*
3202 * We failed, perhaps because the beginning of the NT path used a symlink.
3203 * Try to see whether this is the case by attempting to resolve it.
3204 * If the symlink resolution gives nothing, or we already failed once,
3205 * there is no hope in converting the path to Win32.
3206 * Otherwise, symlink resolution succeeds but we need to recheck again
3207 * the drives list.
3208 */
3209
3210 /*
3211 * In theory we would have to parse each element in the NT path and going
3212 * until finding a symlink object (otherwise we would fail straight away).
3213 * However here we can use guessing instead, since we know which kind of
3214 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
3215 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
3216 * are supported in setuplib\utils\arcname.c .
3217 *
3218 * But actually, all the supported names in arcname.c are real devices,
3219 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
3220 * just check for it.
3221 */
3222 if (!RetryOnce && !FoundDrive)
3223 {
3224 ULONG DiskNumber, PartitionNumber;
3225 INT Length;
3226
3229 HANDLE LinkHandle;
3230 UNICODE_STRING SymLink, Target;
3231
3232 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
3233 &DiskNumber, &PartitionNumber, &Length) != 2)
3234 {
3235 /* Definitively not a recognized path, bail out */
3236 return FALSE;
3237 }
3238
3239 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
3240 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
3241 SymLink.Length = SymLink.MaximumLength;
3242
3244 &SymLink,
3246 NULL,
3247 NULL);
3248 Status = NtOpenSymbolicLinkObject(&LinkHandle,
3251 if (!NT_SUCCESS(Status))
3252 {
3253 /* Not a symlink, or something else happened: bail out */
3254 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
3255 &SymLink, Status);
3256 return FALSE;
3257 }
3258
3259 *TargetPath = UNICODE_NULL;
3260 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
3261
3262 /* Resolve the link and close its handle */
3264 NtClose(LinkHandle);
3265
3266 /* Check for success */
3267 if (!NT_SUCCESS(Status))
3268 {
3269 /* Not a symlink, or something else happened: bail out */
3270 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
3271 &SymLink, Status);
3272 return FALSE;
3273 }
3274
3275 /* Set the pointers */
3276 pwszRemaining = pwszNTPath + Length;
3277 pwszNtPathToMap = TargetPath; // Point to our local buffer
3278
3279 /* Retry once */
3280 RetryOnce = TRUE;
3281 goto Retry;
3282 }
3283
3284 ASSERT(!FoundDrive);
3285
3286Quit:
3287 if (FoundDrive)
3288 {
3289 StringCchPrintfW(pwszPath, cchPathMax,
3290 L"%s%s",
3291 pwszDrive,
3292 pwszRemaining);
3293 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
3294 return TRUE;
3295 }
3296
3297 return FALSE;
3298}
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:2988
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
#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:24
#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:3429
#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 598 of file reactos.c.

605{
606 UINT i;
607 LVCOLUMN lvC;
608 WCHAR szText[50];
609
610 /* Create the columns */
611 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
612 lvC.pszText = szText;
613
614 /* Load the column labels from the resource file */
615 for (i = 0; i < nNumOfColumns; i++)
616 {
617 lvC.iSubItem = i;
618 lvC.cx = pColsWidth[i];
619 lvC.fmt = pColsAlign[i];
620
621 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
622
623 if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
624 return FALSE;
625 }
626
627 return TRUE;
628}
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: sysinfo.c:13
#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 263 of file reactos.c.

268{
269 INT iRes;
271
272 va_start(args, uIDMessage);
274 MAKEINTRESOURCEW(uIDTitle),
275 MAKEINTRESOURCEW(uIDMessage),
276 args);
277 va_end(args);
278
279 return iRes;
280}
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:174
#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 174 of file reactos.c.

180{
181 INT iRes;
183 MSGBOXPARAMSW mb = {0};
185 WCHAR StaticBuffer[256];
186 PWSTR Buffer = StaticBuffer; // Use the static buffer by default.
187
188 /* We need to retrieve the current module's instance handle if either
189 * the title or the format message is specified by a resource ID */
190 if ((pszTitle && IS_INTRESOURCE(pszTitle)) || IS_INTRESOURCE(pszFormatMessage))
191 hInstance = GetModuleHandleW(NULL); // SetupData.hInstance;
192
193 /* Retrieve the format message string if this is a resource */
194 if (pszFormatMessage && IS_INTRESOURCE(pszFormatMessage))
195 {
196 Format = NULL;
197 (void)LoadAllocStringW(hInstance, PtrToUlong(pszFormatMessage), &Format, 0);
198 }
199 else
200 {
201 Format = (PWSTR)pszFormatMessage;
202 }
203
204 if (Format)
205 {
206 /* Format the message and retrieve its length. If it is too long,
207 * an auxiliary buffer is allocated; otherwise the static buffer
208 * is used. The string is built to be NUL-terminated. */
210 if (!Buffer)
211 {
212 /* Allocation failed, use the original format string verbatim */
213 Buffer = Format;
214 }
215 }
216 else
217 {
218 Format = (PWSTR)pszFormatMessage;
219 Buffer = Format;
220 }
221
222 /* Display the message */
223 mb.cbSize = sizeof(mb);
224 mb.hwndOwner = hWnd;
225 mb.hInstance = hInstance;
226 mb.lpszText = Buffer;
227 mb.lpszCaption = pszTitle;
228 mb.dwStyle = uType;
230 iRes = MessageBoxIndirectW(&mb);
231
232 /* Free the buffers if needed */
233 if ((Buffer != StaticBuffer) && (Buffer != Format))
235
236 if (Format && (Format != pszFormatMessage))
238
239 return iRes;
240}
size_t LoadAllocStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen)
Definition: reactos.c:114
size_t FormatAllocStringWV(_In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen, _In_ PCWSTR pszFormat, _In_ va_list args)
Definition: reactos.c:149
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 1759 of file drivepage.c.

1764{
1765 PSETUPDATA pSetupData;
1766 HWND hList;
1767
1768 /* Retrieve pointer to the global setup data */
1769 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1770
1771 switch (uMsg)
1772 {
1773 case WM_INITDIALOG:
1774 {
1775 /* Save pointer to the global setup data */
1776 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
1777 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1778
1779 /* Initially hide and disable all partitioning buttons */
1780 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1781 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1788
1789 /* Initialize the partitions list */
1790 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1792 InitPartitionList(pSetupData->hInstance, hList);
1794 break;
1795 }
1796
1797 case WM_DESTROY:
1798 {
1799 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1803 return TRUE;
1804 }
1805
1806 case WM_COMMAND:
1807 {
1808 if (HIWORD(wParam) == BN_CLICKED) switch (LOWORD(wParam))
1809 {
1810 case IDC_PARTMOREOPTS:
1811 {
1812 DialogBoxParamW(pSetupData->hInstance,
1814 hwndDlg,
1816 (LPARAM)pSetupData);
1817 return TRUE;
1818 }
1819
1820 case IDC_INITDISK:
1821 {
1822 // TODO: Implement disk partitioning initialization
1823 return TRUE;
1824 }
1825
1826 case IDC_PARTCREATE:
1827 {
1828 HTLITEM hItem;
1829 PPARTITEM PartItem;
1830 PPARTENTRY PartEntry;
1831 ULONGLONG PartSize;
1832 ULONGLONG MaxPartSize;
1833 ULONG MaxSizeMB;
1834 INT_PTR ret;
1835 PARTCREATE_CTX PartCreateCtx = {0};
1836
1837 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1838 PartItem = GetSelectedPartition(hList, &hItem);
1839 if (!PartItem)
1840 {
1841 /* If the button was clicked, an empty disk
1842 * region should have been selected first */
1843 ASSERT(FALSE);
1844 break;
1845 }
1846 PartEntry = PartItem->PartEntry;
1847 if (PartEntry->IsPartitioned)
1848 {
1849 /* Don't create a partition when one already exists */
1850 ASSERT(FALSE);
1851 break;
1852 }
1853 ASSERT(!PartEntry->Volume);
1854
1855 /* Get the partition info stored in the TreeList */
1856 PartCreateCtx.PartItem = PartItem;
1857
1858 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1859 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1860 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1861 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1862
1863 /* Don't force formatting by default */
1864 PartCreateCtx.ForceFormat = FALSE;
1865
1866 /* Show the partitioning dialog */
1867 ret = DialogBoxParamW(pSetupData->hInstance,
1869 hwndDlg,
1871 (LPARAM)&PartCreateCtx);
1872 if (ret != IDOK)
1873 break;
1874
1875 /*
1876 * If the input size, given in MB, specifies the maximum partition
1877 * size, it may slightly under- or over-estimate the latter due to
1878 * rounding error. In this case, use all of the unpartitioned space.
1879 * Otherwise, directly convert the size to bytes.
1880 */
1881 PartSize = PartCreateCtx.PartSizeMB;
1882 if (PartSize == MaxSizeMB)
1883 PartSize = MaxPartSize;
1884 else // if (PartSize < MaxSizeMB)
1885 PartSize *= MB;
1886
1887 ASSERT(PartSize <= MaxPartSize);
1888
1889 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1890 &hItem, &PartItem,
1891 PartSize,
1892 !PartCreateCtx.MBRExtPart
1893 ? 0 : PARTITION_EXTENDED))
1894 {
1895 DisplayError(GetParent(hwndDlg),
1898 }
1899 break;
1900 }
1901
1902 case IDC_PARTFORMAT:
1903 {
1904 PPARTITEM PartItem;
1905 PPARTENTRY PartEntry;
1906 INT_PTR ret;
1907 PARTCREATE_CTX PartCreateCtx = {0};
1908
1909 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1910 PartItem = GetSelectedPartition(hList, NULL);
1911 if (!PartItem)
1912 {
1913 /* If the button was clicked, an empty disk
1914 * region should have been selected first */
1915 ASSERT(FALSE);
1916 break;
1917 }
1918 PartEntry = PartItem->PartEntry;
1919 if (!PartEntry->Volume)
1920 {
1921 /* Don't format an unformattable partition */
1922 ASSERT(FALSE);
1923 break;
1924 }
1925
1926 /* Show the formatting dialog */
1927 PartCreateCtx.PartItem = PartItem;
1928 ret = DialogBoxParamW(pSetupData->hInstance,
1930 hwndDlg,
1932 (LPARAM)&PartCreateCtx);
1934 break;
1935 }
1936
1937 case IDC_PARTDELETE:
1938 {
1939 HTLITEM hItem;
1940 PPARTITEM PartItem;
1941 PPARTENTRY PartEntry;
1942 UINT uIDWarnMsg;
1943
1944 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1945 PartItem = GetSelectedPartition(hList, &hItem);
1946 if (!PartItem)
1947 {
1948 /* If the button was clicked, a partition
1949 * should have been selected first */
1950 ASSERT(FALSE);
1951 break;
1952 }
1953 PartEntry = PartItem->PartEntry;
1954 if (!PartEntry->IsPartitioned)
1955 {
1956 /* Don't delete an unpartitioned disk region */
1957 ASSERT(FALSE);
1958 break;
1959 }
1960
1961 /* Choose the correct warning message to display:
1962 * MBR-extended (container) vs. standard partition */
1963 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1965 else
1966 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1967
1968 /* If the user really wants to delete the partition... */
1969 if (DisplayMessage(GetParent(hwndDlg),
1972 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1973 {
1974 /* ... make it so! */
1975 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1976 &hItem, PartItem))
1977 {
1979 L"Could not delete the selected partition.");
1980 }
1981 }
1982 break;
1983 }
1984 }
1985 break;
1986 }
1987
1988 case WM_NOTIFY:
1989 {
1990 LPNMHDR lpnm = (LPNMHDR)lParam;
1991
1992 if (lpnm->idFrom == IDC_PARTITION) switch (lpnm->code)
1993 {
1994 case NM_RETURN:
1995 {
1996 /* If the currently selected item is a partition (and so, if
1997 * the wizard "Next" button is enabled), pressing "Next" will
1998 * attempt to select an install partition and go to the next
1999 * page if successful. */
2000 HWND hWndParent = GetParent(hwndDlg);
2003 break;
2004 }
2005
2006 case TVN_KEYDOWN:
2007 {
2008 if (((LPTV_KEYDOWN_EX)lParam)->wVKey == VK_DELETE)
2009 {
2010 /* Send the delete command only if IDC_PARTDELETE is
2011 * enabled (i.e. the selected item IS a partition) */
2014 }
2015 break;
2016 }
2017 }
2018
2019 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
2020 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
2021 {
2023
2024 /* Check whether the item has been (de)selected */
2025#if 0 // When using NMTVITEMCHANGE
2026 if (!(pnmv->uChanged & TVIF_STATE) ||
2027 !((pnmv->uStateOld ^ pnmv->uStateNew) & TVIS_SELECTED))
2028 { break; }
2029#endif
2030 if (!((pnmv->itemOld.mask | pnmv->itemNew.mask) & TVIF_STATE) ||
2031 !((pnmv->itemOld.state ^ pnmv->itemNew.state) & TVIS_SELECTED))
2032 {
2033 break;
2034 }
2035
2036 if (pnmv->itemNew.state & TVIS_SELECTED)
2037 {
2038 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
2039 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
2040
2041 if (!hParentItem)
2042 {
2043 /* Hard disk */
2044 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
2045 ASSERT(DiskEntry);
2046
2047 /* Show the "Initialize" disk button and hide and disable the others */
2048 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
2049
2050#if 0 // FIXME: Init disk not implemented yet!
2051 EnableDlgItem(hwndDlg, IDC_INITDISK,
2052 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
2053#else
2054 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
2055#endif
2056
2059
2062
2065
2066 /* Disable the "Next" button */
2067 goto DisableWizNext;
2068 }
2069 else
2070 {
2071 /* Partition or unpartitioned space */
2072 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
2073 PPARTENTRY PartEntry;
2074 BOOL CanBePartitioned;
2075 ASSERT(PartItem);
2076 PartEntry = PartItem->PartEntry;
2077 ASSERT(PartEntry);
2078
2079 /* Hide and disable the "Initialize" disk button */
2080 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
2081 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
2082
2083 /* Check whether the selected disk region is not partitioned, and
2084 * can be partitioned according to the disk's partitioning scheme */
2085 CanBePartitioned = (!PartEntry->IsPartitioned &&
2086 (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR));
2087
2088 if (!PartEntry->IsPartitioned)
2089 {
2090 /* Show the "Create" partition button, but enable it
2091 * only if the selected disk region can be partitioned */
2093 EnableDlgItem(hwndDlg, IDC_PARTCREATE, CanBePartitioned);
2094
2095 /* Hide and disable the "Format" button */
2098 }
2099 else
2100 {
2101 /* Hide and disable the "Create" partition button */
2104
2105 /* Show the "Format" button, but enable it only
2106 * if a formattable volume is present */
2108 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
2109 }
2110
2111 /* Show the "Delete" partition button, but enable it
2112 * only if the disk region is partitioned */
2114 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
2115
2116 /*
2117 * Enable the "Next" button if:
2118 *
2119 * 1. the selected disk region is partitioned:
2120 * it can either have a volume attached (and be either
2121 * formatted or ready to be formatted),
2122 * or it's not yet formatted (the installer will prompt
2123 * for formatting parameters).
2124 *
2125 * 2. Or, the selected disk region is not partitioned, but
2126 * can be partitioned according to the disk's partitioning
2127 * scheme (the installer will auto-partition the region
2128 * and prompt for formatting parameters).
2129 *
2130 * In all other cases, the "Next" button is disabled.
2131 */
2132
2133 // TODO: In the future: first test needs to be augmented with:
2134 // (... && PartEntry->Volume->IsSimpleVolume)
2135 if ((PartEntry->IsPartitioned && PartEntry->Volume) || CanBePartitioned)
2136 {
2137 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2140 }
2141 else
2142 {
2143 goto DisableWizNext;
2144 }
2145 }
2146 }
2147 else
2148 {
2149DisableWizNext:
2150 /* Keep the "Next" button disabled. It will be enabled
2151 * only when the user selects a valid partition. */
2153 }
2154
2155 break;
2156 }
2157
2158 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
2159 {
2160 /* Deleting an item from the partition list */
2162 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
2163 break;
2164 }
2165
2166 switch (lpnm->code)
2167 {
2168 case PSN_SETACTIVE:
2169 {
2170 /* Keep the "Next" button disabled. It will be enabled
2171 * only when the user selects a valid partition. */
2173
2174 /* In unattended mode, switch directly to the next page.
2175 * TODO: *UNLESS* there are inconsistencies in the data,
2176 * in which case we should stay on the page! */
2177 if (pSetupData->bUnattend) do
2178 {
2180
2181 /* If DestinationDiskNumber or DestinationPartitionNumber are invalid
2182 * (see below), don't select the partition and show the list instead */
2183 if (pSetupData->USetupData.DestinationDiskNumber == -1 ||
2184 pSetupData->USetupData.DestinationPartitionNumber == -1)
2185 {
2186 break;
2187 }
2188
2189 /* Determine the selected installation disk & partition */
2193
2194 /* Now reset DestinationDiskNumber and DestinationPartitionNumber
2195 * to *invalid* values, so that if the corresponding partition is
2196 * determined to be invalid by the code below or in CreateInstallPartition,
2197 * we don't reselect it when SelectPartitionPage() is called again */
2198 pSetupData->USetupData.DestinationDiskNumber = -1;
2199 pSetupData->USetupData.DestinationPartitionNumber = -1;
2200
2201 // FIXME: Here and in the AutoPartition case below, the CurrentPartition
2202 // may actually be unsuitable (MBR-extended, non-simple volume...).
2203 // More checks need to be made here!
2204 //
2205 // NOTE: We don't check for CurrentPartition->Volume in case
2206 // the partition doesn't contain a recognized volume/none exists.
2207 // We also don't check whether IsPartitioned is TRUE, because if
2208 // the partition is still empty space, we'll try to partition it.
2210 goto CreateInstallPartition;
2211
2212 if (pSetupData->USetupData.AutoPartition)
2213 {
2214 /* Use whatever selected partition (or the first one) in the list */
2215 PPARTITEM PartItem;
2216 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2217 PartItem = GetSelectedPartition(hList, NULL);
2218 if (!PartItem)
2219 PartItem = FindPartitionItem(hList, NULL, NULL);
2220 if (PartItem)
2221 CurrentPartition = PartItem->PartEntry;
2222
2223 // TODO: Do more checks, and loop until we find a valid partition.
2224 goto CreateInstallPartition;
2225 }
2226 break;
2227
2228CreateInstallPartition:
2229 /* Select the install partition and if success,
2230 * proceed with the installation */
2231 if (SelectInstallPartition(pSetupData, hwndDlg, CurrentPartition))
2232 {
2233 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2234 return TRUE;
2235 }
2236 /* Halt the installation and display the page */
2237 } while (0);
2238 break;
2239 }
2240
2242 {
2243 /* Reselect the currently selected item, so as to refresh the UI buttons */
2244 HTLITEM hItem;
2245 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2247 if (hItem)
2248 {
2249 /* Don't use TreeList_SelectItem() directly. Instead,
2250 * deselect first the item before reselecting it, so as to
2251 * invalidate its cached state and have the TVN_SELCHANGED
2252 * notification sent. */
2253 TreeList_SetItemState(hList, hItem, 0, TVIS_SELECTED);
2254 TreeList_SetItemState(hList, hItem, TVIS_SELECTED, TVIS_SELECTED);
2255 }
2256
2257 /* Focus on the partition list */
2259 return TRUE;
2260 }
2261
2262 case PSN_QUERYCANCEL:
2263 {
2264 if (DisplayMessage(GetParent(hwndDlg),
2268 {
2269 /* Go to the Abort page */
2271 }
2272
2273 /* Do not close the wizard too soon */
2275 return TRUE;
2276 }
2277
2278 case PSN_WIZNEXT:
2279 {
2280 /* Select the install partition and if success, go to the next page */
2281 if (SelectInstallPartition(pSetupData, hwndDlg, NULL))
2282 break;
2283 /* Failed, stay on the page */
2284 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2285 return TRUE;
2286 }
2287
2288 default:
2289 break;
2290 }
2291 break;
2292 }
2293
2294 default:
2295 break;
2296 }
2297
2298 return FALSE;
2299}
UI_CONTEXT UiContext
Definition: reactos.c:37
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:244
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
#define ID_WIZNEXT
Definition: reactos.h:47
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
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1336
static PPARTITEM FindPartitionItem(_In_ HWND hTreeList, _In_opt_ PPARTENTRY PartEntry, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:848
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:1524
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:638
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:1425
static PPARTITEM GetSelectedPartition(_In_ HWND hTreeList, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:831
static BOOLEAN SelectInstallPartition(_In_ PSETUPDATA pSetupData, _In_ HWND hwndDlg, _In_opt_ PPARTENTRY CurrentPartition)
Definition: drivepage.c:1625
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:575
static VOID DrawPartitionList(_In_ HWND hWndList, _In_ PPARTLIST List)
Definition: drivepage.c:1373
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:1402
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1168
return ret
Definition: mutex.c:147
@ NOT_AN_ERROR
Definition: errorcode.h:17
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
#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
#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
#define PARTITION_EXTENDED
Definition: part_mbr.h:55
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#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 PSBTN_NEXT
Definition: prsht.h:147
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#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 TVN_KEYDOWN
Definition: commctrl.h:3718
#define LPNMTREEVIEW
Definition: commctrl.h:3648
#define TVIS_SELECTED
Definition: commctrl.h:3285
#define NM_RETURN
Definition: commctrl.h:132
#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
PPARTENTRY SelectPartition(_In_ PPARTLIST List, _In_ ULONG DiskNumber, _In_ ULONG PartitionNumber)
Definition: partlist.c:2333
#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
USETUP_DATA USetupData
Definition: reactos.h:156
HINSTANCE hInstance
Definition: reactos.h:127
PPARTLIST PartitionList
Definition: reactos.h:160
BOOL bUnattend
Definition: reactos.h:128
HWND hPartList
Definition: reactos.h:70
LONG DestinationPartitionNumber
Definition: setuplib.h:130
LONG AutoPartition
Definition: setuplib.h:134
LONG DestinationDiskNumber
Definition: setuplib.h:129
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
HWND hwndFrom
Definition: winuser.h:3265
#define GWLP_USERDATA
Definition: treelist.c:63
#define TLITEMW
Definition: treelist.h:478
HTREEITEM hItem
Definition: treelist.h:37
#define TreeList_GetSelection(h)
Definition: treelist.h:450
#define HTLITEM
Definition: treelist.h:466
#define TreeList_GetParent(h, i)
Definition: treelist.h:442
int32_t INT_PTR
Definition: typedefs.h:64
uint64_t ULONGLONG
Definition: typedefs.h:67
#define HIWORD(l)
Definition: typedefs.h:247
static PPARTENTRY CurrentPartition
Definition: usetup.c:78
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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
struct tagNMHDR * LPNMHDR
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#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 BN_CLICKED
Definition: winuser.h:1954
#define SW_SHOW
Definition: winuser.h:786
#define VK_DELETE
Definition: winuser.h:2269
#define WM_DESTROY
Definition: winuser.h:1637
#define IDYES
Definition: winuser.h:846
#define SetWindowLongPtrW
Definition: winuser.h:5512
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

◆ FindVolCreateInTreeByVolume()

PVOL_CREATE_INFO FindVolCreateInTreeByVolume ( _In_ HWND  hTreeList,
_In_ PVOLENTRY  Volume 
)

Definition at line 876 of file drivepage.c.

879{
880 /* Enumerate every cached data in the TreeList, and for each, check
881 * whether its corresponding PPARTENTRY is the one we are looking for */
883 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
884 {
885 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
886 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
887 continue;
888
889 if (PartItem->Volume == Volume)
890 {
891 /* Found it, return the associated volume-create structure */
892 return PartItem->VolCreate;
893 }
894 }
895 return NULL; /* Nothing was found */
896}
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:817
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define TVI_ROOT
Definition: commctrl.h:3373
PVOL_CREATE_INFO VolCreate
Definition: drivepage.c:360
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 149 of file reactos.c.

154{
155 size_t Length;
156
157 /* Retrieve the message length. If it is too long, allocate
158 * an auxiliary buffer; otherwise use the caller's buffer. */
159 Length = _vscwprintf(pszFormat, args); // Doesn't count the NUL-terminator.
160 if (!*pString || (Length >= cchBufferLen))
161 {
162 /* Allocate a new buffer, adding a NUL-terminator */
164 if (!*pString)
165 return 0;
166 }
167
168 /* Do the printf */
169 StringCchVPrintfW(*pString, Length + 1, pszFormat, args);
170 return Length;
171}
_ACRTIMP int __cdecl _vscwprintf(const wchar_t *, va_list)
Definition: wcs.c:1787
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 114 of file reactos.c.

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

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

◆ SetWindowResPrintfVW()

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

Definition at line 302 of file reactos.c.

307{
308 WCHAR ResBuffer[256];
309 WCHAR szText[256];
310 PWSTR ResFmt = ResBuffer; // Use the static buffers by default.
311 PWSTR String = szText;
312
313 /* Try to load the string from the resource */
314 (void)LoadAllocStringW(hInstance, uID, &ResFmt, _countof(ResBuffer));
315 if (!ResFmt)
316 return;
317
318 /* Format the string and retrieve its length. If it is too long,
319 * an auxiliary buffer is allocated; otherwise the static buffer
320 * is used. The string is built to be NUL-terminated. */
321 (void)FormatAllocStringWV(&String, _countof(szText), ResFmt, args);
322 if (!String)
323 {
324 /* Allocation failed, use the original format string verbatim */
325 String = ResFmt;
326 }
327
329
330 /* Free the buffers if needed */
331 if ((String != szText) && (String != ResFmt))
333
334 if (ResFmt && (ResFmt != ResBuffer))
335 HeapFree(GetProcessHeap(), 0, ResFmt);
336}
_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 340 of file reactos.c.

345{
347
348 va_start(args, uID);
350 va_end(args);
351}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:302

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

◆ SetWindowResTextW()

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

Definition at line 283 of file reactos.c.

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

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

Variable Documentation

◆ InstallPartition

◆ ProcessHeap

HANDLE ProcessHeap
extern
  • Internal Headers *‍/

Definition at line 15 of file servman.c.

◆ SetupData

◆ SystemPartition

◆ UiContext