ReactOS 0.4.16-dev-197-g92996da
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 IDC_TAB_CONTROL   0x3020
 
#define ID_APPLY_NOW   0x3021
 
#define ID_WIZBACK   0x3023
 
#define ID_WIZNEXT   0x3024
 
#define ID_WIZFINISH   0x3025
 
#define NTOS_MODE_USER
 

Typedefs

typedef struct _UI_CONTEXT UI_CONTEXT
 
typedef struct _UI_CONTEXTPUI_CONTEXT
 
typedef struct _NT_WIN32_PATH_MAPPING NT_WIN32_PATH_MAPPING
 
typedef struct _NT_WIN32_PATH_MAPPINGPNT_WIN32_PATH_MAPPING
 
typedef struct _NT_WIN32_PATH_MAPPING_LIST NT_WIN32_PATH_MAPPING_LIST
 
typedef struct _NT_WIN32_PATH_MAPPING_LISTPNT_WIN32_PATH_MAPPING_LIST
 
typedef struct _SETUPDATA SETUPDATA
 
typedef struct _SETUPDATAPSETUPDATA
 
typedef struct _VOL_CREATE_INFO VOL_CREATE_INFO
 Data structure stored when a partition/volume needs to be formatted.
 
typedef struct _VOL_CREATE_INFOPVOL_CREATE_INFO
 

Functions

PVOL_CREATE_INFO FindVolCreateInTreeByVolume (_In_ HWND hTreeList, _In_ PVOLENTRY Volume)
 
BOOL ConvertNtPathToWin32Path (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList, OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
 
INT_PTR CALLBACK DriveDlgProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
BOOL CreateListViewColumns (IN HINSTANCE hInstance, IN HWND hWndListView, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
 
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
 
BOOLEAN IsUnattendedSetup
 
SETUPDATA SetupData
 
PPARTENTRY InstallPartition
 
PPARTENTRY SystemPartition
 

Macro Definition Documentation

◆ EnableDlgItem

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

Definition at line 48 of file reactos.h.

◆ ID_APPLY_NOW

#define ID_APPLY_NOW   0x3021

Definition at line 57 of file reactos.h.

◆ ID_WIZBACK

#define ID_WIZBACK   0x3023

Definition at line 58 of file reactos.h.

◆ ID_WIZFINISH

#define ID_WIZFINISH   0x3025

Definition at line 60 of file reactos.h.

◆ ID_WIZNEXT

#define ID_WIZNEXT   0x3024

Definition at line 59 of file reactos.h.

◆ IDC_TAB_CONTROL

#define IDC_TAB_CONTROL   0x3020

Definition at line 56 of file reactos.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 68 of file reactos.h.

◆ ShowDlgItem

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

Definition at line 51 of file reactos.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 36 of file reactos.h.

Typedef Documentation

◆ NT_WIN32_PATH_MAPPING

◆ NT_WIN32_PATH_MAPPING_LIST

◆ PNT_WIN32_PATH_MAPPING

◆ PNT_WIN32_PATH_MAPPING_LIST

◆ PSETUPDATA

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

2474{
2475 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
2476 PLIST_ENTRY ListEntry;
2478 PCWSTR pwszNtPathToMap = pwszNTPath;
2479 PCWSTR pwszRemaining = NULL;
2480 DWORD cchDrives;
2481 PWCHAR pwszDrive;
2482 WCHAR wszDrives[512];
2483 WCHAR wszNTPath[MAX_PATH];
2484 WCHAR TargetPath[MAX_PATH];
2485
2486 *pwszPath = UNICODE_NULL;
2487
2488 /*
2489 * We find first a mapping inside the MappingList. If one is found, use it
2490 * to build the Win32 path. If there is none, we need to create one by
2491 * checking the Win32 drives (and possibly NT symlinks too).
2492 * In case of success, add the newly found mapping to the list and use it
2493 * to build the Win32 path.
2494 */
2495
2496 for (ListEntry = MappingList->List.Flink;
2497 ListEntry != &MappingList->List;
2498 ListEntry = ListEntry->Flink)
2499 {
2500 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
2501
2502 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
2503
2504 /* Check whether the queried NT path prefixes the user-provided NT path */
2505 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
2506 if (FoundDrive)
2507 {
2508 /* Found it! */
2509
2510 /* Set the pointers and go build the Win32 path */
2511 pwszDrive = Entry->Win32Path;
2512 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
2513 goto Quit;
2514 }
2515 }
2516
2517 /*
2518 * No mapping exists for this path yet: try to find one now.
2519 */
2520
2521 /* Retrieve the mounted drives (available drive letters) */
2522 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2523 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2524 {
2525 /* Buffer too small or failure */
2526 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
2527 return FALSE;
2528 }
2529
2530/* We go back there once if RetryOnce == TRUE */
2531Retry:
2532
2533 /* Enumerate the mounted drives */
2534 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2535 {
2536 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2537 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2538 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2539 pwszDrive[2] = L'\\'; // Restore the backslash
2540
2541 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
2542
2543 /* Check whether the queried NT path prefixes the user-provided NT path */
2544 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2545 if (!FoundDrive)
2546 {
2547 PWCHAR ptr, ptr2;
2548
2549 /*
2550 * Check whether this was a network share that has a drive letter,
2551 * but the user-provided NT path points to this share without
2552 * mentioning the drive letter.
2553 *
2554 * The format is: \Device<network_redirector>\;X:<data>\share\path
2555 * The corresponding drive letter is 'X'.
2556 * A system-provided network redirector (LanManRedirector or Mup)
2557 * or a 3rd-party one may be used.
2558 *
2559 * We check whether the user-provided NT path has the form:
2560 * \Device<network_redirector><data>\share\path
2561 * as it obviously did not have the full form (the previous check
2562 * would have been OK otherwise).
2563 */
2564 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
2565 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
2566 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
2567 {
2568 /*
2569 * Normally the specified drive letter should correspond
2570 * to the one used for the mapping. But we will ignore
2571 * if it happens not to be the case.
2572 */
2573 if (pwszDrive[0] != ptr[1])
2574 {
2575 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
2576 pwszDrive[0], ptr[1]);
2577 }
2578
2579 /* Remove the drive letter from the NT network share path */
2580 ptr2 = ptr + 3;
2581 /* Swallow as many possible consecutive backslashes as there could be */
2582 while (*ptr2 == L'\\') ++ptr2;
2583
2584 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
2585
2586 /* Now do the check again */
2587 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2588 }
2589 }
2590 if (FoundDrive)
2591 {
2592 /* Found it! */
2593
2594 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
2595
2596 if (pwszNtPathToMap == pwszNTPath)
2597 {
2598 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
2599 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
2600 }
2601 break;
2602 }
2603 }
2604
2605 if (FoundDrive)
2606 {
2607 /* A mapping was found, add it to the cache */
2609 if (!Entry)
2610 {
2611 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
2612 return FALSE;
2613 }
2614 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
2615 pwszNTPath, pwszRemaining - pwszNTPath);
2616 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
2617
2618 /* Insert it as the most recent entry */
2619 InsertHeadList(&MappingList->List, &Entry->ListEntry);
2620 MappingList->MappingsCount++;
2621
2622 /* Set the pointers and go build the Win32 path */
2623 pwszDrive = Entry->Win32Path;
2624 goto Quit;
2625 }
2626
2627 /*
2628 * We failed, perhaps because the beginning of the NT path used a symlink.
2629 * Try to see whether this is the case by attempting to resolve it.
2630 * If the symlink resolution gives nothing, or we already failed once,
2631 * there is no hope in converting the path to Win32.
2632 * Otherwise, symlink resolution succeeds but we need to recheck again
2633 * the drives list.
2634 */
2635
2636 /*
2637 * In theory we would have to parse each element in the NT path and going
2638 * until finding a symlink object (otherwise we would fail straight away).
2639 * However here we can use guessing instead, since we know which kind of
2640 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
2641 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
2642 * are supported in setuplib\utils\arcname.c .
2643 *
2644 * But actually, all the supported names in arcname.c are real devices,
2645 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
2646 * just check for it.
2647 */
2648 if (!RetryOnce && !FoundDrive)
2649 {
2650 ULONG DiskNumber, PartitionNumber;
2651 INT Length;
2652
2655 HANDLE LinkHandle;
2656 UNICODE_STRING SymLink, Target;
2657
2658 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
2659 &DiskNumber, &PartitionNumber, &Length) != 2)
2660 {
2661 /* Definitively not a recognized path, bail out */
2662 return FALSE;
2663 }
2664
2665 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
2666 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
2667 SymLink.Length = SymLink.MaximumLength;
2668
2670 &SymLink,
2672 NULL,
2673 NULL);
2674 Status = NtOpenSymbolicLinkObject(&LinkHandle,
2677 if (!NT_SUCCESS(Status))
2678 {
2679 /* Not a symlink, or something else happened: bail out */
2680 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2681 &SymLink, Status);
2682 return FALSE;
2683 }
2684
2685 *TargetPath = UNICODE_NULL;
2686 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
2687
2688 /* Resolve the link and close its handle */
2690 NtClose(LinkHandle);
2691
2692 /* Check for success */
2693 if (!NT_SUCCESS(Status))
2694 {
2695 /* Not a symlink, or something else happened: bail out */
2696 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2697 &SymLink, Status);
2698 return FALSE;
2699 }
2700
2701 /* Set the pointers */
2702 pwszRemaining = pwszNTPath + Length;
2703 pwszNtPathToMap = TargetPath; // Point to our local buffer
2704
2705 /* Retry once */
2706 RetryOnce = TRUE;
2707 goto Retry;
2708 }
2709
2710 ASSERT(!FoundDrive);
2711
2712Quit:
2713 if (FoundDrive)
2714 {
2715 StringCchPrintfW(pwszPath, cchPathMax,
2716 L"%s%s",
2717 pwszDrive,
2718 pwszRemaining);
2719 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
2720 return TRUE;
2721 }
2722
2723 return FALSE;
2724}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
HANDLE ProcessHeap
Definition: reactos.c:40
_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 InsertHeadList(ListHead, Entry)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ASSERT(a)
Definition: mode.c:44
static PVOID ptr
Definition: dispmode.c:27
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define DPRINT
Definition: sndvol32.h: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
base of all file and directory entries
Definition: entries.h:83
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
__wchar_t WCHAR
Definition: xmlstorage.h:180

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

486{
487 UINT i;
488 LVCOLUMN lvC;
489 WCHAR szText[50];
490
491 /* Create the columns */
492 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
493 lvC.pszText = szText;
494
495 /* Load the column labels from the resource file */
496 for (i = 0; i < nNumOfColumns; i++)
497 {
498 lvC.iSubItem = i;
499 lvC.cx = pColsWidth[i];
500 lvC.fmt = pColsAlign[i];
501
502 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
503
504 if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
505 return FALSE;
506 }
507
508 return TRUE;
509}
HINSTANCE hInstance
Definition: charmap.c:19
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVCOLUMN
Definition: commctrl.h:2586
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by UpgradeRepairDlgProc().

◆ DisplayError()

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

Definition at line 230 of file reactos.c.

235{
236 INT iRes;
238
239 va_start(args, uIDMessage);
241 MAKEINTRESOURCEW(uIDTitle),
242 MAKEINTRESOURCEW(uIDMessage),
243 args);
244 va_end(args);
245
246 return iRes;
247}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
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:109
#define args
Definition: format.c:66
Definition: match.c:390
#define MB_ICONERROR
Definition: winuser.h:790
#define MB_OK
Definition: winuser.h:793
#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 109 of file reactos.c.

115{
116 INT iRes;
118 MSGBOXPARAMSW mb = {0};
120 size_t MsgLen;
121 WCHAR StaticBuffer[256];
122 LPWSTR Buffer = StaticBuffer; // Use the static buffer by default.
123
124 /* We need to retrieve the current module's instance handle if either
125 * the title or the format message is specified by a resource ID */
126 if ((pszTitle && IS_INTRESOURCE(pszTitle)) || IS_INTRESOURCE(pszFormatMessage))
127 hInstance = GetModuleHandleW(NULL); // SetupData.hInstance;
128
129 /* Retrieve the format message string if this is a resource */
130 if (pszFormatMessage && IS_INTRESOURCE(pszFormatMessage)) do
131 {
132 // LoadAllocStringW()
133 PCWSTR pStr;
134
135 /* Try to load the string from the resource */
136 MsgLen = LoadStringW(hInstance, PtrToUlong(pszFormatMessage), (LPWSTR)&pStr, 0);
137 if (MsgLen == 0)
138 {
139 /* No resource string was found, return NULL */
140 Format = NULL;
141 break;
142 }
143
144 /* Allocate a new buffer, adding a NULL-terminator */
145 Format = HeapAlloc(GetProcessHeap(), 0, (MsgLen + 1) * sizeof(WCHAR));
146 if (!Format)
147 {
148 MsgLen = 0;
149 break;
150 }
151
152 /* Copy the string, NULL-terminated */
153 StringCchCopyNW(Format, MsgLen + 1, pStr, MsgLen);
154 } while (0);
155 else
156 {
157 Format = (LPWSTR)pszFormatMessage;
158 }
159
160 if (Format)
161 {
162 /*
163 * Retrieve the message length. If it is too long, allocate
164 * an auxiliary buffer; otherwise use the static buffer.
165 * The string is built to be NULL-terminated.
166 */
167 MsgLen = _vscwprintf(Format, args);
168 if (MsgLen >= _countof(StaticBuffer))
169 {
170 Buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (MsgLen + 1) * sizeof(WCHAR));
171 if (!Buffer)
172 {
173 /* Allocation failed, use the original format string verbatim */
174 Buffer = Format;
175 }
176 }
177 if (Buffer != Format)
178 {
179 /* Do the printf as we use the caller's format string */
180 StringCchVPrintfW(Buffer, MsgLen + 1, Format, args);
181 }
182 }
183 else
184 {
185 Format = (LPWSTR)pszFormatMessage;
186 Buffer = Format;
187 }
188
189 /* Display the message */
190 mb.cbSize = sizeof(mb);
191 mb.hwndOwner = hWnd;
192 mb.hInstance = hInstance;
193 mb.lpszText = Buffer;
194 mb.lpszCaption = pszTitle;
195 mb.dwStyle = uType;
197 iRes = MessageBoxIndirectW(&mb);
198
199 /* Free the buffers if needed */
200 if ((Buffer != StaticBuffer) && (Buffer != Format))
202
203 if (Format && (Format != pszFormatMessage))
205
206 return iRes;
207}
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 PtrToUlong(u)
Definition: config.h:107
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
STRSAFEAPI StringCchVPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
Definition: strsafe.h:490
DWORD dwLanguageId
Definition: winuser.h:3348
LPCWSTR lpszCaption
Definition: winuser.h:3343
HWND hwndOwner
Definition: winuser.h:3340
LPCWSTR lpszText
Definition: winuser.h:3342
HINSTANCE hInstance
Definition: winuser.h:3341
DWORD dwStyle
Definition: winuser.h:3344
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
int WINAPI MessageBoxIndirectW(_In_ CONST MSGBOXPARAMSW *lpmbp)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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 1634 of file drivepage.c.

1639{
1640 PSETUPDATA pSetupData;
1641 HWND hList;
1642
1643 /* Retrieve pointer to the global setup data */
1644 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1645
1646 switch (uMsg)
1647 {
1648 case WM_INITDIALOG:
1649 {
1650 /* Save pointer to the global setup data */
1651 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1652 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1653
1654 /* Initially hide and disable all partitioning buttons */
1655 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1656 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1663
1664 /* Initialize the partitions list */
1665 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1667 InitPartitionList(pSetupData->hInstance, hList);
1669
1670 // HACK: Wine "kwality" code doesn't still implement
1671 // PSN_QUERYINITIALFOCUS so we "emulate" its call there...
1672 {
1673 PSHNOTIFY pshn = {{hwndDlg, GetWindowLong(hwndDlg, GWL_ID), PSN_QUERYINITIALFOCUS}, (LPARAM)hList};
1674 SendMessageW(hwndDlg, WM_NOTIFY, (WPARAM)pshn.hdr.idFrom, (LPARAM)&pshn);
1675 }
1676 break;
1677 }
1678
1679 case WM_DESTROY:
1680 {
1681 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1685 return TRUE;
1686 }
1687
1688 case WM_COMMAND:
1689 {
1690 switch (LOWORD(wParam))
1691 {
1692 case IDC_PARTMOREOPTS:
1693 {
1694 DialogBoxParamW(pSetupData->hInstance,
1696 hwndDlg,
1698 (LPARAM)pSetupData);
1699 break;
1700 }
1701
1702 case IDC_INITDISK:
1703 {
1704 // TODO: Implement disk partitioning initialization
1705 break;
1706 }
1707
1708 case IDC_PARTCREATE:
1709 {
1710 HTLITEM hItem;
1711 PPARTITEM PartItem;
1712 PPARTENTRY PartEntry;
1713 ULONGLONG PartSize;
1714 ULONGLONG MaxPartSize;
1715 ULONG MaxSizeMB;
1716 INT_PTR ret;
1717 PARTCREATE_CTX PartCreateCtx = {0};
1718
1719 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1720 PartItem = GetSelectedPartition(hList, &hItem);
1721 if (!PartItem)
1722 {
1723 /* If the button was clicked, an empty disk
1724 * region should have been selected first */
1725 ASSERT(FALSE);
1726 break;
1727 }
1728 PartEntry = PartItem->PartEntry;
1729 if (PartEntry->IsPartitioned)
1730 {
1731 /* Don't create a partition when one already exists */
1732 ASSERT(FALSE);
1733 break;
1734 }
1735 ASSERT(!PartEntry->Volume);
1736
1737 /* Get the partition info stored in the TreeList */
1738 PartCreateCtx.PartItem = PartItem;
1739
1740 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1741 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1742 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1743 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1744
1745 /* Don't force formatting by default */
1746 PartCreateCtx.ForceFormat = FALSE;
1747
1748 /* Show the partitioning dialog */
1749 ret = DialogBoxParamW(pSetupData->hInstance,
1751 hwndDlg,
1753 (LPARAM)&PartCreateCtx);
1754 if (ret != IDOK)
1755 break;
1756
1757 /*
1758 * If the input size, given in MB, specifies the maximum partition
1759 * size, it may slightly under- or over-estimate the latter due to
1760 * rounding error. In this case, use all of the unpartitioned space.
1761 * Otherwise, directly convert the size to bytes.
1762 */
1763 PartSize = PartCreateCtx.PartSizeMB;
1764 if (PartSize == MaxSizeMB)
1765 PartSize = MaxPartSize;
1766 else // if (PartSize < MaxSizeMB)
1767 PartSize *= MB;
1768
1769 ASSERT(PartSize <= MaxPartSize);
1770
1771 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1772 &hItem, &PartItem,
1773 PartSize,
1774 !PartCreateCtx.MBRExtPart
1775 ? 0 : PARTITION_EXTENDED))
1776 {
1777 DisplayError(GetParent(hwndDlg),
1780 }
1781
1782 break;
1783 }
1784
1785 case IDC_PARTFORMAT:
1786 {
1787 HTLITEM hItem;
1788 PPARTITEM PartItem;
1789 PPARTENTRY PartEntry;
1790 INT_PTR ret;
1791 PARTCREATE_CTX PartCreateCtx = {0};
1792
1793 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1794 PartItem = GetSelectedPartition(hList, &hItem);
1795 if (!PartItem)
1796 {
1797 /* If the button was clicked, an empty disk
1798 * region should have been selected first */
1799 ASSERT(FALSE);
1800 break;
1801 }
1802 PartEntry = PartItem->PartEntry;
1803 if (!PartEntry->Volume)
1804 {
1805 /* Don't format an unformattable partition */
1806 ASSERT(FALSE);
1807 break;
1808 }
1809
1810 /* Show the formatting dialog */
1811 PartCreateCtx.PartItem = PartItem;
1812 ret = DialogBoxParamW(pSetupData->hInstance,
1814 hwndDlg,
1816 (LPARAM)&PartCreateCtx);
1818 break;
1819 }
1820
1821 case IDC_PARTDELETE:
1822 {
1823 PPARTITEM PartItem;
1824 PPARTENTRY PartEntry;
1825 HTLITEM hItem;
1826 UINT uIDWarnMsg;
1827
1828 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1829 PartItem = GetSelectedPartition(hList, &hItem);
1830 if (!PartItem)
1831 {
1832 // If the button was clicked, a partition
1833 // should have been selected first...
1834 ASSERT(FALSE);
1835 break;
1836 }
1837 PartEntry = PartItem->PartEntry;
1838 if (!PartEntry->IsPartitioned)
1839 {
1840 /* Don't delete an unpartitioned disk region */
1841 ASSERT(FALSE);
1842 break;
1843 }
1844
1845 /* Choose the correct warning message to display:
1846 * MBR-extended (container) vs. standard partition */
1847 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1849 else
1850 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1851
1852 /* If the user really wants to delete the partition... */
1853 if (DisplayMessage(GetParent(hwndDlg),
1856 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1857 {
1858 /* ... make it so! */
1859 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1860 &hItem, PartItem))
1861 {
1862 // TODO: Show error if partition couldn't be deleted?
1863 }
1864 }
1865
1866 break;
1867 }
1868 }
1869 break;
1870 }
1871
1872 case WM_NOTIFY:
1873 {
1874 LPNMHDR lpnm = (LPNMHDR)lParam;
1875
1876 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1877 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1878 {
1880
1881 // if (!(pnmv->uChanged & TVIF_STATE)) /* The state has changed */
1882 if (!(pnmv->itemNew.mask & TVIF_STATE))
1883 break;
1884
1885 /* The item has been (de)selected */
1886 // if (pnmv->uNewState & TVIS_SELECTED)
1887 if (pnmv->itemNew.state & TVIS_SELECTED)
1888 {
1889 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1890 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1891
1892 if (!hParentItem)
1893 {
1894 /* Hard disk */
1895 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1896 ASSERT(DiskEntry);
1897
1898 /* Show the "Initialize" disk button and hide and disable the others */
1899 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1900
1901#if 0 // FIXME: Init disk not implemented yet!
1902 EnableDlgItem(hwndDlg, IDC_INITDISK,
1903 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1904#else
1905 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1906#endif
1907
1910
1913
1916
1917 /* Disable the "Next" button */
1918 goto DisableWizNext;
1919 }
1920 else
1921 {
1922 /* Partition or unpartitioned space */
1923 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1924 PPARTENTRY PartEntry;
1925 ASSERT(PartItem);
1926 PartEntry = PartItem->PartEntry;
1927 ASSERT(PartEntry);
1928
1929 /* Hide and disable the "Initialize" disk button */
1930 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1931 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1932
1933 if (!PartEntry->IsPartitioned)
1934 {
1935 /* Show and enable the "Create" partition button */
1938
1939 /* Hide and disable the "Format" button */
1942 }
1943 else
1944 {
1945 /* Hide and disable the "Create" partition button */
1948
1949 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
1951 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
1952 }
1953
1954 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
1956 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
1957
1958 /*
1959 * Enable the "Next" button if:
1960 *
1961 * 1. the selected disk region is partitioned:
1962 * it can either have a volume attached (and be either
1963 * formatted or ready to be formatted),
1964 * or it's not yet formatted (the installer will prompt
1965 * for formatting parameters).
1966 *
1967 * 2. Or, the selected disk region is not partitioned but
1968 * can be partitioned according to the disk's partitioning
1969 * scheme (the installer will auto-partition the region
1970 * and prompt for formatting parameters).
1971 *
1972 * In all other cases, the "Next" button is disabled.
1973 */
1974
1975 // TODO: In the future: first test needs to be augmented with:
1976 // (... && PartEntry->Volume->IsSimpleVolume)
1977 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
1978 (!PartEntry->IsPartitioned && (PartitionCreationChecks(PartEntry) == NOT_AN_ERROR)))
1979 {
1980 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1983 }
1984 else
1985 {
1986 goto DisableWizNext;
1987 }
1988 }
1989 }
1990 else
1991 {
1992DisableWizNext:
1993 /* Keep the "Next" button disabled. It will be enabled
1994 * only when the user selects a valid partition. */
1996 }
1997
1998 break;
1999 }
2000
2001 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
2002 {
2003 /* Deleting an item from the partition list */
2005 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
2006 break;
2007 }
2008
2009 switch (lpnm->code)
2010 {
2011 case PSN_SETACTIVE:
2012 {
2013 /* Keep the "Next" button disabled. It will be enabled
2014 * only when the user selects a valid partition. */
2016 break;
2017 }
2018
2020 {
2021 /* Give the focus on and select the first item */
2022 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2023 // TreeList_SetFocusItem(hList, 1, 1);
2026 return TRUE;
2027 }
2028
2029 case PSN_QUERYCANCEL:
2030 {
2031 if (DisplayMessage(GetParent(hwndDlg),
2035 {
2036 /* Go to the Terminate page */
2038 }
2039
2040 /* Do not close the wizard too soon */
2042 return TRUE;
2043 }
2044
2045 case PSN_WIZNEXT: /* Set the selected data */
2046 {
2047 HTLITEM hItem;
2048 PPARTITEM PartItem;
2049 PPARTENTRY PartEntry;
2050
2051 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2052 PartItem = GetSelectedPartition(hList, &hItem);
2053 if (!PartItem)
2054 {
2055 /* Fail and don't continue the installation */
2056 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2057 return TRUE;
2058 }
2059 PartEntry = PartItem->PartEntry;
2060 ASSERT(PartEntry);
2061
2062 /*
2063 * Check whether the user wants to install ReactOS on a disk that
2064 * is not recognized by the computer's firmware and if so, display
2065 * a warning since such disks may not be bootable.
2066 */
2067 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
2068 !PartEntry->DiskEntry->BiosFound)
2069 {
2070 INT nRet;
2071
2072 nRet = DisplayMessage(hwndDlg,
2074 L"Warning",
2075 L"The disk you have selected for installing ReactOS\n"
2076 L"is not visible by the firmware of your computer,\n"
2077 L"and so may not be bootable.\n"
2078 L"\nClick on OK to continue anyway."
2079 L"\nClick on CANCEL to go back to the partitions list.");
2080 if (nRet != IDOK)
2081 {
2082 /* Fail and don't continue the installation */
2083 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2084 return TRUE;
2085 }
2086 }
2087
2088 /* If this is an empty region, auto-create the partition if conditions are OK */
2089 if (!PartEntry->IsPartitioned)
2090 {
2091 ULONG Error;
2092
2093 Error = PartitionCreationChecks(PartEntry);
2094 if (Error != NOT_AN_ERROR)
2095 {
2096 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
2098 L"Could not create a partition on the selected disk region");
2099
2100 /* Fail and don't continue the installation */
2101 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2102 return TRUE;
2103 }
2104
2105 /* Automatically create the partition on the whole empty space;
2106 * it will be formatted later with default parameters */
2107 if (!DoCreatePartition(hList, pSetupData->PartitionList,
2108 &hItem, &PartItem,
2109 0ULL,
2110 0))
2111 {
2112 DisplayError(GetParent(hwndDlg),
2115
2116 /* Fail and don't continue the installation */
2117 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2118 return TRUE;
2119 }
2120 /* Update PartEntry */
2121 PartEntry = PartItem->PartEntry;
2122 }
2123
2124 ASSERT(PartEntry->IsPartitioned);
2125 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2127 ASSERT(PartEntry->Volume);
2128
2129#if 0 // TODO: Implement!
2130 if (!IsPartitionLargeEnough(PartEntry))
2131 {
2134
2135 /* Fail and don't continue the installation */
2136 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2137 return TRUE;
2138 }
2139#endif
2140
2141 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
2142 if (PartEntry->Volume &&
2143 ((PartEntry->Volume->FormatState == Formatted) ||
2144 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
2145 {
2146 /*NOTHING*/;
2147 }
2148 else /* Request formatting of the selected region if it's not already formatted */
2149 {
2150 INT_PTR ret;
2151 PARTCREATE_CTX PartCreateCtx = {0};
2152
2153 /* Show the formatting dialog */
2154 PartCreateCtx.PartItem = PartItem;
2155 ret = DialogBoxParamW(pSetupData->hInstance,
2157 hwndDlg,
2159 (LPARAM)&PartCreateCtx);
2160
2161 /* If the user refuses to format the partition,
2162 * fail and don't continue the installation */
2163 if (ret != IDOK)
2164 {
2165 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2166 return TRUE;
2167 }
2168
2169 /* The partition will be formatted */
2170 }
2171
2172 InstallPartition = PartEntry;
2173 break;
2174 }
2175
2176 default:
2177 break;
2178 }
2179 break;
2180 }
2181
2182 default:
2183 break;
2184 }
2185
2186 return FALSE;
2187}
UI_CONTEXT UiContext
Definition: reactos.c:55
PPARTENTRY InstallPartition
Definition: reactos.c:45
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:211
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:51
struct _SETUPDATA * PSETUPDATA
#define IDD_RESTARTPAGE
Definition: resource.h:62
#define IDS_WARN_DELETE_PARTITION
Definition: resource.h:161
#define IDC_INITDISK
Definition: resource.h:39
#define IDC_PARTMOREOPTS
Definition: resource.h:44
#define IDS_ERROR_CREATE_PARTITION_TITLE
Definition: resource.h:157
#define IDC_PARTDELETE
Definition: resource.h:42
#define IDS_WARN_DELETE_PARTITION_TITLE
Definition: resource.h:160
#define IDS_ERROR_CREATE_PARTITION
Definition: resource.h:158
#define IDC_PARTITION
Definition: resource.h:38
#define IDD_FORMAT
Definition: resource.h:79
#define IDD_ADVINSTOPTS
Definition: resource.h:66
#define IDC_PARTFORMAT
Definition: resource.h:41
#define IDC_PARTCREATE
Definition: resource.h:40
#define IDS_ABORTSETUP2
Definition: resource.h:97
#define IDS_ABORTSETUP
Definition: resource.h:96
#define IDD_PARTITION
Definition: resource.h:70
#define IDS_WARN_DELETE_MBR_EXTENDED_PARTITION
Definition: resource.h:162
BOOL Error
Definition: chkdsk.c:66
#define PARTITION_EXTENDED
Definition: disk.h:92
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static VOID InitPartitionList(_In_ HINSTANCE hInstance, _In_ HWND hWndList)
Definition: drivepage.c:1344
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:1531
static INT_PTR CALLBACK PartitionDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:627
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:1431
static PPARTITEM GetSelectedPartition(_In_ HWND hTreeList, _Out_opt_ HTLITEM *phItem)
Definition: drivepage.c:833
static INT_PTR CALLBACK FormatDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:574
static VOID DrawPartitionList(_In_ HWND hWndList, _In_ PPARTLIST List)
Definition: drivepage.c:1381
static INT_PTR CALLBACK MoreOptDlgProc(_In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:231
static VOID CleanupPartitionList(_In_ HWND hWndList)
Definition: drivepage.c:1408
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1172
@ NOT_AN_ERROR
Definition: errorcode.h:17
@ ERROR_INSUFFICIENT_PARTITION_SIZE
Definition: errorcode.h:57
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
@ Formatted
Definition: partlist.h:37
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:254
struct _DISKENTRY * PDISKENTRY
HWND hList
Definition: livecd.c:10
VOID DisplayError(DWORD dwError)
Definition: logoff.c:33
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
#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:318
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:321
@ FixedMedia
Definition: ntdddisk.h:383
#define LOWORD(l)
Definition: pedump.c:82
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PSWIZB_NEXT
Definition: prsht.h:154
#define PSWIZB_BACK
Definition: prsht.h:153
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define PSN_SETACTIVE
Definition: prsht.h:115
#define TVN_DELETEITEM
Definition: commctrl.h:3747
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define LPNMTREEVIEW
Definition: commctrl.h:3648
#define TVIS_SELECTED
Definition: commctrl.h:3285
#define TVIF_STATE
Definition: commctrl.h:3274
#define WM_NOTIFY
Definition: richedit.h:61
ERROR_NUMBER PartitionCreationChecks(_In_ PPARTENTRY PartEntry)
Definition: partlist.c:2822
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:95
#define MB
Definition: setuplib.h:67
PARTITION_STYLE DiskStyle
Definition: partlist.h:139
Dialog context structure used by PartitionDlgProc() and FormatDlgProc(Worker)().
Definition: drivepage.c:385
BOOLEAN MBRExtPart
Definition: drivepage.c:389
PPARTITEM PartItem
Definition: drivepage.c:386
BOOLEAN ForceFormat
Definition: drivepage.c:390
ULONG PartSizeMB
Definition: drivepage.c:388
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:374
PPARTENTRY PartEntry
Definition: drivepage.c:375
PVOL_CREATE_INFO VolCreate
Definition: drivepage.c:377
NMHDR hdr
Definition: prsht.h:330
HINSTANCE hInstance
Definition: reactos.h:133
PPARTLIST PartitionList
Definition: reactos.h:148
HWND hPartList
Definition: reactos.h:82
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:148
FORMATSTATE FormatState
Definition: partlist.h:48
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:185
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
#define TLITEMW
Definition: treelist.h:478
HTREEITEM hItem
Definition: treelist.h:37
#define HTLITEM
Definition: treelist.h:466
#define TreeList_GetParent(h, i)
Definition: treelist.h:442
#define TreeList_SelectItem(h, i)
Definition: treelist.h:436
int32_t INT_PTR
Definition: typedefs.h:64
uint64_t ULONGLONG
Definition: typedefs.h:67
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
static USETUP_DATA USetupData
Definition: usetup.c:45
static BOOLEAN IsPartitionLargeEnough(_In_ PPARTENTRY PartEntry)
Definition: usetup.c:1504
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:123
int ret
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_HIDE
Definition: winuser.h:771
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define GWL_ID
Definition: winuser.h:862
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MB_YESNO
Definition: winuser.h:820
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
#define MB_OKCANCEL
Definition: winuser.h:807
struct tagNMHDR * LPNMHDR
#define GetWindowLong
Definition: winuser.h:5808
#define MB_ICONWARNING
Definition: winuser.h:789
HWND WINAPI GetParent(_In_ HWND)
#define MB_ICONQUESTION
Definition: winuser.h:792
#define DWLP_MSGRESULT
Definition: winuser.h:873
#define MB_DEFBUTTON2
Definition: winuser.h:802
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define IDYES
Definition: winuser.h:838
#define SetWindowLongPtrW
Definition: winuser.h:5358
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by _tWinMain().

◆ FindVolCreateInTreeByVolume()

PVOL_CREATE_INFO FindVolCreateInTreeByVolume ( _In_ HWND  hTreeList,
_In_ PVOLENTRY  Volume 
)

Definition at line 852 of file drivepage.c.

855{
857
858 /* Enumerate every cached data in the TreeList, and for each, check
859 * whether its corresponding PPARTENTRY is the one we are looking for */
860 // for (hItem = TVI_ROOT; hItem; hItem = TreeList_GetNextItem(...)) { }
861 hItem = TVI_ROOT;
862 while ((hItem = TreeList_GetNextItem(hTreeList, hItem, TVGN_NEXTITEM)))
863 {
864 PPARTITEM PartItem = GetItemPartition(hTreeList, hItem);
865 if (!PartItem || !PartItem->VolCreate /* || !PartItem->Volume */)
866 continue;
867
868 if (PartItem->Volume == Volume)
869 {
870 /* Found it, return the associated volume-create structure */
871 return PartItem->VolCreate;
872 }
873 }
874
875 /* Nothing was found */
876 return NULL;
877}
static PPARTITEM GetItemPartition(_In_ HWND hTreeList, _In_ HTLITEM hItem)
Definition: drivepage.c:815
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define TVI_ROOT
Definition: commctrl.h:3373
PVOLENTRY Volume
Definition: drivepage.c:376
#define TreeList_GetNextItem(h, i, c)
Definition: treelist.h:440
#define TVGN_NEXTITEM
Definition: treelist.h:166

Referenced by FsVolCallback().

◆ SetWindowResPrintfVW()

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

Definition at line 261 of file reactos.c.

266{
267 WCHAR ResBuffer[256];
268 WCHAR szText[256];
269
270 LoadStringW(hInstance, uID, ResBuffer, _countof(ResBuffer));
271 StringCchVPrintfW(szText, _countof(szText), ResBuffer, args);
272 SetWindowTextW(hWnd, szText);
273}
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 277 of file reactos.c.

282{
284
285 va_start(args, uID);
287 va_end(args);
288}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:261

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

◆ SetWindowResTextW()

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

Definition at line 250 of file reactos.c.

254{
255 WCHAR szText[256];
256 LoadStringW(hInstance, uID, szText, _countof(szText));
257 SetWindowTextW(hWnd, szText);
258}

Referenced by PrepareAndDoCopyThread(), and SummaryDlgProc().

Variable Documentation

◆ InstallPartition

PPARTENTRY InstallPartition
extern

◆ IsUnattendedSetup

BOOLEAN IsUnattendedSetup
extern

Definition at line 41 of file reactos.c.

◆ ProcessHeap

HANDLE ProcessHeap
extern
  • Internal Headers *‍/

Definition at line 15 of file servman.c.

◆ SetupData

◆ SystemPartition

◆ UiContext