feat: EXE launcher no longer reject Java 11 and later.

This commit is contained in:
huanghongxun
2021-05-24 21:39:16 +08:00
parent 2f17552b2c
commit 61597cb83d
6 changed files with 7 additions and 8 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.exe filter=lfs diff=lfs merge=lfs -text

View File

@@ -23,7 +23,7 @@
<ProjectGuid>{672B1019-E741-4C0D-A986-627E2ACE157B}</ProjectGuid> <ProjectGuid>{672B1019-E741-4C0D-A986-627E2ACE157B}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>HMCL</RootNamespace> <RootNamespace>HMCL</RootNamespace>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<ProjectName>HMCLauncher</ProjectName> <ProjectName>HMCLauncher</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -49,7 +49,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View File

@@ -9,7 +9,7 @@ const LPCWSTR JRE_OLD = L"SOFTWARE\\JavaSoft\\Java Runtime Environment";
const LPCWSTR JDK_NEW = L"SOFTWARE\\JavaSoft\\JDK"; const LPCWSTR JDK_NEW = L"SOFTWARE\\JavaSoft\\JDK";
const LPCWSTR JRE_NEW = L"SOFTWARE\\JavaSoft\\JRE"; const LPCWSTR JRE_NEW = L"SOFTWARE\\JavaSoft\\JRE";
bool oldJavaFound = false, newJavaFound = false; bool oldJavaFound = false;
bool FindJavaByRegistryKey(HKEY rootKey, LPCWSTR subKey, std::wstring & path) bool FindJavaByRegistryKey(HKEY rootKey, LPCWSTR subKey, std::wstring & path)
{ {
@@ -58,8 +58,6 @@ bool FindJavaByRegistryKey(HKEY rootKey, LPCWSTR subKey, std::wstring & path)
{ {
if (Version(javaVer) < JAVA_8) if (Version(javaVer) < JAVA_8)
oldJavaFound = true; oldJavaFound = true;
else if (JAVA_11 <= Version(javaVer))
newJavaFound = true;
else else
flag = true; flag = true;
} }

View File

@@ -6,7 +6,7 @@
using namespace std; using namespace std;
Version J8(TEXT("8")), J11(TEXT("11")); Version J8(TEXT("8"));
void RawLaunchJVM(const wstring &javaPath, const wstring &jarPath) void RawLaunchJVM(const wstring &javaPath, const wstring &jarPath)
{ {
@@ -20,7 +20,7 @@ void LaunchJVM(const wstring &javaPath, const wstring &jarPath)
if (!MyGetFileVersionInfo(javaPath, javaVersion)) if (!MyGetFileVersionInfo(javaPath, javaVersion))
return; return;
if (J8 <= javaVersion && javaVersion < J11) if (J8 <= javaVersion)
{ {
RawLaunchJVM(javaPath, jarPath); RawLaunchJVM(javaPath, jarPath);
} }

View File

@@ -77,7 +77,7 @@ bool FindFirstFileExists(LPCWSTR lpPath, DWORD dwFilter)
bool GetArch(bool & is64Bit) bool GetArch(bool & is64Bit)
{ {
#if _WIN64 #if _WIN64
isWindows64bit = true; is64Bit = true;
return true; return true;
#elif _WIN32 #elif _WIN32
typedef BOOL(WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); typedef BOOL(WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);