diff --git a/jsmooth-0.9.9-7-patch/build.xml b/jsmooth-0.9.9-7-patch/build.xml
new file mode 100644
index 00000000..091158c5
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/build.xml
@@ -0,0 +1,607 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Compiling the application from ${src}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Running test class... ${jsmoothjar}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Building release ${VERSION} - ${RELEASEINFO}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Making ${skelname} ${target}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Making ${skelname} ${target}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jsmooth-0.9.9-7-patch/jsprj/jsmoothcmd.jsmooth b/jsmooth-0.9.9-7-patch/jsprj/jsmoothcmd.jsmooth
new file mode 100644
index 00000000..b9b4ec08
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/jsprj/jsmoothcmd.jsmooth
@@ -0,0 +1,40 @@
+
+
+registry
+javahome
+jrepath
+jdkpath
+exepath
+jview
+..\lib\jox116.jar
+..\lib\JimiProClasses.zip
+..\lib\dtdparser113.jar
+..\lib\jsmoothgen.jar
+false
+..\jsmoothcmd.exe
+..\src\icons\gnome-application-x-jar-bm.gif
+-1
+
+jsmooth.basedir
+${EXECUTABLEPATH}
+
+net.charabia.jsmoothgen.application.cmdline.CommandLine
+-1
+
+1.4
+0
+Console Wrapper
+
+Message
+This program needs Java 1.4 or higher to run.
+Please download it at http://www.java.com
+
+
+PressKey
+0
+
+
+Debug
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/jsprj/jsmoothcmd64.jsmooth b/jsmooth-0.9.9-7-patch/jsprj/jsmoothcmd64.jsmooth
new file mode 100644
index 00000000..acde98e3
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/jsprj/jsmoothcmd64.jsmooth
@@ -0,0 +1,40 @@
+
+
+registry
+javahome
+jrepath
+jdkpath
+exepath
+jview
+..\lib\jox116.jar
+..\lib\JimiProClasses.zip
+..\lib\dtdparser113.jar
+..\lib\jsmoothgen.jar
+false
+..\jsmoothcmd64.exe
+..\src\icons\gnome-application-x-jar-bm.gif
+-1
+
+jsmooth.basedir
+${EXECUTABLEPATH}
+
+net.charabia.jsmoothgen.application.cmdline.CommandLine
+-1
+
+1.4
+0
+Console Wrapper x64
+
+Message
+This program needs Java 1.4 or higher to run.
+Please download it at http://www.java.com
+
+
+PressKey
+0
+
+
+Debug
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/jsprj/jsmoothgen.jsmooth b/jsmooth-0.9.9-7-patch/jsprj/jsmoothgen.jsmooth
new file mode 100644
index 00000000..ec86efc3
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/jsprj/jsmoothgen.jsmooth
@@ -0,0 +1,51 @@
+
+
+registry
+exepath
+javahome
+jrepath
+jdkpath
+jview
+..\lib\jox116.jar
+..\lib\dtdparser113.jar
+..\lib\jsmoothgen.jar
+..\lib\l2fprod-common-all.jar
+..\jsmoothgen.jar
+..\lib\riverlayout.jar
+..\lib\BrowserLauncher2-10.jar
+${EXECUTABLEPATH}
+false
+..\JSmoothGen.exe
+..\src\icons\gnome-application-x-jar-bm.gif
+-1
+net.charabia.jsmoothgen.application.gui.MainFrame
+-1
+
+1.4
+0
+Autodownload Wrapper
+
+Message
+Java 1.4 or above has not been found on your computer. Do you want to download a compatible Java Environment?
+
+
+DownloadURL
+http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab
+
+
+SingleProcess
+1
+
+
+SingleInstance
+1
+
+
+JniSmooth
+1
+
+
+Debug
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/jsprj/prooftest.jsmooth b/jsmooth-0.9.9-7-patch/jsprj/prooftest.jsmooth
new file mode 100644
index 00000000..fd569423
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/jsprj/prooftest.jsmooth
@@ -0,0 +1,34 @@
+
+
+registry
+javahome
+jrepath
+jdkpath
+exepath
+jview
+simpleargument "multiple tokens" c:\my\test\here
+true
+..\proof-test.exe
+..\src\icons\stock_web-support.png
+-1
+..\sample\sample.jar
+JSmoothPropertiesDisplayer
+-1
+
+1.1
+0
+Console Wrapper
+
+Message
+This program needs Java 1.4 or higher to run.
+Please download it at http://www.java.com
+
+
+PressKey
+0
+
+
+Debug
+1
+
+
diff --git a/jsmooth-0.9.9-7-patch/jsprj/prooftest64.jsmooth b/jsmooth-0.9.9-7-patch/jsprj/prooftest64.jsmooth
new file mode 100644
index 00000000..9b50eca3
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/jsprj/prooftest64.jsmooth
@@ -0,0 +1,34 @@
+
+
+registry
+javahome
+jrepath
+jdkpath
+exepath
+jview
+simpleargument "multiple tokens" c:\my\test\here
+true
+..\proof-test64.exe
+..\src\icons\stock_web-support.png
+-1
+..\sample\sample.jar
+JSmoothPropertiesDisplayer
+-1
+
+1.1
+0
+Console Wrapper x64
+
+Message
+This program needs Java 1.4 or higher to run.
+Please download it at http://www.java.com
+
+
+PressKey
+0
+
+
+Debug
+1
+
+
diff --git a/jsmooth-0.9.9-7-patch/sample/build.xml b/jsmooth-0.9.9-7-patch/sample/build.xml
new file mode 100644
index 00000000..47c5390c
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/sample/build.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/autodownload/Makefile.win b/jsmooth-0.9.9-7-patch/skeletons/autodownload/Makefile.win
new file mode 100644
index 00000000..eb21df76
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/autodownload/Makefile.win
@@ -0,0 +1,46 @@
+# Project: util-core
+
+PROJECTNAME=autodownload
+##libmscabd_la_SOURCES = mspack/system.c mspack/cabd.c mspack/lzxd.c mspack/mszipd.c mspack/qtmd.c
+##libmscabd_la_OBJS = system.o cabd.o lzxd.o mszipd.o qtmd.o
+
+SHELL = /bin/sh
+RM = rm -f
+CPP = ${MINGW}/bin/${TARGET}-g++.exe
+CC = ${MINGW}/bin/${TARGET}-gcc.exe
+WINDRES = windres.exe
+MINGW =
+RES = JWrap_private.res
+LINKOBJ = main.o execcab.o execexe.o $(RES)
+OBJ = main.o execcab.o execexe.o $(libmscabd_la_OBJS) $(RES)
+FLTK-LDFLAGS = $(shell fltk-config --ldflags --use-images)
+FLTK-CXXFLAGS = $(shell fltk-config --cxxflags --use-images)
+##LINKLIBS = ../commonjava/CommonJava.a ../util-core/util-core.a mspack.a ../util-net/util-net.a
+LINKLIBS = ../commonjava/CommonJava.a ../util-net/util-net.a ../util-core/util-core.a
+LIBS = -static-libgcc -L. -L"$(MINGW)/lib" -lws2_32 -L"${MINGW}/bin/libgcc_s_sjlj-1.dll" -L"/lib" -L"../commonjava" -mwindows -L"../util-core" -L"../util-net" $(LINKLIBS) $(FLTK-LDFLAGS) -lsetupapi -lwininet
+INCS = -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32"
+CXXINCS = -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I"../commonjava" -I"../util-core" -I"../util-net" $(FLTK-CXXFLAGS)
+BIN = autodownload.exe
+CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)"
+CFLAGS = $(INCS)
+
+.PHONY: all all-before all-after clean clean-custom $(PROJECTNAME)
+
+all: all-before $(BIN) all-after
+
+clean: clean-custom
+ $(RM) $(OBJ) $(BIN) JWrap_private.res
+
+$(BIN): $(LINKOBJ) $(LINKLIBS)
+ $(CPP) $(CXXFLAGS) $(LINKOBJ) $(LIBS) -o $(BIN)
+
+#mspack.a: $(libmscabd_la_SOURCES)
+# $(CC) -c -Imspack $(libmscabd_la_SOURCES)
+# ar r mspack.a $(libmscabd_la_OBJS)
+# ranlib mspack.a
+
+JWrap_private.res: JWrap_private.rc mainres.rc
+ $(WINDRES) -i JWrap_private.rc -J rc -o JWrap_private.res -O coff
+
+main.o: main.cpp
+ $(CPP) -c main.cpp $(CXXFLAGS)
diff --git a/jsmooth-0.9.9-7-patch/skeletons/autodownload/autodownload64.skel b/jsmooth-0.9.9-7-patch/skeletons/autodownload/autodownload64.skel
new file mode 100644
index 00000000..48411075
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/autodownload/autodownload64.skel
@@ -0,0 +1,52 @@
+
+
+false
+SKEL_AUTODOWNLOAD_PROPERTY_DESCRIPTION
+autodownload.exe
+JAVA
+102
+103
+Autodownload Wrapper x64
+
+SKEL_AUTODOWNLOAD_PROPERTY_MESSAGE_DESCRIPTION
+Message
+
+textarea
+Java has not been found on your computer. Do you want to download it?
+
+
+SKEL_AUTODOWNLOAD_PROPERTY_DLURL_DESCRIPTION
+DownloadURL
+
+autodownloadurl
+http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab
+
+
+SKEL_GENERIC_PROPERTY_SINGLEPROCESS_DESCRIPTION
+SingleProcess
+
+boolean
+0
+
+
+SKEL_GENERIC_SINGLEINSTANCE_DESCRIPTION
+SingleInstance
+
+boolean
+0
+
+
+SKEL_GENERIC_JNISMOOTH_DESCRIPTION
+JniSmooth
+
+boolean
+0
+
+
+SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION
+Debug
+
+boolean
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/autodownload/customdownload64.skel b/jsmooth-0.9.9-7-patch/skeletons/autodownload/customdownload64.skel
new file mode 100644
index 00000000..5c81ff21
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/autodownload/customdownload64.skel
@@ -0,0 +1,52 @@
+
+
+false
+SKEL_CUSTOMDOWNLOAD_DESCRIPTION
+autodownload.exe
+JAVA
+102
+103
+Custom Web Download Wrapper x64
+
+SKEL_CUSTOMDOWNLOAD_PROPERTY_MESSAGE_DESCRIPTION
+Message
+
+textarea
+Java has not been found on your computer. Do you want to download it?
+
+
+SKEL_CUSTOMDOWNLOAD_PROPERTY_URL_DESCRIPTION
+DownloadURL
+
+string
+http://
+
+
+SKEL_GENERIC_PROPERTY_SINGLEPROCESS_DESCRIPTION
+SingleProcess
+
+boolean
+0
+
+
+SKEL_GENERIC_SINGLEINSTANCE_DESCRIPTION
+SingleInstance
+
+boolean
+0
+
+
+SKEL_GENERIC_JNISMOOTH_DESCRIPTION
+JniSmooth
+
+boolean
+0
+
+
+SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION
+Debug
+
+boolean
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/autodownload/mainres.rc b/jsmooth-0.9.9-7-patch/skeletons/autodownload/mainres.rc
new file mode 100644
index 00000000..f2634f14
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/autodownload/mainres.rc
@@ -0,0 +1,9 @@
+
+#include "resource.h"
+
+JARID JAVA "../samplejar/sample.jar"
+PROPID JAVA "../samplejar/sample.props"
+JNISMOOTHID JAVA "../jnismooth/jnismooth.jar"
+
+A2 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "JWrap.ico"
+1 MANIFEST "../samplejar/sample.manifest"
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMBase.cpp b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMBase.cpp
new file mode 100644
index 00000000..14072b85
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMBase.cpp
@@ -0,0 +1,74 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JVMBase.h"
+
+JVMBase::JVMBase()
+{
+ m_maxHeap = -1;
+ m_initialHeap = -1;
+ m_vmParameter = "";
+}
+
+void JVMBase::addPathElement(const std::string& element)
+{
+ m_pathElements.push_back(element);
+}
+
+void JVMBase::addProperty(const JavaProperty& prop)
+{
+ m_properties.push_back(prop);
+}
+
+void JVMBase::setMaxHeap(long size)
+{
+ m_maxHeap = size;
+}
+
+void JVMBase::setInitialHeap(long size)
+{
+ m_initialHeap = size;
+}
+
+void JVMBase::addArgument(const std::string& arg)
+{
+ // m_arguments.push_back(StringUtils::requoteForCommandLine(arg));
+ m_arguments.push_back(arg);
+}
+
+
+void JVMBase::setArguments(const std::string& args)
+{
+ m_arguments.clear();
+ DEBUG("arguments:<" + args + ">");
+ // std::string ua = StringUtils::unescape(args);
+ // DEBUG("arguments unescaped:<" + ua + ">");
+ vector splitted = StringUtils::split(args, " \t\n\r", "\"\'", false);
+ for (int i=0; iaddArgument(splitted[i]);
+ }
+}
+
+void JVMBase::setVmParameter(std::string parameter)
+{
+ m_vmParameter = parameter;
+}
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMBase.h b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMBase.h
new file mode 100644
index 00000000..5ad2cd0e
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMBase.h
@@ -0,0 +1,61 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __SUNJVMBASE_H_
+#define __SUNJVMBASE_H_
+
+#include
+#include "jni.h"
+
+#include "Version.h"
+#include "StringUtils.h"
+#include "FileUtils.h"
+#include "ResourceManager.h"
+#include "JavaProperty.h"
+
+/**
+ * @author Rodrigo Reyes
+ */
+
+class JVMBase
+{
+ protected:
+
+ std::vector m_pathElements;
+ std::vector m_properties;
+ int m_maxHeap;
+ int m_initialHeap;
+ std::vector m_arguments;
+ std::string m_vmParameter;
+
+ public:
+ JVMBase();
+
+ void addPathElement(const std::string& element);
+ void addProperty(const JavaProperty& prop);
+ void setMaxHeap(long size);
+ void setInitialHeap(long size);
+ void addArgument(const std::string& arg);
+ void setArguments(const std::string& args);
+ void setVmParameter(std::string parameter);
+};
+
+
+#endif
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMRegistryLookup.cpp b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMRegistryLookup.cpp
new file mode 100644
index 00000000..c495ce85
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMRegistryLookup.cpp
@@ -0,0 +1,115 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JVMRegistryLookup.h"
+
+struct jvmsorter_dec : public binary_function
+{
+ bool operator()(const SunJVMLauncher& s1, const SunJVMLauncher& s2)
+ {
+ return s2 < s1;
+ }
+};
+
+vector JVMRegistryLookup::lookupJVM()
+{
+ vector res = JVMRegistryLookup::lookup(HKEY_LOCAL_MACHINE, "SOFTWARE\\JavaSoft\\Java Runtime Environment");
+
+ vector res2 = JVMRegistryLookup::lookup(HKEY_LOCAL_MACHINE, "SOFTWARE\\JavaSoft\\Java Development Kit");
+
+ for (vector::iterator i = res2.begin(); i != res2.end(); i++)
+ {
+ res.insert(res.end(), *i);
+ }
+
+ sort(res.begin(), res.end(), jvmsorter_dec() );
+
+ return res;
+}
+
+vector JVMRegistryLookup::lookup(HKEY key, const string& path)
+{
+ vector result;
+
+ HKEY hKey;
+ LONG error = ERROR_SUCCESS;
+ LONG val = RegOpenKeyEx(key, path.c_str(), 0, KEY_READ, &hKey);
+
+ unsigned long buffersize = 1024;
+ char buffer[1024];
+
+ for (int i=0; RegEnumKey(hKey, i, buffer, buffersize) == ERROR_SUCCESS; i++)
+ {
+ int v = i;
+ HKEY version;
+ int foundver = RegOpenKeyEx(hKey, buffer, 0, KEY_READ, &version);
+ if (foundver == ERROR_SUCCESS)
+ {
+ std::string versionname(buffer);
+ HKEY runtimelib;
+ unsigned long datatype;
+ std::string runtimelibstr = "";
+ std::string javahomestr = "";
+
+ unsigned char *b = (unsigned char*)buffer;
+ buffersize = 1024;
+ int foundlib = RegQueryValueEx(version, TEXT("RuntimeLib"),
+ NULL,
+ &datatype,
+ b,
+ &buffersize);
+
+ if (foundlib == ERROR_SUCCESS)
+ {
+ runtimelibstr = buffer;
+ }
+
+ b = (unsigned char*)buffer;
+ buffersize = 1024;
+ int foundhome = RegQueryValueEx(version, TEXT("JavaHome"),
+ NULL,
+ &datatype,
+ b,
+ &buffersize);
+ if (foundhome == ERROR_SUCCESS)
+ {
+ javahomestr = buffer;
+ }
+
+ if ((runtimelibstr.length()>0) || (javahomestr.length()>0))
+ {
+ SunJVMLauncher vm;
+ vm.RuntimeLibPath = runtimelibstr;
+ vm.JavaHome = javahomestr;
+ vm.VmVersion = Version(versionname);
+ result.push_back(vm);
+
+ char buffer[244];
+ sprintf(buffer, "V(%d)(%d)(%d)", vm.VmVersion.getMajor(), vm.VmVersion.getMinor(), vm.VmVersion.getSubMinor());
+ DEBUG(std::string("JVM Lookup: found VM (") + buffer + ") in registry.");
+ }
+ }
+
+ }
+
+ return result;
+}
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMRegistryLookup.h b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMRegistryLookup.h
new file mode 100644
index 00000000..76ef6f9a
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JVMRegistryLookup.h
@@ -0,0 +1,52 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef _JVMREGISTRYLOOKUP_H_
+#define _JVMREGISTRYLOOKUP_H_
+
+#include
+#include
+
+#include "SunJVMLauncher.h"
+#include "JVMRegistryLookup.h"
+
+/** Utility class that scans the windows registry for installed JRE.
+ *
+ * @author Rodrigo Reyes
+ */
+
+class JVMRegistryLookup
+{
+ public:
+ /**
+ * Scans the Windows Registry for the Java Runtime Environments. If
+ * no JRE is found, an empty vector is returned.
+ *
+ * @return a vector containing the JRE found.
+ */
+ static vector lookupJVM();
+
+ private:
+ static vector lookup(HKEY key, const string& path);
+
+};
+
+
+#endif
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/JavaMachineManager.cpp b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JavaMachineManager.cpp
new file mode 100644
index 00000000..5d5ec84f
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/JavaMachineManager.cpp
@@ -0,0 +1,232 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "JavaMachineManager.h"
+
+
+JavaMachineManager::JavaMachineManager(ResourceManager& resman): m_resman(resman)
+{
+ DEBUG("Now searching the JVM installed on the system...");
+
+ m_registryVms = JVMRegistryLookup::lookupJVM();
+ m_javahomeVm = JVMEnvVarLookup::lookupJVM("JAVA_HOME");
+ m_jrepathVm = JVMEnvVarLookup::lookupJVM("JRE_HOME");
+ m_jdkpathVm = JVMEnvVarLookup::lookupJVM("JDK_HOME");
+ m_exitCode = 0;
+ m_useConsole = true;
+ m_acceptExe = true;
+ m_acceptDLL = true;
+ m_preferDLL = false;
+
+ if (resman.getProperty("bundledvm").length() > 0)
+ {
+ string bjvm = resman.getProperty("bundledvm");
+ DEBUG("Found a vm bundled with the application: (" + bjvm + ")");
+ m_localVMenabled = true;
+ std::string home = FileUtils::concFile(resman.getCurrentDirectory(), bjvm);
+ m_localVM.JavaHome = home;
+ } else
+ {
+ m_localVMenabled = false;
+ }
+ DEBUG("Current directory is " + resman.getCurrentDirectory());
+}
+
+bool JavaMachineManager::run()
+{
+ string vmorder = m_resman.getProperty(ResourceManager::KEY_JVMSEARCH);
+
+ if (m_localVMenabled)
+ {
+ if (internalRun(m_localVM, "bundled"))
+ {
+ return true;
+ }
+
+// DEBUG("Trying to use bundled VM " + m_localVM.JavaHome);
+// if (m_localVM.runProc(m_resman, m_useConsole, "bundled"))
+// {
+// m_exitCode = m_localVM.getExitCode();
+// return true;
+// }
+// if (m_localVM.run(m_resman, "bundled"))
+// return true;
+ }
+
+ if (vmorder == "")
+ {
+ vmorder = "registry;jdkpath;jrepath;javahome;jview;exepath";
+ }
+
+ DEBUG("JSmooth will now try to use the VM in the following order: " + vmorder);
+
+ vector jvmorder = StringUtils::split(vmorder, ";,", "");
+
+ Version max(m_resman.getProperty(ResourceManager:: KEY_MAXVERSION));
+ Version min(m_resman.getProperty(ResourceManager:: KEY_MINVERSION));
+
+ for (vector::const_iterator i = jvmorder.begin(); i != jvmorder.end(); i++)
+ {
+ DEBUG("------------------------------");
+
+ if (*i == "registry")
+ {
+ DEBUG("Trying to use a JVM defined in the registry (" + StringUtils::toString(m_registryVms.size()) + " available)");
+ string vms = "VM will be tried in the following order: ";
+ for (int i=0; i0))
+ {
+ DEBUG("- Trying to use JAVAHOME");
+ if (internalRun(m_javahomeVm[0], "jrehome"))
+ return true;
+ }
+ else if ((*i == "jrepath") && (m_jrepathVm.size()>0))
+ {
+ DEBUG("- Trying to use JRE_HOME");
+ if (internalRun(m_jrepathVm[0], "jrehome"))
+ return true;
+ }
+ else if (*i == "exepath")
+ {
+ DEBUG("- Trying to use PATH");
+
+ SunJVMLauncher launcher;
+ if (launcher.runProc(m_resman, m_useConsole, "path"))
+ {
+ m_exitCode = m_localVM.getExitCode();
+ return true;
+ }
+ }
+ }
+
+ DEBUG("Couldn't run any suitable JVM!");
+ return false;
+}
+
+
+bool JavaMachineManager::internalRun(SunJVMLauncher& launcher, const string& org)
+{
+ if (m_acceptDLL && m_preferDLL)
+ {
+ if (launcher.run(m_resman, org))
+ return true;
+ }
+
+ if (m_acceptExe)
+ {
+ if (launcher.runProc(m_resman, m_useConsole, org))
+ {
+ m_exitCode = launcher.getExitCode();
+ return true;
+ }
+ }
+
+ if (m_acceptDLL && !m_preferDLL)
+ {
+ if (launcher.run(m_resman, org))
+ return true;
+ }
+
+ return false;
+}
+
+
+
+SunJVMLauncher* JavaMachineManager::runDLLFromRegistry(bool justInstanciate)
+{
+ string vms = "DLL VM will be tried in the following order: ";
+ for (int i=0; i
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ResourceManager.h"
+
+char * const ResourceManager::KEY_MAINCLASSNAME = "mainclassname";
+char * const ResourceManager::KEY_ARGUMENTS = "arguments";
+char * const ResourceManager::KEY_CLASSPATH = "classpath";
+char * const ResourceManager::KEY_JVMSEARCH = "jvmsearch";
+char * const ResourceManager::KEY_MINVERSION = "minversion";
+char * const ResourceManager::KEY_MAXVERSION = "maxversion";
+char * const ResourceManager::KEY_NOJVMMESSAGE = "nojvmmessage";
+char * const ResourceManager::KEY_NOJVMURL = "nojvmurl";
+char * const ResourceManager::KEY_BUNDLEDVM = "bundledvm";
+char * const ResourceManager::KEY_CURRENTDIR = "currentdir";
+char * const ResourceManager::KEY_EMBEDJAR = "embedjar";
+
+ResourceManager::ResourceManager(std::string category, int propsId, int jarId, int jniId)
+{
+ m_resourceCategory = category;
+ m_resourcePropsId = propsId;
+ m_resourceJarId = jarId;
+
+ //
+ // Load the Properties
+ //
+ DEBUG("Initialize properties...");
+ std::string propsidstr = this->idToResourceName(propsId);
+ HRSRC resprop = FindResource(NULL, propsidstr.c_str(), category.c_str());
+ if (resprop != NULL)
+ {
+ int mainsize = 0;
+ mainsize = SizeofResource(NULL, resprop);
+ // char mainbuf[mainsize+1];
+ HGLOBAL main = LoadResource(NULL, resprop);
+ m_props.setData((const char*)main, mainsize);
+ }
+ else
+ {
+ m_lastError = "Can't find resource 'main name'";
+ return;
+ }
+
+ //
+ // Split the arguments
+ //
+ m_arguments = StringUtils::split(getProperty(KEY_ARGUMENTS, ""), " \t\n\r", "\"\'");
+
+ //
+ // loads the jar information
+ //
+ std::string jaridstr = this->idToResourceName(jarId);
+ HRSRC resjar = FindResource(NULL, jaridstr.c_str(), category.c_str());
+ if (resjar != NULL)
+ {
+ m_jarSize = SizeofResource(NULL, resjar);
+ m_jarHandler = LoadResource(NULL, resjar);
+ }
+ else
+ {
+ m_lastError = "Can't find JAR resource!";
+ return;
+ }
+
+
+ m_jnismoothSize = this->getResourceSize(jniId);
+ m_jnismoothHandler = this->getResource(jniId);
+
+ //
+ // Extract the java properties from the Property
+ //
+ std::string jpropcountstr = m_props.get("javapropertiescount");
+
+ string exepath = FileUtils::getExecutablePath();
+ string exename = FileUtils::getExecutableFileName();
+ string computername = FileUtils::getComputerName();
+
+ int jpropcount = StringUtils::parseInt(jpropcountstr);
+ DEBUG("Number of Java Parameters: "+jpropcountstr);
+ for (int i=0; i0)
+ {
+ int pos = string::npos;
+ if ( (pos=curdirmodifier.find("${EXECUTABLEPATH}")) != string::npos)
+ {
+ m_currentDirectory = FileUtils::concFile(exepath, curdirmodifier.substr(pos + string("${EXECUTABLEPATH}").size()));
+ // m_currentDirectory = StringUtils::replace(curdirmodifier, "${EXECUTABLEPATH}", exepath);
+ }
+ else
+ {
+ DEBUG(string("Currentdirectory =") + curdirmodifier);
+ m_currentDirectory = curdirmodifier;
+ // m_currentDirectory = FileUtils::concFile(FileUtils::getExecutablePath(), curdirmodifier);
+ m_currentDirectory = StringUtils::replaceEnvironmentVariable(m_currentDirectory);
+ }
+ }
+ else
+ {
+ m_currentDirectory = "";
+ }
+ // printf("CURDIR SET TO: [%s]\n", m_currentDirectory.c_str());
+}
+
+ResourceManager::~ResourceManager()
+{
+ for (std::vector::iterator i=m_deleteOnFinalize.begin(); i != m_deleteOnFinalize.end(); i++)
+ {
+ int res = DeleteFile(i->c_str());
+ }
+}
+
+void ResourceManager::setProperty(const std::string& key, const std::string& value)
+{
+ m_props.set(key, value);
+}
+
+void ResourceManager::saveTemp(std::string tempname, HGLOBAL data, int size)
+{
+ if ((data == 0) || (size == 0))
+ return;
+
+ HANDLE temp = CreateFile(tempname.c_str(),
+ GENERIC_WRITE,
+ FILE_SHARE_WRITE,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (temp != NULL)
+ {
+ DWORD reallyWritten;
+ WriteFile(temp, data, size, &reallyWritten, NULL);
+
+ // TODO: check the reallyWritten value for errors
+
+ CloseHandle(temp);
+ string s = tempname;
+ // m_deleteOnFinalize.push_back(s);
+ FileUtils::deleteOnReboot(s);
+ }
+}
+
+std::string ResourceManager::getMainName() const
+{
+ return getProperty(string("mainclassname"));
+}
+
+std::string ResourceManager::getProperty(const std::string& key) const
+{
+ return m_props.get(key);
+}
+
+std::string ResourceManager::getProperty(const std::string& key, const std::string& def) const
+{
+ if (m_props.contains(key))
+ return m_props.get(key);
+ else
+ return def;
+}
+
+bool ResourceManager::getBooleanProperty(const std::string& key) const
+{
+ std::string prop = getProperty(key, "0");
+
+ if (StringUtils::parseInt(prop)==1)
+ return true;
+
+ if (StringUtils::toLowerCase(prop) == "true")
+ return true;
+
+ return false;
+}
+
+std::string ResourceManager::saveJarInTempFile()
+{
+ if (useEmbeddedJar() == false)
+ return "";
+
+ std::string tempfilename = FileUtils::createTempFileName(".jar");
+ DEBUG("Created temporary filename to hold the jar (" + tempfilename + ")");
+ saveTemp(tempfilename, m_jarHandler, m_jarSize);
+ return tempfilename;
+}
+
+const vector& ResourceManager::getJavaProperties()
+{
+ return m_javaProperties;
+}
+
+std::vector ResourceManager::getNormalizedClassPathVector() const
+{
+ std::string basepath = FileUtils::getExecutablePath();
+ std::string curdirmodifier = getCurrentDirectory(); //getProperty(string(ResourceManager::KEY_CURRENTDIR));
+ if (FileUtils::isAbsolute(curdirmodifier)){
+ basepath = curdirmodifier;
+ DEBUG("DEBUG: (absolut) Basepath is : " + basepath);
+ } else {
+ basepath = FileUtils::concFile(basepath, curdirmodifier);
+ DEBUG("DEBUG: (not absolut) Basepath is : " + basepath);
+ }
+
+ std::string cp = getProperty(string(ResourceManager::KEY_CLASSPATH));
+ vectorcps = StringUtils::split(cp, ";", "", false);
+ for (int i=0; i cps = getNormalizedClassPathVector();
+ return StringUtils::join(cps, ";");
+}
+
+std::string ResourceManager::getCurrentDirectory() const
+{
+ return m_currentDirectory;
+}
+
+bool ResourceManager::useEmbeddedJar() const
+{
+ std::string value = m_props.get(ResourceManager::KEY_EMBEDJAR);
+ if (value == "true")
+ return true;
+ return false;
+}
+
+void ResourceManager::printDebug() const
+{
+ DEBUG("ResourceManager resource configuration:");
+ DEBUG(" - Resource category: " + m_resourceCategory);
+ DEBUG(" - Current directory: " + m_currentDirectory);
+
+ map props = m_props.getDataCopy();
+ DEBUG(" - Property count: " + StringUtils::toString(props.size()));
+ for (map::iterator i = props.begin(); i != props.end(); i++)
+ {
+ DEBUG(" - Property: " + i->first + "=<" + i->second+">");
+ }
+}
+
+void ResourceManager::setUserArguments(std::vector arguments)
+{
+ m_arguments.clear();
+
+ for (std::vector::iterator i=arguments.begin(); i != arguments.end(); i++)
+ {
+ addUserArgument(*i);
+ }
+}
+
+
+void ResourceManager::addUserArgument(std::string argument)
+{
+ bool keyFound = false;
+ if (argument.size()>3)
+ {
+ int pos = argument.find("=");
+ if (pos != std::string::npos)
+ {
+ string key = argument.substr(2, pos-2);
+ string value = argument.substr(pos+1);
+ string argumentType = argument.substr(0,2);
+ if (argumentType == "-J")
+ {
+ DEBUG("FOUND USER ARGUMENT for JSMOOTH: [" + key + "]=[" + value + "]");
+ keyFound = true;
+ setProperty(key, value);
+ }
+ if (argumentType == "-D")
+ {
+ DEBUG("FOUND USER ARGUMENT for JAVA: [" + key + "]=[" + value + "]");
+ JavaProperty jprop(key, value);
+ keyFound = true;
+ m_javaProperties.push_back(jprop);
+ }
+ }
+ }
+ if (!keyFound)
+ {
+ m_arguments.push_back(argument);
+// setProperty(KEY_ARGUMENTS, getProperty(KEY_ARGUMENTS) + " " + StringUtils::requoteForCommandLine(StringUtils::escape(argument)) );
+ }
+}
+
+
+std::vector ResourceManager::getArguments()
+{
+ return m_arguments;
+}
+
+int ResourceManager::getResourceSize(int id)
+{
+ std::string propid = idToResourceName(id);
+ HRSRC resprop = FindResource(NULL, propid.c_str(), m_resourceCategory.c_str());
+ if (resprop != NULL)
+ {
+ return SizeofResource(NULL, resprop);
+ }
+ else
+ return 0;
+}
+
+HGLOBAL ResourceManager::getResource(int id)
+{
+ std::string propid = idToResourceName(id);
+ HRSRC resprop = FindResource(NULL, propid.c_str(), m_resourceCategory.c_str());
+ if (resprop != NULL)
+ {
+ return LoadResource(NULL, resprop);
+ }
+ else
+ return 0;
+}
+
+
+std::string ResourceManager::saveJnismoothInTempFile()
+{
+ if (m_jnismoothHandler == 0)
+ {
+ DEBUG("NO JNI SMOOTH ID !!");
+ return "";
+ }
+
+ std::string tempfilename = FileUtils::createTempFileName(".jar");
+ DEBUG("Saving jnismoothjar in " + tempfilename);
+
+ DEBUG("Created temporary filename to hold the jar (" + tempfilename + ")");
+ saveTemp(tempfilename, m_jnismoothHandler, m_jnismoothSize);
+ return tempfilename;
+}
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/ResourceManager.h b/jsmooth-0.9.9-7-patch/skeletons/commonjava/ResourceManager.h
new file mode 100644
index 00000000..1c22faba
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/ResourceManager.h
@@ -0,0 +1,198 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef RESOURCEMANAGER_H
+#define RESOURCEMANAGER_H
+
+#include
+#include
+#include
+#include
+
+#include "common.h"
+#include "Properties.h"
+#include "FileUtils.h"
+#include "JavaProperty.h"
+
+/**
+ * Manages the executable resources associated to a Java
+ * application. This class manages the resources that are used to
+ * store the data associated to a java application. Those resources
+ * are:
+ * - The JAR file, stored as a raw resource.
+ * - The Property file, stored as a raw resource.
+ *
+ * The Property file contains an 8-bit text, as parsed and used by the
+ * Properties class, which defines information relative to the java
+ * application (for instance the name of the main class, the java
+ * properties, and so on).
+ *
+ * @author Rodrigo Reyes
+ */
+
+class ResourceManager
+{
+ private:
+ std::string m_mainName;
+ std::string m_resourceCategory;
+ Properties m_props;
+ std::string m_currentDirectory;
+
+ int m_resourcePropsId;
+ int m_resourceJarId;
+ std::string m_lastError;
+ HGLOBAL m_jarHandler;
+ int m_jarSize;
+ HGLOBAL m_jnismoothHandler;
+ int m_jnismoothSize;
+
+ std::vector m_arguments;
+
+ std::vector m_deleteOnFinalize;
+ std::vector m_javaProperties;
+
+ public:
+
+ static char * const KEY_MAINCLASSNAME;
+ static char * const KEY_ARGUMENTS;
+ static char * const KEY_CLASSPATH;
+ static char * const KEY_JVMSEARCH;
+ static char * const KEY_MINVERSION;
+ static char * const KEY_MAXVERSION;
+ static char * const KEY_NOJVMMESSAGE;
+ static char * const KEY_NOJVMURL;
+ static char * const KEY_BUNDLEDVM;
+ static char * const KEY_CURRENTDIR;
+ static char * const KEY_EMBEDJAR;
+
+ /**
+ * Constructs a ResourceManager which extract the jar and property
+ * files from the resources defined by the given parameters. The
+ * resource are loaded from the resource type and resource names
+ * passed as parameters.
+ *
+ * @param category the resource type to look in
+ * @param propsId the resource id, stored under the category type, for the property file
+ * @param jarId the resource id, stored under the category type, for the jar file
+ */
+ ResourceManager(std::string category, int propsId, int jarId, int jniId = -1);
+
+ /**
+ * Default destructor. The detructor tries to delete all the
+ * temporary files that have been created by the object. This is
+ * mainly the files created by the saveJarInTempFile() method.
+ *
+ * @sa ResourceManager::saveJarInTempFile
+ */
+ ~ResourceManager();
+
+ /** Saves the jar in a temporary folder. Extract the jar file
+ * from the resource defined in the consructor, and saves it in
+ * the temporary directory defined by the operating system.
+ *
+ * NOTE: if the KEY_EMBEDJAR key does not return "true", this method
+ * does not save the jar, and returns an empty string ("").
+ *
+ * @return the filename of the temp file where the Jar can be found.
+ */
+ std::string saveJarInTempFile();
+
+ std::string saveJnismoothInTempFile();
+
+ /** Returns the name of the main class. The main class is the
+ * class used to launch the java application. The static "public
+ * void main(String[])" method of this class is called to start
+ * the program.
+ *
+ * @return the name of the main class
+ */
+ std::string getMainName() const;
+
+ /**
+ * Returns the last error string. This is the string that describes
+ * the last error that was raised by an operation on the object.
+ * @return a string
+ */
+ std::string getLastErrorString()
+ {
+ return m_lastError;
+ }
+
+ /**
+ * Retrieves a property value from the Properties resource defined
+ * in the constructor.
+ *
+ * @param key the name of the property
+ * @return a string that contains the value of the property, or an empty string if the property does not exist.
+ */
+ std::string getProperty(const std::string& key) const;
+ std::string getProperty(const std::string& key, const std::string& def) const;
+ bool getBooleanProperty(const std::string& key) const;
+
+ /**
+ * Adds a new property.
+ *
+ * @param key the name of the property
+ * @param value the value associated to the property
+ */
+ void setProperty(const std::string& key, const std::string& value);
+
+ std::vector getNormalizedClassPathVector() const;
+ std::string getNormalizedClassPath() const;
+
+ /**
+ * Return the list of JavaProperty elements defined in the property
+ * resource.
+ *
+ * @return a vector of JavaProperty elements, or an empty vector if none are defined.
+ */
+ const vector& getJavaProperties();
+
+ std::string getCurrentDirectory() const;
+
+ bool useEmbeddedJar() const;
+
+ void printDebug() const;
+
+ void setUserArguments(std::vector arguments);
+ void addUserArgument(std::string argument);
+
+ std::vector getArguments();
+
+ int getResourceSize(int id);
+ HGLOBAL getResource(int id);
+
+ private:
+ void saveTemp(std::string tempname, HGLOBAL data, int size);
+
+ std::string idToResourceName(int id) const
+ {
+ char buffer[32];
+ sprintf(buffer, "%d", id);
+ std::string result("#");
+ result += buffer;
+ return result;
+ }
+
+};
+
+
+#endif
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMDLL.cpp b/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMDLL.cpp
index 2566a26d..d7efa553 100644
--- a/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMDLL.cpp
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMDLL.cpp
@@ -119,6 +119,15 @@ bool SunJVMDLL::instanciate()
bool SunJVMDLL::setupVM12DLL(CreateJavaVM_t CreateJavaVM, GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs)
{
vector jpropstrv;
+ if (m_vmParameter != "")
+ {
+ std::vector vmParameter = StringUtils::split(m_vmParameter, " ", " ", false);
+ for (std::vector::iterator i=vmParameter.begin(); i != vmParameter.end(); i++)
+ {
+ jpropstrv.push_back(*i);
+ }
+ }
+
for (int i=0; i 0)
+ if (m_vmParameter != "")
+ {
+ std::vector vmParameter = StringUtils::split(m_vmParameter, " ", " ", false);
+ for (std::vector::iterator i=vmParameter.begin(); i != vmParameter.end(); i++)
+ {
+ execv.push_back(*i);
+ }
+ }
+
+ if (m_maxHeap > 0)
{
if ((m_version.getMajor()==1)&&(m_version.getMinor()==1))
execv.push_back("-mx" + StringUtils::toString(m_maxHeap));
@@ -70,7 +79,7 @@ bool SunJVMExe::run(const std::string& mainclass, bool useconsole)
if(m_properties[i].getName()[0]=='-') {
execv.push_back( StringUtils::requoteForCommandLine(m_properties[i].getName()));
} else {
- execv.push_back( StringUtils::requoteForCommandLine("-D" + m_properties[i].getName()) + "=" + StringUtils::requoteForCommandLine(m_properties[i].getValue()));
+ execv.push_back( StringUtils::requoteForCommandLine("-D" + m_properties[i].getName()) + "=" + StringUtils::requoteForCommandLine(m_properties[i].getValue()));
}
std::string classpath;
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMLauncher.cpp b/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMLauncher.cpp
new file mode 100644
index 00000000..6441f113
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/SunJVMLauncher.cpp
@@ -0,0 +1,233 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "SunJVMLauncher.h"
+#include "Process.h"
+
+#include "SunJVMDLL.h"
+#include "JArgs.h"
+#include "JClassProxy.h"
+
+extern "C" {
+ static jint JNICALL myvprintf(FILE *fp, const char *format, va_list args)
+ {
+ DEBUG("MYPRINTF");
+ }
+ void JNICALL myexit(jint code)
+ {
+ DEBUG("EXIT CALLED FROM JVM DLL");
+ exit(code);
+ }
+}
+
+std::string SunJVMLauncher::toString() const
+{
+ return "<" + JavaHome + "><" + RuntimeLibPath + "><" + VmVersion.toString() + ">";
+}
+
+bool SunJVMLauncher::run(ResourceManager& resource, const string& origin, bool justInstanciate)
+{
+ DEBUG("Running now " + this->toString() + ", instanciate=" + (justInstanciate?"yes":"no"));
+
+ Version max(resource.getProperty(ResourceManager:: KEY_MAXVERSION));
+ Version min(resource.getProperty(ResourceManager:: KEY_MINVERSION));
+
+ // patch proposed by zregvart: if you're using bundeled JVM, you
+ // apriori know the version bundled and we can trust. The version
+ // check is therefore unrequired.
+ if (origin != "bundled") {
+
+ if (VmVersion.isValid() == false)
+ {
+ DEBUG("No version identified for " + toString());
+ SunJVMExe exe(this->JavaHome);
+ VmVersion = exe.guessVersion();
+ DEBUG("Version found: " + VmVersion.toString());
+ }
+
+ if (VmVersion.isValid() == false)
+ {
+ DEBUG("No version found, can't instanciate DLL without it");
+ return false;
+ }
+
+ if (min.isValid() && (VmVersion < min))
+ return false;
+
+ if (max.isValid() && (max < VmVersion))
+ return false;
+ }
+
+ DEBUG("Launching " + toString());
+
+ //
+ // search for the dll if it's not set in the registry, or if the
+ // file doesn't exist
+ //
+ if ( (this->JavaHome.size()>0)
+ && ((this->RuntimeLibPath.size() == 0) || (!FileUtils::fileExists(this->RuntimeLibPath))) )
+ {
+ std::string assump = FileUtils::concFile(this->JavaHome, "jre\\bin\\jvm.dll");
+ std::string assump2 = FileUtils::concFile(this->JavaHome, "jre\\bin\\server\\jvm.dll"); // for JRE 1.5+
+ std::string assump3 = FileUtils::concFile(this->JavaHome, "jre\\bin\\client\\jvm.dll"); // for JRE 1.5+
+ std::string assump4 = FileUtils::concFile(this->JavaHome, "bin\\javai.dll"); // For JRE 1.1
+
+ if (FileUtils::fileExists(assump))
+ this->RuntimeLibPath = assump;
+ else if (FileUtils::fileExists(assump2))
+ this->RuntimeLibPath = assump2;
+ else if (FileUtils::fileExists(assump3))
+ this->RuntimeLibPath = assump3;
+ else if (FileUtils::fileExists(assump4))
+ this->RuntimeLibPath = assump4;
+ else
+ {
+ vector dlls = FileUtils::recursiveSearch(this->JavaHome, string("jvm.dll"));
+ if (dlls.size() > 0)
+ this->RuntimeLibPath = dlls[0];
+ }
+ }
+
+ if (FileUtils::fileExists(this->RuntimeLibPath))
+ {
+ DEBUG("RuntimeLibPath used: " + this->RuntimeLibPath);
+ Version v = this->VmVersion;
+ if (!v.isValid())
+ {
+ v = min;
+ if (!v.isValid())
+ v = Version("1.2.0");
+ DEBUG("No version, trying with " + v.toString());
+ }
+
+ m_dllrunner = new SunJVMDLL(this->RuntimeLibPath, v);
+ // set up the vm parameters...
+ setupVM(resource, m_dllrunner);
+
+ if (justInstanciate)
+ return m_dllrunner->instanciate();
+ else
+ return m_dllrunner->run(resource.getProperty(ResourceManager::KEY_MAINCLASSNAME),
+ true);
+ }
+
+ return false;
+}
+
+bool SunJVMLauncher::runProc(ResourceManager& resource, bool useConsole, const string& origin)
+{
+ std::string classname = resource.getProperty(string(ResourceManager::KEY_MAINCLASSNAME));
+
+ if (VmVersion.isValid() == false)
+ {
+ DEBUG("No version identified for " + toString());
+ SunJVMExe exe(this->JavaHome);
+ VmVersion = exe.guessVersion();
+ DEBUG("Version found: " + VmVersion.toString());
+ }
+
+ if (VmVersion.isValid() == false)
+ return false;
+
+ if (origin != "bundled") {
+
+ Version max(resource.getProperty(ResourceManager:: KEY_MAXVERSION));
+ Version min(resource.getProperty(ResourceManager:: KEY_MINVERSION));
+
+ if (min.isValid() && (VmVersion < min))
+ return false;
+
+ if (max.isValid() && (max < VmVersion))
+ return false;
+ }
+
+ SunJVMExe exe(this->JavaHome, VmVersion);
+ setupVM(resource, &exe);
+ if (exe.run(classname, useConsole))
+ {
+ m_exitCode = exe.getExitCode();
+ return true;
+ }
+ return false;
+}
+
+bool SunJVMLauncher::setupVM(ResourceManager& resource, JVMBase* vm)
+{
+ //
+ // create the properties array
+ const vector& jprops = resource.getJavaProperties();
+ for (int i=0; iaddProperty(jprops[i]);
+ }
+
+ if (resource.getProperty("maxheap") != "")
+ vm->setMaxHeap( StringUtils::parseInt(resource.getProperty("maxheap") ));
+
+ if (resource.getProperty("initialheap") != "")
+ vm->setInitialHeap( StringUtils::parseInt(resource.getProperty("initialheap") ));
+
+ if (resource.getProperty("vmparameter") != "")
+ vm->setVmParameter( resource.getProperty("vmparameter") );
+
+ if (resource.useEmbeddedJar())
+ {
+ std::string embj = resource.saveJarInTempFile();
+ vm->addPathElement(embj);
+ }
+
+ std::string jnijar = resource.saveJnismoothInTempFile();
+ if (jnijar != "")
+ vm->addPathElement(jnijar);
+
+ //
+ // Define the classpath
+ std::vector classpath = resource.getNormalizedClassPathVector();
+ for (int i=0; iaddPathElement(classpath[i]);
+ }
+
+ //
+ // Defines the arguments passed to the java application
+ // vm->setArguments(resource.getProperty(ResourceManager::KEY_ARGUMENTS));
+ std::vector args = resource.getArguments();
+ for (int i=0; iaddArgument(args[i]);
+ }
+
+}
+
+SunJVMDLL* SunJVMLauncher::getDLL()
+{
+ return m_dllrunner;
+}
+
+bool operator < (const SunJVMLauncher& v1, const SunJVMLauncher& v2)
+{
+ return v1.VmVersion < v2.VmVersion;
+}
+
+int SunJVMLauncher::getExitCode()
+{
+ return m_exitCode;
+}
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/commonjava/Version.h b/jsmooth-0.9.9-7-patch/skeletons/commonjava/Version.h
new file mode 100644
index 00000000..bd941019
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/commonjava/Version.h
@@ -0,0 +1,131 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __VERSION_H_
+#define __VERSION_H_
+
+#include
+#include
+
+#include "common.h"
+#include "StringUtils.h"
+
+/**
+ * Manages versions as used by Sun's JVM. The version scheme used is
+ * major.minor.sub, for instance 1.1.8 or 1.4.2.
+ *
+ * @author Rodrigo Reyes
+ */
+
+class Version
+{
+ private:
+ int m_major;
+ int m_minor;
+ int m_sub;
+
+ public:
+ std::string Value;
+
+ /**
+ * Creates a Version object from a string representation. This
+ * string needs to start as a normal version, but don't need to
+ * follow exactly the schema X.Y.Z. The Major number is mandatory,
+ * but the Minor and Sub numbers are optional.
+ *
+ * If the string representation does not represent a valid
+ * version, the object is said 'invalid', and returns false to the
+ * isInvalid() method.
+ *
+ * @param val a string representation of the version.
+ */
+ Version(std::string val);
+
+ /**
+ * Creates an invalid Version object. The object created returns
+ * false to the isValid() method.
+ */
+ Version();
+
+ /**
+ * Returns the major number of this Version.
+ */
+ int getMajor() const;
+ /**
+ * Returns the minor number of this Version.
+ */
+ int getMinor() const;
+ /**
+ * Returns the subminor number of this Version.
+ */
+ int getSubMinor() const;
+
+ std::string toString() const;
+
+ // bool operator > (const Version& v) const;
+
+ friend bool operator < (const Version& v1, const Version& v2);
+ friend bool operator <= (const Version& v1, const Version& v2);
+
+ /**
+ * A version object may be invalid if it does not refer to a valid
+ * version. In such a case, the behaviour of object the is altered
+ * as follows:
+ *
+ * - The getMajor(), getMinor(), and getSubMinor() methods return 0
+ * - Any comparison (< or <=) between an invalid Version object
+ * and another object (invalid or not) return true.
+ */
+ bool isValid() const;
+
+ private:
+ void parseValue(const std::string& val);
+
+ int extractIntAt(const std::string& val, int pos) const;
+
+ public:
+ struct AscendingSort
+ {
+ bool operator()(const Version& v1, const Version& v2)
+ {
+ if (v1.getMajor() > v2.getMajor())
+ return true;
+ if (v1.getMajor() < v2.getMajor())
+ return false;
+
+ if (v1.getMinor() > v2.getMinor())
+ return true;
+ if (v1.getMinor() < v2.getMinor())
+ return false;
+
+ if (v1.getSubMinor() > v2.getSubMinor())
+ return true;
+ if (v1.getSubMinor() < v2.getSubMinor())
+ return false;
+
+ return false;
+ }
+ };
+
+};
+
+
+
+#endif
diff --git a/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/Makefile.win b/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/Makefile.win
new file mode 100644
index 00000000..89134560
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/Makefile.win
@@ -0,0 +1,32 @@
+# Project: ConsoleWrapper
+# Makefile created by Dev-C++ 4.9.8.0
+
+RM = rm -f
+CPP = ${MINGW}/bin/${TARGET}-g++.exe
+CC = ${MINGW}/bin/${TARGET}-gcc.exe
+WINDRES = windres.exe
+RES = ConsoleWrapper_private.res
+OBJ = main.o $(RES)
+LINKOBJ = main.o $(RES)
+LIBS = -static-libgcc -L"${MINGW}/lib" -L"../commonjava" -L"../util-core" ../commonjava/CommonJava.a ../util-core/util-core.a
+INCS = -I"/include" -I"../commonjava" -I"$(JDK)/include" -I"$(JDK)/include/win32"
+CXXINCS = -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I"../commonjava" -I"../util-core" -I"../util-net" $(FLTK-CXXFLAGS)
+BIN = ConsoleWrapper.exe
+CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)"
+CFLAGS = $(INCS)
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before ConsoleWrapper.exe all-after
+
+clean: clean-custom
+ $(RM) $(OBJ) $(BIN) ConsoleWrapper_private.res
+
+$(BIN): $(LINKOBJ) ../commonjava/CommonJava.a
+ $(CPP) $(LINKOBJ) -o "ConsoleWrapper.exe" $(LIBS)
+
+main.o: main.cpp
+ $(CPP) -c main.cpp -o main.o $(CXXFLAGS)
+
+ConsoleWrapper_private.res: ConsoleWrapper_private.rc mainres.rc
+ $(WINDRES) -i ConsoleWrapper_private.rc -J rc -o ConsoleWrapper_private.res -O coff
diff --git a/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/description64.skel b/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/description64.skel
new file mode 100644
index 00000000..2d2fced6
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/description64.skel
@@ -0,0 +1,32 @@
+
+
+false
+SKEL_CONSOLEWRAPPER_DESCRIPTION
+consolewrapper.exe
+JAVA
+102
+103
+Console Wrapper x64
+
+SKEL_CUSTOMWRAPPER_PROPERTY_MESSAGE_DESCRIPTION
+Message
+
+textarea
+This program needs Java to run.
+Please download it at http://www.java.com
+
+
+SKEL_CUSTOMWRAPPER_PROPERTY_KEYPRESS_DESCRIPTION
+PressKey
+
+boolean
+0
+
+
+SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION
+Debug
+
+boolean
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/mainres.rc b/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/mainres.rc
new file mode 100644
index 00000000..8bd397fb
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/consolewrapper/mainres.rc
@@ -0,0 +1,8 @@
+
+#include "resource.h"
+
+JARID JAVA "samplejar/sample.jar"
+PROPID JAVA "samplejar/sample.props"
+
+A2 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "JWrap.ico"
+1 MANIFEST "../samplejar/sample.manifest"
diff --git a/jsmooth-0.9.9-7-patch/skeletons/samplejar/sample.manifest b/jsmooth-0.9.9-7-patch/skeletons/samplejar/sample.manifest
new file mode 100644
index 00000000..3a9962eb
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/samplejar/sample.manifest
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jsmooth-0.9.9-7-patch/skeletons/simplewrap/Makefile.win b/jsmooth-0.9.9-7-patch/skeletons/simplewrap/Makefile.win
new file mode 100644
index 00000000..5841f204
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/simplewrap/Makefile.win
@@ -0,0 +1,32 @@
+# Project: JWrap
+# Makefile created by Dev-C++ 4.9.8.0
+
+CPP = ${MINGW}/bin/${TARGET}-g++.exe
+CC = ${MINGW}/bin/${TARGET}-gcc.exe
+WINDRES = windres.exe
+RES = JWrap_private.res
+OBJ = main.o $(RES)
+LINKOBJ = main.o $(RES)
+LIBS = -static-libgcc -L"${MINGW}/lib" -L"../commonjava" -L"../util-core" -mwindows ../commonjava/CommonJava.a ../util-core/util-core.a
+INCS = -I"/include" -I"$(JDK)/include/win32" -I"$(JDK)/include" -I"../commonjava" -I"../util-core"
+CXXINCS = -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I"../commonjava" -I"../util-core" -I"../util-net" $(FLTK-CXXFLAGS)
+BIN = JWrap.exe
+CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)"
+CFLAGS = $(INCS)
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before JWrap.exe all-after
+
+
+clean: clean-custom
+ $(RM) $(OBJ) $(BIN) JWrap_private.res
+
+$(BIN): $(LINKOBJ) ../commonjava/CommonJava.a
+ $(CPP) $(LINKOBJ) -o "JWrap.exe" $(LIBS)
+
+main.o: main.cpp
+ $(CPP) -c main.cpp -o main.o $(CXXFLAGS)
+
+JWrap_private.res: JWrap_private.rc mainres.rc
+ $(WINDRES) -i JWrap_private.rc -J rc -o JWrap_private.res -O coff
diff --git a/jsmooth-0.9.9-7-patch/skeletons/simplewrap/description64.skel b/jsmooth-0.9.9-7-patch/skeletons/simplewrap/description64.skel
new file mode 100644
index 00000000..da01764d
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/simplewrap/description64.skel
@@ -0,0 +1,52 @@
+
+
+false
+SKEL_SIMPLEWRAPPER_DESCRIPTION
+jwrap.exe
+JAVA
+102
+103
+Windowed Wrapper x64
+
+SKEL_SIMPLEWRAPPER_PROPERTY_MESSAGE_DESCRIPTION
+Message
+
+textarea
+Java has not been found on your computer. Do you want to download it?
+
+
+SKEL_SIMPLEWRAPPER_PROPERTY_URL_DESCRIPTION
+URL
+
+string
+http://www.java.com
+
+
+SKEL_GENERIC_PROPERTY_SINGLEPROCESS_DESCRIPTION
+SingleProcess
+
+boolean
+0
+
+
+SKEL_GENERIC_SINGLEINSTANCE_DESCRIPTION
+SingleInstance
+
+boolean
+0
+
+
+SKEL_GENERIC_JNISMOOTH_DESCRIPTION
+JniSmooth
+
+boolean
+0
+
+
+SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION
+Debug
+
+boolean
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/simplewrap/mainres.rc b/jsmooth-0.9.9-7-patch/skeletons/simplewrap/mainres.rc
new file mode 100644
index 00000000..e082dadc
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/simplewrap/mainres.rc
@@ -0,0 +1,8 @@
+#include "resource.h"
+
+JARID JAVA "../samplejar/sample.jar"
+PROPID JAVA "../samplejar/sample.props"
+JNISMOOTHID JAVA "../jnismooth/jnismooth.jar"
+
+A2 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "JWrap.ico"
+1 MANIFEST "../samplejar/sample.manifest"
diff --git a/jsmooth-0.9.9-7-patch/skeletons/util-core/FileUtils.cpp b/jsmooth-0.9.9-7-patch/skeletons/util-core/FileUtils.cpp
new file mode 100644
index 00000000..f57ebfff
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/util-core/FileUtils.cpp
@@ -0,0 +1,211 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "FileUtils.h"
+
+string FileUtils::createTempFileName(const string& suffix)
+{
+ char temppath[512];
+ int tplen = GetTempPath(512, temppath);
+
+ int counter = 0;
+ string temp;
+ do {
+
+ temp = string(temppath) + "temp" + StringUtils::toString(counter) + suffix;
+ counter ++;
+
+ } while (GetFileAttributes(temp.c_str()) != 0xFFFFFFFF);
+
+ return temp;
+}
+
+
+bool FileUtils::fileExists(const string& filename)
+{
+ if (filename[0] == '"')
+ {
+ string unquoted = StringUtils::replace(filename, "\"", "");
+ return GetFileAttributes(unquoted.c_str()) != 0xFFFFFFFF;
+ }
+ return GetFileAttributes(filename.c_str()) != 0xFFFFFFFF;
+}
+
+bool FileUtils::fileExists(const std::string& path, const std::string& filename)
+{
+ std::string f = FileUtils::concFile(path, filename);
+ return fileExists(f);
+}
+
+vector FileUtils::recursiveSearch(const string& pathdir, const string& pattern)
+{
+ vector result;
+ string path = StringUtils::replace(pathdir, "\"", "");
+
+ WIN32_FIND_DATA data;
+ string file = path + ((path[path.length()-1]=='\\')?"":"\\") + pattern;
+
+ HANDLE handle = FindFirstFile(file.c_str(), &data);
+ if (handle != INVALID_HANDLE_VALUE)
+ {
+ result.push_back(path + ((path[path.length()-1]=='\\')?"":"\\") + data.cFileName);
+ for ( ; FindNextFile(handle, &data) == TRUE ; )
+ {
+ result.push_back(path + ((path[path.length()-1]=='\\')?"":"\\") + data.cFileName);
+ }
+
+ FindClose(handle);
+ }
+
+ handle = FindFirstFile((path + ((path[path.length()-1]=='\\')?"":"\\") + "*").c_str(), &data);
+ if (handle == INVALID_HANDLE_VALUE)
+ return result;
+
+ do {
+ string foundpath(data.cFileName);
+ if ((foundpath != ".") && (foundpath != "..") && ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0))
+ {
+ string npath = path + ((path[path.length()-1]=='\\')?"":"\\") + data.cFileName;
+ vector tres = FileUtils::recursiveSearch(npath, pattern);
+ result.insert(result.end(), tres.begin(), tres.end());
+ }
+ } while (FindNextFile(handle, &data));
+ FindClose(handle);
+
+ return result;
+}
+
+std::string FileUtils::extractFileName(const std::string& filename)
+{
+ int start = filename.rfind("\\", filename.length()-1);
+ if (start != filename.npos)
+ {
+ return filename.substr(start+1);
+ }
+ return filename;
+}
+
+std::string FileUtils::getExecutablePath()
+{
+ char buffer[512];
+ GetModuleFileName(NULL, buffer, 512);
+ string full = buffer;
+ int pos = full.rfind('\\', full.npos);
+
+ return full.substr(0, pos+1);
+}
+
+std::string FileUtils::getExecutableFileName()
+{
+ char buffer[512];
+ GetModuleFileName(NULL, buffer, 512);
+ string full = buffer;
+ int pos = full.rfind('\\', full.npos);
+
+ return full.substr(pos+1);
+}
+
+std::string FileUtils::getParent(const std::string &path)
+{
+ if (path[path.length()-1] == '\\')
+ return getParent( path.substr(0, path.size() - 1) );
+
+ int pos = path.rfind('\\', path.npos);
+ if (pos != path.npos)
+ return path.substr(0, pos+1);
+ else
+ return path;
+}
+
+std::string FileUtils::getComputerName()
+{
+ char buffer[MAX_COMPUTERNAME_LENGTH + 1];
+ DWORD size = MAX_COMPUTERNAME_LENGTH+1;
+ GetComputerName(buffer, &size);
+ return buffer;
+}
+
+std::string FileUtils::concFile(std::string path, std::string file)
+{
+ if (FileUtils::isAbsolute(file))
+ return file;
+
+ if (path.length() > 0)
+ {
+ if (path[path.length()-1] != '\\')
+ path += '\\';
+ }
+ path += file;
+
+ return path;
+}
+
+std::string FileUtils::getFileExtension(const std::string& filename)
+{
+ int pos = filename.rfind('.');
+ if (pos != std::string::npos)
+ {
+ return filename.substr(pos+1);
+ }
+ return "";
+}
+
+bool FileUtils::isAbsolute(const std::string& filename)
+{
+ if (((filename.length()>2) && (filename[1] == ':') && (filename[2] =='\\')) || ((filename.length() >2) && (filename[0] == '\\') && (filename[1]=='\\')))
+ return true;
+
+ return false;
+}
+
+void FileUtils::deleteOnReboot(std::string file)
+{
+ MoveFileEx(file.c_str(), 0, MOVEFILE_DELAY_UNTIL_REBOOT);
+}
+
+std::string FileUtils::readFile(const std::string& filename)
+{
+ HANDLE f = CreateFile(filename.c_str(), GENERIC_READ,
+ FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+ std::string result;
+
+ if (f != INVALID_HANDLE_VALUE)
+ {
+ char buffer[129];
+ DWORD hasread;
+ buffer[127] = 0;
+
+ do {
+ ReadFile(f, buffer, 127, &hasread, NULL);
+ buffer[hasread] = 0;
+ result += buffer;
+ } while (hasread > 0);
+
+ CloseHandle(f);
+ }
+ else
+ {
+ // printf("Can't open file %s\n",filename.c_str());
+ }
+
+ return result;
+}
diff --git a/jsmooth-0.9.9-7-patch/skeletons/util-core/FileUtils.h b/jsmooth-0.9.9-7-patch/skeletons/util-core/FileUtils.h
new file mode 100644
index 00000000..665c6afb
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/util-core/FileUtils.h
@@ -0,0 +1,127 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __FILEUTILS_H_
+#define __FILEUTILS_H_
+
+#include
+#include
+#include
+
+#include "StringUtils.h"
+
+using namespace std;
+
+/** File access utility class.
+ * This class contains static class members that provide facilities
+ * for manamement of files.
+ *
+ * @author Rodrigo Reyes
+ */
+
+class FileUtils
+{
+ public:
+
+ /**
+ * Creates a temp filename. This method builds a temporary file
+ * name in the default windows temporary directory.
+ *
+ * @param suffix the suffix to use for the filename.
+ */
+ static string createTempFileName(const string& suffix);
+
+ /**
+ * Test wether a file exists.
+ * @param filename the file name to check.
+ * @return true if the file exists, false otherwise.
+ */
+ static bool fileExists(const string& filename);
+
+ static bool fileExists(const std::string&path, const string& filename);
+
+ /**
+ * Lookup recursively for files matching a given pattern in a given
+ * path. The method scans all the directory provided and its
+ * subdirectories. Each file matching the pattern is added to the
+ * resulting vector of strings.
+ *
+ * @param path the path of the directory to scan.
+ * @param pattern the file pattern, for instance "*.zip".
+ * @return a vector of string that contains the result.
+ */
+ static vector recursiveSearch(const string& path, const string& pattern);
+
+ /**
+ * Extracts the file part of a file path. Given a path of the form
+ * c:\\a\\b\\c\\d or c\\d, return the last component of the file path
+ * (that is, d in the previous example).
+ *
+ * @param filename an absolute or relative filename.
+ * @return a string with the file part of the file.
+ */
+ static std::string extractFileName(const std::string& filename);
+
+ /**
+ * Returns the path where the executable application is executed
+ * from. This is not the current directory, but the directory path
+ * where the application was found. For instance if the application
+ * was runned at c:\\programs\\bin\\test.exe, it returns
+ * c:\\programs\\bin\\.
+ *
+ * @return a std::string text that holds the path.
+ */
+ static std::string getExecutablePath();
+
+
+ static std::string getParent(const std::string &path);
+
+ /**
+ * Returns the name of the executable binary that was used to start
+ * the application.For instance if the application
+ * was runned at c:\\programs\\bin\\test.exe, it returns
+ * test.exe
+ *
+ * @return the executable name.
+ */
+ static std::string getExecutableFileName();
+
+
+ /**
+ * Returns the name of the computer.
+ * @return a std::string that holds the computer name.
+ */
+ static std::string getComputerName();
+
+ static std::string concFile(std::string path, std::string file);
+
+ static std::string getFileExtension(const std::string& filename);
+
+ static bool isAbsolute(const std::string& filename);
+
+ static std::string readFile(const std::string& filename);
+
+ static void deleteOnReboot(std::string file);
+
+};
+
+#endif
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/util-core/Makefile.win b/jsmooth-0.9.9-7-patch/skeletons/util-core/Makefile.win
new file mode 100644
index 00000000..29e409ea
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/util-core/Makefile.win
@@ -0,0 +1,32 @@
+# Project: util-core
+
+PROJECTNAME=util-core
+RM = rm -f
+CPP = ${MINGW}/bin/${TARGET}-g++.exe
+CC = ${MINGW}/bin/${TARGET}-gcc.exe
+WINDRES = windres.exe
+MINGW =
+RES =
+OBJ = SingleInstanceManager.o Process.o Log.o Thread.o FileUtils.o StringUtils.o DebugConsole.o $(RES)
+LIBS = -static-libgcc -L"$(MINGW)/lib"
+INCS = -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32"
+CXXINCS = -Os -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32"
+BIN = $(PROJECTNAME).a
+CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)"
+CFLAGS = $(INCS)
+
+.PHONY: all all-before all-after clean clean-custom $(PROJECTNAME)
+
+all: all-before $(PROJECTNAME).a testmain.cpp all-after
+
+
+clean: clean-custom
+ $(RM) $(OBJ) $(BIN) testmain.o test.exe
+
+$(BIN): $(OBJ)
+ ar r $(BIN) $(OBJ)
+ ranlib $(BIN)
+ $(CPP) $(OBJ) testmain.o -o test.exe $(LIBS)
+
+$(PROJECTNAME).a: $(OBJ) testmain.o
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/util-core/StringUtils.h b/jsmooth-0.9.9-7-patch/skeletons/util-core/StringUtils.h
new file mode 100644
index 00000000..f64078e4
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/util-core/StringUtils.h
@@ -0,0 +1,163 @@
+/*
+ JSmooth: a VM wrapper toolkit for Windows
+ Copyright (C) 2003-2007 Rodrigo Reyes
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __STRINGUTILS_H_
+#define __STRINGUTILS_H_
+
+#include
+#include
+#include
+#include
+
+using namespace std;
+
+/**
+ * Provides basic string operations.
+ *
+ * @author Rodrigo Reyes
+ */
+
+class StringUtils
+{
+ public:
+ /**
+ * Splits a string in several substrings. The split method takes a
+ * string as input, and outputs a vector of string. The string split
+ * is done according to 2 parameters:
+ *
+ * - the separators parameter, defines which chars are
+ * separators. Typically, this is a string that contains spaces,
+ * line-feed, and tabulation chars (" \n\t").
+ *
+ * - the quotechars parameter, is useful when your input contains
+ * quoted string that should not be broken down into substrings. For
+ * instance, a typical quote char is a quote or a double quote
+ * (resp. ' and ").
+ *
+ * For example, is the input string is the line belows:
+ * - this is "my string" and this is 'another one'.
+ *
+ * Here is the result of the call with the following parameters:
+ * - separators = \\n\\r\\t
+ * - quotechars = \\"\\'
+ *
+ * The output string is:
+ * - this
+ * - is
+ * - my string
+ * - and
+ * - this
+ * - is
+ * - another one
+ *
+ * @param str the string to be splitted
+ * @param separators a string that contains all the characters to be used as separators.
+ * @param quotechars a string that contains all the characters that are used as quote chars.
+ */
+ static vector split(const string& str, const string& separators, const string& quotechars, bool handleEscape = true, bool returnSeparators = false);
+
+ /**
+ * Converts a string to an int. If the string is not a valid
+ * integer, it returns 0.
+ *
+ * @param val the string to parse
+ * @return an integer value
+ */
+ static int parseInt(const string& val);
+
+ static int parseHexa(const string& val);
+
+ /**
+ * Convers an integer to a string.
+ *
+ * @param val an integer
+ * @return a string
+ */
+ static string toString(int val);
+ static string toHexString(int val);
+
+ /**
+ * Provides a string representation of a vector of string. A vector
+ * that contains 2 string aaa and bbb is represented as follows:
+ * [aaa, bbb].
+ *
+ * @param seq a vector of string
+ * @return a string representation
+ */
+ static string toString(const vector& seq);
+
+ /**
+ * Copies the content of a string in a char array.
+ *
+ * @param from the string to copy from
+ * @param to the destination array of chars
+ * @param length the length of the array of char
+ */
+ static void copyTo(const string& from, char* to, int length);
+
+ /**
+ * Returns a copy of the string with the environment variables
+ * replaced. The environment variable must be surrounded by %
+ * signs. For each variable defined between 2 % signs, the method
+ * tries to replace it by the value of the corresponding environment
+ * variable. If no variable exists, it just replaces it with an
+ * empty string.
+ *
+ * @param str the string to transform
+ * @return the same string, but with all the environment variable replaced
+ */
+ static string replaceEnvironmentVariable(const string& str);
+
+ static string replace(const string& str, const string& pattern, const string& replacement);
+
+ static string join(const vector& seq, const string& separator);
+ static string trim(string& str);
+
+ /**
+ * If a string does not start with a quote ("), it returns a copy of
+ * the string with enclosing quotes.
+ *
+ * @param str a string
+ * @return a fixed copy of the string
+ */
+ static std::string fixQuotes(const string& str);
+
+ static std::string escape(const string& str);
+ static std::string unescape(const string& str);
+ /**
+ * Ensures a string is correctly quoted, the quotes are enclosing
+ * the whole string, not a part of the string. For instance
+ * <<"c:\\my path"\\bin>> is transformed into <<"c:\\my path\\bin">>
+ *
+ * @param str a string
+ * @return a fixed copy of the string
+ */
+ static std::string requote(const string& str);
+ static std::string requoteForCommandLine(const string& str);
+ static std::string toLowerCase(const string& str);
+
+ static std::string fixArgumentString(const std::string& arg);
+
+ static std::string sizeToJavaString(int size);
+ static std::string sizeToJavaString(std::string size);
+
+};
+
+#endif
diff --git a/jsmooth-0.9.9-7-patch/skeletons/util-net/Makefile.win b/jsmooth-0.9.9-7-patch/skeletons/util-net/Makefile.win
new file mode 100644
index 00000000..32b2aaab
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/util-net/Makefile.win
@@ -0,0 +1,34 @@
+# Project: CommonJava
+
+PROJECTNAME=util-net
+RM = rm -f
+CPP = ${MINGW}/bin/${TARGET}-g++.exe
+CC = ${MINGW}/bin/${TARGET}-gcc.exe
+WINDRES = windres.exe
+MINGW = "c:/MinGW"
+FLTK-LDFLAGS = $(shell fltk-config --ldflags)
+FLTK-CXXFLAGS = $(shell fltk-config --cxxflags)
+RES =
+OBJ = WinHttpClient.o HttpClient.o URL.o downloadgui.o httpdownload.o $(RES)
+LIBS = -static-libgcc -L"$(MINGW)/lib" -lws2_32 -lwininet $(FLTK-LDFLAGS)
+CXXINCS = -Os -I"../util-core" -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" $(FLTK-CXXFLAGS)
+BIN = $(PROJECTNAME).a
+CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)"
+
+.PHONY: all all-before all-after clean clean-custom $(PROJECTNAME)
+
+all: all-before $(PROJECTNAME).a testmain.cpp all-after
+
+clean: clean-custom
+ $(RM) $(OBJ) $(BIN) test.exe testmain.o
+
+$(BIN): $(OBJ)
+ ar r $(BIN) $(OBJ)
+ ranlib $(BIN)
+ $(CPP) -g $(OBJ) ../util-core/util-core.a testmain.o -o test.exe $(LIBS)
+
+$(PROJECTNAME).a: $(OBJ) testmain.o
+
+
+testmain.o: testmain.cpp
+ $(CPP) -c testmain.cpp -o testmain.o $(CXXFLAGS)
diff --git a/jsmooth-0.9.9-7-patch/skeletons/winservice/Makefile.win b/jsmooth-0.9.9-7-patch/skeletons/winservice/Makefile.win
new file mode 100644
index 00000000..064aefc0
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/winservice/Makefile.win
@@ -0,0 +1,33 @@
+# Project: WinService Wrapper
+# Makefile created by Dev-C++ 4.9.8.0
+
+RM = rm -f
+#cmd /C DEL
+CPP = ${MINGW}/bin/${TARGET}-g++.exe
+CC = ${MINGW}/bin/${TARGET}-gcc.exe
+WINDRES = windres.exe
+RES = winservice_private.res
+OBJ = main.o $(RES)
+LINKOBJ = WinService.o main.o $(RES)
+LIBS = -static-libgcc -L"${MINGW}/lib" -L"../commonjava" -L"../util-core" ../commonjava/CommonJava.a ../util-core/util-core.a
+INCS = -I"/include" -I"../util-core" -I"../commonjava" -I"$(JDK)/include" -I"$(JDK)/include/win32"
+CXXINCS = -I"$(MINGW)/include/c++" -I"$(MINGW)/include/c++/mingw32" -I"$(MINGW)/include/c++/backward" -I"$(MINGW)/include" -I"$(JDK)/include" -I"$(JDK)/include/win32" -I"../commonjava" -I"../util-core" -I"../util-net" $(FLTK-CXXFLAGS)
+BIN = winservice.exe
+CXXFLAGS = $(CUSTOMFLAGS) $(CXXINCS) -DJDK="$(JDK)"
+CFLAGS = $(INCS)
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before winservice.exe all-after
+
+clean: clean-custom
+ $(RM) $(OBJ) $(BIN) winservice.o winservice_private.res
+
+$(BIN): $(LINKOBJ) ../commonjava/CommonJava.a
+ $(CPP) $(LINKOBJ) -o "winservice.exe" $(LIBS)
+
+main.o: main.cpp
+ $(CPP) -c main.cpp -o main.o $(CXXFLAGS)
+
+winservice_private.res: winservice_private.rc mainres.rc
+ $(WINDRES) -i winservice_private.rc -J rc -o winservice_private.res -O coff
diff --git a/jsmooth-0.9.9-7-patch/skeletons/winservice/description64.skel b/jsmooth-0.9.9-7-patch/skeletons/winservice/description64.skel
new file mode 100644
index 00000000..bede8c4c
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/winservice/description64.skel
@@ -0,0 +1,66 @@
+
+
+false
+SKEL_WINSERVICE_DESCRIPTION
+winservice.exe
+JAVA
+102
+103
+WinService Wrapper x64
+
+SKEL_WINSERVICE_NAME_DESCRIPTION
+ServiceName
+
+string
+myservice
+
+
+SKEL_WINSERVICE_DISPLAYNAME_DESCRIPTION
+ServiceDisplayName
+
+string
+My Service
+
+
+SKEL_WINSERVICE_PROPERTY_MESSAGE_DESCRIPTION
+Message
+
+textarea
+This program needs Java to run. Please download it at http://www.java.comf
+
+
+SKEL_WINSERVICE_AUTOSTART_DESCRIPTION
+Autostart
+
+boolean
+1
+
+
+SKEL_WINSERVICE_LOGFILE_DESCRIPTION
+Logfile
+
+string
+service.log
+
+
+SKEL_WINSERVICE_INTERACTIVE_DESCRIPTION
+Interactive
+
+boolean
+0
+
+
+SKEL_GENERIC_JNISMOOTH_DESCRIPTION
+JniSmooth
+
+boolean
+0
+
+
+SKEL_GENERIC_PROPERTY_DEBUG_DESCRIPTION
+Debug
+
+boolean
+0
+
+
diff --git a/jsmooth-0.9.9-7-patch/skeletons/winservice/mainres.rc b/jsmooth-0.9.9-7-patch/skeletons/winservice/mainres.rc
new file mode 100644
index 00000000..f2634f14
--- /dev/null
+++ b/jsmooth-0.9.9-7-patch/skeletons/winservice/mainres.rc
@@ -0,0 +1,9 @@
+
+#include "resource.h"
+
+JARID JAVA "../samplejar/sample.jar"
+PROPID JAVA "../samplejar/sample.props"
+JNISMOOTHID JAVA "../jnismooth/jnismooth.jar"
+
+A2 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "JWrap.ico"
+1 MANIFEST "../samplejar/sample.manifest"