]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Fix an issue when install some Lite Windows version with special file name.
authorlongpanda <admin@ventoy.net>
Sat, 7 Aug 2021 02:55:41 +0000 (10:55 +0800)
committerlongpanda <admin@ventoy.net>
Sat, 7 Aug 2021 02:55:41 +0000 (10:55 +0800)
We need to wrap the file name in quotation marks when use imdisk to mount the iso file.

INSTALL/ventoy/vtoyjump32.exe
INSTALL/ventoy/vtoyjump64.exe
vtoyjump/vtoyjump/vtoyjump.c

index 0bd00292cd4573e8b64f1f94d5e6884ef890cf07..6cc493453a7703e716985e7f73e310fb93d44bc7 100644 (file)
Binary files a/INSTALL/ventoy/vtoyjump32.exe and b/INSTALL/ventoy/vtoyjump32.exe differ
index 8ec830feac9ad1624bf1ee0b444bb452c8cb0e80..eb7639b272de5171170ed6c3c792541a84f047d5 100644 (file)
Binary files a/INSTALL/ventoy/vtoyjump64.exe and b/INSTALL/ventoy/vtoyjump64.exe differ
index d539888fbceb1a633f7c1368ac51da3576792011..1936143a1f865a7e6a268ab066df4390830b5be0 100644 (file)
@@ -772,23 +772,13 @@ int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
        HANDLE hDrive;\r
        CHAR PhyPath[MAX_PATH];\r
        WCHAR PhyPathW[MAX_PATH];\r
-       STARTUPINFOA Si;\r
        PROCESS_INFORMATION Pi;\r
        GET_LENGTH_INFORMATION LengthInfo;\r
 \r
        Log("VentoyMountISOByImdisk %s", IsoPath);\r
 \r
        sprintf_s(PhyPath, sizeof(PhyPath), "\\\\.\\PhysicalDrive%d", PhyDrive);\r
-    if (IsUTF8Encode(PhyPath))\r
-    {\r
-        Utf8ToUtf16(PhyPath, PhyPathW);\r
-        hDrive = CreateFileW(PhyPathW, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);\r
-    }\r
-    else\r
-    {\r
-        hDrive = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);\r
-    }\r
-    \r
+    hDrive = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);\r
        if (hDrive == INVALID_HANDLE_VALUE)\r
        {\r
                Log("Could not open the disk<%s>, error:%u", PhyPath, GetLastError());\r
@@ -832,16 +822,33 @@ int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
                        rc = 0;\r
 \r
                        Letter = GetMountLogicalDrive();\r
-            sprintf_s(PhyPath, sizeof(PhyPath), "ventoy\\imdisk.exe -a -o ro -f %s -m %C:", IsoPath, Letter);\r
+            sprintf_s(PhyPath, sizeof(PhyPath), "ventoy\\imdisk.exe -a -o ro -f \"%s\" -m %C:", IsoPath, Letter);\r
+            Log("mount iso to %C: use imdisk cmd <%s>", Letter, PhyPath);\r
 \r
-                       Log("mount iso to %C: use imdisk cmd <%s>", Letter, PhyPath);\r
+            if (IsUTF8Encode(IsoPath))\r
+            {\r
+                STARTUPINFOW Si;\r
+                GetStartupInfoW(&Si);\r
+                Si.dwFlags |= STARTF_USESHOWWINDOW;\r
+                Si.wShowWindow = SW_HIDE;\r
 \r
-            GetStartupInfoA(&Si);\r
+                Utf8ToUtf16(PhyPath, PhyPathW);\r
+                CreateProcessW(NULL, PhyPathW, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);\r
 \r
-            Si.dwFlags |= STARTF_USESHOWWINDOW;\r
-            Si.wShowWindow = SW_HIDE;\r
+                Log("This is UTF8 encoding");\r
+            }\r
+            else\r
+            {\r
+                STARTUPINFOA Si;\r
+                GetStartupInfoA(&Si);\r
+                Si.dwFlags |= STARTF_USESHOWWINDOW;\r
+                Si.wShowWindow = SW_HIDE;\r
+\r
+                CreateProcessA(NULL, PhyPath, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);\r
+\r
+                Log("This is ANSI encoding");\r
+            }\r
 \r
-                       CreateProcessA(NULL, PhyPath, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);\r
                        WaitForSingleObject(Pi.hProcess, INFINITE);\r
                }\r
        }\r
@@ -1529,7 +1536,12 @@ int main(int argc, char **argv)
         }\r
     }\r
 \r
-    Log("######## VentoyJump [%d] ##########", id);\r
+#ifdef VTOY_32\r
+    Log("######## VentoyJump 32bit [%d] ##########", id);\r
+#else\r
+    Log("######## VentoyJump 64bit [%d] ##########", id);\r
+#endif\r
+\r
     Log("argc = %d", argc);\r
     for (i = 0; i < argc; i++)\r
     {\r
@@ -1611,7 +1623,12 @@ int main(int argc, char **argv)
     \r
     Log("Now launch <%s> ...", LunchFile);\r
 \r
-    //sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");\r
+    if (g_os_param_reserved[0] == 4)\r
+    {\r
+        Log("Open cmd for debug ...");\r
+        sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");\r
+    }\r
+\r
     CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);\r
 \r
     for (i = 0; rc && i < 1800; i++)\r