mirror of https://github.com/ventoy/Ventoy.git
Fix an issue when install some Lite Windows version with special file name.
We need to wrap the file name in quotation marks when use imdisk to mount the iso file.
This commit is contained in:
parent
659ac1cfe3
commit
56a1543f7d
Binary file not shown.
Binary file not shown.
|
@ -772,23 +772,13 @@ int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
|
||||||
HANDLE hDrive;
|
HANDLE hDrive;
|
||||||
CHAR PhyPath[MAX_PATH];
|
CHAR PhyPath[MAX_PATH];
|
||||||
WCHAR PhyPathW[MAX_PATH];
|
WCHAR PhyPathW[MAX_PATH];
|
||||||
STARTUPINFOA Si;
|
|
||||||
PROCESS_INFORMATION Pi;
|
PROCESS_INFORMATION Pi;
|
||||||
GET_LENGTH_INFORMATION LengthInfo;
|
GET_LENGTH_INFORMATION LengthInfo;
|
||||||
|
|
||||||
Log("VentoyMountISOByImdisk %s", IsoPath);
|
Log("VentoyMountISOByImdisk %s", IsoPath);
|
||||||
|
|
||||||
sprintf_s(PhyPath, sizeof(PhyPath), "\\\\.\\PhysicalDrive%d", PhyDrive);
|
sprintf_s(PhyPath, sizeof(PhyPath), "\\\\.\\PhysicalDrive%d", PhyDrive);
|
||||||
if (IsUTF8Encode(PhyPath))
|
|
||||||
{
|
|
||||||
Utf8ToUtf16(PhyPath, PhyPathW);
|
|
||||||
hDrive = CreateFileW(PhyPathW, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hDrive = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
hDrive = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
if (hDrive == INVALID_HANDLE_VALUE)
|
if (hDrive == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
Log("Could not open the disk<%s>, error:%u", PhyPath, GetLastError());
|
Log("Could not open the disk<%s>, error:%u", PhyPath, GetLastError());
|
||||||
|
@ -832,16 +822,33 @@ int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
Letter = GetMountLogicalDrive();
|
Letter = GetMountLogicalDrive();
|
||||||
sprintf_s(PhyPath, sizeof(PhyPath), "ventoy\\imdisk.exe -a -o ro -f %s -m %C:", IsoPath, Letter);
|
sprintf_s(PhyPath, sizeof(PhyPath), "ventoy\\imdisk.exe -a -o ro -f \"%s\" -m %C:", IsoPath, Letter);
|
||||||
|
|
||||||
Log("mount iso to %C: use imdisk cmd <%s>", Letter, PhyPath);
|
Log("mount iso to %C: use imdisk cmd <%s>", Letter, PhyPath);
|
||||||
|
|
||||||
GetStartupInfoA(&Si);
|
if (IsUTF8Encode(IsoPath))
|
||||||
|
{
|
||||||
|
STARTUPINFOW Si;
|
||||||
|
GetStartupInfoW(&Si);
|
||||||
|
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||||
|
Si.wShowWindow = SW_HIDE;
|
||||||
|
|
||||||
|
Utf8ToUtf16(PhyPath, PhyPathW);
|
||||||
|
CreateProcessW(NULL, PhyPathW, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
||||||
|
|
||||||
|
Log("This is UTF8 encoding");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
STARTUPINFOA Si;
|
||||||
|
GetStartupInfoA(&Si);
|
||||||
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||||
Si.wShowWindow = SW_HIDE;
|
Si.wShowWindow = SW_HIDE;
|
||||||
|
|
||||||
CreateProcessA(NULL, PhyPath, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
CreateProcessA(NULL, PhyPath, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
||||||
|
|
||||||
|
Log("This is ANSI encoding");
|
||||||
|
}
|
||||||
|
|
||||||
WaitForSingleObject(Pi.hProcess, INFINITE);
|
WaitForSingleObject(Pi.hProcess, INFINITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1529,7 +1536,12 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log("######## VentoyJump [%d] ##########", id);
|
#ifdef VTOY_32
|
||||||
|
Log("######## VentoyJump 32bit [%d] ##########", id);
|
||||||
|
#else
|
||||||
|
Log("######## VentoyJump 64bit [%d] ##########", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
Log("argc = %d", argc);
|
Log("argc = %d", argc);
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
@ -1611,7 +1623,12 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
Log("Now launch <%s> ...", LunchFile);
|
Log("Now launch <%s> ...", LunchFile);
|
||||||
|
|
||||||
//sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
|
if (g_os_param_reserved[0] == 4)
|
||||||
|
{
|
||||||
|
Log("Open cmd for debug ...");
|
||||||
|
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
|
||||||
|
}
|
||||||
|
|
||||||
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
||||||
|
|
||||||
for (i = 0; rc && i < 1800; i++)
|
for (i = 0; rc && i < 1800; i++)
|
||||||
|
|
Loading…
Reference in New Issue