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
0c310c5b
Commit
0c310c5b
authored
Sep 13, 2022
by
longpanda
Browse files
Make injection plugin available in WIMBOOT mode. (#1834)
parent
c81b4980
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
0 deletions
+72
-0
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
+63
-0
vtoyjump/vtoyjump/vtoyjump.h
vtoyjump/vtoyjump/vtoyjump.h
+9
-0
No files found.
INSTALL/ventoy/vtoyjump32.exe
View file @
0c310c5b
No preview for this file type
INSTALL/ventoy/vtoyjump64.exe
View file @
0c310c5b
No preview for this file type
vtoyjump/vtoyjump/vtoyjump.c
View file @
0c310c5b
...
...
@@ -36,6 +36,7 @@ static ventoy_guid g_ventoy_guid = VENTOY_GUID;
static
HANDLE
g_vtoylog_mutex
=
NULL
;
static
HANDLE
g_vtoyins_mutex
=
NULL
;
static
INT
g_winpeshl_ini_updated
=
0
;
static
DWORD
g_vtoy_disk_drive
;
static
CHAR
g_prog_full_path
[
MAX_PATH
];
...
...
@@ -51,6 +52,8 @@ static CHAR g_prog_name[MAX_PATH];
#define VTOY_AUTO_FILE "X:\\_vtoy_auto_install"
#define WINPESHL_INI "X:\\Windows\\system32\\winpeshl.ini"
#define LOG_FILE "X:\\Windows\\system32\\ventoy.log"
#define MUTEX_LOCK(hmutex) if (hmutex != NULL) LockStatus = WaitForSingleObject(hmutex, INFINITE)
#define MUTEX_UNLOCK(hmutex) if (hmutex != NULL && WAIT_OBJECT_0 == LockStatus) ReleaseMutex(hmutex)
...
...
@@ -1962,6 +1965,31 @@ static BOOL CheckVentoyDisk(DWORD DiskNum)
return
FALSE
;
}
static
int
GetWinpeshlIniFileAttr
(
WinpeshlIniAttr
*
pAttr
)
{
HANDLE
hFile
;
SYSTEMTIME
systime
;
hFile
=
CreateFileA
(
WINPESHL_INI
,
FILE_READ_EA
,
FILE_SHARE_READ
,
0
,
OPEN_EXISTING
,
0
,
0
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
Log
(
"Could not open the file<%s>, error:%u"
,
WINPESHL_INI
,
GetLastError
());
return
1
;
}
pAttr
->
FileSize
=
(
INT
)
GetFileSize
(
hFile
,
NULL
);
GetFileTime
(
hFile
,
&
pAttr
->
CreateTime
,
&
pAttr
->
LastAccessTime
,
&
pAttr
->
LastWriteTime
);
FileTimeToSystemTime
(
&
pAttr
->
LastWriteTime
,
&
systime
);
Log
(
"Winpeshl.ini size:%d LastWriteTime:<%04u/%02u/%02u %02u:%02u:%02u.%03u>"
,
pAttr
->
FileSize
,
systime
.
wYear
,
systime
.
wMonth
,
systime
.
wDay
,
systime
.
wHour
,
systime
.
wMinute
,
systime
.
wSecond
,
systime
.
wMilliseconds
);
CloseHandle
(
hFile
);
return
0
;
}
static
int
VentoyHook
(
ventoy_os_param
*
param
)
{
...
...
@@ -1984,6 +2012,8 @@ static int VentoyHook(ventoy_os_param *param)
Log
(
"VentoyHook Path:<%s>"
,
param
->
vtoy_img_path
);
g_winpeshl_ini_updated
=
0
;
if
(
IsUTF8Encode
(
param
->
vtoy_img_path
))
{
Log
(
"This file is UTF8 encoding"
);
...
...
@@ -2180,9 +2210,35 @@ static int VentoyHook(ventoy_os_param *param)
sprintf_s
(
IsoPath
,
sizeof
(
IsoPath
),
"%C:%s"
,
VtoyLetter
,
g_windows_data
.
injection_archive
);
if
(
IsFileExist
(
"%s"
,
IsoPath
))
{
int
rc1
=
-
1
,
rc2
=
-
1
;
WinpeshlIniAttr
Attr1
,
Attr2
;
memset
(
&
Attr1
,
0
,
sizeof
(
Attr1
));
memset
(
&
Attr2
,
0
,
sizeof
(
Attr2
));
Log
(
"decompress injection archive %s..."
,
IsoPath
);
if
(
IsFileExist
(
WINPESHL_INI
))
{
rc1
=
GetWinpeshlIniFileAttr
(
&
Attr1
);
}
DecompressInjectionArchive
(
IsoPath
,
VtoyDiskNum
);
if
(
IsFileExist
(
WINPESHL_INI
))
{
rc2
=
GetWinpeshlIniFileAttr
(
&
Attr2
);
if
(
rc1
==
rc2
&&
rc1
==
0
)
{
if
(
Attr1
.
FileSize
!=
Attr2
.
FileSize
||
Attr1
.
LastWriteTime
.
dwHighDateTime
!=
Attr2
.
LastWriteTime
.
dwHighDateTime
||
Attr1
.
LastWriteTime
.
dwLowDateTime
!=
Attr2
.
LastWriteTime
.
dwLowDateTime
)
{
Log
(
"winpeshl.ini file updated"
);
g_winpeshl_ini_updated
=
1
;
}
}
}
if
(
IsFileExist
(
"%s"
,
AUTO_RUN_BAT
))
{
HANDLE
hOut
;
...
...
@@ -2441,6 +2497,7 @@ int real_main(int argc, char **argv)
{
int
i
=
0
;
int
rc
=
0
;
int
wimboot
=
0
;
CHAR
NewFile
[
MAX_PATH
];
CHAR
LunchFile
[
MAX_PATH
];
CHAR
CallParam
[
1024
]
=
{
0
};
...
...
@@ -2468,6 +2525,7 @@ int real_main(int argc, char **argv)
if
(
strstr
(
argv
[
0
],
"vtoyjump.exe"
))
{
wimboot
=
1
;
rc
=
VentoyJumpWimboot
(
argc
,
argv
,
LunchFile
);
}
else
...
...
@@ -2490,6 +2548,11 @@ int real_main(int argc, char **argv)
sprintf_s
(
LunchFile
,
sizeof
(
LunchFile
),
"%s"
,
g_prog_full_path
);
Log
(
"Final lunchFile is <%s>"
,
LunchFile
);
}
else
if
(
wimboot
&&
g_winpeshl_ini_updated
)
{
sprintf_s
(
LunchFile
,
MAX_PATH
,
"X:
\\
Windows
\\
system32
\\
winpeshl.exe"
);
Log
(
"Recall winpeshl.exe"
);
}
else
{
Log
(
"We don't need to recover original <%s>"
,
g_prog_name
);
...
...
vtoyjump/vtoyjump/vtoyjump.h
View file @
0c310c5b
...
...
@@ -152,6 +152,14 @@ typedef struct VTOY_GPT_INFO
#pragma pack()
typedef
struct
WinpeshlIniAttr
{
INT
FileSize
;
FILETIME
CreateTime
;
FILETIME
LastAccessTime
;
FILETIME
LastWriteTime
;
}
WinpeshlIniAttr
;
typedef
struct
VarDiskInfo
{
...
...
@@ -187,4 +195,5 @@ int unxz(unsigned char *in, int in_size,
unsigned
char
*
out
,
int
*
in_used
,
void
(
*
error
)(
char
*
x
));
#endif
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