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
683101ae
Commit
683101ae
authored
Dec 31, 2022
by
longpanda
Browse files
vtoyjump optimization.
Signed-off-by:
longpanda
<
admin@ventoy.net
>
parent
0e968e26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
30 deletions
+109
-30
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
+109
-30
No files found.
INSTALL/ventoy/vtoyjump32.exe
View file @
683101ae
No preview for this file type
INSTALL/ventoy/vtoyjump64.exe
View file @
683101ae
No preview for this file type
vtoyjump/vtoyjump/vtoyjump.c
View file @
683101ae
...
@@ -2022,36 +2022,19 @@ static int ProcessUnattendedInstallation(const char *script, DWORD PhyDrive)
...
@@ -2022,36 +2022,19 @@ static int ProcessUnattendedInstallation(const char *script, DWORD PhyDrive)
return
0
;
return
0
;
}
}
static
int
Windows11Bypass
(
const
char
*
isofile
,
const
char
MntLetter
,
UINT8
Check
,
UINT8
NRO
)
static
int
VentoyGetFileVersion
(
const
CHAR
*
FilePath
,
UINT16
*
pMajor
,
UINT16
*
pMinor
,
UINT16
*
pBuild
,
UINT16
*
pRevision
)
{
{
int
R
et
=
1
;
int
r
et
=
1
;
DWORD
dwHandle
;
DWORD
dwHandle
;
DWORD
dwSize
;
DWORD
dwSize
;
DWORD
dwValue
=
1
;
UINT
VerLen
=
0
;
UINT
VerLen
=
0
;
CHAR
*
Buffer
=
NULL
;
CHAR
*
Buffer
=
NULL
;
VS_FIXEDFILEINFO
*
VerInfo
=
NULL
;
VS_FIXEDFILEINFO
*
VerInfo
=
NULL
;
CHAR
CheckFile
[
MAX_PATH
];
UINT16
Major
,
Minor
,
Build
,
Revision
;
UINT16
Major
,
Minor
,
Build
,
Revision
;
Log
(
"Windows11Bypass for <%s> %C: Check:%u NRO:%u"
,
isofile
,
MntLetter
,
Check
,
NRO
);
Log
(
"Get file version for <%s>"
,
FilePath
);
if
(
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
boot.wim"
,
MntLetter
)
||
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
compatresources.dll"
,
MntLetter
))
{
Log
(
"boot.wim/compatresources.dll not exist, this is not a windows install media."
);
goto
End
;
}
if
(
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
install.wim"
,
MntLetter
)
&&
dwSize
=
GetFileVersionInfoSizeA
(
FilePath
,
&
dwHandle
);
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
install.esd"
,
MntLetter
))
{
Log
(
"install.wim/install.esd not exist, this is not a windows install media."
);
goto
End
;
}
sprintf_s
(
CheckFile
,
sizeof
(
CheckFile
),
"%C:
\\
sources
\\
compatresources.dll"
,
MntLetter
);
dwSize
=
GetFileVersionInfoSizeA
(
CheckFile
,
&
dwHandle
);
if
(
0
==
dwSize
)
if
(
0
==
dwSize
)
{
{
Log
(
"Failed to get file version info size: %u"
,
LASTERR
);
Log
(
"Failed to get file version info size: %u"
,
LASTERR
);
...
@@ -2061,10 +2044,11 @@ static int Windows11Bypass(const char *isofile, const char MntLetter, UINT8 Chec
...
@@ -2061,10 +2044,11 @@ static int Windows11Bypass(const char *isofile, const char MntLetter, UINT8 Chec
Buffer
=
malloc
(
dwSize
);
Buffer
=
malloc
(
dwSize
);
if
(
!
Buffer
)
if
(
!
Buffer
)
{
{
Log
(
"malloc failed %u"
,
dwSize
);
goto
End
;
goto
End
;
}
}
if
(
FALSE
==
GetFileVersionInfoA
(
Check
File
,
dwHandle
,
dwSize
,
Buffer
))
if
(
FALSE
==
GetFileVersionInfoA
(
File
Path
,
dwHandle
,
dwSize
,
Buffer
))
{
{
Log
(
"Failed to get file version info : %u"
,
LASTERR
);
Log
(
"Failed to get file version info : %u"
,
LASTERR
);
goto
End
;
goto
End
;
...
@@ -2086,18 +2070,117 @@ static int Windows11Bypass(const char *isofile, const char MntLetter, UINT8 Chec
...
@@ -2086,18 +2070,117 @@ static int Windows11Bypass(const char *isofile, const char MntLetter, UINT8 Chec
Major
=
11
;
Major
=
11
;
}
}
if
(
Major
!=
11
)
if
(
p
Major
)
{
{
Log
(
"This is not Windows 11, not need to bypass."
,
Major
);
*
pMajor
=
Major
;
goto
End
;
}
if
(
pMinor
)
{
*
pMinor
=
Minor
;
}
if
(
pBuild
)
{
*
pBuild
=
Build
;
}
}
if
(
pRevision
)
{
*
pRevision
=
Revision
;
}
ret
=
0
;
}
}
else
{
Log
(
"Invalid verinfo signature 0x%x"
,
VerInfo
->
dwSignature
);
}
}
else
{
Log
(
"VerQueryValueA failed %u"
,
LASTERR
);
}
}
//Now we really need to bypass windows 11 check. create registry
End:
if
(
Buffer
)
{
free
(
Buffer
);
}
return
ret
;
}
static
BOOL
VentoyIsNeedBypass
(
const
char
*
isofile
,
const
char
MntLetter
)
{
UINT16
Major
;
BOOL
bRet
=
FALSE
;
CHAR
CheckFile
[
MAX_PATH
];
if
(
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
install.wim"
,
MntLetter
)
&&
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
install.esd"
,
MntLetter
))
{
Log
(
"install.wim/install.esd not exist, this is not a windows install media."
);
goto
End
;
}
if
(
FALSE
==
IsFileExist
(
"%C:
\\
sources
\\
boot.wim"
,
MntLetter
))
{
Log
(
"boot.wim not exist, this is not a windows install media."
);
goto
End
;
}
if
(
IsFileExist
(
"%C:
\\
sources
\\
compatresources.dll"
,
MntLetter
))
{
sprintf_s
(
CheckFile
,
sizeof
(
CheckFile
),
"%C:
\\
sources
\\
compatresources.dll"
,
MntLetter
);
}
else
if
(
IsFileExist
(
"%C:
\\
setup.exe"
,
MntLetter
))
{
sprintf_s
(
CheckFile
,
sizeof
(
CheckFile
),
"%C:
\\
setup.exe"
,
MntLetter
);
}
else
if
(
IsFileExist
(
"X:
\\
setup.exe"
))
{
sprintf_s
(
CheckFile
,
sizeof
(
CheckFile
),
"X:
\\
setup.exe"
);
}
else
{
Log
(
"No Check file found"
);
goto
End
;
}
if
(
VentoyGetFileVersion
(
CheckFile
,
&
Major
,
NULL
,
NULL
,
NULL
))
{
goto
End
;
}
if
(
Major
>=
11
)
{
Log
(
"Enable for Windows 11 %u"
,
Major
);
bRet
=
TRUE
;
}
else
{
Log
(
"This is not Windows 11, not need to bypass."
,
Major
);
}
End:
return
bRet
;
}
static
int
Windows11Bypass
(
const
char
*
isofile
,
const
char
MntLetter
,
UINT8
Check
,
UINT8
NRO
)
{
int
Ret
=
1
;
HKEY
hKey
=
NULL
;
HKEY
hKey
=
NULL
;
HKEY
hSubKey
=
NULL
;
HKEY
hSubKey
=
NULL
;
LSTATUS
Status
;
LSTATUS
Status
;
DWORD
dwValue
;
DWORD
dwSize
;
Log
(
"Windows11Bypass for <%s> %C: Check:%u NRO:%u"
,
isofile
,
MntLetter
,
Check
,
NRO
);
if
(
!
VentoyIsNeedBypass
(
isofile
,
MntLetter
))
{
goto
End
;
}
//Now we really need to bypass windows 11 check. create registry
if
(
Check
)
if
(
Check
)
{
{
...
@@ -2149,10 +2232,6 @@ static int Windows11Bypass(const char *isofile, const char MntLetter, UINT8 Chec
...
@@ -2149,10 +2232,6 @@ static int Windows11Bypass(const char *isofile, const char MntLetter, UINT8 Chec
Ret
=
0
;
Ret
=
0
;
End:
End:
if
(
Buffer
)
{
free
(
Buffer
);
}
return
Ret
;
return
Ret
;
}
}
...
...
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