diff --git a/README.md b/README.md index a93ee13..9a0f576 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ build\Release\ParavisInstaller.exe и защита системного диска Windows. - Разметка через diskpart: FAT32 `PARAVIS` 16 ГБ, FAT `VTOYEFI` 32 МБ, exFAT `DATA` (оставшийся объём). +- Галочка «Не копировать Windows ESD» (по умолчанию снята): если включить, + папка `WindowsESD` из образа 3 после распаковки удаляется с раздела DATA. - Отключённый диск переводится в онлайн перед разметкой. - Проверка разметки по таблице разделов и меткам томов. - Распаковка DISM: образ 1 → `PARAVIS`, 2 → `VTOYEFI`, 3 → `DATA`, с diff --git a/src/app.h b/src/app.h index 6d6cdd1..31c366e 100644 --- a/src/app.h +++ b/src/app.h @@ -25,6 +25,7 @@ enum class Hit { Progress, Work, Go, + Check, Hint }; @@ -46,7 +47,7 @@ public: HFONT fontArrow = nullptr; int width = 376; - int height = 183; + int height = 196; std::vector disks; int selIdx = 0; @@ -57,6 +58,8 @@ public: bool cancel = false; bool needScan = false; bool dimmed = false; + bool noEsd = false; + bool checkDown = false; int phase = 0; int applied = 0; @@ -94,6 +97,8 @@ public: COLORREF sizeFg = ColorFromHex(0x1F2430); COLORREF arrowBg = RGB(255, 255, 255); COLORREF arrowFg = ColorFromHex(0x6B7280); + COLORREF checkBorder = ColorFromHex(0x9AA3B2); + COLORREF checkFg = ColorFromHex(0x1F2430); int popupHover = -1; diff --git a/src/install.cpp b/src/install.cpp index 26a114e..e23e8a9 100644 --- a/src/install.cpp +++ b/src/install.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -223,6 +224,9 @@ void App::Apply() static_cast(p3) / 1024.0); message += L"Затем на разделы будут распакованы файлы из архива Data.pf\r\n"; message += L"(1 -> PARAVIS, 2 -> VTOYEFI, 3 -> DATA).\r\n\r\n"; + if (noEsd) { + message += L"Папка WindowsESD на раздел DATA копироваться не будет.\r\n\r\n"; + } message += L"ВНИМАНИЕ! ВСЕ ДАННЫЕ НА ЭТОМ ДИСКЕ БУДУТ УНИЧТОЖЕНЫ.\r\n"; message += L"Продолжить?"; @@ -451,6 +455,13 @@ int App::ApplyImages(int disk, const std::wstring& wim) return 2; } + if (i == 2 && noEsd) { + std::wstring esdDir = dir + L"WindowsESD"; + std::error_code ec; + std::filesystem::remove_all(esdDir, ec); + DebugLog(L"skip WindowsESD: remove_all %s ec=%d", esdDir.c_str(), ec.value()); + } + ++applied; if (cancel) { diff --git a/src/main.cpp b/src/main.cpp index cfea4df..702d476 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -189,7 +189,7 @@ bool App::Init(HWND window) hProgress = CreateWindowExW(0, PROGRESS_CLASSW, nullptr, WS_CHILD | PBS_SMOOTH, - 14, 139, 348, 5, + 14, 152, 348, 5, hwnd, reinterpret_cast(static_cast(100)), hInst, nullptr); if (hProgress) { @@ -340,6 +340,8 @@ void App::DimControls(bool on) sizeFg = ColorFromHex(0xB4B9C2); arrowFg = ColorFromHex(0xC7CBD3); comboFrame = ColorFromHex(0xE3E6EB); + checkBorder = ColorFromHex(0xD5DAE3); + checkFg = ColorFromHex(0xA0A6B1); ClosePopup(); } else { dropBg = nameBg = sizeBg = arrowBg = RGB(255, 255, 255); @@ -347,6 +349,8 @@ void App::DimControls(bool on) sizeFg = ColorFromHex(0x6B7280); ArrowState(); comboFrame = ColorFromHex(0xD5DAE3); + checkBorder = ColorFromHex(0x9AA3B2); + checkFg = ColorFromHex(0x1F2430); } InvalidateAll(); } @@ -491,17 +495,38 @@ void App::Paint(HDC dc) DrawTextRect(memory, statusText, fontText, 14, 95, 348, 15, ColorFromHex(0x6B7280), DT_LEFT | DT_TOP); + const int cbX = 16; + const int cbY = 114; + const int cbSize = 14; + FillRectColor(memory, cbX, cbY, cbSize, cbSize, RGB(255, 255, 255)); + RECT cbRect{ cbX, cbY, cbX + cbSize - 1, cbY + cbSize - 1 }; + HBRUSH cbBrush = CreateSolidBrush(checkBorder); + FrameRect(memory, &cbRect, cbBrush); + DeleteObject(cbBrush); + if (noEsd) { + COLORREF markColor = dimmed ? ColorFromHex(0xA0A6B1) : ColorFromHex(0x2563EB); + HPEN pen = CreatePen(PS_SOLID, 2, markColor); + HGDIOBJ oldPen = SelectObject(memory, pen); + MoveToEx(memory, cbX + 3, cbY + 7, nullptr); + LineTo(memory, cbX + 6, cbY + 10); + LineTo(memory, cbX + 11, cbY + 4); + SelectObject(memory, oldPen); + DeleteObject(pen); + } + DrawTextRect(memory, L"Не копировать Windows ESD", fontText, 36, 112, 300, 18, + checkFg, DT_LEFT | DT_VCENTER); + if (busy) { - DrawTextRect(memory, workText, fontBold, 14, 115, 348, 18, + DrawTextRect(memory, workText, fontBold, 14, 132, 348, 18, ColorFromHex(0x1F2430), DT_CENTER | DT_TOP); } else { DrawTextRect(memory, L"Все данные на выбранном диске будут уничтожены", - fontBold, 14, 115, 348, 18, ColorFromHex(0xC0392B), + fontBold, 14, 132, 348, 18, ColorFromHex(0xC0392B), DT_CENTER | DT_TOP); } - FillRectColor(memory, 14, 147, 348, 30, goBg); - DrawTextRect(memory, goText, fontGo, 14, 147, 348, 30, goFg, + FillRectColor(memory, 14, 160, 348, 30, goBg); + DrawTextRect(memory, goText, fontGo, 14, 160, 348, 30, goFg, DT_CENTER | DT_VCENTER); BitBlt(dc, 0, 0, w, h, memory, 0, 0, SRCCOPY); @@ -694,6 +719,17 @@ void App::OnPoll() return; } + if (hit == Hit::Check && leftDown) { + checkDown = true; + } else if (checkDown) { + checkDown = false; + if (hit == Hit::Check && !leftDown) { + noEsd = !noEsd; + DebugLog(L"checkbox noEsd=%d", noEsd ? 1 : 0); + InvalidateAll(); + } + } + COLORREF minColor = ColorFromHex(CLR_HEAD); COLORREF closeColor = ColorFromHex(CLR_HEAD); if (hit == Hit::Min) { @@ -761,6 +797,7 @@ void App::OnPoll() (hit == Hit::Combo || hit == Hit::Drop || hit == Hit::DropName || hit == Hit::DropSize || hit == Hit::Arrow); comboFrame = comboHover ? ColorFromHex(0x7FA6F0) : ColorFromHex(0xD5DAE3); + checkBorder = (hit == Hit::Check) ? ColorFromHex(0x7FA6F0) : ColorFromHex(0x9AA3B2); if (!disks.empty() && (hit == Hit::Drop || hit == Hit::Arrow || hit == Hit::DropName || @@ -868,7 +905,10 @@ Hit App::HitTest(POINT pt) const if (inside(15, 61, 342, 28)) { return Hit::Combo; } - if (inside(14, 147, 348, 30)) { + if (inside(14, 110, 320, 22)) { + return Hit::Check; + } + if (inside(14, 160, 348, 30)) { return Hit::Go; } if (inside(16, 2, 300, 24)) {