Updated launch4j
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2015 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2015 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
2
launch4j/head_src/consolehead/.gitignore
vendored
2
launch4j/head_src/consolehead/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
/consolehead.exe
|
||||
/consolehead.layout
|
||||
@@ -1,30 +1,28 @@
|
||||
# Project: consolehead
|
||||
# Makefile created by Dev-C++ 4.9.9.2
|
||||
# Makefile created by Dev-C++ 5.7.1
|
||||
|
||||
CPP = g++.exe
|
||||
CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
RES =
|
||||
OBJ = ../../head/consolehead.o ../../head/head.o $(RES)
|
||||
LINKOBJ = ../../head/consolehead.o ../../head/head.o $(RES)
|
||||
LIBS = -L"C:/Dev-Cpp/lib" -n -s
|
||||
INCS = -I"C:/Dev-Cpp/include"
|
||||
CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
|
||||
BIN = consolehead.exe
|
||||
CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3
|
||||
CFLAGS = $(INCS) -fexpensive-optimizations -O3
|
||||
RM = rm -f
|
||||
CPP = g++.exe
|
||||
CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
OBJ = ../../head/consolehead.o ../../head/head.o
|
||||
LINKOBJ = ../../head/consolehead.o ../../head/head.o
|
||||
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -n -s
|
||||
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include"
|
||||
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++"
|
||||
BIN = consolehead.exe
|
||||
CXXFLAGS = $(CXXINCS) -Os
|
||||
CFLAGS = $(INCS) -Os
|
||||
RM = rm.exe -f
|
||||
|
||||
.PHONY: all all-before all-after clean clean-custom
|
||||
|
||||
all: all-before consolehead.exe all-after
|
||||
|
||||
all: all-before $(BIN) all-after
|
||||
|
||||
clean: clean-custom
|
||||
${RM} $(OBJ) $(BIN)
|
||||
|
||||
$(BIN): $(OBJ)
|
||||
# $(CC) $(LINKOBJ) -o "consolehead.exe" $(LIBS)
|
||||
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
|
||||
|
||||
../../head/consolehead.o: consolehead.c
|
||||
$(CC) -c consolehead.c -o ../../head/consolehead.o $(CFLAGS)
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../resource.h"
|
||||
#include "../head.h"
|
||||
|
||||
extern FILE* hLog;
|
||||
|
||||
BOOL restartOnCrash = FALSE;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
setConsoleFlag();
|
||||
LPTSTR cmdLine = GetCommandLine();
|
||||
|
||||
if (*cmdLine == '"')
|
||||
{
|
||||
if (*(cmdLine = strchr(cmdLine + 1, '"') + 1))
|
||||
{
|
||||
cmdLine++;
|
||||
}
|
||||
}
|
||||
else if ((cmdLine = strchr(cmdLine, ' ')) != NULL)
|
||||
{
|
||||
cmdLine++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdLine = "";
|
||||
}
|
||||
|
||||
int result = prepare(cmdLine);
|
||||
|
||||
if (result == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
char errMsg[BIG_STR] = {0};
|
||||
loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg);
|
||||
msgBox(errMsg);
|
||||
closeLogFile();
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (result != TRUE)
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
restartOnCrash = loadBool(RESTART_ON_CRASH);
|
||||
DWORD dwExitCode;
|
||||
|
||||
do
|
||||
{
|
||||
dwExitCode = 0;
|
||||
|
||||
if (!execute(TRUE, &dwExitCode))
|
||||
{
|
||||
signalError();
|
||||
break;
|
||||
}
|
||||
|
||||
if (restartOnCrash && dwExitCode != 0)
|
||||
{
|
||||
debug("Exit code:\t%d, restarting the application!\n", dwExitCode);
|
||||
}
|
||||
} while (restartOnCrash && dwExitCode != 0);
|
||||
|
||||
debug("Exit code:\t%d\n", dwExitCode);
|
||||
closeLogFile();
|
||||
return (int) dwExitCode;
|
||||
}
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../resource.h"
|
||||
#include "../head.h"
|
||||
|
||||
extern FILE* hLog;
|
||||
|
||||
BOOL restartOnCrash = FALSE;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
setConsoleFlag();
|
||||
LPTSTR cmdLine = GetCommandLine();
|
||||
|
||||
if (*cmdLine == '"')
|
||||
{
|
||||
if (*(cmdLine = strchr(cmdLine + 1, '"') + 1))
|
||||
{
|
||||
cmdLine++;
|
||||
}
|
||||
}
|
||||
else if ((cmdLine = strchr(cmdLine, ' ')) != NULL)
|
||||
{
|
||||
cmdLine++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdLine = "";
|
||||
}
|
||||
|
||||
int result = prepare(cmdLine, FALSE);
|
||||
|
||||
if (result == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
char errMsg[BIG_STR] = {0};
|
||||
loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg);
|
||||
msgBox(errMsg);
|
||||
closeLogFile();
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (result != TRUE)
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
restartOnCrash = loadBool(RESTART_ON_CRASH);
|
||||
DWORD dwExitCode;
|
||||
|
||||
do
|
||||
{
|
||||
dwExitCode = 0;
|
||||
|
||||
if (!execute(TRUE, &dwExitCode))
|
||||
{
|
||||
signalError();
|
||||
break;
|
||||
}
|
||||
|
||||
if (restartOnCrash && dwExitCode != 0)
|
||||
{
|
||||
debug("Exit code:\t%d, restarting the application!\n", dwExitCode);
|
||||
}
|
||||
} while (restartOnCrash && dwExitCode != 0);
|
||||
|
||||
debug("Exit code:\t%d\n", dwExitCode);
|
||||
closeLogFile();
|
||||
return (int) dwExitCode;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ FileName=consolehead.dev
|
||||
Name=consolehead
|
||||
UnitCount=4
|
||||
Type=1
|
||||
Ver=1
|
||||
Ver=2
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
@@ -22,12 +22,14 @@ OverrideOutputName=consolehead.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
UseCustomMakefile=1
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=Makefile.win
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000001001000000100
|
||||
CompilerSettings=000000d000000000000001000
|
||||
LogOutput=
|
||||
LogOutputEnabled=0
|
||||
|
||||
[Unit1]
|
||||
FileName=consolehead.c
|
||||
@@ -47,7 +49,7 @@ Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileVersion=0.1.1.1
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
@@ -56,6 +58,7 @@ OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
SyncProduct=0
|
||||
|
||||
[Unit2]
|
||||
FileName=..\resource.h
|
||||
|
||||
2
launch4j/head_src/guihead/.gitignore
vendored
2
launch4j/head_src/guihead/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
/guihead.exe
|
||||
/guihead.layout
|
||||
@@ -1,30 +1,28 @@
|
||||
# Project: guihead
|
||||
# Makefile created by Dev-C++ 4.9.9.2
|
||||
# Makefile created by Dev-C++ 5.7.1
|
||||
|
||||
CPP = g++.exe
|
||||
CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
RES =
|
||||
OBJ = ../../head/guihead.o ../../head/head.o $(RES)
|
||||
LINKOBJ = ../../head/guihead.o ../../head/head.o $(RES)
|
||||
LIBS = -L"C:/Dev-Cpp/lib" -mwindows -n -s
|
||||
INCS = -I"C:/Dev-Cpp/include"
|
||||
CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
|
||||
BIN = guihead.exe
|
||||
CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3
|
||||
CFLAGS = $(INCS) -fexpensive-optimizations -O3
|
||||
RM = rm -f
|
||||
CPP = g++.exe
|
||||
CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
OBJ = ../../head/guihead.o ../../head/head.o
|
||||
LINKOBJ = ../../head/guihead.o ../../head/head.o
|
||||
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -n -s
|
||||
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include"
|
||||
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++"
|
||||
BIN = guihead.exe
|
||||
CXXFLAGS = $(CXXINCS) -Os
|
||||
CFLAGS = $(INCS) -Os
|
||||
RM = rm.exe -f
|
||||
|
||||
.PHONY: all all-before all-after clean clean-custom
|
||||
|
||||
all: all-before guihead.exe all-after
|
||||
|
||||
all: all-before $(BIN) all-after
|
||||
|
||||
clean: clean-custom
|
||||
${RM} $(OBJ) $(BIN)
|
||||
|
||||
$(BIN): $(OBJ)
|
||||
# $(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS)
|
||||
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
|
||||
|
||||
../../head/guihead.o: guihead.c
|
||||
$(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS)
|
||||
|
||||
@@ -1,241 +1,241 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2015 Grzegorz Kowal
|
||||
Sylvain Mina (single instance patch)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../resource.h"
|
||||
#include "../head.h"
|
||||
#include "guihead.h"
|
||||
|
||||
extern FILE* hLog;
|
||||
extern PROCESS_INFORMATION processInformation;
|
||||
|
||||
HWND hWnd;
|
||||
DWORD dwExitCode = 0;
|
||||
BOOL stayAlive = FALSE;
|
||||
BOOL splash = FALSE;
|
||||
BOOL splashTimeoutErr;
|
||||
BOOL waitForWindow;
|
||||
BOOL restartOnCrash = FALSE;
|
||||
int splashTimeout = DEFAULT_SPLASH_TIMEOUT;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
int result = prepare(lpCmdLine);
|
||||
|
||||
if (result == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
HWND handle = getInstanceWindow();
|
||||
ShowWindow(handle, SW_SHOW);
|
||||
SetForegroundWindow(handle);
|
||||
closeLogFile();
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (result != TRUE)
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
splash = loadBool(SHOW_SPLASH)
|
||||
&& strstr(lpCmdLine, "--l4j-no-splash") == NULL;
|
||||
restartOnCrash = loadBool(RESTART_ON_CRASH);
|
||||
|
||||
// if we should restart on crash, we must also stay alive to check for crashes
|
||||
stayAlive = restartOnCrash ||
|
||||
(loadBool(GUI_HEADER_STAYS_ALIVE)
|
||||
&& strstr(lpCmdLine, "--l4j-dont-wait") == NULL);
|
||||
|
||||
if (splash || stayAlive)
|
||||
{
|
||||
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "",
|
||||
WS_POPUP | SS_BITMAP,
|
||||
0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
|
||||
if (splash)
|
||||
{
|
||||
char timeout[10] = {0};
|
||||
if (loadString(SPLASH_TIMEOUT, timeout))
|
||||
{
|
||||
splashTimeout = atoi(timeout);
|
||||
if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT)
|
||||
{
|
||||
splashTimeout = DEFAULT_SPLASH_TIMEOUT;
|
||||
}
|
||||
}
|
||||
splashTimeout = splashTimeout * 1000; // to millis
|
||||
splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR)
|
||||
&& strstr(lpCmdLine, "--l4j-no-splash-err") == NULL;
|
||||
waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW);
|
||||
HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image
|
||||
MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image
|
||||
IMAGE_BITMAP, // type of image
|
||||
0, // desired width
|
||||
0, // desired height
|
||||
LR_DEFAULTSIZE);
|
||||
if (hImage == NULL)
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage);
|
||||
RECT rect;
|
||||
GetWindowRect(hWnd, &rect);
|
||||
int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
|
||||
int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
|
||||
SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow (hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (splash || stayAlive)
|
||||
{
|
||||
if (!SetTimer (hWnd, ID_TIMER, TIMER_PROC_INTERVAL, TimerProc))
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!execute(FALSE, &dwExitCode))
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(splash || stayAlive))
|
||||
{
|
||||
debug("Exit code:\t0\n");
|
||||
closeProcessHandles();
|
||||
closeLogFile();
|
||||
return 0;
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (restartOnCrash && dwExitCode != 0)
|
||||
{
|
||||
debug("Exit code:\t%d, restarting the application!\n", dwExitCode);
|
||||
}
|
||||
|
||||
closeProcessHandles();
|
||||
} while (restartOnCrash && dwExitCode != 0);
|
||||
|
||||
debug("Exit code:\t%d\n", dwExitCode);
|
||||
closeLogFile();
|
||||
return dwExitCode;
|
||||
}
|
||||
|
||||
HWND getInstanceWindow()
|
||||
{
|
||||
char windowTitle[STR];
|
||||
char instWindowTitle[STR] = {0};
|
||||
if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle))
|
||||
{
|
||||
HWND handle = FindWindowEx(NULL, NULL, NULL, NULL);
|
||||
while (handle != NULL)
|
||||
{
|
||||
GetWindowText(handle, windowTitle, STR - 1);
|
||||
if (strstr(windowTitle, instWindowTitle) != NULL)
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
handle = FindWindowEx(NULL, handle, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
DWORD processId;
|
||||
GetWindowThreadProcessId(hwnd, &processId);
|
||||
if (processInformation.dwProcessId == processId)
|
||||
{
|
||||
LONG styles = GetWindowLong(hwnd, GWL_STYLE);
|
||||
if ((styles & WS_VISIBLE) != 0)
|
||||
{
|
||||
splash = FALSE;
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID CALLBACK TimerProc(
|
||||
HWND hwnd, // handle of window for timer messages
|
||||
UINT uMsg, // WM_TIMER message
|
||||
UINT idEvent, // timer identifier
|
||||
DWORD dwTime) // current system time
|
||||
{
|
||||
if (splash)
|
||||
{
|
||||
if (splashTimeout == 0)
|
||||
{
|
||||
splash = FALSE;
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
if (waitForWindow && splashTimeoutErr)
|
||||
{
|
||||
KillTimer(hwnd, ID_TIMER);
|
||||
signalError();
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
splashTimeout -= TIMER_PROC_INTERVAL;
|
||||
if (waitForWindow)
|
||||
{
|
||||
EnumWindows(enumwndfn, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetExitCodeProcess(processInformation.hProcess, &dwExitCode);
|
||||
if (dwExitCode != STILL_ACTIVE
|
||||
|| !(splash || stayAlive))
|
||||
{
|
||||
KillTimer(hWnd, ID_TIMER);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2015 Grzegorz Kowal
|
||||
Sylvain Mina (single instance patch)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../resource.h"
|
||||
#include "../head.h"
|
||||
#include "guihead.h"
|
||||
|
||||
extern FILE* hLog;
|
||||
extern PROCESS_INFORMATION processInformation;
|
||||
|
||||
HWND hWnd;
|
||||
DWORD dwExitCode = 0;
|
||||
BOOL stayAlive = FALSE;
|
||||
BOOL splash = FALSE;
|
||||
BOOL splashTimeoutErr;
|
||||
BOOL waitForWindow;
|
||||
BOOL restartOnCrash = FALSE;
|
||||
int splashTimeout = DEFAULT_SPLASH_TIMEOUT;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
int result = prepare(lpCmdLine, FALSE);
|
||||
|
||||
if (result == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
HWND handle = getInstanceWindow();
|
||||
ShowWindow(handle, SW_SHOW);
|
||||
SetForegroundWindow(handle);
|
||||
closeLogFile();
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (result != TRUE)
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
splash = loadBool(SHOW_SPLASH)
|
||||
&& strstr(lpCmdLine, "--l4j-no-splash") == NULL;
|
||||
restartOnCrash = loadBool(RESTART_ON_CRASH);
|
||||
|
||||
// if we should restart on crash, we must also stay alive to check for crashes
|
||||
stayAlive = restartOnCrash ||
|
||||
(loadBool(GUI_HEADER_STAYS_ALIVE)
|
||||
&& strstr(lpCmdLine, "--l4j-dont-wait") == NULL);
|
||||
|
||||
if (splash || stayAlive)
|
||||
{
|
||||
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "",
|
||||
WS_POPUP | SS_BITMAP,
|
||||
0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
|
||||
if (splash)
|
||||
{
|
||||
char timeout[10] = {0};
|
||||
if (loadString(SPLASH_TIMEOUT, timeout))
|
||||
{
|
||||
splashTimeout = atoi(timeout);
|
||||
if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT)
|
||||
{
|
||||
splashTimeout = DEFAULT_SPLASH_TIMEOUT;
|
||||
}
|
||||
}
|
||||
splashTimeout = splashTimeout * 1000; // to millis
|
||||
splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR)
|
||||
&& strstr(lpCmdLine, "--l4j-no-splash-err") == NULL;
|
||||
waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW);
|
||||
HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image
|
||||
MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image
|
||||
IMAGE_BITMAP, // type of image
|
||||
0, // desired width
|
||||
0, // desired height
|
||||
LR_DEFAULTSIZE);
|
||||
if (hImage == NULL)
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage);
|
||||
RECT rect;
|
||||
GetWindowRect(hWnd, &rect);
|
||||
int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
|
||||
int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
|
||||
SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow (hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (splash || stayAlive)
|
||||
{
|
||||
if (!SetTimer (hWnd, ID_TIMER, TIMER_PROC_INTERVAL, TimerProc))
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!execute(FALSE, &dwExitCode))
|
||||
{
|
||||
signalError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(splash || stayAlive))
|
||||
{
|
||||
debug("Exit code:\t0\n");
|
||||
closeProcessHandles();
|
||||
closeLogFile();
|
||||
return 0;
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (restartOnCrash && dwExitCode != 0)
|
||||
{
|
||||
debug("Exit code:\t%d, restarting the application!\n", dwExitCode);
|
||||
}
|
||||
|
||||
closeProcessHandles();
|
||||
} while (restartOnCrash && dwExitCode != 0);
|
||||
|
||||
debug("Exit code:\t%d\n", dwExitCode);
|
||||
closeLogFile();
|
||||
return dwExitCode;
|
||||
}
|
||||
|
||||
HWND getInstanceWindow()
|
||||
{
|
||||
char windowTitle[STR];
|
||||
char instWindowTitle[STR] = {0};
|
||||
if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle))
|
||||
{
|
||||
HWND handle = FindWindowEx(NULL, NULL, NULL, NULL);
|
||||
while (handle != NULL)
|
||||
{
|
||||
GetWindowText(handle, windowTitle, STR - 1);
|
||||
if (strstr(windowTitle, instWindowTitle) != NULL)
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
handle = FindWindowEx(NULL, handle, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
DWORD processId;
|
||||
GetWindowThreadProcessId(hwnd, &processId);
|
||||
if (processInformation.dwProcessId == processId)
|
||||
{
|
||||
LONG styles = GetWindowLong(hwnd, GWL_STYLE);
|
||||
if ((styles & WS_VISIBLE) != 0)
|
||||
{
|
||||
splash = FALSE;
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID CALLBACK TimerProc(
|
||||
HWND hwnd, // handle of window for timer messages
|
||||
UINT uMsg, // WM_TIMER message
|
||||
UINT idEvent, // timer identifier
|
||||
DWORD dwTime) // current system time
|
||||
{
|
||||
if (splash)
|
||||
{
|
||||
if (splashTimeout == 0)
|
||||
{
|
||||
splash = FALSE;
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
if (waitForWindow && splashTimeoutErr)
|
||||
{
|
||||
KillTimer(hwnd, ID_TIMER);
|
||||
signalError();
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
splashTimeout -= TIMER_PROC_INTERVAL;
|
||||
if (waitForWindow)
|
||||
{
|
||||
EnumWindows(enumwndfn, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetExitCodeProcess(processInformation.hProcess, &dwExitCode);
|
||||
if (dwExitCode != STILL_ACTIVE
|
||||
|| !(splash || stayAlive))
|
||||
{
|
||||
KillTimer(hWnd, ID_TIMER);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ FileName=guihead.dev
|
||||
Name=guihead
|
||||
UnitCount=5
|
||||
Type=0
|
||||
Ver=1
|
||||
Ver=2
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
@@ -22,12 +22,14 @@ OverrideOutputName=guihead.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
UseCustomMakefile=1
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=Makefile.win
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000001001000000100
|
||||
CompilerSettings=000000d000000000000001000
|
||||
LogOutput=
|
||||
LogOutputEnabled=0
|
||||
|
||||
[Unit1]
|
||||
FileName=guihead.c
|
||||
@@ -66,6 +68,7 @@ OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
SyncProduct=0
|
||||
|
||||
[Unit4]
|
||||
FileName=..\head.h
|
||||
@@ -95,7 +98,7 @@ Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
BuildCmd=$(CC) -c head.c -o ../../head/head.o $(CFLAGS)
|
||||
|
||||
[Unit5]
|
||||
FileName=..\resource.h
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define ID_TIMER 1
|
||||
#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */
|
||||
#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */
|
||||
#define TIMER_PROC_INTERVAL 100 /* interval in ms between calls to EnumWindows */
|
||||
|
||||
HWND getInstanceWindow();
|
||||
|
||||
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam);
|
||||
|
||||
VOID CALLBACK TimerProc(
|
||||
HWND hwnd, // handle of window for timer messages
|
||||
UINT uMsg, // WM_TIMER message
|
||||
UINT idEvent, // timer identifier
|
||||
DWORD dwTime // current system time
|
||||
);
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define ID_TIMER 1
|
||||
#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */
|
||||
#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */
|
||||
#define TIMER_PROC_INTERVAL 100 /* interval in ms between calls to EnumWindows */
|
||||
|
||||
HWND getInstanceWindow();
|
||||
|
||||
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam);
|
||||
|
||||
VOID CALLBACK TimerProc(
|
||||
HWND hwnd, // handle of window for timer messages
|
||||
UINT uMsg, // WM_TIMER message
|
||||
UINT idEvent, // timer identifier
|
||||
DWORD dwTime // current system time
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2015 Grzegorz Kowal,
|
||||
Copyright (c) 2004, 2019 Grzegorz Kowal,
|
||||
Ian Roberts (jdk preference patch)
|
||||
Sylvain Mina (single instance patch)
|
||||
|
||||
@@ -37,6 +37,7 @@ FILE* hLog;
|
||||
BOOL debugAll = FALSE;
|
||||
BOOL console = FALSE;
|
||||
BOOL wow64 = FALSE;
|
||||
BOOL jniHeader = FALSE;
|
||||
char oldPwd[_MAX_PATH];
|
||||
|
||||
PROCESS_INFORMATION processInformation;
|
||||
@@ -51,16 +52,15 @@ struct
|
||||
|
||||
struct
|
||||
{
|
||||
int runtimeBits;
|
||||
int foundJava;
|
||||
BOOL bundledJreAsFallback;
|
||||
BOOL requiresJdk;
|
||||
BOOL requires64Bit;
|
||||
BOOL corruptedJreFound;
|
||||
char originalJavaMinVer[STR];
|
||||
char originalJavaMaxVer[STR];
|
||||
char javaMinVer[STR];
|
||||
char javaMaxVer[STR];
|
||||
char foundJavaVer[STR];
|
||||
char foundJavaKey[_MAX_PATH];
|
||||
char foundJavaHome[_MAX_PATH];
|
||||
} search;
|
||||
|
||||
@@ -71,8 +71,9 @@ struct
|
||||
char args[MAX_ARGS];
|
||||
} launcher;
|
||||
|
||||
BOOL initGlobals()
|
||||
BOOL initGlobals(BOOL jni)
|
||||
{
|
||||
jniHeader = jni;
|
||||
hModule = GetModuleHandle(NULL);
|
||||
|
||||
if (hModule == NULL)
|
||||
@@ -82,9 +83,9 @@ BOOL initGlobals()
|
||||
|
||||
strcpy(error.title, LAUNCH4j);
|
||||
|
||||
search.runtimeBits = INIT_RUNTIME_BITS;
|
||||
search.foundJava = NO_JAVA_FOUND;
|
||||
search.bundledJreAsFallback = FALSE;
|
||||
search.foundJava = JAVA_NOT_FOUND;
|
||||
search.requiresJdk = FALSE;
|
||||
search.requires64Bit = FALSE;
|
||||
search.corruptedJreFound = FALSE;
|
||||
|
||||
return TRUE;
|
||||
@@ -141,7 +142,7 @@ void setWow64Flag()
|
||||
fnIsWow64Process(GetCurrentProcess(), &wow64);
|
||||
}
|
||||
|
||||
debug("WOW64:\t\t%s\n", wow64 ? "yes" : "no");
|
||||
debug("WOW64:\t\t%s\n", wow64 ? "Yes" : "No");
|
||||
}
|
||||
|
||||
void setConsoleFlag()
|
||||
@@ -464,28 +465,23 @@ void regSearch(const char* keyName, const int searchType)
|
||||
debug("Check:\t\t%s\n", fullKeyName);
|
||||
formatJavaVersion(version, originalVersion);
|
||||
|
||||
if (strcmp(version, search.javaMinVer) >= 0
|
||||
&& (!*search.javaMaxVer || strcmp(version, search.javaMaxVer) <= 0)
|
||||
&& strcmp(version, search.foundJavaVer) > 0
|
||||
&& isJavaHomeValid(fullKeyName, searchType))
|
||||
if (isJavaVersionGood(version, wow64KeyMask)
|
||||
&& isRegistryJavaHomeValid(fullKeyName, searchType))
|
||||
{
|
||||
strcpy(search.foundJavaVer, version);
|
||||
strcpy(search.foundJavaKey, fullKeyName);
|
||||
search.foundJava = searchType;
|
||||
debug("Match:\t\t%s\n", version);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("Ignore:\t\t%s\n", version);
|
||||
break;
|
||||
}
|
||||
|
||||
debug("Ignore:\t\t%s\n", version);
|
||||
versionSize = _MAX_PATH;
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
BOOL isJavaHomeValid(const char* keyName, const int searchType)
|
||||
BOOL isRegistryJavaHomeValid(const char* keyName, const int searchType)
|
||||
{
|
||||
BOOL valid = FALSE;
|
||||
HKEY hKey;
|
||||
@@ -531,6 +527,7 @@ BOOL isLauncherPathValid(const char* path)
|
||||
{
|
||||
struct _stat statBuf;
|
||||
char launcherPath[_MAX_PATH] = {0};
|
||||
char javacPath[_MAX_PATH] = {0};
|
||||
BOOL result = FALSE;
|
||||
|
||||
if (*path)
|
||||
@@ -538,6 +535,15 @@ BOOL isLauncherPathValid(const char* path)
|
||||
strcpy(launcherPath, path);
|
||||
appendLauncher(launcherPath);
|
||||
result = _stat(launcherPath, &statBuf) == 0;
|
||||
debug("Check launcher:\t%s %s\n", launcherPath, result ? "(OK)" : "(not found)");
|
||||
|
||||
if (result && search.requiresJdk)
|
||||
{
|
||||
strcpy(javacPath, path);
|
||||
appendPath(javacPath, "bin\\javac.exe");
|
||||
result = _stat(javacPath, &statBuf) == 0;
|
||||
debug("Check javac:\t%s %s\n", javacPath, result ? "(OK)" : "(not found)");
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -546,120 +552,73 @@ BOOL isLauncherPathValid(const char* path)
|
||||
}
|
||||
}
|
||||
|
||||
debug("Check launcher:\t%s %s\n", launcherPath, result ? "(OK)" : "(not found)");
|
||||
return result;
|
||||
}
|
||||
|
||||
void regSearchWow(const char* keyName, const int searchType)
|
||||
void regSearchWow(const char* keyName)
|
||||
{
|
||||
if (search.runtimeBits == INIT_RUNTIME_BITS)
|
||||
if (search.foundJava != JAVA_NOT_FOUND)
|
||||
{
|
||||
search.runtimeBits = loadInt(RUNTIME_BITS);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (search.runtimeBits)
|
||||
if (wow64 && !jniHeader)
|
||||
{
|
||||
case USE_64_BIT_RUNTIME:
|
||||
if (wow64)
|
||||
{
|
||||
regSearch(keyName, searchType | KEY_WOW64_64KEY);
|
||||
}
|
||||
break;
|
||||
|
||||
case USE_64_AND_32_BIT_RUNTIME:
|
||||
if (wow64)
|
||||
{
|
||||
regSearch(keyName, searchType | KEY_WOW64_64KEY);
|
||||
regSearch(keyName, JAVA_FOUND | KEY_WOW64_64KEY);
|
||||
|
||||
if ((search.foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((search.foundJava & KEY_WOW64_64KEY) != JAVA_NOT_FOUND)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
regSearch(keyName, searchType);
|
||||
break;
|
||||
|
||||
case USE_32_AND_64_BIT_RUNTIME:
|
||||
regSearch(keyName, searchType);
|
||||
|
||||
if (search.foundJava != NO_JAVA_FOUND
|
||||
&& (search.foundJava & KEY_WOW64_64KEY) == NO_JAVA_FOUND)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (wow64)
|
||||
{
|
||||
regSearch(keyName, searchType | KEY_WOW64_64KEY);
|
||||
}
|
||||
break;
|
||||
|
||||
case USE_32_BIT_RUNTIME:
|
||||
regSearch(keyName, searchType);
|
||||
break;
|
||||
|
||||
default:
|
||||
debug("Runtime bits:\tFailed to load.\n");
|
||||
break;
|
||||
if (!search.requires64Bit)
|
||||
{
|
||||
regSearch(keyName, JAVA_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName,
|
||||
const int jdkPreference)
|
||||
BOOL findRegistryJavaHome(char* path)
|
||||
{
|
||||
if (jdkPreference == JDK_ONLY || jdkPreference == PREFER_JDK)
|
||||
{
|
||||
regSearchWow(sdkKeyName, FOUND_SDK);
|
||||
if (jdkPreference != JDK_ONLY)
|
||||
{
|
||||
regSearchWow(jreKeyName, FOUND_JRE);
|
||||
}
|
||||
debugAll("findRegistryJavaHome()\n");
|
||||
if (!search.requiresJdk)
|
||||
{
|
||||
regSearchWow("SOFTWARE\\JavaSoft\\Java Runtime Environment");
|
||||
}
|
||||
else
|
||||
{
|
||||
// jdkPreference == JRE_ONLY or PREFER_JRE
|
||||
regSearchWow(jreKeyName, FOUND_JRE);
|
||||
if (jdkPreference != JRE_ONLY)
|
||||
{
|
||||
regSearchWow(sdkKeyName, FOUND_SDK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL findJavaHome(char* path, const int jdkPreference)
|
||||
{
|
||||
debugAll("findJavaHome()\n");
|
||||
regSearchJreSdk("SOFTWARE\\JavaSoft\\Java Runtime Environment",
|
||||
"SOFTWARE\\JavaSoft\\Java Development Kit",
|
||||
jdkPreference);
|
||||
regSearchWow("SOFTWARE\\JavaSoft\\Java Development Kit");
|
||||
|
||||
// Java 9 support
|
||||
regSearchJreSdk("SOFTWARE\\JavaSoft\\JRE",
|
||||
"SOFTWARE\\JavaSoft\\JDK",
|
||||
jdkPreference);
|
||||
if (!search.requiresJdk)
|
||||
{
|
||||
regSearchWow("SOFTWARE\\JavaSoft\\JRE");
|
||||
}
|
||||
regSearchWow("SOFTWARE\\JavaSoft\\JDK");
|
||||
|
||||
// IBM Java 1.8
|
||||
if (search.foundJava == NO_JAVA_FOUND)
|
||||
if (search.foundJava == JAVA_NOT_FOUND)
|
||||
{
|
||||
regSearchJreSdk("SOFTWARE\\IBM\\Java Runtime Environment",
|
||||
"SOFTWARE\\IBM\\Java Development Kit",
|
||||
jdkPreference);
|
||||
if (!search.requiresJdk)
|
||||
{
|
||||
regSearchWow("SOFTWARE\\IBM\\Java Runtime Environment");
|
||||
}
|
||||
regSearchWow("SOFTWARE\\IBM\\Java Development Kit");
|
||||
}
|
||||
|
||||
// IBM Java 1.7 and earlier
|
||||
if (search.foundJava == NO_JAVA_FOUND)
|
||||
if (search.foundJava == JAVA_NOT_FOUND)
|
||||
{
|
||||
regSearchJreSdk("SOFTWARE\\IBM\\Java2 Runtime Environment",
|
||||
"SOFTWARE\\IBM\\Java Development Kit",
|
||||
jdkPreference);
|
||||
if (!search.requiresJdk)
|
||||
{
|
||||
regSearchWow("SOFTWARE\\IBM\\Java2 Runtime Environment");
|
||||
}
|
||||
regSearchWow("SOFTWARE\\IBM\\Java Development Kit");
|
||||
}
|
||||
|
||||
if (search.foundJava != NO_JAVA_FOUND)
|
||||
if (search.foundJava != JAVA_NOT_FOUND)
|
||||
{
|
||||
strcpy(path, search.foundJavaHome);
|
||||
debug("Runtime used:\t%s (%s-bit)\n", search.foundJavaVer,
|
||||
(search.foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND ? "64" : "32");
|
||||
(search.foundJava & KEY_WOW64_64KEY) != JAVA_NOT_FOUND ? "64" : "32");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -911,51 +870,90 @@ void setWorkingDirectory(const char *exePath, const int pathLen)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL bundledJreSearch(const char *exePath, const int pathLen)
|
||||
void removeChar(char *src, const char toRemove)
|
||||
{
|
||||
debugAll("bundledJreSearch()\n");
|
||||
char tmpPath[_MAX_PATH] = {0};
|
||||
BOOL is64BitJre = loadBool(BUNDLED_JRE_64_BIT);
|
||||
char* dst = src;
|
||||
|
||||
if (!wow64 && is64BitJre)
|
||||
do
|
||||
{
|
||||
if (*src != toRemove)
|
||||
{
|
||||
*dst++ = *src;
|
||||
}
|
||||
} while (*src++ != 0);
|
||||
}
|
||||
|
||||
BOOL pathJreSearch(const char *exePath, const int pathLen)
|
||||
{
|
||||
debugAll("pathJreSearch()\n");
|
||||
char jrePathSpec[_MAX_PATH] = {0};
|
||||
|
||||
if (!wow64 && search.requires64Bit)
|
||||
{
|
||||
debug("Bundled JRE:\tCannot use 64-bit runtime on 32-bit OS.\n");
|
||||
debug("JRE:\t\tCannot use 64-bit runtime on 32-bit OS.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (loadString(JRE_PATH, tmpPath))
|
||||
if (loadString(JRE_PATH, jrePathSpec))
|
||||
{
|
||||
char jrePath[MAX_ARGS] = {0};
|
||||
expandVars(jrePath, tmpPath, exePath, pathLen);
|
||||
debug("Bundled JRE:\t%s\n", jrePath);
|
||||
expandVars(jrePath, jrePathSpec, exePath, pathLen);
|
||||
debug("JRE paths:\t%s\n", jrePath);
|
||||
char* path = strtok(jrePath, ";");
|
||||
|
||||
while (path != NULL)
|
||||
{
|
||||
char pathNoBin[_MAX_PATH] = {0};
|
||||
char *lastBackslash = strrchr(path, '\\');
|
||||
char *lastSlash = strrchr(path, '/');
|
||||
|
||||
if (jrePath[0] == '\\' || jrePath[1] == ':')
|
||||
{
|
||||
// Absolute
|
||||
strcpy(launcher.cmd, jrePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Relative
|
||||
strncpy(launcher.cmd, exePath, pathLen);
|
||||
appendPath(launcher.cmd, jrePath);
|
||||
}
|
||||
if (lastBackslash != NULL && strcasecmp(lastBackslash, "\\bin") == 0)
|
||||
{
|
||||
strncpy(pathNoBin, path, lastBackslash - path);
|
||||
}
|
||||
else if (lastSlash != NULL && strcasecmp(lastSlash, "/bin") == 0)
|
||||
{
|
||||
strncpy(pathNoBin, path, lastSlash - path);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(pathNoBin, path);
|
||||
}
|
||||
|
||||
removeChar(pathNoBin, '"');
|
||||
|
||||
if (isLauncherPathValid(launcher.cmd))
|
||||
{
|
||||
search.foundJava = is64BitJre ? FOUND_BUNDLED | KEY_WOW64_64KEY : FOUND_BUNDLED;
|
||||
strcpy(search.foundJavaHome, launcher.cmd);
|
||||
return TRUE;
|
||||
}
|
||||
if (*pathNoBin == '\\' || (*pathNoBin != '\0' && *(pathNoBin + 1) == ':'))
|
||||
{
|
||||
// Absolute
|
||||
strcpy(launcher.cmd, pathNoBin);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Relative
|
||||
strncpy(launcher.cmd, exePath, pathLen);
|
||||
launcher.cmd[pathLen] = 0;
|
||||
appendPath(launcher.cmd, pathNoBin);
|
||||
}
|
||||
|
||||
BOOL is64Bit;
|
||||
if (isLauncherPathValid(launcher.cmd) && isPathJavaVersionGood(launcher.cmd, &is64Bit))
|
||||
{
|
||||
search.foundJava = is64Bit ? JAVA_FOUND | KEY_WOW64_64KEY : JAVA_FOUND;
|
||||
strcpy(search.foundJavaHome, launcher.cmd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
path = strtok(NULL, ";");
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL installedJreSearch()
|
||||
BOOL registryJreSearch()
|
||||
{
|
||||
debugAll("installedJreSearch()\n");
|
||||
return *search.javaMinVer && findJavaHome(launcher.cmd, loadInt(JDK_PREFERENCE));
|
||||
debugAll("registryJreSearch()\n");
|
||||
return *search.javaMinVer && findRegistryJavaHome(launcher.cmd);
|
||||
}
|
||||
|
||||
void createJreSearchError()
|
||||
@@ -972,12 +970,9 @@ void createJreSearchError()
|
||||
strcat(error.msg, search.originalJavaMaxVer);
|
||||
}
|
||||
|
||||
if (search.runtimeBits == USE_64_BIT_RUNTIME
|
||||
|| search.runtimeBits == USE_32_BIT_RUNTIME)
|
||||
if (search.requires64Bit)
|
||||
{
|
||||
strcat(error.msg, " (");
|
||||
strcat(error.msg, search.runtimeBits == USE_64_BIT_RUNTIME ? "64" : "32");
|
||||
strcat(error.msg, "-bit)");
|
||||
strcat(error.msg, " (64-bit)");
|
||||
}
|
||||
|
||||
if (search.corruptedJreFound)
|
||||
@@ -995,7 +990,7 @@ void createJreSearchError()
|
||||
}
|
||||
else
|
||||
{
|
||||
loadString(BUNDLED_JRE_ERR, error.msg);
|
||||
loadString(JRE_NOT_FOUND_ERR, error.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1004,7 +999,10 @@ BOOL jreSearch(const char *exePath, const int pathLen)
|
||||
debugAll("jreSearch()\n");
|
||||
BOOL result = TRUE;
|
||||
|
||||
search.bundledJreAsFallback = loadBool(BUNDLED_JRE_AS_FALLBACK);
|
||||
search.requiresJdk = loadBool(REQUIRES_JDK);
|
||||
debug("Requires JDK:\t%s\n", search.requiresJdk ? "Yes" : "No");
|
||||
search.requires64Bit = loadBool(REQUIRES_64_BIT);
|
||||
debug("Requires 64-Bit: %s\n", search.requires64Bit ? "Yes" : "No");
|
||||
loadString(JAVA_MIN_VER, search.originalJavaMinVer);
|
||||
formatJavaVersion(search.javaMinVer, search.originalJavaMinVer);
|
||||
debug("Java min ver:\t%s\n", search.javaMinVer);
|
||||
@@ -1012,21 +1010,11 @@ BOOL jreSearch(const char *exePath, const int pathLen)
|
||||
formatJavaVersion(search.javaMaxVer, search.originalJavaMaxVer);
|
||||
debug("Java max ver:\t%s\n", search.javaMaxVer);
|
||||
|
||||
if (search.bundledJreAsFallback)
|
||||
if (!pathJreSearch(exePath, pathLen))
|
||||
{
|
||||
if (!installedJreSearch())
|
||||
{
|
||||
result = bundledJreSearch(exePath, pathLen);
|
||||
}
|
||||
result = registryJreSearch();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bundledJreSearch(exePath, pathLen))
|
||||
{
|
||||
result = installedJreSearch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!result)
|
||||
{
|
||||
createJreSearchError();
|
||||
@@ -1209,9 +1197,9 @@ void setCommandLineArgs(const char *lpCmdLine)
|
||||
}
|
||||
}
|
||||
|
||||
int prepare(const char *lpCmdLine)
|
||||
int prepare(const char *lpCmdLine, BOOL jni)
|
||||
{
|
||||
if (!initGlobals())
|
||||
if (!initGlobals(jni))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1230,6 +1218,7 @@ int prepare(const char *lpCmdLine)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
debug("JNI:\t\t%s\n", jniHeader ? "Yes" : "No");
|
||||
setWow64Flag();
|
||||
|
||||
// Set default error message, title and optional support web site url.
|
||||
@@ -1333,3 +1322,131 @@ const char* getLauncherArgs()
|
||||
return launcher.args;
|
||||
}
|
||||
|
||||
/* read java version output and save version string in version */
|
||||
void getVersionFromOutput(HANDLE outputRd, char *version, int versionLen, BOOL *is64Bit)
|
||||
{
|
||||
CHAR chBuf[BIG_STR] = {0}, *bptr = chBuf;
|
||||
DWORD dwRead, remain = sizeof(chBuf);
|
||||
BOOL bSuccess = FALSE;
|
||||
|
||||
while (remain > 0) {
|
||||
bSuccess = ReadFile(outputRd, bptr, remain, &dwRead, NULL);
|
||||
if (! bSuccess || dwRead == 0) break;
|
||||
bptr += dwRead;
|
||||
remain -= dwRead;
|
||||
}
|
||||
debugAll("Java version output: %s\n", chBuf);
|
||||
*version = '\0';
|
||||
const char *verStartPtr = strchr(chBuf, '"');
|
||||
if (verStartPtr == NULL)
|
||||
{
|
||||
debug("Cannot get version string: cannot find quote\n");
|
||||
return;
|
||||
}
|
||||
const char *verEndPtr = strchr(++verStartPtr, '"');
|
||||
if (verEndPtr == NULL)
|
||||
{
|
||||
debug("Cannot get version string: missing end quote\n");
|
||||
return;
|
||||
}
|
||||
size_t len = verEndPtr - verStartPtr;
|
||||
if (len >= versionLen) {
|
||||
debug("Cannot get version string: data too large\n");
|
||||
return;
|
||||
}
|
||||
memcpy(version, verStartPtr, len);
|
||||
version[len] = '\0';
|
||||
*is64Bit = strstr(chBuf, "64-Bit") != NULL || strstr(chBuf, "64-bit") != NULL;
|
||||
}
|
||||
|
||||
/* create a child process with cmdline and set stderr/stdout to outputWr */
|
||||
BOOL CreateChildProcess(char *cmdline, HANDLE outputWr)
|
||||
{
|
||||
PROCESS_INFORMATION piProcInfo;
|
||||
STARTUPINFO siStartInfo;
|
||||
BOOL bSuccess = FALSE;
|
||||
|
||||
ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
|
||||
ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
|
||||
siStartInfo.cb = sizeof(STARTUPINFO);
|
||||
siStartInfo.hStdError = outputWr;
|
||||
siStartInfo.hStdOutput = outputWr;
|
||||
siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
|
||||
|
||||
debugAll("Create process: %s\n", cmdline);
|
||||
bSuccess = CreateProcess(NULL, cmdline, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &siStartInfo, &piProcInfo);
|
||||
if (!bSuccess)
|
||||
{
|
||||
debug("Cannot create process %s\n", cmdline);
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle(piProcInfo.hProcess);
|
||||
CloseHandle(piProcInfo.hThread);
|
||||
}
|
||||
CloseHandle(outputWr);
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL isJavaVersionGood(const char *version, BOOL is64Bit)
|
||||
{
|
||||
BOOL result = (!*search.javaMinVer || strcmp(version, search.javaMinVer) >= 0)
|
||||
&& (!*search.javaMaxVer || strcmp(version, search.javaMaxVer) <= 0)
|
||||
&& (!search.requires64Bit || is64Bit)
|
||||
&& (!jniHeader || !is64Bit);
|
||||
debug("Version string: %s / %s-Bit (%s)\n", version, is64Bit ? "64" : "32", result ? "OK" : "Ignore");
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run <path>/bin/java(w) -version. Return TRUE if version is good.
|
||||
*/
|
||||
BOOL isPathJavaVersionGood(const char *path, BOOL *is64Bit)
|
||||
{
|
||||
SECURITY_ATTRIBUTES saAttr;
|
||||
HANDLE outputRd = NULL;
|
||||
HANDLE outputWr = NULL;
|
||||
|
||||
debugAll("Check Java Version: %s min=%s max=%s\n", path, search.javaMinVer, search.javaMaxVer);
|
||||
|
||||
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
saAttr.bInheritHandle = TRUE;
|
||||
saAttr.lpSecurityDescriptor = NULL;
|
||||
|
||||
// Create a pipe for the child process's STDOUT.
|
||||
if (!CreatePipe(&outputRd, &outputWr, &saAttr, 0))
|
||||
{
|
||||
debug("Cannot create pipe\n");
|
||||
return FALSE;
|
||||
}
|
||||
// Ensure the read handle to the pipe for STDOUT is not inherited.
|
||||
if (!SetHandleInformation(outputRd, HANDLE_FLAG_INHERIT, 0))
|
||||
{
|
||||
debug("Cannot set handle information\n");
|
||||
CloseHandle(outputRd);
|
||||
CloseHandle(outputWr);
|
||||
return FALSE;
|
||||
}
|
||||
// create child process
|
||||
char cmdline[MAX_ARGS] = {0};
|
||||
char launcherPath[_MAX_PATH] = {0};
|
||||
strcpy(launcherPath, path);
|
||||
appendLauncher(launcherPath);
|
||||
snprintf(cmdline, MAX_ARGS, "\"%s\" -version", launcherPath);
|
||||
if (!CreateChildProcess(cmdline, outputWr))
|
||||
{
|
||||
debug("Cannot run java(w) -version\n");
|
||||
CloseHandle(outputRd);
|
||||
return FALSE;
|
||||
}
|
||||
char version[STR] = {0}, formattedVersion[STR] = {0};
|
||||
|
||||
getVersionFromOutput(outputRd, version, sizeof(version), is64Bit);
|
||||
CloseHandle(outputRd);
|
||||
if (*version != '\0')
|
||||
{
|
||||
formatJavaVersion(formattedVersion, version);
|
||||
return isJavaVersionGood(formattedVersion, *is64Bit);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -54,25 +54,12 @@
|
||||
#include <process.h>
|
||||
|
||||
#define LAUNCH4j "Launch4j"
|
||||
#define VERSION "3.12"
|
||||
#define VERSION "3.50"
|
||||
|
||||
#define JRE_VER_MAX_DIGITS_PER_PART 3
|
||||
|
||||
#define NO_JAVA_FOUND 0
|
||||
#define FOUND_JRE 1
|
||||
#define FOUND_SDK 2
|
||||
#define FOUND_BUNDLED 4
|
||||
|
||||
#define JRE_ONLY 0
|
||||
#define PREFER_JRE 1
|
||||
#define PREFER_JDK 2
|
||||
#define JDK_ONLY 3
|
||||
|
||||
#define USE_64_BIT_RUNTIME 1
|
||||
#define USE_64_AND_32_BIT_RUNTIME 2
|
||||
#define USE_32_AND_64_BIT_RUNTIME 3
|
||||
#define USE_32_BIT_RUNTIME 4
|
||||
#define INIT_RUNTIME_BITS 9
|
||||
#define JAVA_NOT_FOUND 0
|
||||
#define JAVA_FOUND 1
|
||||
|
||||
#define KEY_WOW64_64KEY 0x0100
|
||||
|
||||
@@ -97,7 +84,7 @@
|
||||
|
||||
typedef void (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
|
||||
BOOL initGlobals();
|
||||
BOOL initGlobals(BOOL jni);
|
||||
FILE* openLogFile(const char* exePath, const int pathLen);
|
||||
void closeLogFile();
|
||||
BOOL initializeLogging(const char *lpCmdLine, const char* exePath, const int pathLen);
|
||||
@@ -110,12 +97,10 @@ BOOL regQueryValue(const char* regPath, unsigned char* buffer,
|
||||
unsigned long bufferLength);
|
||||
void formatJavaVersion(char* version, const char* originalVersion);
|
||||
void regSearch(const char* keyName, const int searchType);
|
||||
BOOL isJavaHomeValid(const char* keyName, const int searchType);
|
||||
BOOL isRegistryJavaHomeValid(const char* keyName, const int searchType);
|
||||
BOOL isLauncherPathValid(const char* path);
|
||||
void regSearchWow(const char* keyName, const int searchType);
|
||||
void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName,
|
||||
const int jdkPreference);
|
||||
BOOL findJavaHome(char* path, const int jdkPreference);
|
||||
void regSearchWow(const char* keyName);
|
||||
BOOL findRegistryJavaHome(char* path);
|
||||
int getExePath(char* exePath);
|
||||
void appendPath(char* basepath, const char* path);
|
||||
void appendLauncher(char* jrePath);
|
||||
@@ -127,8 +112,9 @@ void appendHeapSize(char *dst, const int megabytesID, const int percentID,
|
||||
void setJvmOptions(char *jvmOptions, const char *exePath);
|
||||
BOOL createMutex();
|
||||
void setWorkingDirectory(const char *exePath, const int pathLen);
|
||||
BOOL bundledJreSearch(const char *exePath, const int pathLen);
|
||||
BOOL installedJreSearch();
|
||||
void removeChar(char *src, const char toRemove);
|
||||
BOOL pathJreSearch(const char *exePath, const int pathLen);
|
||||
BOOL registryJreSearch();
|
||||
void createJreSearchError();
|
||||
BOOL jreSearch(const char *exePath, const int pathLen);
|
||||
BOOL appendToPathVar(const char* path);
|
||||
@@ -136,11 +122,15 @@ BOOL appendJreBinToPathVar();
|
||||
void setEnvironmentVariables(const char *exePath, const int pathLen);
|
||||
void setMainClassAndClassPath(const char *exePath, const int pathLen);
|
||||
void setCommandLineArgs(const char *lpCmdLine);
|
||||
int prepare(const char *lpCmdLine);
|
||||
int prepare(const char *lpCmdLine, BOOL jni);
|
||||
void closeProcessHandles();
|
||||
BOOL execute(const BOOL wait, DWORD *dwExitCode);
|
||||
const char* getJavaHome();
|
||||
const char* getMainClass();
|
||||
const char* getLauncherArgs();
|
||||
void getVersionFromOutput(HANDLE outputRd, char *version, int versionLen, BOOL *is64Bit);
|
||||
BOOL CreateChildProcess(char *cmdline, HANDLE outputWr);
|
||||
BOOL isJavaVersionGood(const char* version, BOOL is64Bit);
|
||||
BOOL isJavaPathVersionGood(const char *path, BOOL *is64Bit);
|
||||
|
||||
#endif // _LAUNCH4J_HEAD__INCLUDED_
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/jniconsolehead.exe
|
||||
/jniconsolehead.layout
|
||||
@@ -6,9 +6,9 @@ CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
OBJ = ../../head_jni_BETA/jniconsolehead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o
|
||||
LINKOBJ = ../../head_jni_BETA/jniconsolehead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o
|
||||
LIBS = -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib" -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -n -s
|
||||
INCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32"
|
||||
CXXINCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32"
|
||||
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -n -s
|
||||
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32"
|
||||
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32"
|
||||
BIN = jniconsolehead.exe
|
||||
CXXFLAGS = $(CXXINCS) -Os
|
||||
CFLAGS = $(INCS) -Os
|
||||
|
||||
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
|
||||
cmdLine = "";
|
||||
}
|
||||
|
||||
int result = prepare(cmdLine);
|
||||
int result = prepare(cmdLine, TRUE);
|
||||
|
||||
if (result == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ UnitCount=6
|
||||
Type=1
|
||||
Ver=2
|
||||
ObjFiles=
|
||||
Includes="C:\Program Files (x86)\Java\jdk 1.4\include";"C:\Program Files (x86)\Java\jdk 1.4\include\win32"
|
||||
Includes="c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include";"c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include\win32"
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
|
||||
2
launch4j/head_src/jniguihead_BETA/.gitignore
vendored
2
launch4j/head_src/jniguihead_BETA/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
/jniguihead.exe
|
||||
/jniguihead.layout
|
||||
@@ -6,9 +6,9 @@ CC = gcc.exe
|
||||
WINDRES = windres.exe
|
||||
OBJ = ../../head_jni_BETA/jniguihead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o
|
||||
LINKOBJ = ../../head_jni_BETA/jniguihead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o
|
||||
LIBS = -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib" -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -n -s
|
||||
INCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32"
|
||||
CXXINCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32"
|
||||
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -n -s
|
||||
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32"
|
||||
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32"
|
||||
BIN = jniguihead.exe
|
||||
CXXFLAGS = $(CXXINCS) -Os
|
||||
CFLAGS = $(INCS) -Os
|
||||
|
||||
@@ -50,7 +50,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
int result = prepare(lpCmdLine);
|
||||
int result = prepare(lpCmdLine, TRUE);
|
||||
|
||||
if (result == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ UnitCount=7
|
||||
Type=0
|
||||
Ver=2
|
||||
ObjFiles=
|
||||
Includes="C:\Program Files (x86)\Java\jdk 1.4\include";"C:\Program Files (x86)\Java\jdk 1.4\include\win32"
|
||||
Includes="c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include";"c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include\win32"
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define ID_TIMER 1
|
||||
#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */
|
||||
#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */
|
||||
|
||||
HWND getInstanceWindow();
|
||||
|
||||
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam);
|
||||
|
||||
VOID CALLBACK TimerProc(
|
||||
HWND hwnd, // handle of window for timer messages
|
||||
UINT uMsg, // WM_TIMER message
|
||||
UINT idEvent, // timer identifier
|
||||
DWORD dwTime // current system time
|
||||
);
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2007 Grzegorz Kowal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define ID_TIMER 1
|
||||
#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */
|
||||
#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */
|
||||
|
||||
HWND getInstanceWindow();
|
||||
|
||||
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam);
|
||||
|
||||
VOID CALLBACK TimerProc(
|
||||
HWND hwnd, // handle of window for timer messages
|
||||
UINT uMsg, // WM_TIMER message
|
||||
UINT idEvent, // timer identifier
|
||||
DWORD dwTime // current system time
|
||||
);
|
||||
|
||||
13
launch4j/head_src/makefile
Normal file
13
launch4j/head_src/makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
MAKE = mingw32-make.exe
|
||||
|
||||
all:
|
||||
$(MAKE) -C guihead -f Makefile.win all
|
||||
$(MAKE) -C consolehead -f Makefile.win all
|
||||
$(MAKE) -C jniguihead_BETA -f Makefile.win all
|
||||
$(MAKE) -C jniconsolehead_BETA -f Makefile.win all
|
||||
|
||||
clean:
|
||||
$(MAKE) -C guihead -f Makefile.win clean
|
||||
$(MAKE) -C consolehead -f Makefile.win clean
|
||||
$(MAKE) -C jniguihead_BETA -f Makefile.win clean
|
||||
$(MAKE) -C jniconsolehead_BETA -f Makefile.win clean
|
||||
@@ -1,75 +1,72 @@
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2014 Grzegorz Kowal
|
||||
Ian Roberts (jdk preference patch)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// ICON
|
||||
#define APP_ICON 1
|
||||
|
||||
// BITMAP
|
||||
#define SPLASH_BITMAP 1
|
||||
|
||||
// RCDATA
|
||||
#define JRE_PATH 1
|
||||
#define JAVA_MIN_VER 2
|
||||
#define JAVA_MAX_VER 3
|
||||
#define SHOW_SPLASH 4
|
||||
#define SPLASH_WAITS_FOR_WINDOW 5
|
||||
#define SPLASH_TIMEOUT 6
|
||||
#define SPLASH_TIMEOUT_ERR 7
|
||||
#define CHDIR 8
|
||||
#define SET_PROC_NAME 9
|
||||
#define ERR_TITLE 10
|
||||
#define GUI_HEADER_STAYS_ALIVE 11
|
||||
#define JVM_OPTIONS 12
|
||||
#define CMD_LINE 13
|
||||
#define JAR 14
|
||||
#define MAIN_CLASS 15
|
||||
#define CLASSPATH 16
|
||||
#define WRAPPER 17
|
||||
#define JDK_PREFERENCE 18
|
||||
#define ENV_VARIABLES 19
|
||||
#define PRIORITY_CLASS 20
|
||||
#define DOWNLOAD_URL 21
|
||||
#define SUPPORT_URL 22
|
||||
#define MUTEX_NAME 23
|
||||
#define INSTANCE_WINDOW_TITLE 24
|
||||
#define INITIAL_HEAP_SIZE 25
|
||||
#define INITIAL_HEAP_PERCENT 26
|
||||
#define MAX_HEAP_SIZE 27
|
||||
#define MAX_HEAP_PERCENT 28
|
||||
#define BUNDLED_JRE_64_BIT 29
|
||||
#define RUNTIME_BITS 30
|
||||
#define RESTART_ON_CRASH 31
|
||||
#define BUNDLED_JRE_AS_FALLBACK 32
|
||||
|
||||
#define STARTUP_ERR 101
|
||||
#define BUNDLED_JRE_ERR 102
|
||||
#define JRE_VERSION_ERR 103
|
||||
#define LAUNCHER_ERR 104
|
||||
#define INSTANCE_ALREADY_EXISTS_MSG 105
|
||||
/*
|
||||
Launch4j (http://launch4j.sourceforge.net/)
|
||||
Cross-platform Java application wrapper for creating Windows native executables.
|
||||
|
||||
Copyright (c) 2004, 2014 Grzegorz Kowal
|
||||
Ian Roberts (jdk preference patch)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above copyright holders
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// ICON
|
||||
#define APP_ICON 1
|
||||
|
||||
// BITMAP
|
||||
#define SPLASH_BITMAP 1
|
||||
|
||||
// RCDATA
|
||||
#define JRE_PATH 1
|
||||
#define JAVA_MIN_VER 2
|
||||
#define JAVA_MAX_VER 3
|
||||
#define SHOW_SPLASH 4
|
||||
#define SPLASH_WAITS_FOR_WINDOW 5
|
||||
#define SPLASH_TIMEOUT 6
|
||||
#define SPLASH_TIMEOUT_ERR 7
|
||||
#define CHDIR 8
|
||||
#define ERR_TITLE 10
|
||||
#define GUI_HEADER_STAYS_ALIVE 11
|
||||
#define JVM_OPTIONS 12
|
||||
#define CMD_LINE 13
|
||||
#define JAR 14
|
||||
#define MAIN_CLASS 15
|
||||
#define CLASSPATH 16
|
||||
#define WRAPPER 17
|
||||
#define REQUIRES_JDK 18
|
||||
#define ENV_VARIABLES 19
|
||||
#define PRIORITY_CLASS 20
|
||||
#define DOWNLOAD_URL 21
|
||||
#define SUPPORT_URL 22
|
||||
#define MUTEX_NAME 23
|
||||
#define INSTANCE_WINDOW_TITLE 24
|
||||
#define INITIAL_HEAP_SIZE 25
|
||||
#define INITIAL_HEAP_PERCENT 26
|
||||
#define MAX_HEAP_SIZE 27
|
||||
#define MAX_HEAP_PERCENT 28
|
||||
#define REQUIRES_64_BIT 29
|
||||
#define RESTART_ON_CRASH 31
|
||||
|
||||
#define STARTUP_ERR 101
|
||||
#define JRE_NOT_FOUND_ERR 102
|
||||
#define JRE_VERSION_ERR 103
|
||||
#define LAUNCHER_ERR 104
|
||||
#define INSTANCE_ALREADY_EXISTS_MSG 105
|
||||
|
||||
Reference in New Issue
Block a user