From 5dcdfa71953b24ac2cbfef9eb5ed008234537197 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Tue, 29 Sep 2020 22:07:03 +0200 Subject: [PATCH] Make sure that the URL begins with a HTTP(S) prefix + updated README file. --- .gitignore | 1 + README.md | 2 ++ res/common.rc | 8 ++++---- src/head.c | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 4c7473d..6e46005 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +/*.html /bin /obj diff --git a/README.md b/README.md index f807644..5eb33f1 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,8 @@ Some options can be configured via the launcher executable's [STRINGTABLE](https The Java download URL that will ne suggested, if **no** suitable JRE could be detected on the machine. If not specified, wes suggest downloading OpenJDK as provided by the [AdoptOpenJDK](https://adoptopenjdk.net/) project. + *Hint:* The URL must begin with a `http://` or `https://` prefix; otherwise the URL will be ignored! + (This option only applies to the “registry” variant of Launch5j) *Note:* We use the convention that the default resource string value `"?"` is used to represent an “undefined” value, because resource strings cannot be empty. You can replace the default value as needed! diff --git a/res/common.rc b/res/common.rc index 0bf6cdc..9040139 100644 --- a/res/common.rc +++ b/res/common.rc @@ -49,8 +49,8 @@ END ///////////////////////////////////////////////////////////////////////////// VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,2,0,0 - PRODUCTVERSION 0,2,0,0 + FILEVERSION 0,3,0,0 + PRODUCTVERSION 0,3,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x3L @@ -67,8 +67,8 @@ BEGIN BEGIN VALUE "ProductName", "Launch5j" VALUE "FileDescription", "Launch5j" - VALUE "ProductVersion", "0.2.0" - VALUE "FileVersion", "0.2.0" + VALUE "ProductVersion", "0.3.0" + VALUE "FileVersion", "0.3.0" VALUE "InternalName", "Launch5j" VALUE "OriginalFilename", "launch5j.exe" VALUE "LegalCopyright", "Created by LoRd_MuldeR " diff --git a/src/head.c b/src/head.c index d53be47..92ab10b 100644 --- a/src/head.c +++ b/src/head.c @@ -856,6 +856,8 @@ static BOOL wait_for_process_ready(const HWND hwnd, const HANDLE process_handle, /* Message box */ /* ======================================================================== */ +#define IS_HTTP_URL(STR) (NOT_EMPTY(STR) && ((wcsnicmp((STR), L"http://", 7U) == 0) || (wcsnicmp((STR), L"https://", 8U) == 0))) + static const wchar_t *describe_system_error(const DWORD error_code) { const wchar_t *error_test = NULL, *buffer = NULL; @@ -902,7 +904,7 @@ static void show_jre_download_notice(const HINSTANCE hinstance, const HWND hwnd, : awprintf(L"%u.%u", req_version_comp[0U], req_version_comp[1U])); if(version_str) { - const wchar_t *const jre_download_ptr = AVAILABLE(jre_download_link) ? jre_download_link : JRE_DOWNLOAD_LINK_DEFAULT; + const wchar_t *const jre_download_ptr = IS_HTTP_URL(jre_download_link) ? jre_download_link : JRE_DOWNLOAD_LINK_DEFAULT; const int result = (required_bitness == 0U) ? show_message_format(hwnd, MB_ICONWARNING | MB_OKCANCEL | MB_TOPMOST, title, L"This application requires the Java Runtime Environment, version %ls, or a compatible newer version.\n\n"