ReactOS 0.4.16-dev-983-g23ad936
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 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
 
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 60 of file reactos.h.

◆ ID_WIZBACK

#define ID_WIZBACK   0x3023

Definition at line 61 of file reactos.h.

◆ ID_WIZFINISH

#define ID_WIZFINISH   0x3025

Definition at line 63 of file reactos.h.

◆ ID_WIZNEXT

#define ID_WIZNEXT   0x3024

Definition at line 62 of file reactos.h.

◆ IDC_TAB_CONTROL

#define IDC_TAB_CONTROL   0x3020

Definition at line 59 of file reactos.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 71 of file reactos.h.

◆ SetDlgItemFont

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

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

2510{
2511 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
2512 PLIST_ENTRY ListEntry;
2514 PCWSTR pwszNtPathToMap = pwszNTPath;
2515 PCWSTR pwszRemaining = NULL;
2516 DWORD cchDrives;
2517 PWCHAR pwszDrive;
2518 WCHAR wszDrives[512];
2519 WCHAR wszNTPath[MAX_PATH];
2520 WCHAR TargetPath[MAX_PATH];
2521
2522 *pwszPath = UNICODE_NULL;
2523
2524 /*
2525 * We find first a mapping inside the MappingList. If one is found, use it
2526 * to build the Win32 path. If there is none, we need to create one by
2527 * checking the Win32 drives (and possibly NT symlinks too).
2528 * In case of success, add the newly found mapping to the list and use it
2529 * to build the Win32 path.
2530 */
2531
2532 for (ListEntry = MappingList->List.Flink;
2533 ListEntry != &MappingList->List;
2534 ListEntry = ListEntry->Flink)
2535 {
2536 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
2537
2538 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
2539
2540 /* Check whether the queried NT path prefixes the user-provided NT path */
2541 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
2542 if (FoundDrive)
2543 {
2544 /* Found it! */
2545
2546 /* Set the pointers and go build the Win32 path */
2547 pwszDrive = Entry->Win32Path;
2548 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
2549 goto Quit;
2550 }
2551 }
2552
2553 /*
2554 * No mapping exists for this path yet: try to find one now.
2555 */
2556
2557 /* Retrieve the mounted drives (available drive letters) */
2558 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2559 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2560 {
2561 /* Buffer too small or failure */
2562 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
2563 return FALSE;
2564 }
2565
2566/* We go back there once if RetryOnce == TRUE */
2567Retry:
2568
2569 /* Enumerate the mounted drives */
2570 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2571 {
2572 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2573 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2574 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2575 pwszDrive[2] = L'\\'; // Restore the backslash
2576
2577 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
2578
2579 /* Check whether the queried NT path prefixes the user-provided NT path */
2580 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2581 if (!FoundDrive)
2582 {
2583 PWCHAR ptr, ptr2;
2584
2585 /*
2586 * Check whether this was a network share that has a drive letter,
2587 * but the user-provided NT path points to this share without
2588 * mentioning the drive letter.
2589 *
2590 * The format is: \Device<network_redirector>\;X:<data>\share\path
2591 * The corresponding drive letter is 'X'.
2592 * A system-provided network redirector (LanManRedirector or Mup)
2593 * or a 3rd-party one may be used.
2594 *
2595 * We check whether the user-provided NT path has the form:
2596 * \Device<network_redirector><data>\share\path
2597 * as it obviously did not have the full form (the previous check
2598 * would have been OK otherwise).
2599 */
2600 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
2601 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
2602 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
2603 {
2604 /*
2605 * Normally the specified drive letter should correspond
2606 * to the one used for the mapping. But we will ignore
2607 * if it happens not to be the case.
2608 */
2609 if (pwszDrive[0] != ptr[1])
2610 {
2611 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
2612 pwszDrive[0], ptr[1]);
2613 }
2614
2615 /* Remove the drive letter from the NT network share path */
2616 ptr2 = ptr + 3;
2617 /* Swallow as many possible consecutive backslashes as there could be */
2618 while (*ptr2 == L'\\') ++ptr2;
2619
2620 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
2621
2622 /* Now do the check again */
2623 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2624 }
2625 }
2626 if (FoundDrive)
2627 {
2628 /* Found it! */
2629
2630 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
2631
2632 if (pwszNtPathToMap == pwszNTPath)
2633 {
2634 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
2635 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
2636 }
2637 break;
2638 }
2639 }
2640
2641 if (FoundDrive)
2642 {
2643 /* A mapping was found, add it to the cache */
2645 if (!Entry)
2646 {
2647 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
2648 return FALSE;
2649 }
2650 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
2651 pwszNTPath, pwszRemaining - pwszNTPath);
2652 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
2653
2654 /* Insert it as the most recent entry */
2655 InsertHeadList(&MappingList->List, &Entry->ListEntry);
2656 MappingList->MappingsCount++;
2657
2658 /* Set the pointers and go build the Win32 path */
2659 pwszDrive = Entry->Win32Path;
2660 goto Quit;
2661 }
2662
2663 /*
2664 * We failed, perhaps because the beginning of the NT path used a symlink.
2665 * Try to see whether this is the case by attempting to resolve it.
2666 * If the symlink resolution gives nothing, or we already failed once,
2667 * there is no hope in converting the path to Win32.
2668 * Otherwise, symlink resolution succeeds but we need to recheck again
2669 * the drives list.
2670 */
2671
2672 /*
2673 * In theory we would have to parse each element in the NT path and going
2674 * until finding a symlink object (otherwise we would fail straight away).
2675 * However here we can use guessing instead, since we know which kind of
2676 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
2677 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
2678 * are supported in setuplib\utils\arcname.c .
2679 *
2680 * But actually, all the supported names in arcname.c are real devices,
2681 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
2682 * just check for it.
2683 */
2684 if (!RetryOnce && !FoundDrive)
2685 {
2686 ULONG DiskNumber, PartitionNumber;
2687 INT Length;
2688
2691 HANDLE LinkHandle;
2692 UNICODE_STRING SymLink, Target;
2693
2694 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
2695 &DiskNumber, &PartitionNumber, &Length) != 2)
2696 {
2697 /* Definitively not a recognized path, bail out */
2698 return FALSE;
2699 }
2700
2701 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
2702 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
2703 SymLink.Length = SymLink.MaximumLength;
2704
2706 &SymLink,
2708 NULL,
2709 NULL);
2710 Status = NtOpenSymbolicLinkObject(&LinkHandle,
2713 if (!NT_SUCCESS(Status))
2714 {
2715 /* Not a symlink, or something else happened: bail out */
2716 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2717 &SymLink, Status);
2718 return FALSE;
2719 }
2720
2721 *TargetPath = UNICODE_NULL;
2722 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
2723
2724 /* Resolve the link and close its handle */
2726 NtClose(LinkHandle);
2727
2728 /* Check for success */
2729 if (!NT_SUCCESS(Status))
2730 {
2731 /* Not a symlink, or something else happened: bail out */
2732 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2733 &SymLink, Status);
2734 return FALSE;
2735 }
2736
2737 /* Set the pointers */
2738 pwszRemaining = pwszNTPath + Length;
2739 pwszNtPathToMap = TargetPath; // Point to our local buffer
2740
2741 /* Retry once */
2742 RetryOnce = TRUE;
2743 goto Retry;
2744 }
2745
2746 ASSERT(!FoundDrive);
2747
2748Quit:
2749 if (FoundDrive)
2750 {
2751 StringCchPrintfW(pwszPath, cchPathMax,
2752 L"%s%s",
2753 pwszDrive,
2754 pwszRemaining);
2755 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
2756 return TRUE;
2757 }
2758
2759 return FALSE;
2760}
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 519 of file reactos.c.

526{
527 UINT i;
528 LVCOLUMN lvC;
529 WCHAR szText[50];
530
531 /* Create the columns */
532 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
533 lvC.pszText = szText;
534
535 /* Load the column labels from the resource file */
536 for (i = 0; i < nNumOfColumns; i++)
537 {
538 lvC.iSubItem = i;
539 lvC.cx = pColsWidth[i];
540 lvC.fmt = pColsAlign[i];
541
542 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
543
544 if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
545 return FALSE;
546 }
547
548 return TRUE;
549}
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 251 of file reactos.c.

256{
257 INT iRes;
259
260 va_start(args, uIDMessage);
262 MAKEINTRESOURCEW(uIDTitle),
263 MAKEINTRESOURCEW(uIDMessage),
264 args);
265 va_end(args);
266
267 return iRes;
268}
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:130
#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 130 of file reactos.c.

136{
137 INT iRes;
139 MSGBOXPARAMSW mb = {0};
141 size_t MsgLen;
142 WCHAR StaticBuffer[256];
143 LPWSTR Buffer = StaticBuffer; // Use the static buffer by default.
144
145 /* We need to retrieve the current module's instance handle if either
146 * the title or the format message is specified by a resource ID */
147 if ((pszTitle && IS_INTRESOURCE(pszTitle)) || IS_INTRESOURCE(pszFormatMessage))
148 hInstance = GetModuleHandleW(NULL); // SetupData.hInstance;
149
150 /* Retrieve the format message string if this is a resource */
151 if (pszFormatMessage && IS_INTRESOURCE(pszFormatMessage)) do
152 {
153 // LoadAllocStringW()
154 PCWSTR pStr;
155
156 /* Try to load the string from the resource */
157 MsgLen = LoadStringW(hInstance, PtrToUlong(pszFormatMessage), (LPWSTR)&pStr, 0);
158 if (MsgLen == 0)
159 {
160 /* No resource string was found, return NULL */
161 Format = NULL;
162 break;
163 }
164
165 /* Allocate a new buffer, adding a NULL-terminator */
166 Format = HeapAlloc(GetProcessHeap(), 0, (MsgLen + 1) * sizeof(WCHAR));
167 if (!Format)
168 {
169 MsgLen = 0;
170 break;
171 }
172
173 /* Copy the string, NULL-terminated */
174 StringCchCopyNW(Format, MsgLen + 1, pStr, MsgLen);
175 } while (0);
176 else
177 {
178 Format = (LPWSTR)pszFormatMessage;
179 }
180
181 if (Format)
182 {
183 /*
184 * Retrieve the message length. If it is too long, allocate
185 * an auxiliary buffer; otherwise use the static buffer.
186 * The string is built to be NULL-terminated.
187 */
188 MsgLen = _vscwprintf(Format, args);
189 if (MsgLen >= _countof(StaticBuffer))
190 {
191 Buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (MsgLen + 1) * sizeof(WCHAR));
192 if (!Buffer)
193 {
194 /* Allocation failed, use the original format string verbatim */
195 Buffer = Format;
196 }
197 }
198 if (Buffer != Format)
199 {
200 /* Do the printf as we use the caller's format string */
201 StringCchVPrintfW(Buffer, MsgLen + 1, Format, args);
202 }
203 }
204 else
205 {
206 Format = (LPWSTR)pszFormatMessage;
207 Buffer = Format;
208 }
209
210 /* Display the message */
211 mb.cbSize = sizeof(mb);
212 mb.hwndOwner = hWnd;
213 mb.hInstance = hInstance;
214 mb.lpszText = Buffer;
215 mb.lpszCaption = pszTitle;
216 mb.dwStyle = uType;
218 iRes = MessageBoxIndirectW(&mb);
219
220 /* Free the buffers if needed */
221 if ((Buffer != StaticBuffer) && (Buffer != Format))
223
224 if (Format && (Format != pszFormatMessage))
226
227 return iRes;
228}
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:3356
LPCWSTR lpszCaption
Definition: winuser.h:3351
HWND hwndOwner
Definition: winuser.h:3348
LPCWSTR lpszText
Definition: winuser.h:3350
HINSTANCE hInstance
Definition: winuser.h:3349
DWORD dwStyle
Definition: winuser.h:3352
#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 1612 of file drivepage.c.

1617{
1618 PSETUPDATA pSetupData;
1619 HWND hList;
1620
1621 /* Retrieve pointer to the global setup data */
1622 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1623
1624 switch (uMsg)
1625 {
1626 case WM_INITDIALOG:
1627 {
1628 /* Save pointer to the global setup data */
1629 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1630 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pSetupData);
1631
1632 /* Initially hide and disable all partitioning buttons */
1633 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1634 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1641
1642 /* Initialize the partitions list */
1643 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1645 InitPartitionList(pSetupData->hInstance, hList);
1647
1648 // HACK: Wine "kwality" code doesn't still implement
1649 // PSN_QUERYINITIALFOCUS so we "emulate" its call there...
1650 {
1651 PSHNOTIFY pshn = {{hwndDlg, GetWindowLong(hwndDlg, GWL_ID), PSN_QUERYINITIALFOCUS}, (LPARAM)hList};
1652 SendMessageW(hwndDlg, WM_NOTIFY, (WPARAM)pshn.hdr.idFrom, (LPARAM)&pshn);
1653 }
1654 break;
1655 }
1656
1657 case WM_DESTROY:
1658 {
1659 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1663 return TRUE;
1664 }
1665
1666 case WM_COMMAND:
1667 {
1668 switch (LOWORD(wParam))
1669 {
1670 case IDC_PARTMOREOPTS:
1671 {
1672 DialogBoxParamW(pSetupData->hInstance,
1674 hwndDlg,
1676 (LPARAM)pSetupData);
1677 break;
1678 }
1679
1680 case IDC_INITDISK:
1681 {
1682 // TODO: Implement disk partitioning initialization
1683 break;
1684 }
1685
1686 case IDC_PARTCREATE:
1687 {
1688 HTLITEM hItem;
1689 PPARTITEM PartItem;
1690 PPARTENTRY PartEntry;
1691 ULONGLONG PartSize;
1692 ULONGLONG MaxPartSize;
1693 ULONG MaxSizeMB;
1694 INT_PTR ret;
1695 PARTCREATE_CTX PartCreateCtx = {0};
1696
1697 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1698 PartItem = GetSelectedPartition(hList, &hItem);
1699 if (!PartItem)
1700 {
1701 /* If the button was clicked, an empty disk
1702 * region should have been selected first */
1703 ASSERT(FALSE);
1704 break;
1705 }
1706 PartEntry = PartItem->PartEntry;
1707 if (PartEntry->IsPartitioned)
1708 {
1709 /* Don't create a partition when one already exists */
1710 ASSERT(FALSE);
1711 break;
1712 }
1713 ASSERT(!PartEntry->Volume);
1714
1715 /* Get the partition info stored in the TreeList */
1716 PartCreateCtx.PartItem = PartItem;
1717
1718 /* Retrieve the maximum size in MB (rounded up) the partition can have */
1719 MaxPartSize = GetPartEntrySizeInBytes(PartEntry);
1720 MaxSizeMB = (ULONG)RoundingDivide(MaxPartSize, MB);
1721 PartCreateCtx.MaxSizeMB = MaxSizeMB;
1722
1723 /* Don't force formatting by default */
1724 PartCreateCtx.ForceFormat = FALSE;
1725
1726 /* Show the partitioning dialog */
1727 ret = DialogBoxParamW(pSetupData->hInstance,
1729 hwndDlg,
1731 (LPARAM)&PartCreateCtx);
1732 if (ret != IDOK)
1733 break;
1734
1735 /*
1736 * If the input size, given in MB, specifies the maximum partition
1737 * size, it may slightly under- or over-estimate the latter due to
1738 * rounding error. In this case, use all of the unpartitioned space.
1739 * Otherwise, directly convert the size to bytes.
1740 */
1741 PartSize = PartCreateCtx.PartSizeMB;
1742 if (PartSize == MaxSizeMB)
1743 PartSize = MaxPartSize;
1744 else // if (PartSize < MaxSizeMB)
1745 PartSize *= MB;
1746
1747 ASSERT(PartSize <= MaxPartSize);
1748
1749 if (!DoCreatePartition(hList, pSetupData->PartitionList,
1750 &hItem, &PartItem,
1751 PartSize,
1752 !PartCreateCtx.MBRExtPart
1753 ? 0 : PARTITION_EXTENDED))
1754 {
1755 DisplayError(GetParent(hwndDlg),
1758 }
1759
1760 break;
1761 }
1762
1763 case IDC_PARTFORMAT:
1764 {
1765 HTLITEM hItem;
1766 PPARTITEM PartItem;
1767 PPARTENTRY PartEntry;
1768 INT_PTR ret;
1769 PARTCREATE_CTX PartCreateCtx = {0};
1770
1771 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1772 PartItem = GetSelectedPartition(hList, &hItem);
1773 if (!PartItem)
1774 {
1775 /* If the button was clicked, an empty disk
1776 * region should have been selected first */
1777 ASSERT(FALSE);
1778 break;
1779 }
1780 PartEntry = PartItem->PartEntry;
1781 if (!PartEntry->Volume)
1782 {
1783 /* Don't format an unformattable partition */
1784 ASSERT(FALSE);
1785 break;
1786 }
1787
1788 /* Show the formatting dialog */
1789 PartCreateCtx.PartItem = PartItem;
1790 ret = DialogBoxParamW(pSetupData->hInstance,
1792 hwndDlg,
1794 (LPARAM)&PartCreateCtx);
1796 break;
1797 }
1798
1799 case IDC_PARTDELETE:
1800 {
1801 PPARTITEM PartItem;
1802 PPARTENTRY PartEntry;
1803 HTLITEM hItem;
1804 UINT uIDWarnMsg;
1805
1806 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
1807 PartItem = GetSelectedPartition(hList, &hItem);
1808 if (!PartItem)
1809 {
1810 // If the button was clicked, a partition
1811 // should have been selected first...
1812 ASSERT(FALSE);
1813 break;
1814 }
1815 PartEntry = PartItem->PartEntry;
1816 if (!PartEntry->IsPartitioned)
1817 {
1818 /* Don't delete an unpartitioned disk region */
1819 ASSERT(FALSE);
1820 break;
1821 }
1822
1823 /* Choose the correct warning message to display:
1824 * MBR-extended (container) vs. standard partition */
1825 if (PartEntry == PartEntry->DiskEntry->ExtendedPartition)
1827 else
1828 uIDWarnMsg = IDS_WARN_DELETE_PARTITION;
1829
1830 /* If the user really wants to delete the partition... */
1831 if (DisplayMessage(GetParent(hwndDlg),
1834 MAKEINTRESOURCEW(uIDWarnMsg)) == IDYES)
1835 {
1836 /* ... make it so! */
1837 if (!DoDeletePartition(hList, pSetupData->PartitionList,
1838 &hItem, PartItem))
1839 {
1840 // TODO: Show error if partition couldn't be deleted?
1841 }
1842 }
1843
1844 break;
1845 }
1846 }
1847 break;
1848 }
1849
1850 case WM_NOTIFY:
1851 {
1852 LPNMHDR lpnm = (LPNMHDR)lParam;
1853
1854 // On Vista+ we can use TVN_ITEMCHANGED instead, with NMTVITEMCHANGE* pointer
1855 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_SELCHANGED)
1856 {
1858
1859 // if (!(pnmv->uChanged & TVIF_STATE)) /* The state has changed */
1860 if (!(pnmv->itemNew.mask & TVIF_STATE))
1861 break;
1862
1863 /* The item has been (de)selected */
1864 // if (pnmv->uNewState & TVIS_SELECTED)
1865 if (pnmv->itemNew.state & TVIS_SELECTED)
1866 {
1867 HTLITEM hParentItem = TreeList_GetParent(lpnm->hwndFrom, pnmv->itemNew.hItem);
1868 /* May or may not be a PPARTENTRY: this is a PPARTENTRY only when hParentItem != NULL */
1869
1870 if (!hParentItem)
1871 {
1872 /* Hard disk */
1873 PDISKENTRY DiskEntry = (PDISKENTRY)pnmv->itemNew.lParam;
1874 ASSERT(DiskEntry);
1875
1876 /* Show the "Initialize" disk button and hide and disable the others */
1877 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_SHOW);
1878
1879#if 0 // FIXME: Init disk not implemented yet!
1880 EnableDlgItem(hwndDlg, IDC_INITDISK,
1881 DiskEntry->DiskStyle == PARTITION_STYLE_RAW);
1882#else
1883 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1884#endif
1885
1888
1891
1894
1895 /* Disable the "Next" button */
1896 goto DisableWizNext;
1897 }
1898 else
1899 {
1900 /* Partition or unpartitioned space */
1901 PPARTITEM PartItem = (PPARTITEM)pnmv->itemNew.lParam;
1902 PPARTENTRY PartEntry;
1903 ASSERT(PartItem);
1904 PartEntry = PartItem->PartEntry;
1905 ASSERT(PartEntry);
1906
1907 /* Hide and disable the "Initialize" disk button */
1908 ShowDlgItem(hwndDlg, IDC_INITDISK, SW_HIDE);
1909 EnableDlgItem(hwndDlg, IDC_INITDISK, FALSE);
1910
1911 if (!PartEntry->IsPartitioned)
1912 {
1913 /* Show and enable the "Create" partition button */
1916
1917 /* Hide and disable the "Format" button */
1920 }
1921 else
1922 {
1923 /* Hide and disable the "Create" partition button */
1926
1927 /* Show the "Format" button, but enable or disable it if a formattable volume is present */
1929 EnableDlgItem(hwndDlg, IDC_PARTFORMAT, !!PartEntry->Volume);
1930 }
1931
1932 /* Show the "Delete" partition button, but enable or disable it if the disk region is partitioned */
1934 EnableDlgItem(hwndDlg, IDC_PARTDELETE, PartEntry->IsPartitioned);
1935
1936 /*
1937 * Enable the "Next" button if:
1938 *
1939 * 1. the selected disk region is partitioned:
1940 * it can either have a volume attached (and be either
1941 * formatted or ready to be formatted),
1942 * or it's not yet formatted (the installer will prompt
1943 * for formatting parameters).
1944 *
1945 * 2. Or, the selected disk region is not partitioned but
1946 * can be partitioned according to the disk's partitioning
1947 * scheme (the installer will auto-partition the region
1948 * and prompt for formatting parameters).
1949 *
1950 * In all other cases, the "Next" button is disabled.
1951 */
1952
1953 // TODO: In the future: first test needs to be augmented with:
1954 // (... && PartEntry->Volume->IsSimpleVolume)
1955 if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
1956 (!PartEntry->IsPartitioned && (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR)))
1957 {
1958 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
1961 }
1962 else
1963 {
1964 goto DisableWizNext;
1965 }
1966 }
1967 }
1968 else
1969 {
1970DisableWizNext:
1971 /* Keep the "Next" button disabled. It will be enabled
1972 * only when the user selects a valid partition. */
1974 }
1975
1976 break;
1977 }
1978
1979 if (lpnm->idFrom == IDC_PARTITION && lpnm->code == TVN_DELETEITEM)
1980 {
1981 /* Deleting an item from the partition list */
1983 DeleteTreeItem(lpnm->hwndFrom, (TLITEMW*)&pnmv->itemOld);
1984 break;
1985 }
1986
1987 switch (lpnm->code)
1988 {
1989 case PSN_SETACTIVE:
1990 {
1991 /* Keep the "Next" button disabled. It will be enabled
1992 * only when the user selects a valid partition. */
1994 break;
1995 }
1996
1998 {
1999 /* Give the focus on and select the first item */
2000 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2001 // TreeList_SetFocusItem(hList, 1, 1);
2004 return TRUE;
2005 }
2006
2007 case PSN_QUERYCANCEL:
2008 {
2009 if (DisplayMessage(GetParent(hwndDlg),
2013 {
2014 /* Go to the Terminate page */
2016 }
2017
2018 /* Do not close the wizard too soon */
2020 return TRUE;
2021 }
2022
2023 case PSN_WIZNEXT: /* Set the selected data */
2024 {
2025 HTLITEM hItem;
2026 PPARTITEM PartItem;
2027 PPARTENTRY PartEntry;
2028
2029 hList = GetDlgItem(hwndDlg, IDC_PARTITION);
2030 PartItem = GetSelectedPartition(hList, &hItem);
2031 if (!PartItem)
2032 {
2033 /* Fail and don't continue the installation */
2034 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2035 return TRUE;
2036 }
2037 PartEntry = PartItem->PartEntry;
2038 ASSERT(PartEntry);
2039
2040 /*
2041 * Check whether the user wants to install ReactOS on a disk that
2042 * is not recognized by the computer's firmware and if so, display
2043 * a warning since such disks may not be bootable.
2044 */
2045 if (PartEntry->DiskEntry->MediaType == FixedMedia &&
2046 !PartEntry->DiskEntry->BiosFound)
2047 {
2048 INT nRet;
2049
2050 nRet = DisplayMessage(hwndDlg,
2052 L"Warning",
2053 L"The disk you have selected for installing ReactOS\n"
2054 L"is not visible by the firmware of your computer,\n"
2055 L"and so may not be bootable.\n"
2056 L"\nClick on OK to continue anyway."
2057 L"\nClick on CANCEL to go back to the partitions list.");
2058 if (nRet != IDOK)
2059 {
2060 /* Fail and don't continue the installation */
2061 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2062 return TRUE;
2063 }
2064 }
2065
2066 /* If this is an empty region, auto-create the partition if conditions are OK */
2067 if (!PartEntry->IsPartitioned)
2068 {
2069 ULONG Error;
2070
2071 Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
2072 if (Error != NOT_AN_ERROR)
2073 {
2074 // MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
2076 L"Could not create a partition on the selected disk region");
2077
2078 /* Fail and don't continue the installation */
2079 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2080 return TRUE;
2081 }
2082
2083 /* Automatically create the partition on the whole empty space;
2084 * it will be formatted later with default parameters */
2085 if (!DoCreatePartition(hList, pSetupData->PartitionList,
2086 &hItem, &PartItem,
2087 0ULL,
2088 0))
2089 {
2090 DisplayError(GetParent(hwndDlg),
2093
2094 /* Fail and don't continue the installation */
2095 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2096 return TRUE;
2097 }
2098 /* Update PartEntry */
2099 PartEntry = PartItem->PartEntry;
2100 }
2101
2102 ASSERT(PartEntry->IsPartitioned);
2103 // ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
2105 ASSERT(PartEntry->Volume);
2106
2107#if 0 // TODO: Implement!
2108 if (!IsPartitionLargeEnough(PartEntry))
2109 {
2112
2113 /* Fail and don't continue the installation */
2114 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2115 return TRUE;
2116 }
2117#endif
2118
2119 /* Force formatting only if the partition doesn't have a volume (may or may not be formatted) */
2120 if (PartEntry->Volume &&
2121 ((PartEntry->Volume->FormatState == Formatted) ||
2122 (PartItem->VolCreate && *PartItem->VolCreate->FileSystemName)))
2123 {
2124 /*NOTHING*/;
2125 }
2126 else /* Request formatting of the selected region if it's not already formatted */
2127 {
2128 INT_PTR ret;
2129 PARTCREATE_CTX PartCreateCtx = {0};
2130
2131 /* Show the formatting dialog */
2132 PartCreateCtx.PartItem = PartItem;
2133 ret = DialogBoxParamW(pSetupData->hInstance,
2135 hwndDlg,
2137 (LPARAM)&PartCreateCtx);
2138
2139 /* If the user refuses to format the partition,
2140 * fail and don't continue the installation */
2141 if (ret != IDOK)
2142 {
2143 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2144 return TRUE;
2145 }
2146
2147 /* The partition will be formatted */
2148 }
2149
2150 InstallPartition = PartEntry;
2151 break;
2152 }
2153
2154 default:
2155 break;
2156 }
2157 break;
2158 }
2159
2160 default:
2161 break;
2162 }
2163
2164 return FALSE;
2165}
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:232
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:51
struct _SETUPDATA * PSETUPDATA
#define IDD_RESTARTPAGE
Definition: resource.h:65
#define IDS_WARN_DELETE_PARTITION
Definition: resource.h:166
#define IDC_INITDISK
Definition: resource.h:42
#define IDC_PARTMOREOPTS
Definition: resource.h:47
#define IDS_ERROR_CREATE_PARTITION_TITLE
Definition: resource.h:162
#define IDC_PARTDELETE
Definition: resource.h:45
#define IDS_WARN_DELETE_PARTITION_TITLE
Definition: resource.h:165
#define IDS_ERROR_CREATE_PARTITION
Definition: resource.h:163
#define IDC_PARTITION
Definition: resource.h:41
#define IDD_FORMAT
Definition: resource.h:82
#define IDD_ADVINSTOPTS
Definition: resource.h:69
#define IDC_PARTFORMAT
Definition: resource.h:44
#define IDC_PARTCREATE
Definition: resource.h:43
#define IDS_ABORTSETUP2
Definition: resource.h:102
#define IDS_ABORTSETUP
Definition: resource.h:101
#define IDD_PARTITION
Definition: resource.h:73
#define IDS_WARN_DELETE_MBR_EXTENDED_PARTITION
Definition: resource.h:167
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:1322
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:1509
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:1409
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:1359
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:1386
static VOID DeleteTreeItem(_In_ HWND hWndList, _In_ TLITEMW *ptlItem)
Called on response to the TVN_DELETEITEM notification sent by the TreeList.
Definition: drivepage.c:1150
@ 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:326
#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 NTAPI PartitionCreateChecks(_In_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2881
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
Definition: partlist.c:95
#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: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:136
PPARTLIST PartitionList
Definition: reactos.h:152
HWND hPartList
Definition: reactos.h:85
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:156
FORMATSTATE FormatState
Definition: partlist.h:48
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:187
UINT_PTR idFrom
Definition: winuser.h:3169
UINT code
Definition: winuser.h:3170
HWND hwndFrom
Definition: winuser.h:3168
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
#define TLITEMW
Definition: treelist.h:478
HTREEITEM hItem
Definition: treelist.h:37
#define HTLITEM
Definition: treelist.h:466
#define TreeList_GetParent(h, i)
Definition: treelist.h:442
#define TreeList_SelectItem(h, i)
Definition: treelist.h:436
int32_t INT_PTR
Definition: typedefs.h:64
uint64_t ULONGLONG
Definition: typedefs.h:67
VOID __cdecl MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent,...)
Definition: mui.c:237
static USETUP_DATA USetupData
Definition: usetup.c:44
#define POPUP_WAIT_ANY_KEY
Definition: usetup.h:122
int ret
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4840
#define GWL_ID
Definition: winuser.h:870
#define WM_COMMAND
Definition: winuser.h:1751
#define WM_INITDIALOG
Definition: winuser.h:1750
#define MB_YESNO
Definition: winuser.h:828
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define MB_OKCANCEL
Definition: winuser.h:815
struct tagNMHDR * LPNMHDR
#define GetWindowLong
Definition: winuser.h:5816
#define MB_ICONWARNING
Definition: winuser.h:797
HWND WINAPI GetParent(_In_ HWND)
#define MB_ICONQUESTION
Definition: winuser.h:800
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define MB_DEFBUTTON2
Definition: winuser.h:810
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1620
#define IDYES
Definition: winuser.h:846
#define SetWindowLongPtrW
Definition: winuser.h:5366
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 282 of file reactos.c.

287{
288 WCHAR ResBuffer[256];
289 WCHAR szText[256];
290
291 LoadStringW(hInstance, uID, ResBuffer, _countof(ResBuffer));
292 StringCchVPrintfW(szText, _countof(szText), ResBuffer, args);
293 SetWindowTextW(hWnd, szText);
294}
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 298 of file reactos.c.

303{
305
306 va_start(args, uID);
308 va_end(args);
309}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:282

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

◆ SetWindowResTextW()

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

Definition at line 271 of file reactos.c.

275{
276 WCHAR szText[256];
277 LoadStringW(hInstance, uID, szText, _countof(szText));
278 SetWindowTextW(hWnd, szText);
279}

Referenced by PrepareAndDoCopyThread(), and SummaryDlgProc().

Variable Documentation

◆ InstallPartition

PPARTENTRY InstallPartition
extern

◆ ProcessHeap

HANDLE ProcessHeap
extern
  • Internal Headers *‍/

Definition at line 15 of file servman.c.

◆ SetupData

◆ SystemPartition

◆ UiContext