Skip to content

Commit fade944

Browse files
committed
[CONTENT] Blog: GUI setup, Part 2 (Partitioning)
1 parent 0988cc7 commit fade944

File tree

6 files changed

+116
-0
lines changed

6 files changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: "1st-stage GUI setup, Part 2 - October-November 2023: Making partitioning UI work"
3+
author: "hbelusca"
4+
date: 2024-01-31
5+
tags: [ newsletter, gui-setup ]
6+
---
7+
8+
Greetings!
9+
10+
Welcome to the second blog of the series "1st-stage GUI setup":
11+
1. [September 2023: partly Wine-syncing setupapi](/blogs/gui-setup-part1-setupapi)
12+
2. October-November 2023: Making partitioning UI work
13+
3. [December 2023: First tests](/blogs/gui-setup-part3-first-testing-problems)
14+
15+
As you may have noticed, I have been quite silent about my work and not regularly writing blog posts about what I have done so far.
16+
Well, I am more concerned about getting _actual_ code written and working before discussing about it,
17+
instead of doing that about half-done not-yet-tested code; much like what the GUI setup was during these previous months.
18+
19+
This is why I am now presenting, in this second blog, the work I did during the months of [October](https://docs.google.com/spreadsheets/d/1Kx80SmSkj1IdomVC9gcbA_MJ7XFiz_YlYYVxoxv-Jgs/view#gid=711109022) and [November](https://docs.google.com/spreadsheets/d/1Kx80SmSkj1IdomVC9gcbA_MJ7XFiz_YlYYVxoxv-Jgs/view#gid=1783614271) 2023, in preparation for the new 1st-stage ReactOS GUI setup.
20+
A third blog post describing the work done during the month of December will follow soon.
21+
22+
During the first week of October, I finished addressing some issues that arose with the partial setupapi winesync [that I started back in September](/blogs/gui-setup-part1-setupapi).
23+
24+
I then started the main part of this project: working on the GUI setup proper.
25+
The crucial work for it resides in three functions:
26+
- Disk partitioning and bootloader installation;
27+
- File copying;
28+
- Saving settings in the registry.
29+
30+
While the last two features were already partly implemented (most of the code being shared with the existing text-mode installer "USETUP") and will be discussed in future blog posts, the first feature, disk partitioning, necessitated more work than I originally anticipated.
31+
This functionality is shared with USETUP but is used in a slightly different manner in the GUI setup.
32+
33+
34+
## Partitioning workflow - Text-mode versus GUI-mode setup
35+
36+
### In the usual text-mode setup
37+
38+
Long-time ReactOS users (and Windows XP/2k3 alike) certainly remember that, during the 1st-stage _text-mode_ setup ("USETUP"), disk partitions can be created, selected, and deleted from the partition list screen.
39+
40+
{{< gallery >}}
41+
{{< figure link="/img/blogs/hbelusca_gui-setup/usetup_partition_list.png" src="/img/blogs/hbelusca_gui-setup/usetup_partition_list.png" caption="USETUP - Partition list">}}
42+
{{< /gallery >}}
43+
44+
While the creation and deletion operations made from this screen are not immediately applied to the disk, they get applied _as soon_ as the user selects a suitable partition, or an eligible[^1] empty space, for installing ReactOS.
45+
There, the new partition layout is written to the disk and the installation continues, with the choice of a filesystem for formatting the selected or newly-created partitions.
46+
[^1]: Eligible empty space, _i.e._ large enough so that a partition can be created in it.
47+
48+
{{< gallery >}}
49+
{{< figure link="/img/blogs/hbelusca_gui-setup/usetup_partition_filesystem.png" src="/img/blogs/hbelusca_gui-setup/usetup_partition_filesystem.png" caption="USETUP - Partition filesystem selection">}}
50+
{{< /gallery >}}
51+
52+
The actual partition formatting takes place after the filesystem selection.
53+
Once all the new and (optionally) selected partitions are formatted, they are checked for filesystem defects.
54+
This is particularly true for the selected [_boot partition_](http://jdebp.info/FGA/boot-and-system-volumes.html) for ReactOS installation
55+
(as well as the [_system partition_](https://en.wikipedia.org/wiki/System_partition_and_boot_partition) where the bootloader is installed; these can be the same or different).
56+
57+
After all these steps have been performed, the installer asks the user for the ReactOS installation directory, as well as where to install the bootloader.
58+
The ReactOS installation then begins, copying files and saving settings, then continues after a system restart with the 2nd-stage installer.
59+
60+
61+
### Workflow change in the GUI-mode setup
62+
63+
Although the installation workflow used by the text-mode USETUP _might_ make sense, from a UI perspective (each action is done from a different screen; only forward progress is allowed, and once an action has been chosen, it cannot be undone), the GUI-mode setup changes some of these assumptions.
64+
The wizard-style of the GUI setup allows going back and forth between different pages.
65+
66+
Its partitioning page shows a minimal interface, similar to the text-mode one, but more reminiscent of other GUI partitioning software.
67+
68+
Changing the disk partition layout and formatting new or existing partitions can be considered a sensitive operation -- existing partitions or filesystems could be destroyed!
69+
The user then may feel more comfortable performing such operations virtually, viewing the resulting changes, knowing they haven't yet been actually applied, until his or her final choice has been made.
70+
This is why, for example, 3rd-party partitioning software allows users to stash (queue) all these operations, allowing them to carefully review the changes before applying them.
71+
72+
Because of these considerations, I chose to make the ReactOS GUI setup follow a similar philosophy.
73+
The partition page allows the user to choose the partition where to install ReactOS, as well as to modify the partition layout, keeping the changes in memory until the actual ReactOS installation starts.
74+
75+
{{< gallery >}}
76+
{{< figure link="/img/blogs/hbelusca_gui-setup/guisetup_partition_list.png" src="/img/blogs/hbelusca_gui-setup/guisetup_partition_list.png" caption="GUI setup - Partition list">}}
77+
{{< /gallery >}}
78+
79+
This new installation workflow necessitated adapting the existing partitioning code, shared with the text-mode USETUP, to determine where and how to store additional per-partition arbitrary data state (for example, filesystem choice and formatting parameters).
80+
81+
Most importantly, three main changes were required in the code, summarized below.
82+
- Rewriting the formatter/chkdsk machine-state code, that is originally used in USETUP, to make it more generic and act as a queue whose stashed actions can then be committed all at once, so as to employ it in the GUI setup as well.
83+
- Splitting the bootloader installation choice, from its actual installation code: see GitHub [PR #5786](https://github.com/reactos/reactos/pull/5786).
84+
This was needed, because the old behaviour was to present the user with the bootloader installation choice only at the very end of ReactOS installation, and not before starting it, and the old code was not reusable elsewhere.
85+
- Better unify the helper functions used to create partitions: see GitHub [PR #5837](https://github.com/reactos/reactos/pull/5837).
86+
The existing code distinguished between "primary", "logical" and "extended" partitions.
87+
This makes sense for MBR-based disks but does not anywhere else (such as GPT disks).
88+
These partition creation helpers now automatically deduce their actual type -- the only exception being for "extended" partitions for MBR disks only.
89+
90+
{{< gallery >}}
91+
{{< figure link="/img/blogs/hbelusca_gui-setup/guisetup_createpart_dlg.png" src="/img/blogs/hbelusca_gui-setup/guisetup_createpart_dlg.png" caption="GUI setup - The new \"Create and Format Partition\" dialog">}}
92+
{{< figure link="/img/blogs/hbelusca_gui-setup/guisetup_old_createpart_dlg.png" src="/img/blogs/hbelusca_gui-setup/guisetup_old_createpart_dlg.png" caption="The old \"Create Partition\" dialog, for comparison">}}
93+
{{< /gallery >}}
94+
95+
96+
## What's next -- partition-wise
97+
98+
Partition handling code is now present in the GUI setup.
99+
However, it requires a few improvements:
100+
- Being able to select empty disk space between existing partitions and install ReactOS onto it.
101+
- Reformat an _existing_ partition from the UI.
102+
This is not yet possible because the formatting options currently exist only in the Create-And-Format-Partition dialog;
103+
- Display the selected filesystem for a newly-created partition in the partition list, instead of showing `"New (Unformatted)"`.
104+
105+
----
106+
107+
In the next [blog post](/blogs/gui-setup-part3-first-testing-problems), I will talk about the other functions of the GUI setup not pertaining to partitioning, as well as the problems I encountered when testing the ReactOS GUI installer for the first time.
108+
109+
Stay tuned!
110+
111+
----
112+
113+
#### Some credits
114+
115+
I thank [@learn-more](https://github.com/learn-more), [@tkreuzer](https://github.com/tkreuzer), [@GeoB99](https://github.com/GeoB99), [@binarymaster](https://github.com/binarymaster) and [@cbialorucki](https://github.com/cbialorucki) for the thorough review of this blog post!
116+
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)