Commit 4df793e0 authored by longpanda's avatar longpanda
Browse files

1. Add new options for Windows CLI mode.

2. Add tip message for 4k native disk.
parent e0132ac4
...@@ -94,6 +94,8 @@ typedef enum STR_ID ...@@ -94,6 +94,8 @@ typedef enum STR_ID
STR_DONATE, //54 STR_DONATE, //54
STR_4KN_UNSUPPORTED, //55
STR_ID_MAX STR_ID_MAX
}STR_ID; }STR_ID;
......
...@@ -139,7 +139,7 @@ static DWORD GetVentoyVolumeName(int PhyDrive, UINT64 StartSectorId, CHAR *NameB ...@@ -139,7 +139,7 @@ static DWORD GetVentoyVolumeName(int PhyDrive, UINT64 StartSectorId, CHAR *NameB
return Status; return Status;
} }
static int GetLettersBelongPhyDrive(int PhyDrive, char *DriveLetters, size_t Length) int GetLettersBelongPhyDrive(int PhyDrive, char *DriveLetters, size_t Length)
{ {
int n = 0; int n = 0;
DWORD DataSize = 0; DWORD DataSize = 0;
...@@ -355,6 +355,7 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount) ...@@ -355,6 +355,7 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount)
STORAGE_PROPERTY_QUERY Query; STORAGE_PROPERTY_QUERY Query;
STORAGE_DESCRIPTOR_HEADER DevDescHeader; STORAGE_DESCRIPTOR_HEADER DevDescHeader;
STORAGE_DEVICE_DESCRIPTOR *pDevDesc; STORAGE_DEVICE_DESCRIPTOR *pDevDesc;
STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR diskAlignment;
int PhyDriveId[VENTOY_MAX_PHY_DRIVE]; int PhyDriveId[VENTOY_MAX_PHY_DRIVE];
Count = GetPhysicalDriveCount(); Count = GetPhysicalDriveCount();
...@@ -468,12 +469,35 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount) ...@@ -468,12 +469,35 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount)
continue; continue;
} }
memset(&Query, 0, sizeof(STORAGE_PROPERTY_QUERY));
Query.PropertyId = StorageAccessAlignmentProperty;
Query.QueryType = PropertyStandardQuery;
memset(&diskAlignment, 0, sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR));
bRet = DeviceIoControl(Handle,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(STORAGE_PROPERTY_QUERY),
&diskAlignment,
sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR),
&dwBytes,
NULL);
if (!bRet)
{
Log("DeviceIoControl3 error:%u dwBytes:%u", LASTERR, dwBytes);
}
CurDrive->PhyDrive = i; CurDrive->PhyDrive = i;
CurDrive->SizeInBytes = LengthInfo.Length.QuadPart; CurDrive->SizeInBytes = LengthInfo.Length.QuadPart;
CurDrive->DeviceType = pDevDesc->DeviceType; CurDrive->DeviceType = pDevDesc->DeviceType;
CurDrive->RemovableMedia = pDevDesc->RemovableMedia; CurDrive->RemovableMedia = pDevDesc->RemovableMedia;
CurDrive->BusType = pDevDesc->BusType; CurDrive->BusType = pDevDesc->BusType;
CurDrive->BytesPerLogicalSector = diskAlignment.BytesPerLogicalSector;
CurDrive->BytesPerPhysicalSector = diskAlignment.BytesPerPhysicalSector;
if (pDevDesc->VendorIdOffset) if (pDevDesc->VendorIdOffset)
{ {
safe_strcpy(CurDrive->VendorId, (char *)pDevDesc + pDevDesc->VendorIdOffset); safe_strcpy(CurDrive->VendorId, (char *)pDevDesc + pDevDesc->VendorIdOffset);
...@@ -508,9 +532,10 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount) ...@@ -508,9 +532,10 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount)
for (i = 0, CurDrive = pDriveList; i < (int)DriveCount; i++, CurDrive++) for (i = 0, CurDrive = pDriveList; i < (int)DriveCount; i++, CurDrive++)
{ {
Log("PhyDrv:%d BusType:%-4s Removable:%u Size:%dGB(%llu) Name:%s %s", Log("PhyDrv:%d BusType:%-4s Removable:%u Size:%dGB(%llu) Sector:%u/%u Name:%s %s",
CurDrive->PhyDrive, GetBusTypeString(CurDrive->BusType), CurDrive->RemovableMedia, CurDrive->PhyDrive, GetBusTypeString(CurDrive->BusType), CurDrive->RemovableMedia,
GetHumanReadableGBSize(CurDrive->SizeInBytes), CurDrive->SizeInBytes, GetHumanReadableGBSize(CurDrive->SizeInBytes), CurDrive->SizeInBytes,
CurDrive->BytesPerLogicalSector, CurDrive->BytesPerPhysicalSector,
CurDrive->VendorId, CurDrive->ProductId); CurDrive->VendorId, CurDrive->ProductId);
} }
...@@ -2351,6 +2376,12 @@ int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive) ...@@ -2351,6 +2376,12 @@ int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive)
Sleep(2000); Sleep(2000);
if (g_CLI_Mode)
{
Log("### Ventoy non-destructive CLI installation successfully finished.");
}
else
{
//Refresh disk list //Refresh disk list
PhyDrive = pPhyDrive->PhyDrive; PhyDrive = pPhyDrive->PhyDrive;
...@@ -2375,6 +2406,7 @@ int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive) ...@@ -2375,6 +2406,7 @@ int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive)
} }
InitComboxCtrl(g_DialogHwnd, PhyDrive); InitComboxCtrl(g_DialogHwnd, PhyDrive);
}
rc = 0; rc = 0;
......
...@@ -40,6 +40,56 @@ void TraceOut(const char *Fmt, ...) ...@@ -40,6 +40,56 @@ void TraceOut(const char *Fmt, ...)
} }
} }
typedef struct LogBuf
{
int Len;
char szBuf[1024];
struct LogBuf* next;
}LogBuf;
static BOOL g_LogCache = FALSE;
static LogBuf* g_LogHead = NULL;
static LogBuf* g_LogTail = NULL;
void LogCache(BOOL cache)
{
g_LogCache = cache;
}
void LogFlush(void)
{
FILE* File = NULL;
LogBuf* Node = NULL;
LogBuf* Next = NULL;
if (g_CLI_Mode)
{
fopen_s(&File, VENTOY_CLI_LOG, "a+");
}
else
{
fopen_s(&File, VENTOY_FILE_LOG, "a+");
}
if (File)
{
for (Node = g_LogHead; Node; Node = Node->next)
{
fwrite(Node->szBuf, 1, Node->Len, File);
fwrite("\n", 1, 1, File);
}
fclose(File);
}
for (Node = g_LogHead; Node; Node = Next)
{
Next = Node->next;
free(Node);
}
g_LogHead = g_LogTail = NULL;
}
void Log(const char *Fmt, ...) void Log(const char *Fmt, ...)
{ {
va_list Arg; va_list Arg;
...@@ -59,6 +109,30 @@ void Log(const char *Fmt, ...) ...@@ -59,6 +109,30 @@ void Log(const char *Fmt, ...)
Len += vsnprintf_s(szBuf + Len, sizeof(szBuf)-Len - 1, sizeof(szBuf)-Len-1, Fmt, Arg); Len += vsnprintf_s(szBuf + Len, sizeof(szBuf)-Len - 1, sizeof(szBuf)-Len-1, Fmt, Arg);
va_end(Arg); va_end(Arg);
if (g_LogCache)
{
LogBuf* Node = NULL;
Node = malloc(sizeof(LogBuf));
if (Node)
{
memcpy(Node->szBuf, szBuf, Len);
Node->next = NULL;
Node->Len = Len;
if (g_LogTail)
{
g_LogTail->next = Node;
g_LogTail = Node;
}
else
{
g_LogHead = g_LogTail = Node;
}
}
return;
}
if (g_CLI_Mode) if (g_CLI_Mode)
{ {
fopen_s(&File, VENTOY_CLI_LOG, "a+"); fopen_s(&File, VENTOY_CLI_LOG, "a+");
......
...@@ -176,6 +176,9 @@ typedef struct PHY_DRIVE_INFO ...@@ -176,6 +176,9 @@ typedef struct PHY_DRIVE_INFO
CHAR SerialNumber[128]; CHAR SerialNumber[128];
STORAGE_BUS_TYPE BusType; STORAGE_BUS_TYPE BusType;
DWORD BytesPerLogicalSector;
DWORD BytesPerPhysicalSector;
CHAR DriveLetters[64]; CHAR DriveLetters[64];
int VentoyFsClusterSize; int VentoyFsClusterSize;
...@@ -234,6 +237,8 @@ extern int g_FilterUSB; ...@@ -234,6 +237,8 @@ extern int g_FilterUSB;
void TraceOut(const char *Fmt, ...); void TraceOut(const char *Fmt, ...);
void Log(const char *Fmt, ...); void Log(const char *Fmt, ...);
void LogCache(BOOL cache);
void LogFlush(void);
BOOL IsPathExist(BOOL Dir, const char *Fmt, ...); BOOL IsPathExist(BOOL Dir, const char *Fmt, ...);
void DumpWindowsVersion(void); void DumpWindowsVersion(void);
const CHAR* GetLocalVentoyVersion(void); const CHAR* GetLocalVentoyVersion(void);
...@@ -370,6 +375,15 @@ BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD* pMBR, UINT64* Pa ...@@ -370,6 +375,15 @@ BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD* pMBR, UINT64* Pa
int GetVentoyFsNameInPhyDrive(PHY_DRIVE_INFO* CurDrive); int GetVentoyFsNameInPhyDrive(PHY_DRIVE_INFO* CurDrive);
void CLISetReserveSpace(int MB); void CLISetReserveSpace(int MB);
void CLI_UpdatePercent(int Pos); void CLI_UpdatePercent(int Pos);
int GetLettersBelongPhyDrive(int PhyDrive, char* DriveLetters, size_t Length);
PHY_DRIVE_INFO* CLI_PhyDrvInfo(void);
#define UTF8_Log(fmt, wstr) \
{\
memset(TmpPathA, 0, sizeof(TmpPathA));\
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, TmpPathA, sizeof(TmpPathA), NULL, NULL);\
Log(fmt, TmpPathA);\
}
#define VTSI_SUPPORT 1 #define VTSI_SUPPORT 1
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -17,12 +17,16 @@ typedef struct CLI_CFG ...@@ -17,12 +17,16 @@ typedef struct CLI_CFG
int PartStyle; int PartStyle;
int ReserveMB; int ReserveMB;
BOOL USBCheck; BOOL USBCheck;
BOOL NonDest;
int fstype;
}CLI_CFG; }CLI_CFG;
BOOL g_CLI_Mode = FALSE; BOOL g_CLI_Mode = FALSE;
static int g_CLI_OP; static int g_CLI_OP;
static int g_CLI_PhyDrive; static int g_CLI_PhyDrive;
static PHY_DRIVE_INFO* g_CLI_PhyDrvInfo = NULL;
static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo) static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo)
{ {
BOOL bRet; BOOL bRet;
...@@ -33,6 +37,7 @@ static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo) ...@@ -33,6 +37,7 @@ static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo)
STORAGE_PROPERTY_QUERY Query; STORAGE_PROPERTY_QUERY Query;
STORAGE_DESCRIPTOR_HEADER DevDescHeader; STORAGE_DESCRIPTOR_HEADER DevDescHeader;
STORAGE_DEVICE_DESCRIPTOR* pDevDesc; STORAGE_DEVICE_DESCRIPTOR* pDevDesc;
STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR diskAlignment;
safe_sprintf(PhyDrivePath, "\\\\.\\PhysicalDrive%d", PhyDrive); safe_sprintf(PhyDrivePath, "\\\\.\\PhysicalDrive%d", PhyDrive);
Handle = CreateFileA(PhyDrivePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); Handle = CreateFileA(PhyDrivePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
...@@ -103,12 +108,35 @@ static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo) ...@@ -103,12 +108,35 @@ static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo)
return 1; return 1;
} }
memset(&Query, 0, sizeof(STORAGE_PROPERTY_QUERY));
Query.PropertyId = StorageAccessAlignmentProperty;
Query.QueryType = PropertyStandardQuery;
memset(&diskAlignment, 0, sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR));
bRet = DeviceIoControl(Handle,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(STORAGE_PROPERTY_QUERY),
&diskAlignment,
sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR),
&dwBytes,
NULL);
if (!bRet)
{
Log("DeviceIoControl3 error:%u dwBytes:%u", LASTERR, dwBytes);
}
pInfo->PhyDrive = PhyDrive; pInfo->PhyDrive = PhyDrive;
pInfo->SizeInBytes = LengthInfo.Length.QuadPart; pInfo->SizeInBytes = LengthInfo.Length.QuadPart;
pInfo->DeviceType = pDevDesc->DeviceType; pInfo->DeviceType = pDevDesc->DeviceType;
pInfo->RemovableMedia = pDevDesc->RemovableMedia; pInfo->RemovableMedia = pDevDesc->RemovableMedia;
pInfo->BusType = pDevDesc->BusType; pInfo->BusType = pDevDesc->BusType;
pInfo->BytesPerLogicalSector = diskAlignment.BytesPerLogicalSector;
pInfo->BytesPerPhysicalSector = diskAlignment.BytesPerPhysicalSector;
if (pDevDesc->VendorIdOffset) if (pDevDesc->VendorIdOffset)
{ {
safe_strcpy(pInfo->VendorId, (char*)pDevDesc + pDevDesc->VendorIdOffset); safe_strcpy(pInfo->VendorId, (char*)pDevDesc + pDevDesc->VendorIdOffset);
...@@ -143,12 +171,14 @@ static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo) ...@@ -143,12 +171,14 @@ static int CLI_GetPhyDriveInfo(int PhyDrive, PHY_DRIVE_INFO* pInfo)
static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg) static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg)
{ {
int i; int i;
int fstype = VTOY_FS_EXFAT;
int op = -1; int op = -1;
char* opt = NULL; char* opt = NULL;
int PhyDrive = -1; int PhyDrive = -1;
int PartStyle = 0; int PartStyle = 0;
int ReserveMB = 0; int ReserveMB = 0;
BOOL USBCheck = TRUE; BOOL USBCheck = TRUE;
BOOL NonDest = FALSE;
MBR_HEAD MBR; MBR_HEAD MBR;
UINT64 Part2GPTAttr = 0; UINT64 Part2GPTAttr = 0;
UINT64 Part2StartSector = 0; UINT64 Part2StartSector = 0;
...@@ -176,6 +206,10 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C ...@@ -176,6 +206,10 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C
{ {
USBCheck = FALSE; USBCheck = FALSE;
} }
else if (_stricmp(opt, "/NonDest") == 0)
{
NonDest = TRUE;
}
else if (_strnicmp(opt, "/Drive:", 7) == 0) else if (_strnicmp(opt, "/Drive:", 7) == 0)
{ {
Log("Get PhyDrive by logical drive %C:", opt[7]); Log("Get PhyDrive by logical drive %C:", opt[7]);
...@@ -189,6 +223,17 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C ...@@ -189,6 +223,17 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C
{ {
ReserveMB = (int)strtol(opt + 3, NULL, 10); ReserveMB = (int)strtol(opt + 3, NULL, 10);
} }
else if (_strnicmp(opt, "/FS:", 4) == 0)
{
if (_stricmp(opt + 4, "NTFS") == 0)
{
fstype = VTOY_FS_NTFS;
}
else if (_stricmp(opt + 4, "FAT32") == 0)
{
fstype = VTOY_FS_FAT32;
}
}
} }
if (op < 0 || PhyDrive < 0) if (op < 0 || PhyDrive < 0)
...@@ -197,10 +242,10 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C ...@@ -197,10 +242,10 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C
return 1; return 1;
} }
Log("Ventoy CLI %s PhyDrive:%d %s SecureBoot:%d ReserveSpace:%dMB USBCheck:%u", Log("Ventoy CLI %s PhyDrive:%d %s SecureBoot:%d ReserveSpace:%dMB USBCheck:%u FS:%s NonDest:%d",
op == 0 ? "install" : "update", op == 0 ? "install" : "update",
PhyDrive, PartStyle ? "GPT" : "MBR", PhyDrive, PartStyle ? "GPT" : "MBR",
g_SecureBoot, ReserveMB, USBCheck g_SecureBoot, ReserveMB, USBCheck, GetVentoyFsFmtNameByTypeA(fstype), NonDest
); );
if (CLI_GetPhyDriveInfo(PhyDrive, pDrvInfo)) if (CLI_GetPhyDriveInfo(PhyDrive, pDrvInfo))
...@@ -231,14 +276,51 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C ...@@ -231,14 +276,51 @@ static int CLI_CheckParam(int argc, char** argv, PHY_DRIVE_INFO* pDrvInfo, CLI_C
} }
} }
if (op == 0 && NonDest)
{
GetLettersBelongPhyDrive(PhyDrive, pDrvInfo->DriveLetters, sizeof(pDrvInfo->DriveLetters));
}
pCfg->op = op; pCfg->op = op;
pCfg->PartStyle = PartStyle; pCfg->PartStyle = PartStyle;
pCfg->ReserveMB = ReserveMB; pCfg->ReserveMB = ReserveMB;
pCfg->USBCheck = USBCheck; pCfg->USBCheck = USBCheck;
pCfg->NonDest = NonDest;
pCfg->fstype = fstype;
return 0; return 0;
} }
static int Ventoy_CLI_NonDestInstall(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG* pCfg)
{
int rc;
int TryId = 1;
Log("Ventoy_CLI_NonDestInstall start ...");
if (pDrvInfo->BytesPerLogicalSector == 4096 && pDrvInfo->BytesPerPhysicalSector == 4096)
{
Log("Ventoy does not support 4k native disk.");
rc = 1;
goto out;
}
if (!PartResizePreCheck(NULL))
{
Log("#### Part Resize PreCheck Failed ####");
rc = 1;
goto out;
}
rc = PartitionResizeForVentoy(pDrvInfo);
out:
Log("Ventoy_CLI_NonDestInstall [%s]", rc == 0 ? "SUCCESS" : "FAILED");
return rc;
}
static int Ventoy_CLI_Install(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg) static int Ventoy_CLI_Install(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg)
{ {
int rc; int rc;
...@@ -246,11 +328,20 @@ static int Ventoy_CLI_Install(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg) ...@@ -246,11 +328,20 @@ static int Ventoy_CLI_Install(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg)
Log("Ventoy_CLI_Install start ..."); Log("Ventoy_CLI_Install start ...");
if (pDrvInfo->BytesPerLogicalSector == 4096 && pDrvInfo->BytesPerPhysicalSector == 4096)
{
Log("Ventoy does not support 4k native disk.");
rc = 1;
goto out;
}
if (pCfg->ReserveMB > 0) if (pCfg->ReserveMB > 0)
{ {
CLISetReserveSpace(pCfg->ReserveMB); CLISetReserveSpace(pCfg->ReserveMB);
} }
SetVentoyFsType(pCfg->fstype);
rc = InstallVentoy2PhyDrive(pDrvInfo, pCfg->PartStyle, TryId++); rc = InstallVentoy2PhyDrive(pDrvInfo, pCfg->PartStyle, TryId++);
if (rc) if (rc)
{ {
...@@ -274,6 +365,9 @@ static int Ventoy_CLI_Install(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg) ...@@ -274,6 +365,9 @@ static int Ventoy_CLI_Install(PHY_DRIVE_INFO* pDrvInfo, CLI_CFG *pCfg)
} }
} }
SetVentoyFsType(VTOY_FS_EXFAT);
out:
Log("Ventoy_CLI_Install [%s]", rc == 0 ? "SUCCESS" : "FAILED"); Log("Ventoy_CLI_Install [%s]", rc == 0 ? "SUCCESS" : "FAILED");
return rc; return rc;
...@@ -351,6 +445,11 @@ static void CLI_WriteDoneFile(int ret) ...@@ -351,6 +445,11 @@ static void CLI_WriteDoneFile(int ret)
} }
} }
PHY_DRIVE_INFO* CLI_PhyDrvInfo(void)
{
return g_CLI_PhyDrvInfo;
}
/* /*
* Ventoy2Disk.exe VTOYCLI { /I | /U } { /Drive:F: | /PhyDrive:1 } /GPT /NoSB /R:4096 /NoUSBCheck * Ventoy2Disk.exe VTOYCLI { /I | /U } { /Drive:F: | /PhyDrive:1 } /GPT /NoSB /R:4096 /NoUSBCheck
* *
...@@ -364,7 +463,7 @@ int VentoyCLIMain(int argc, char** argv) ...@@ -364,7 +463,7 @@ int VentoyCLIMain(int argc, char** argv)
DeleteFileA(VENTOY_CLI_PERCENT); DeleteFileA(VENTOY_CLI_PERCENT);
DeleteFileA(VENTOY_CLI_DONE); DeleteFileA(VENTOY_CLI_DONE);
pDrvInfo = (PHY_DRIVE_INFO*)malloc(sizeof(PHY_DRIVE_INFO)); g_CLI_PhyDrvInfo = pDrvInfo = (PHY_DRIVE_INFO*)malloc(sizeof(PHY_DRIVE_INFO));
if (!pDrvInfo) if (!pDrvInfo)
{ {
goto end; goto end;
...@@ -388,8 +487,17 @@ int VentoyCLIMain(int argc, char** argv) ...@@ -388,8 +487,17 @@ int VentoyCLIMain(int argc, char** argv)
if (CliCfg.op == 0) if (CliCfg.op == 0)
{ {
if (CliCfg.NonDest)
{
ret = Ventoy_CLI_NonDestInstall(pDrvInfo, &CliCfg);
}
else
{
AlertSuppressInit();
SetAlertPromptHookEnable(TRUE);
ret = Ventoy_CLI_Install(pDrvInfo, &CliCfg); ret = Ventoy_CLI_Install(pDrvInfo, &CliCfg);
} }
}
else else
{ {
if (pDrvInfo->VentoyVersion[0] == 0) if (pDrvInfo->VentoyVersion[0] == 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment