Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
686ed110
Commit
686ed110
authored
Jan 05, 2023
by
longpanda
Browse files
Optimization for Lenovo Recovery Image (USB unplug process)
parent
7fe4762f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletion
+67
-1
INSTALL/ventoy/vtoyjump32.exe
INSTALL/ventoy/vtoyjump32.exe
+0
-0
INSTALL/ventoy/vtoyjump64.exe
INSTALL/ventoy/vtoyjump64.exe
+0
-0
vtoyjump/vtoyjump/vtoyjump.c
vtoyjump/vtoyjump/vtoyjump.c
+67
-1
No files found.
INSTALL/ventoy/vtoyjump32.exe
View file @
686ed110
No preview for this file type
INSTALL/ventoy/vtoyjump64.exe
View file @
686ed110
No preview for this file type
vtoyjump/vtoyjump/vtoyjump.c
View file @
686ed110
...
@@ -2362,6 +2362,9 @@ static BOOL VentoyIsLenovoRecovery(CHAR *IsoPath, CHAR *VTLRIPath)
...
@@ -2362,6 +2362,9 @@ static BOOL VentoyIsLenovoRecovery(CHAR *IsoPath, CHAR *VTLRIPath)
static
int
MountVTLRI
(
CHAR
*
ImgPath
,
DWORD
PhyDrive
)
static
int
MountVTLRI
(
CHAR
*
ImgPath
,
DWORD
PhyDrive
)
{
{
STARTUPINFOA
Si
;
PROCESS_INFORMATION
Pi
;
CHAR
Cmdline
[
256
];
CHAR
ImDiskPath
[
256
];
CHAR
ImDiskPath
[
256
];
Log
(
"MountVTLRI <%s> %u"
,
ImgPath
,
PhyDrive
);
Log
(
"MountVTLRI <%s> %u"
,
ImgPath
,
PhyDrive
);
...
@@ -2370,6 +2373,18 @@ static int MountVTLRI(CHAR *ImgPath, DWORD PhyDrive)
...
@@ -2370,6 +2373,18 @@ static int MountVTLRI(CHAR *ImgPath, DWORD PhyDrive)
VentoyRunImdisk
(
"VTLRI"
,
ImgPath
,
ImDiskPath
,
"ro,rem"
);
VentoyRunImdisk
(
"VTLRI"
,
ImgPath
,
ImDiskPath
,
"ro,rem"
);
CopyFileA
(
g_prog_full_path
,
"ventoy
\\
VTLRISRV.exe"
,
FALSE
);
sprintf_s
(
Cmdline
,
sizeof
(
Cmdline
),
"ventoy
\\
VTLRISRV.exe VTLRI_SRV %C Z"
,
ImgPath
[
0
]);
GetStartupInfoA
(
&
Si
);
Si
.
dwFlags
|=
STARTF_USESHOWWINDOW
;
Si
.
wShowWindow
=
SW_HIDE
;
CreateProcessA
(
NULL
,
Cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
Si
,
&
Pi
);
Log
(
"Process cmdline <%s>"
,
Cmdline
);
return
0
;
return
0
;
}
}
...
@@ -2939,6 +2954,52 @@ static int vtoy_remove_duplicate_file(char *File)
...
@@ -2939,6 +2954,52 @@ static int vtoy_remove_duplicate_file(char *File)
return
0
;
return
0
;
}
}
static
int
VTLRI_ServiceMain
(
int
argc
,
char
**
argv
)
{
int
n
=
0
;
DWORD
Err
;
BOOL
bRet
=
TRUE
;
CHAR
Drive
[
16
];
CHAR
FsType
[
64
];
CHAR
Cmdline
[
256
];
PROCESS_INFORMATION
Pi
;
STARTUPINFOA
Si
;
//XXX.exe VTLRI_SRV D Z
Log
(
"VTLRI_ServiceMain start %s %s %s ..."
,
argv
[
0
],
argv
[
1
],
argv
[
2
]);
sprintf_s
(
Drive
,
sizeof
(
Drive
),
"%C:
\\
"
,
argv
[
2
][
0
]);
while
(
n
<
3
)
{
bRet
=
GetVolumeInformationA
(
Drive
,
NULL
,
0
,
NULL
,
NULL
,
NULL
,
FsType
,
sizeof
(
FsType
));
if
(
bRet
)
{
Sleep
(
400
);
}
else
{
Err
=
LASTERR
;
if
(
Err
==
ERROR_PATH_NOT_FOUND
)
{
Log
(
"%s not found"
,
Drive
);
n
++
;
}
}
}
sprintf_s
(
Cmdline
,
sizeof
(
Cmdline
),
"ventoy
\\
imdisk.exe -d -m %C:"
,
argv
[
3
][
0
]);
Log
(
"Remove disk by <%s>"
,
Cmdline
);
GetStartupInfoA
(
&
Si
);
Si
.
dwFlags
|=
STARTF_USESHOWWINDOW
;
Si
.
wShowWindow
=
SW_HIDE
;
CreateProcessA
(
NULL
,
Cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
Si
,
&
Pi
);
WaitForSingleObject
(
Pi
.
hProcess
,
INFINITE
);
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
int
i
;
int
i
;
...
@@ -2953,6 +3014,11 @@ int main(int argc, char **argv)
...
@@ -2953,6 +3014,11 @@ int main(int argc, char **argv)
Log
(
"######## VentoyJump %dbit ##########"
,
g_system_bit
);
Log
(
"######## VentoyJump %dbit ##########"
,
g_system_bit
);
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"VTLRI_SRV"
)
==
0
)
{
return
VTLRI_ServiceMain
(
argc
,
argv
);
}
GetCurrentDirectoryA
(
sizeof
(
CurDir
),
CurDir
);
GetCurrentDirectoryA
(
sizeof
(
CurDir
),
CurDir
);
Log
(
"Current directory is <%s>"
,
CurDir
);
Log
(
"Current directory is <%s>"
,
CurDir
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment