ReactOS 0.4.17-dev-573-g8315b8c
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 3013 of file reactos.c.

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

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

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

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

1689{
1690 PSETUPDATA pSetupData;
1691 HWND hList;
1692
1693 /* Retrieve pointer to the global setup data */
1694 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1695
1696 switch (uMsg)
1697 {
1698 case WM_INITDIALOG:
1699 {
1700 /* Save pointer to the global setup data */
1701 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
1702 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1703
1704 /* Initially hide and disable all partitioning buttons */
1705 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1706 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1713
1714 /* Initialize the partitions list */
1715 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1717 InitPartitionList(pSetupData->hInstance, hList);
1719 break;
1720 }
1721
1722 case WM_DESTROY:
1723 {
1724 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1728 return TRUE;
1729 }
1730
1731 case WM_COMMAND:
1732 {
1733 if (HIWORD(wParam) == BN_CLICKED) switch (LOWORD(wParam))
1734 {
1735 case IDC_PARTMOREOPTS:
1736 {
1737 DialogBoxParamW(pSetupData->hInstance,
1739 hwndDlg,
1741 (LPARAM)pSetupData);
1742 return TRUE;
1743 }
1744
1745 case IDC_INITDISK:
1746 {
1747 // TODO: Implement disk partitioning initialization
1748 return TRUE;
1749 }
1750
1751 case IDC_PARTCREATE:
1752 {
1753 HTLITEM hItem;
1754 PPARTITEM PartItem;
1755 PPARTENTRY PartEntry;
1756 ULONGLONG PartSize;
1757 ULONGLONG MaxPartSize;
1758 ULONG MaxSizeMB;
1759 INT_PTR ret;
1760 PARTCREATE_CTX PartCreateCtx = {0};
1761
1762 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1763 PartItem = GetSelectedPartition(hList, &hItem);
1764 if (!PartItem)
1765 {
1766 /* If the button was clicked, an empty disk
1767 * region should have been selected first */
1768 ASSERT(FALSE);
1769 break;
1770 }
1771 PartEntry = PartItem->PartEntry;
1772 if (PartEntry->IsPartitioned)
1773 {
1774 /* Don't create a partition when one already exists */
1775 ASSERT(FALSE);
1776 break;
1777 }
1778 ASSERT(!PartEntry->Volume);
1779
1780 /* Get the partition info stored in the TreeList */
1781 PartCreateCtx.PartItem = PartItem;
1782
1783 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1784 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1785 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1786 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1787
1788 /* Don't force formatting by default */
1789 PartCreateCtx.ForceFormat = FALSE;
1790
1791 /* Show the partitioning dialog */
1792 ret = DialogBoxParamW(pSetupData->hInstance,
1794 hwndDlg,
1796 (LPARAM)&PartCreateCtx);
1797 if (ret != IDOK)
1798 break;
1799
1800 /*
1801 * If the input size, given in MB, specifies the maximum partition
1802 * size, it may slightly under- or over-estimate the latter due to
1803 * rounding error. In this case, use all of the unpartitioned space.
1804 * Otherwise, directly convert the size to bytes.
1805 */
1806 PartSize = PartCreateCtx.PartSizeMB;
1807 if (PartSize == MaxSizeMB)
1808 PartSize = MaxPartSize;
1809 else // if (PartSize < MaxSizeMB)
1810 PartSize *= MB;
1811
1812 ASSERT(PartSize <= MaxPartSize);
1813
1814 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1815 &hItem, &PartItem,
1816 PartSize,
1817 !PartCreateCtx.MBRExtPart
1818 ? 0 : PARTITION_EXTENDED))
1819 {
1820 DisplayError(GetParent(hwndDlg),
1823 }
1824 break;
1825 }
1826
1827 case IDC_PARTFORMAT:
1828 {
1829 PPARTITEM PartItem;
1830 PPARTENTRY PartEntry;
1831 INT_PTR ret;
1832 PARTCREATE_CTX PartCreateCtx = {0};
1833
1834 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1835 PartItem = GetSelectedPartition(hList, NULL);
1836 if (!PartItem)
1837 {
1838 /* If the button was clicked, an empty disk
1839 * region should have been selected first */
1840 ASSERT(FALSE);
1841 break;
1842 }
1843 PartEntry = PartItem->PartEntry;
1844 if (!PartEntry->Volume)
1845 {
1846 /* Don't format an unformattable partition */
1847 ASSERT(FALSE);
1848 break;
1849 }
1850
1851 /* Show the formatting dialog */
1852 PartCreateCtx.PartItem = PartItem;
1853 ret = DialogBoxParamW(pSetupData->hInstance,
1855 hwndDlg,
1857 (LPARAM)&PartCreateCtx);
1859 break;
1860 }
1861
1862 case IDC_PARTDELETE:
1863 {
1864 HTLITEM hItem;
1865 PPARTITEM PartItem;
1866 PPARTENTRY PartEntry;
1867 UINT uIDWarnMsg;
1868
1869 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1870 PartItem = GetSelectedPartition(hList, &hItem);
1871 if (!PartItem)
1872 {
1873 /* If the button was clicked, a partition
1874 * should have been selected first */
1875 ASSERT(FALSE);
1876 break;
1877 }
1878 PartEntry = PartItem->PartEntry;
1879 if (!PartEntry->IsPartitioned)
1880 {
1881 /* Don't delete an unpartitioned disk region */
1882 ASSERT(FALSE);
1883 break;
1884 }
1885
1886 /* Choose the correct warning message to display:
1887 * MBR-extended (container) vs. standard partition */
1888 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1890 else
1891 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1892
1893 /* If the user really wants to delete the partition... */
1894 if (DisplayMessage(GetParent(hwndDlg),
1897 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1898 {
1899 /* ... make it so! */
1900 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1901 &hItem, PartItem))
1902 {
1904 L"Could not delete the selected partition.");
1905 }
1906 }
1907 break;
1908 }
1909 }
1910 break;
1911 }
1912
1913 case WM_NOTIFY:
1914 {
1915 LPNMHDR lpnm = (LPNMHDR)lParam;
1916
1917 if (lpnm->idFrom == IDC_PARTITION) switch (lpnm->code)
1918 {
1919 case NM_RETURN:
1920 {
1921 /* If the currently selected item is a partition (and so, if
1922 * the wizard "Next" button is enabled), pressing "Next" will
1923 * attempt to select an install partition and go to the next
1924 * page if successful. */
1925 HWND hWndParent = GetParent(hwndDlg);
1928 break;
1929 }
1930
1931 case TVN_KEYDOWN:
1932 {
1933 if (((LPTV_KEYDOWN_EX)lParam)->wVKey == VK_DELETE)
1934 {
1935 /* Send the delete command only if IDC_PARTDELETE is
1936 * enabled (i.e. the selected item IS a partition) */
1939 }
1940 break;
1941 }
1942 }
1943
1944 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1945 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1946 {
1948
1949 /* Check whether the item has been (de)selected */
1950#if 0 // When using NMTVITEMCHANGE
1951 if (!(pnmv->uChanged & TVIF_STATE) ||
1952 !((pnmv->uStateOld ^ pnmv->uStateNew) & TVIS_SELECTED))
1953 { break; }
1954#endif
1955 if (!((pnmv->itemOld.mask | pnmv->itemNew.mask) & TVIF_STATE) ||
1956 !((pnmv->itemOld.state ^ pnmv->itemNew.state) & TVIS_SELECTED))
1957 {
1958 break;
1959 }
1960
1961 if (pnmv->itemNew.state & TVIS_SELECTED)
1962 {
1963 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1964 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1965
1966 if (!hParentItem)
1967 {
1968 /* Hard disk */
1969 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1970 ASSERT(DiskEntry);
1971
1972 /* Show the "Initialize" disk button and hide and disable the others */
1973 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1974
1975#if 0 // FIXME: Init disk not implemented yet!
1976 EnableDlgItem(hwndDlg, IDC_INITDISK,
1977 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1978#else
1979 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1980#endif
1981
1984
1987
1990
1991 /* Disable the "Next" button */
1992 goto DisableWizNext;
1993 }
1994 else
1995 {
1996 /* Partition or unpartitioned space */
1997 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1998 PPARTENTRY PartEntry;
1999 BOOL CanBePartitioned;
2000 ASSERT(PartItem);
2001 PartEntry = PartItem->PartEntry;
2002 ASSERT(PartEntry);
2003
2004 /* Hide and disable the "Initialize" disk button */
2005 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
2006 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
2007
2008 /* Check whether the selected disk region is not partitioned, and
2009 * can be partitioned according to the disk's partitioning scheme */
2010 CanBePartitioned = (!PartEntry->IsPartitioned &&
2011 (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR));
2012
2013 if (!PartEntry->IsPartitioned)
2014 {
2015 /* Show the "Create" partition button, but enable it
2016 * only if the selected disk region can be partitioned */
2018 EnableDlgItem(hwndDlg, IDC_PARTCREATE, CanBePartitioned);
2019
2020 /* Hide and disable the "Format" button */
2023 }
2024 else
2025 {
2026 /* Hide and disable the "Create" partition button */
2029
2030 /* Show the "Format" button, but enable it only
2031 * if a formattable volume is present */
2033 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
2034 }
2035
2036 /* Show the "Delete" partition button, but enable it
2037 * only if the disk region is partitioned */
2039 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
2040
2041 /*
2042 * Enable the "Next" button if:
2043 *
2044 * 1. the selected disk region is partitioned:
2045 * it can either have a volume attached (and be either
2046 * formatted or ready to be formatted),
2047 * or it's not yet formatted (the installer will prompt
2048 * for formatting parameters).
2049 *
2050 * 2. Or, the selected disk region is not partitioned, but
2051 * can be partitioned according to the disk's partitioning
2052 * scheme (the installer will auto-partition the region
2053 * and prompt for formatting parameters).
2054 *
2055 * In all other cases, the "Next" button is disabled.
2056 */
2057
2058 // TODO: In the future: first test needs to be augmented with:
2059 // (... && PartEntry->Volume->IsSimpleVolume)
2060 if ((PartEntry->IsPartitioned && PartEntry->Volume) || CanBePartitioned)
2061 {
2062 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2065 }
2066 else
2067 {
2068 goto DisableWizNext;
2069 }
2070 }
2071 }
2072 else
2073 {
2074DisableWizNext:
2075 /* Keep the "Next" button disabled. It will be enabled
2076 * only when the user selects a valid partition. */
2078 }
2079
2080 break;
2081 }
2082
2083 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
2084 {
2085 /* Deleting an item from the partition list */
2087 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
2088 break;
2089 }
2090
2091 switch (lpnm->code)
2092 {
2093 case PSN_SETACTIVE:
2094 {
2095 /* Keep the "Next" button disabled. It will be enabled
2096 * only when the user selects a valid partition. */
2098 break;
2099 }
2100
2102 {
2103 /* Reselect the currently selected item, so as to refresh the UI buttons */
2104 HTLITEM hItem;
2105 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2107 if (hItem)
2108 {
2109 /* Don't use TreeList_SelectItem() directly. Instead,
2110 * deselect first the item before reselecting it, so as to
2111 * invalidate its cached state and have the TVN_SELCHANGED
2112 * notification sent. */
2113 TreeList_SetItemState(hList, hItem, 0, TVIS_SELECTED);
2114 TreeList_SetItemState(hList, hItem, TVIS_SELECTED, TVIS_SELECTED);
2115 }
2116
2117 /* Focus on the partition list */
2119 return TRUE;
2120 }
2121
2122 case PSN_QUERYCANCEL:
2123 {
2124 if (DisplayMessage(GetParent(hwndDlg),
2128 {
2129 /* Go to the Abort page */
2131 }
2132
2133 /* Do not close the wizard too soon */
2135 return TRUE;
2136 }
2137
2138 case PSN_WIZNEXT:
2139 {
2140 /* Select the install partition and if success, go to the next page */
2141 if (SelectInstallPartition(pSetupData, hwndDlg))
2142 break;
2143 /* Failed, stay on the page */
2144 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2145 return TRUE;
2146 }
2147
2148 default:
2149 break;
2150 }
2151 break;
2152 }
2153
2154 default:
2155 break;
2156 }
2157
2158 return FALSE;
2159}
UI_CONTEXT UiContext
Definition: reactos.c:38
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:245
#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:1282
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:1467
static BOOLEAN SelectInstallPartition(_In_ PSETUPDATA pSetupData, _In_ HWND hwndDlg)
Definition: drivepage.c:1569
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:598
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:1367
static PPARTITEM GetSelectedPartition(_In_ HWND hTreeList, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:796
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:553
static VOID DrawPartitionList(_In_ HWND hWndList, _In_ PPARTLIST List)
Definition: drivepage.c:1319
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:1344
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1112
return ret
Definition: mutex.c:146
@ 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
#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
HINSTANCE hInstance
Definition: reactos.h:127
PPARTLIST PartitionList
Definition: reactos.h:160
HWND hPartList
Definition: reactos.h:70
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
#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 815 of file drivepage.c.

818{
820
821 /* Enumerate every cached data in the TreeList, and for each, check
822 * whether its corresponding PPARTENTRY is the one we are looking for */
823 // for (hItem = TVI_ROOT; hItem; hItem = TreeList_GetNextItem(...)) { }
824 hItem = TVI_ROOT;
825 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
826 {
827 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
828 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
829 continue;
830
831 if (PartItem->Volume == Volume)
832 {
833 /* Found it, return the associated volume-create structure */
834 return PartItem->VolCreate;
835 }
836 }
837
838 /* Nothing was found */
839 return NULL;
840}
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:778
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 150 of file reactos.c.

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

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

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

346{
348
349 va_start(args, uID);
351 va_end(args);
352}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:303

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

◆ SetWindowResTextW()

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

Definition at line 284 of file reactos.c.

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

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