USB-installer: on drives under 50 GB the "do not copy Windows ESD" option is forced on and locked
This commit is contained in:
1 parent
381cc8a766
commit
538e4b1a5a
1 file changed
+15
-5
+15
-5
@@ -1,6 +1,3 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
// Copyright (c) 2026 Paravis
|
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "disks.h"
|
#include "disks.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@@ -296,10 +293,23 @@ void App::ShowSelected()
|
|||||||
if (selIdx < 0 || selIdx >= static_cast<int>(disks.size())) {
|
if (selIdx < 0 || selIdx >= static_cast<int>(disks.size())) {
|
||||||
selIdx = 0;
|
selIdx = 0;
|
||||||
}
|
}
|
||||||
|
if (EsdLocked()) {
|
||||||
|
noEsd = true;
|
||||||
|
DebugLog(L"disk < 50 GB: noEsd forced");
|
||||||
|
}
|
||||||
CheckInstalled();
|
CheckInstalled();
|
||||||
InvalidateAll();
|
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()
|
void App::CheckInstalled()
|
||||||
{
|
{
|
||||||
installed = false;
|
installed = false;
|
||||||
@@ -507,7 +517,7 @@ void App::Paint(HDC dc)
|
|||||||
const int cbX = 16;
|
const int cbX = 16;
|
||||||
const int cbY = 114;
|
const int cbY = 114;
|
||||||
const int cbSize = 14;
|
const int cbSize = 14;
|
||||||
bool checkEnabled = esdPfAvailable && !busy;
|
bool checkEnabled = esdPfAvailable && !busy && !EsdLocked();
|
||||||
COLORREF boxFill = checkEnabled ? RGB(255, 255, 255) : ColorFromHex(0xF2F3F5);
|
COLORREF boxFill = checkEnabled ? RGB(255, 255, 255) : ColorFromHex(0xF2F3F5);
|
||||||
COLORREF boxBorder = checkEnabled ? checkBorder : ColorFromHex(0xD5DAE3);
|
COLORREF boxBorder = checkEnabled ? checkBorder : ColorFromHex(0xD5DAE3);
|
||||||
COLORREF boxText = checkEnabled ? checkFg : ColorFromHex(0xA0A6B1);
|
COLORREF boxText = checkEnabled ? checkFg : ColorFromHex(0xA0A6B1);
|
||||||
@@ -736,7 +746,7 @@ void App::OnPoll()
|
|||||||
checkDown = true;
|
checkDown = true;
|
||||||
} else if (checkDown) {
|
} else if (checkDown) {
|
||||||
checkDown = false;
|
checkDown = false;
|
||||||
if (hit == Hit::Check && !leftDown && esdPfAvailable) {
|
if (hit == Hit::Check && !leftDown && esdPfAvailable && !EsdLocked()) {
|
||||||
noEsd = !noEsd;
|
noEsd = !noEsd;
|
||||||
DebugLog(L"checkbox noEsd=%d", noEsd ? 1 : 0);
|
DebugLog(L"checkbox noEsd=%d", noEsd ? 1 : 0);
|
||||||
InvalidateAll();
|
InvalidateAll();
|
||||||
|
|||||||
Reference in new issue
Block a user