USB-installer: on drives under 50 GB the "do not copy Windows ESD" option is forced on and locked

This commit is contained in:
Paravis committed 2026-11-21 14:52:02 +03:00
1 parent 381cc8a766
commit 538e4b1a5a
1 file changed
+15 -5
+15 -5
View File
@@ -1,6 +1,3 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 Paravis
#include "app.h"
#include "disks.h"
#include "util.h"
@@ -296,10 +293,23 @@ void App::ShowSelected()
if (selIdx < 0 || selIdx >= static_cast<int>(disks.size())) {
selIdx = 0;
}
if (EsdLocked()) {
noEsd = true;
DebugLog(L"disk < 50 GB: noEsd forced");
}
CheckInstalled();
InvalidateAll();
}
bool App::EsdLocked() const
{
if (disks.empty() || selIdx < 0 || selIdx >= static_cast<int>(disks.size())) {
return false;
}
// 50 GB по реальной ёмкости: флешка "32 ГБ" реально ~30 ГБ, "64 ГБ" ~63.8 ГБ
return disks[selIdx].size < 50000000000ULL;
}
void App::CheckInstalled()
{
installed = false;
@@ -507,7 +517,7 @@ void App::Paint(HDC dc)
const int cbX = 16;
const int cbY = 114;
const int cbSize = 14;
bool checkEnabled = esdPfAvailable && !busy;
bool checkEnabled = esdPfAvailable && !busy && !EsdLocked();
COLORREF boxFill = checkEnabled ? RGB(255, 255, 255) : ColorFromHex(0xF2F3F5);
COLORREF boxBorder = checkEnabled ? checkBorder : ColorFromHex(0xD5DAE3);
COLORREF boxText = checkEnabled ? checkFg : ColorFromHex(0xA0A6B1);
@@ -736,7 +746,7 @@ void App::OnPoll()
checkDown = true;
} else if (checkDown) {
checkDown = false;
if (hit == Hit::Check && !leftDown && esdPfAvailable) {
if (hit == Hit::Check && !leftDown && esdPfAvailable && !EsdLocked()) {
noEsd = !noEsd;
DebugLog(L"checkbox noEsd=%d", noEsd ? 1 : 0);
InvalidateAll();