You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2022/12/08 13:14:31 UTC
[netbeans-native-installers] 01/19: [INFRA-15006] Initial donation of NetBeans.
This is an automated email from the ASF dual-hosted git repository.
skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-native-installers.git
commit 820863d01f5d27a4d5b42ae2c235d508c80645a8
Author: pgebauer <pe...@oracle.com>
AuthorDate: Mon Sep 11 15:32:02 2017 +0200
[INFRA-15006] Initial donation of NetBeans.
Equivalent to the content of netbeans-donation-review.zip donated as part of ApacheNetBeansDonation1.zip with SHA256 being 7f2ca0f61953a190613c9a0fbcc1b034084b04a4d55d23c02cefffc354e7c24a.
---
build.properties | 88 +
build.xml | 164 ++
cleaner/unix/src/cleaner.sh | 112 ++
cleaner/windows/Makefile | 99 ++
cleaner/windows/Makefile-vc | 59 +
cleaner/windows/nbproject/configurations.xml | 115 ++
cleaner/windows/nbproject/project.properties | 40 +
cleaner/windows/nbproject/project.xml | 49 +
cleaner/windows/src/main.c | 493 ++++++
cleaner/windows/vcproject/NBI Native Cleaner.ncb | 1 +
cleaner/windows/vcproject/NBI Native Cleaner.sln | 20 +
cleaner/windows/vcproject/NBI Native Cleaner.suo | Bin 0 -> 33280 bytes
.../windows/vcproject/NBI Native Cleaner.vcproj | 209 +++
.../vcproject/NBI Native Cleaner.vcproj.user | 1 +
jnilib/.common/src/CommonUtils.c | 404 +++++
jnilib/.common/src/CommonUtils.h | 142 ++
jnilib/.unix/src/jni_UnixNativeUtils.c | 128 ++
jnilib/.unix/src/jni_UnixNativeUtils.h | 103 ++
jnilib/linux/Makefile | 129 ++
jnilib/linux/nbproject/configurations.xml | 201 +++
jnilib/linux/nbproject/project.properties | 40 +
jnilib/linux/nbproject/project.xml | 49 +
jnilib/macosx/Makefile | 129 ++
jnilib/macosx/nbproject/configurations.xml | 144 ++
jnilib/macosx/nbproject/project.properties | 40 +
jnilib/macosx/nbproject/project.xml | 49 +
jnilib/solaris-sparc/Makefile | 129 ++
jnilib/solaris-sparc/nbproject/configurations.xml | 301 ++++
jnilib/solaris-sparc/nbproject/project.properties | 40 +
jnilib/solaris-sparc/nbproject/project.xml | 49 +
jnilib/solaris-x86/Makefile | 129 ++
jnilib/solaris-x86/nbproject/configurations.xml | 301 ++++
jnilib/solaris-x86/nbproject/project.properties | 40 +
jnilib/solaris-x86/nbproject/project.xml | 49 +
jnilib/windows/Makefile | 129 ++
jnilib/windows/Makefile-vc | 76 +
jnilib/windows/Makefile-vc-wo-crt | 79 +
jnilib/windows/nbproject/configurations.xml | 197 +++
jnilib/windows/nbproject/project.properties | 40 +
jnilib/windows/nbproject/project.xml | 49 +
jnilib/windows/src/WindowsUtils.c | 166 ++
jnilib/windows/src/WindowsUtils.h | 68 +
jnilib/windows/src/jni_WindowsNativeUtils.c | 420 +++++
jnilib/windows/src/jni_WindowsNativeUtils.h | 129 ++
jnilib/windows/src/jni_WindowsRegistry.c | 652 ++++++++
jnilib/windows/src/jni_WindowsRegistry.h | 286 ++++
jnilib/windows/vcproject/NBI JNI Library.ncb | 1 +
jnilib/windows/vcproject/NBI JNI Library.sln | 20 +
jnilib/windows/vcproject/NBI JNI Library.suo | Bin 0 -> 13824 bytes
jnilib/windows/vcproject/NBI JNI Library.vcproj | 261 +++
.../windows/vcproject/NBI JNI Library.vcproj.user | 1 +
jnilib/windows/vcproject/vc80.idb | Bin 0 -> 11264 bytes
launcher/unix/i18n/launcher.properties | 71 +
launcher/unix/src/launcher.sh | 1685 ++++++++++++++++++++
launcher/windows/.dep.inc | 5 +
launcher/windows/Makefile | 129 ++
launcher/windows/Makefile-vc | 92 ++
launcher/windows/Makefile-vc-wo-crt | 92 ++
launcher/windows/i18n/launcher.properties | 74 +
launcher/windows/nbproject/configurations.xml | 126 ++
launcher/windows/nbproject/project.properties | 40 +
launcher/windows/nbproject/project.xml | 64 +
launcher/windows/resources/icon.ico | Bin 0 -> 300318 bytes
launcher/windows/resources/nlw-alt.exe.manifest | 11 +
launcher/windows/resources/nlw.exe.manifest | 11 +
launcher/windows/resources/res.rc | 61 +
launcher/windows/src/Errors.h | 72 +
launcher/windows/src/ExtractUtils.c | 781 +++++++++
launcher/windows/src/ExtractUtils.h | 70 +
launcher/windows/src/FileUtils.c | 613 +++++++
launcher/windows/src/FileUtils.h | 88 +
launcher/windows/src/JavaUtils.c | 799 ++++++++++
launcher/windows/src/JavaUtils.h | 84 +
launcher/windows/src/Launcher.c | 1029 ++++++++++++
launcher/windows/src/Launcher.h | 73 +
launcher/windows/src/Main.c | 692 ++++++++
launcher/windows/src/Main.h | 78 +
launcher/windows/src/ProcessUtils.c | 241 +++
launcher/windows/src/ProcessUtils.h | 68 +
launcher/windows/src/RegistryUtils.c | 80 +
launcher/windows/src/RegistryUtils.h | 64 +
launcher/windows/src/StringUtils.c | 814 ++++++++++
launcher/windows/src/StringUtils.h | 169 ++
launcher/windows/src/SystemUtils.c | 120 ++
launcher/windows/src/SystemUtils.h | 64 +
launcher/windows/src/Types.h | 175 ++
launcher/windows/vcproject/NBI Native Launcher.ncb | 1 +
launcher/windows/vcproject/NBI Native Launcher.sln | 17 +
launcher/windows/vcproject/NBI Native Launcher.suo | Bin 0 -> 50176 bytes
.../windows/vcproject/NBI Native Launcher.vcproj | 304 ++++
.../NBI Native Launcher.vcproj.SARD.dlm198383.user | 65 +
.../vcproject/NBI Native Launcher.vcproj.user | 1 +
92 files changed, 15643 insertions(+)
diff --git a/build.properties b/build.properties
new file mode 100644
index 0000000..4359a3b
--- /dev/null
+++ b/build.properties
@@ -0,0 +1,88 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#ignore.native=
+
+native.dist.dir=dist
+
+native.jnilib.dir=jnilib
+native.launcher.dir=launcher
+native.cleaner.dir=cleaner
+
+# Native Library properties
+native.jnilib.dir.windows=${native.jnilib.dir}/windows
+native.jnilib.dir.linux=${native.jnilib.dir}/linux
+native.jnilib.dir.solaris-x86=${native.jnilib.dir}/solaris-x86
+native.jnilib.dir.solaris-sparc=${native.jnilib.dir}/solaris-sparc
+native.jnilib.dir.macosx=${native.jnilib.dir}/macosx
+
+native.jnilib.file.windows.i386=windows-x86.dll
+native.jnilib.file.windows.amd64=windows-x64.dll
+native.jnilib.file.windows.ia64=windows-ia64.dll
+native.jnilib.file.linux.i386=linux.so
+native.jnilib.file.linux.amd64=linux-amd64.so
+native.jnilib.file.solaris-x86=solaris-x86.so
+native.jnilib.file.solaris-sparc=solaris-sparc.so
+native.jnilib.file.solaris-amd64=solaris-amd64.so
+native.jnilib.file.solaris-sparcv9=solaris-sparcv9.so
+native.jnilib.file.macosx=macosx.dylib
+
+
+# Native Launcher Properties
+native.launcher.windows.dir=${native.launcher.dir}/windows
+native.launcher.windows.stub.file=nlw.exe
+native.launcher.windows.stub.src=${native.launcher.windows.dir}/dist/${native.launcher.windows.stub.file}
+native.launcher.windows.stub.dst.dir=${native.launcher.windows.dir}
+native.launcher.windows.i18n.dir=${native.launcher.windows.dir}/i18n
+
+native.launcher.unix.dir=${native.launcher.dir}/unix
+native.launcher.unix.stub.file=launcher.sh
+native.launcher.unix.stub.src=${native.launcher.unix.dir}/src/${native.launcher.unix.stub.file}
+native.launcher.unix.stub.dst.dir=${native.launcher.unix.dir}
+native.launcher.unix.i18n.dir=${native.launcher.unix.dir}/i18n
+
+
+# Native on-exit cleaner properties
+native.cleaner.windows.dir=${native.cleaner.dir}/windows
+native.cleaner.windows.srcdir=${native.cleaner.windows.dir}/dist
+native.cleaner.windows.file=cleaner.exe
+
+native.cleaner.unix.dir=${native.cleaner.dir}/unix
+native.cleaner.unix.srcdir=${native.cleaner.unix.dir}/src
+native.cleaner.unix.file=cleaner.sh
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..2378874
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<project name="native" default="default" basedir=".">
+ <property file="build.properties"/>
+
+ <!-- =======================================================================
+ NetBeans Installer engine specific targets
+ ======================================================================== -->
+
+ <!-- =======================================================================
+ Build native library
+ ======================================================================== -->
+ <target name="jnilib-init" depends="define-platform,init-platform"/>
+ <target name="jnilib-clean" depends="jnilib-init" unless="ignore.native">
+ <exec executable="make" dir="${jnilib.dir}">
+ <arg value="clean"/>
+ </exec>
+ </target>
+
+ <target name="jnilib-compile" depends="jnilib-init,jnilib-clean" unless="ignore.native">
+ <exec executable="make" dir="${jnilib.dir}">
+ <arg value="build"/>
+ </exec>
+ </target>
+ <target name="jnilib-build" depends="jnilib-init,jnilib-compile"/>
+
+ <!-- =======================================================================
+ Build launcher
+ ======================================================================== -->
+ <target name="launcher-init" depends="define-platform,init-platform"/>
+ <target name="launcher-clean" depends="launcher-init" unless="ignore.native">
+ <exec executable="make" dir="${launcher.dir}">
+ <arg value="clean"/>
+ </exec>
+ </target>
+
+ <target name="launcher-compile" depends="launcher-init,launcher-clean" if="is.windows" unless="ignore.native">
+ <exec executable="make" dir="${launcher.dir}">
+ <arg value="build"/>
+ </exec>
+ </target>
+ <target name="launcher-build" depends="launcher-init,launcher-compile"/>
+
+
+
+<!-- =======================================================================
+ Build cleaner
+ ======================================================================== -->
+ <target name="cleaner-init" depends="define-platform,init-platform"/>
+ <target name="cleaner-clean" depends="cleaner-init" unless="ignore.native">
+ <exec executable="make" dir="${cleaner.dir}">
+ <arg value="clean"/>
+ </exec>
+ </target>
+
+ <target name="cleaner-compile" depends="cleaner-init,cleaner-clean" if="is.windows" unless="ignore.native">
+ <exec executable="make" dir="${cleaner.dir}">
+ <arg value="build"/>
+ </exec>
+ </target>
+ <target name="cleaner-build" depends="cleaner-init,cleaner-compile"/>
+
+
+<!-- =======================================================================
+ Build all native resources
+ ======================================================================== -->
+
+ <target name="native-clean" depends="jnilib-clean,launcher-clean,cleaner-clean"/>
+ <target name="native-compile" depends="jnilib-compile,launcher-compile,cleaner-compile"/>
+ <target name="native-build" depends="jnilib-build,launcher-build,cleaner-build"/>
+
+ <target name="define-platform">
+ <condition property="is.windows">
+ <os family="windows"/>
+ </condition>
+ <condition property="is.linux">
+ <os name="Linux"/>
+ </condition>
+ <condition property="is.solaris-x86">
+ <os name="SunOS" arch="x86"/>
+ </condition>
+ <condition property="is.solaris-sparc">
+ <os name="SunOS" arch="sparc"/>
+ </condition>
+ <condition property="is.macosx">
+ <and>
+ <os family="mac"/>
+ <os family="unix"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="init-platform" depends="init-windows,init-linux,init-solaris-x86,init-solaris-sparc,init-macosx"/>
+
+ <target name="init-windows" if="is.windows">
+ <property name="jnilib.dir" value="${native.jnilib.dir.windows}"/>
+ <property name="jnilib.file" value="${native.jnilib.file.windows}"/>
+ <property name="launcher.dir" value="${native.launcher.windows.dir}"/>
+ <property name="cleaner.dir" value="${native.cleaner.windows.dir}"/>
+ </target>
+ <target name="init-linux" if="is.linux">
+ <property name="jnilib.dir" value="${native.jnilib.dir.linux}"/>
+ <property name="jnilib.file" value="${native.jnilib.file.linux}"/>
+ <property name="launcher.dir" value="${native.launcher.unix.dir}"/>
+ <property name="cleaner.dir" value="${native.cleaner.unix.dir}"/>
+ </target>
+ <target name="init-solaris-x86" if="is.solaris-x86">
+ <property name="jnilib.dir" value="${native.jnilib.dir.solaris-x86}"/>
+ <property name="jnilib.file" value="${native.jnilib.file.solaris-x86}"/>
+ <property name="launcher.dir" value="${native.launcher.unix.dir}"/>
+ <property name="cleaner.dir" value="${native.cleaner.unix.dir}"/>
+ </target>
+ <target name="init-solaris-sparc" if="is.solaris-sparc">
+ <property name="jnilib.dir" value="${native.jnilib.dir.solaris-sparc}"/>
+ <property name="jnilib.file" value="${native.jnilib.file.solaris-sparc}"/>
+ <property name="launcher.dir" value="${native.launcher.unix.dir}"/>
+ <property name="cleaner.dir" value="${native.cleaner.unix.dir}"/>
+ </target>
+ <target name="init-macosx" if="is.macosx">
+ <property name="jnilib.dir" value="${native.jnilib.dir.macosx}"/>
+ <property name="jnilib.file" value="${native.jnilib.file.macosx}"/>
+ <property name="launcher.dir" value="${native.launcher.unix.dir}"/>
+ <property name="cleaner.dir" value="${native.cleaner.unix.dir}"/>
+ </target>
+
+</project>
diff --git a/cleaner/unix/src/cleaner.sh b/cleaner/unix/src/cleaner.sh
new file mode 100644
index 0000000..4d91691
--- /dev/null
+++ b/cleaner/unix/src/cleaner.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+deleteFiles() {
+ testSymlinkErr=`test -L / > /dev/null`
+ if [ -z "$testSymlinkErr" ] ; then
+ isSymlink=-L
+ else
+ isSymlink=-h
+ fi
+
+ #wait for main thread to finish...
+ sleep 3
+ waitOnError=1
+ tryTimes=3
+ list="$1"
+ if [ -n "$list" ] && [ -f "$list" ] ; then
+ #echo "Using list file : $list"
+ itemsNumber=`wc -l $list | sed "s/^\ *//;s/\ .*//" 2>/dev/null`
+ #echo "Total items : $itemsNumber"
+ counter=1
+ try=$tryTimes
+ allitems=`cat "$list" 2>/dev/null`
+ if [ -f "$list" ] ; then
+ #echo "... remove cleaner list $list"
+ rm -f "$list"
+ fi
+ while [ $counter -le $itemsNumber ] ; do
+ file=`echo "$allitems" | sed -n "${counter}p" 2>/dev/null`
+ #echo "entry : $file"
+ result=1
+ if [ -n "$file" ] ; then
+ #echo "... file not zero"
+ if [ $isSymlink "$file" ] || [ -f "$file" ] ; then
+ # file or symlink
+ #echo "deleting [F] $file"
+ rm -f "$file" 2>/dev/null 1>&2
+ if [ $? -ne 0 ] ; then
+ #echo "... can't delete $file"
+ result=0
+ fi
+ elif [ -d "$file" ] ; then
+ # directory
+ #echo "deleting [D] $file"
+ rmdir "$file" 2>/dev/null 1>&2
+ if [ $? -ne 0 ] ; then
+ result=0
+ #echo "... can't delete $file"
+ fi
+ fi
+ fi
+ if [ 0 -eq $result ] ; then
+ # try to remove it again after a short wait
+ if [ $try -gt 0 ] ; then
+ try=`expr "$try" - 1`
+ sleep $waitOnError
+ else
+ #can`t delete.. skip it
+ result=1
+ fi
+
+ fi
+ if [ 1 -eq $result ] ; then
+ counter=`expr "$counter" + 1`
+ try=$tryTimes
+ fi
+ done
+ fi
+ if [ -f "$0" ] ; then
+ #echo "... remove cleaner itself $0"
+ rm -f "$0"
+ fi
+}
+
+deleteFiles "$@"
diff --git a/cleaner/windows/Makefile b/cleaner/windows/Makefile
new file mode 100644
index 0000000..bf5b7f9
--- /dev/null
+++ b/cleaner/windows/Makefile
@@ -0,0 +1,99 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/cleaner/windows/Makefile-vc b/cleaner/windows/Makefile-vc
new file mode 100644
index 0000000..b9edda9
--- /dev/null
+++ b/cleaner/windows/Makefile-vc
@@ -0,0 +1,59 @@
+#
+#
+
+
+!include <$(PLATFORM_SDK)/include/win32.mak>
+
+# define the compiler and linker for all the platforms
+CC32="$(VC_2005)\Bin\cl.exe"
+L32="$(VC_2005)\Bin\link.exe"
+
+BUILD_DIR32=.\build\32bit
+OUTPUT_FILE32=.\dist\cleaner.exe
+
+CC32_OPTS=/O1 /Os \
+ /I "$(VC_2005)\include" \
+ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CRT_SECURE_NO_DEPRECATE" \
+ /FD /GS-\
+ /Fo"$(BUILD_DIR32)\\" /Fd"$(BUILD_DIR32)\vc80.pdb" \
+ /W3 /nologo /c /Wp64 /TC /errorReport:prompt
+
+LINKING_LIBRARIES=\
+ shell32.lib \
+ kernel32.lib
+
+L32_OPTS=\
+ /OUT:$(OUTPUT_FILE32) \
+ /INCREMENTAL:NO \
+ /LIBPATH:"$(PLATFORM_SDK)\Lib" \
+ /MANIFEST:NO \
+ /NODEFAULTLIB \
+ /SUBSYSTEM:WINDOWS \
+ /OPT:REF /OPT:ICF \
+ /MACHINE:X86 \
+ /ERRORREPORT:PROMPT \
+ /ENTRY:WinMain \
+ $(LINKING_LIBRARIES)
+
+all: init build-32
+
+clean:
+
+
+init:
+ - md $(BUILD_DIR32)
+ - md .\dist
+
+ del /Q /S $(BUILD_DIR32)
+ del /Q $(OUTPUT_FILE32)
+
+build-32:
+ Set CPU=i386
+ Set Lib=%VC_2005%\Lib;%PLATFORM_SDK%\Lib;%Lib%
+ Set Include=%PLATFORM_SDK%\Include;%Include%
+ Set Path=%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%VC_2005_PATH%;%path%
+ Set APPVER=5.01
+ Set TARGETOS=WINNT
+
+ $(CC32) $(CC32_OPTS) .\src\main.c
+ $(L32) $(L32_OPTS) $(BUILD_DIR32)\main.obj
diff --git a/cleaner/windows/nbproject/configurations.xml b/cleaner/windows/nbproject/configurations.xml
new file mode 100644
index 0000000..83d7e4b
--- /dev/null
+++ b/cleaner/windows/nbproject/configurations.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<configurationDescriptor version="35">
+ <logicalFolder name="root" displayName="root" projectFiles="true">
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>src/main.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <defaultConf>0</defaultConf>
+ <confs>
+ <conf name="Debug" type="1">
+ <toolsSet>
+ <compilerSet>Cygwin</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>3</platform>
+ </toolsSet>
+ <compileType>
+ <linkerTool>
+ <output>dist/cleaner</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerLibItems>
+ <linkerOptionItem>-lshell32 -lkernel32</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-mno-cygwin -mwindows</commandLine>
+ </linkerTool>
+ </compileType>
+ <item path="src/main.c">
+ <itemTool>0</itemTool>
+ </item>
+ </conf>
+ <conf name="Release" type="1">
+ <toolsSet>
+ <compilerSet>Cygwin</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>3</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>5</developmentMode>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>5</developmentMode>
+ </ccCompilerTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="src/main.c">
+ <itemTool>0</itemTool>
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/cleaner/windows/nbproject/project.properties b/cleaner/windows/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/cleaner/windows/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/cleaner/windows/nbproject/project.xml b/cleaner/windows/nbproject/project.xml
new file mode 100644
index 0000000..d8bb645
--- /dev/null
+++ b/cleaner/windows/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Cleaner : Windows</name>
+ <make-project-type>0</make-project-type>
+ </data>
+ </configuration>
+</project>
diff --git a/cleaner/windows/src/main.c b/cleaner/windows/src/main.c
new file mode 100644
index 0000000..21d2d9d
--- /dev/null
+++ b/cleaner/windows/src/main.c
@@ -0,0 +1,493 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <windows.h>
+#include <wchar.h>
+
+
+
+const DWORD SLEEP_DELAY = 200;
+const DWORD MAX_ATTEPTS = 15;
+const DWORD THREAD_FINISHED = 100;
+const DWORD INITIAL_DELAY = 2000; // 2 seconds is seems to be enough to finish java process
+const WCHAR * LINE_SEPARATOR = L"\r\n";
+const WCHAR * UNC_PREFIX = L"\\\\?\\";
+const WCHAR * UNC_STD_PREFIX = L"\\\\";
+const DWORD UNC_PREFIX_LENGTH = 4;
+
+#ifdef _MSC_VER
+#define ZERO(x,y) SecureZeroMemory((x),(y));
+#else
+#define ZERO(x,y) ZeroMemory((x),(y));
+#endif
+
+/*
+ * typedef UINT (WINAPI * WAIT_PROC)(HANDLE, DWORD);
+ * typedef BOOL (WINAPI * CLOSE_PROC)(HANDLE);
+ * typedef BOOL (WINAPI * DELETE_PROC)(LPCWSTR);
+ * typedef VOID (WINAPI * EXIT_PROC)(DWORD);
+ * typedef VOID (WINAPI * SLEEP_PROC)(DWORD);
+ *
+ *
+ * typedef struct {
+ * WAIT_PROC waitObject;
+ * CLOSE_PROC closeHandle;
+ * DELETE_PROC deleteFile;
+ * EXIT_PROC exitProcess;
+ * SLEEP_PROC sleep;
+ *
+ * HANDLE hProcess;
+ * WCHAR szFileName[MAX_PATH];
+ *
+ * } INJECT;
+ */
+WCHAR * search( const WCHAR * wcs1, const WCHAR * wcs2) {
+ WCHAR *cp = (WCHAR *) wcs1;
+ WCHAR *s1, *s2;
+
+ if ( !*wcs2) {
+ return (WCHAR *)wcs1;
+ }
+
+ while (*cp) {
+ s1 = cp;
+ s2 = (WCHAR *) wcs2;
+
+ while ( *s1 && *s2 && !(*s1-*s2) ) {
+ s1++, s2++;
+ }
+ if (!*s2) {
+ return(cp);
+ }
+ cp++;
+ }
+ return(NULL);
+}
+
+/*
+ * DWORD WINAPI RemoteThread(INJECT *remote) {
+ * DWORD count = 0 ;
+ *
+ * remote->waitObject(remote->hProcess, INFINITE);
+ * remote->closeHandle(remote->hProcess);
+ * while(!remote->deleteFile(remote->szFileName) && (count++) < MAX_ATTEPTS) {
+ * remote->sleep(SLEEP_DELAY);
+ * }
+ * remote->exitProcess(0);
+ * return 0;
+ * }
+ *
+ * HANDLE GetRemoteProcess() {
+ * STARTUPINFO si;
+ *
+ * PROCESS_INFORMATION pi;
+ * ZERO( &si, sizeof(si) );
+ * ZERO( &pi, sizeof(pi) );
+ * si.cb = sizeof(si);
+ * if(CreateProcess(0, "explorer.exe", 0, 0, FALSE, CREATE_SUSPENDED|CREATE_NO_WINDOW|IDLE_PRIORITY_CLASS, 0, 0, &si, &pi)) {
+ * CloseHandle(pi.hThread);
+ * return pi.hProcess;
+ * }
+ * else {
+ * return 0;
+ * }
+ * }
+ *
+ * BOOL removeItself() {
+ *
+ * INJECT local, *remote;
+ * BYTE *code;
+ * HMODULE hKernel32;
+ * HANDLE hRemoteProcess;
+ * HANDLE hCurProc;
+ *
+ * DWORD dwThreadId;
+ * HANDLE hThread = 0;
+ * DWORD sizeOfCode = 200;
+ *
+ * hRemoteProcess = GetRemoteProcess();
+ *
+ * if(hRemoteProcess == 0) {
+ * return FALSE;
+ * }
+ *
+ * code = VirtualAllocEx(hRemoteProcess, 0, sizeof(INJECT) + sizeOfCode, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ *
+ * if(code == 0) {
+ * CloseHandle(hRemoteProcess);
+ * return FALSE;
+ * }
+ *
+ * hKernel32 = GetModuleHandleW(L"kernel32.dll");
+ * remote = (INJECT *)(code + sizeOfCode);
+ *
+ * local.waitObject = (WAIT_PROC) GetProcAddress(hKernel32, "WaitForSingleObject");
+ * local.closeHandle = (CLOSE_PROC) GetProcAddress(hKernel32, "CloseHandle");
+ * local.exitProcess = (EXIT_PROC) GetProcAddress(hKernel32, "ExitProcess");
+ * local.deleteFile = (DELETE_PROC)GetProcAddress(hKernel32, "DeleteFileW");
+ * local.sleep = (SLEEP_PROC) GetProcAddress(hKernel32, "Sleep");
+ *
+ * // duplicate our own process handle for remote process to wait on
+ * hCurProc = GetCurrentProcess();
+ *
+ * DuplicateHandle(hCurProc, hCurProc, hRemoteProcess, &local.hProcess, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ *
+ * // find name of current executable
+ *
+ * GetModuleFileNameW(NULL, local.szFileName, MAX_PATH);
+ *
+ * // write in code to execute, and the remote structure
+ * WriteProcessMemory(hRemoteProcess, (LPVOID) code, RemoteThread, sizeOfCode, 0);
+ * WriteProcessMemory(hRemoteProcess, (LPVOID) remote, &local, sizeof(local), 0);
+ *
+ * // execute the code in remote process
+ * hThread = CreateRemoteThread(hRemoteProcess, 0, 0, (LPTHREAD_START_ROUTINE) code, remote, 0, &dwThreadId);
+ *
+ * if(hThread != 0) {
+ * CloseHandle(hThread);
+ * }
+ * return TRUE;
+ * }
+ */
+
+typedef struct _list {
+ WCHAR * item;
+ struct _list * next;
+} LIST;
+
+
+WCHAR * toWCHAR(char * charBuffer, DWORD size) {
+ DWORD i=0;
+ WCHAR * buffer;
+ BOOL hasBOM = (*charBuffer == '\xFF' && *(charBuffer+1) == '\xFE');
+ BOOL hasReverseBOM = (*charBuffer == '\xFE' && *(charBuffer+1) == '\xFF');
+
+ char * realStringPtr = charBuffer;
+ if (hasBOM || hasReverseBOM) {
+ size-= 2;
+ realStringPtr+= 2;
+ if(hasReverseBOM) {
+ char c;
+ for (i = 0 ; i < size/2 ; i++) {
+ c = charBuffer [2 * i] ;
+ charBuffer [2 * i] = charBuffer [2 * i + 1] ;
+ charBuffer [2 * i + 1] = c;
+ }
+ }
+ }
+
+ buffer = (WCHAR*) LocalAlloc(LPTR, sizeof(WCHAR) * (size/2+1));
+ ZERO(buffer, sizeof(WCHAR) * (size/2+1));
+ for(i=0;i<size/2;i++) {
+ realStringPtr[2*i] = (realStringPtr[2*i]) & 0xFF;
+ realStringPtr[2*i+1] = (realStringPtr[2*i+1])& 0xFF;
+ buffer [i] = ((unsigned char)realStringPtr[2*i]) + (((unsigned char)realStringPtr[2*i+1]) << 8);
+ }
+
+ return buffer;
+}
+
+DWORD getLinesNumber(WCHAR *str) {
+ DWORD result = 0;
+ WCHAR *ptr = str;
+ WCHAR *ptr2 = str;
+ DWORD sepLength = lstrlenW(LINE_SEPARATOR);
+ if(ptr!=NULL) {
+ while((ptr2 = search(ptr, LINE_SEPARATOR))!=NULL) {
+ ptr = ptr2 + sepLength;
+ result++;
+
+ if(ptr==NULL) break;
+ }
+ if(ptr!=NULL && lstrlenW(ptr) > 0) {
+ result ++;
+ }
+ }
+ return result;
+}
+
+void getLines(WCHAR *str, WCHAR *** list, DWORD * number) {
+ WCHAR *ptr = str;
+ WCHAR *ptr2 = NULL;
+ DWORD length = 0;
+ DWORD sepLength = lstrlenW(LINE_SEPARATOR);
+ DWORD counter = 0;
+ *number = getLinesNumber(str);
+ *list = (WCHAR**) LocalAlloc(LPTR, sizeof(WCHAR*) * (*number));
+
+ if(ptr!=NULL) {
+ while(counter < (*number)) {
+ DWORD i = 0 ;
+ if((ptr2 = search(ptr, LINE_SEPARATOR))!=NULL) {
+ ptr2 = search(ptr, LINE_SEPARATOR) + sepLength;
+ length = lstrlenW(ptr) - lstrlenW(ptr2) - sepLength;
+ (*list) [counter ] = (WCHAR*) LocalAlloc(LPTR, sizeof(WCHAR*)*(length+1));
+ ZERO((*list) [counter ], sizeof(WCHAR*)*(length+1));
+ for(i=0;i<length;i++) {
+ (*list) [counter ][i]=ptr[i];
+ }
+ ptr = ptr2;
+ } else if((length = lstrlenW(ptr)) > 0) {
+ (*list)[counter ] = (WCHAR*) LocalAlloc(LPTR, sizeof(WCHAR*)*(length+1));
+ ZERO((*list) [counter ], sizeof(WCHAR*)*(length+1));
+ for(i=0;i<length;i++) {
+ (*list) [counter ][i]=ptr[i];
+ }
+ ptr = NULL;
+ }
+ counter++;
+ if(ptr==NULL) break;
+ }
+ }
+}
+
+
+void readStringList(HANDLE fileHandle, WCHAR *** list, DWORD *number) {
+ DWORD size = GetFileSize(fileHandle, NULL); // hope it much less than 2GB
+ DWORD read = 0;
+ char * charBuffer = (char*) LocalAlloc(LPTR, sizeof(char) * (size + 2));
+ ZERO(charBuffer, sizeof(char) * (size + 2));
+
+ if(ReadFile(fileHandle, charBuffer, size, &read, 0) && read >=2) {
+ WCHAR * buffer = toWCHAR(charBuffer, size + 2);
+ getLines(buffer, list, number);
+ LocalFree(buffer);
+ }
+ LocalFree(charBuffer);
+}
+
+void deleteFile(WCHAR * filePath) {
+ DWORD count = 0 ;
+ WIN32_FILE_ATTRIBUTE_DATA attrs;
+ DWORD filePathLength = lstrlenW(filePath);
+ DWORD prefixLength = (filePath == search(filePath, UNC_STD_PREFIX)) ? 0 : UNC_PREFIX_LENGTH;
+ DWORD length = filePathLength + prefixLength + 1;
+ WCHAR * file = (WCHAR*) LocalAlloc(LPTR, sizeof(WCHAR) * length);
+ DWORD i=0;
+ for(i=0;i<prefixLength;i++) {
+ file[i]=UNC_PREFIX[i];
+ }
+ for(i=0;i<filePathLength;i++) {
+ file[i+prefixLength] = filePath[i];
+ }
+
+ if(GetFileAttributesExW(file, GetFileExInfoStandard, &attrs)) {
+ if(attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ while((!RemoveDirectoryW(file) || GetFileAttributesExW(file, GetFileExInfoStandard, &attrs)) &&
+ ((count++) < MAX_ATTEPTS))
+ Sleep(SLEEP_DELAY);
+ else
+ while((!DeleteFileW(file) || GetFileAttributesExW(file, GetFileExInfoStandard, &attrs)) &&
+ ((count++) < MAX_ATTEPTS))
+ Sleep(SLEEP_DELAY);
+ }
+ LocalFree(file);
+}
+
+DWORD WINAPI deleteFileThread(void * ptr) {
+ WCHAR * file = (WCHAR*) ptr;
+ deleteFile(file);
+ return THREAD_FINISHED;
+}
+
+void getFreeIndexForNextThread(HANDLE * list, DWORD max, DWORD * counter) {
+ DWORD code = 0;
+ DWORD maxReached = 0;
+
+ while(1) {
+ if((*counter)==max) {
+ maxReached = 1;
+ *counter = 0;
+ }
+ code = 0;
+ if(list[*counter]==INVALID_HANDLE_VALUE) {
+ break;
+ } else if(GetExitCodeThread(list[*counter], &code)!=0 && code==THREAD_FINISHED) {
+ break;
+ } else {
+ *counter = (*counter) + 1;
+ if((*counter)==max && maxReached == 1) {
+ *counter = WaitForMultipleObjects(max, list, FALSE, INFINITE) - WAIT_OBJECT_0;
+ }
+ }
+ }
+}
+
+#define BUFSIZE 512
+void removeItselfUsingCmd() {
+ char * currentFile = LocalAlloc(LPTR, sizeof(char) * BUFSIZE);
+ if (GetModuleFileNameA(0, currentFile, MAX_PATH)) {
+ char * tempFile = LocalAlloc(LPTR, sizeof(char) * BUFSIZE);
+ HANDLE hTempFile;
+ int index = 0;
+ int i = 0;
+ char cleanerSuffix [] = ".bat";
+ for( i = 0; i < (lstrlenA(currentFile) - lstrlenA(cleanerSuffix)); i++) {
+ tempFile[index++] = currentFile[i];
+ }
+ for(i=0;i<lstrlenA(cleanerSuffix);i++) {
+ tempFile[index++] = cleanerSuffix[i];
+ }
+ hTempFile = CreateFileA(tempFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hTempFile != INVALID_HANDLE_VALUE) {
+ char * command = LocalAlloc(LPTR, sizeof(char) * (lstrlenA(tempFile) + lstrlenA(currentFile) + 6));
+ DWORD bytesNumber = 0 ;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ char * strings [4] = {
+ ":Repeat\n",
+ "del %1\n",
+ "if exist %1 goto Repeat\n",
+ "del %0\n",
+ };
+ for(i=0;i<4;i++) {
+ WriteFile(hTempFile, strings[i], lstrlenA(strings[i]), &bytesNumber, NULL);
+ }
+
+ CloseHandle(hTempFile);
+
+ ZERO( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZERO( &pi, sizeof(pi) );
+ index=0;
+ command [index++]= '"';
+ for(i=0;i<lstrlenA(tempFile);i++) {
+ command [index++] = tempFile[i];
+ }
+ command[index++]= '"';
+ command[index++]= ' ';
+ command[index++]= '"';
+ for(i=0;i<lstrlenA(currentFile);i++) {
+ command [index++] = currentFile[i];
+ }
+ command[index++]= '"';
+ command[index++]= 0;
+
+ CreateProcess(0, command, 0, 0, FALSE, CREATE_NO_WINDOW | IDLE_PRIORITY_CLASS, 0, 0, &si, &pi);
+ LocalFree(command);
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+ }
+ LocalFree(tempFile);
+ }
+ LocalFree(currentFile);
+
+}
+
+void changeCurrentDirectory() {
+ WCHAR * currentFile = LocalAlloc(LPTR, sizeof(WCHAR) * MAX_PATH);
+ if (GetModuleFileNameW(0, currentFile, MAX_PATH)) {
+ WCHAR * ptr = currentFile;
+ DWORD i=0;
+ DWORD len=0;
+ WCHAR * parent;
+ while(search(ptr, L"\\")!=NULL) {
+ ptr = search(ptr, L"\\") + 1;
+ }
+ len = lstrlenW(currentFile) - lstrlenW(ptr) - 1;
+ parent = LocalAlloc(LPTR, sizeof(WCHAR) * (len + 1));
+ for(i=0;i<len;i++) {
+ parent[i] = currentFile[i];
+ }
+ parent[len] = 0;
+ SetCurrentDirectoryW(parent);
+ LocalFree(parent);
+ }
+ LocalFree(currentFile);
+}
+
+// should be less or equals to MAXIMUM_WAIT_OBJECTS
+#define MAXIMUM_THREADS MAXIMUM_WAIT_OBJECTS
+
+int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hi, PSTR pszCmdLine, int nCmdShow) {
+//int main(void) {
+ int argumentsNumber = 0;
+ DWORD i=0;
+ DWORD threadCounter = 0;
+ DWORD dwThread;
+ WCHAR ** commandLine = CommandLineToArgvW(GetCommandLineW(), &argumentsNumber);
+ HANDLE * runningThreads = (HANDLE *) LocalAlloc(LPTR, sizeof(HANDLE) * MAXIMUM_THREADS);
+
+ for(i=0;i<MAXIMUM_THREADS;i++) {
+ runningThreads[i] = INVALID_HANDLE_VALUE;
+ }
+ changeCurrentDirectory();
+
+ if(argumentsNumber==2) {
+ WCHAR * filename = commandLine[1];
+ HANDLE fileList = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
+ if(fileList!=0) {
+ WCHAR ** files = NULL;
+ DWORD number = 0;
+ DWORD allThreadsUsed=0;
+ readStringList(fileList, &files, &number);
+ CloseHandle(fileList);
+
+ if(files!=NULL) {
+ Sleep(INITIAL_DELAY);
+ for(i=0;i<number;i++) {
+ WCHAR * file = files[i];
+ if(file!=NULL) {
+ if(lstrlenW(file)>0) {
+ getFreeIndexForNextThread(runningThreads, MAXIMUM_THREADS, &threadCounter);
+ runningThreads [threadCounter] = CreateThread( NULL, 0, &deleteFileThread, (LPVOID) file, 0, &dwThread );
+ threadCounter++;
+ if(threadCounter==MAXIMUM_THREADS) allThreadsUsed = 1;
+ }
+ }
+ }
+
+ WaitForMultipleObjects(allThreadsUsed ? MAXIMUM_THREADS : threadCounter,
+ runningThreads, TRUE, INFINITE);
+
+ for(i=0;i<number;i++) {
+ if(files[i]!=NULL) LocalFree(files[i]);
+ }
+
+ LocalFree(files);
+ }
+ }
+ }
+ LocalFree(commandLine);
+ LocalFree(runningThreads);
+ //removeItself();
+ removeItselfUsingCmd();
+ return 0;
+}
diff --git a/cleaner/windows/vcproject/NBI Native Cleaner.ncb b/cleaner/windows/vcproject/NBI Native Cleaner.ncb
new file mode 100644
index 0000000..9057eba
--- /dev/null
+++ b/cleaner/windows/vcproject/NBI Native Cleaner.ncb
@@ -0,0 +1 @@
+Microsoft C/C++ MSF 7.00
diff --git a/cleaner/windows/vcproject/NBI Native Cleaner.sln b/cleaner/windows/vcproject/NBI Native Cleaner.sln
new file mode 100644
index 0000000..659a421
--- /dev/null
+++ b/cleaner/windows/vcproject/NBI Native Cleaner.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NBI Native Cleaner", "NBI Native Cleaner.vcproj", "{0DB81F65-E9E6-4506-BE27-C020AAD1B04A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0DB81F65-E9E6-4506-BE27-C020AAD1B04A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0DB81F65-E9E6-4506-BE27-C020AAD1B04A}.Debug|Win32.Build.0 = Debug|Win32
+ {0DB81F65-E9E6-4506-BE27-C020AAD1B04A}.Release|Win32.ActiveCfg = Release|Win32
+ {0DB81F65-E9E6-4506-BE27-C020AAD1B04A}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/cleaner/windows/vcproject/NBI Native Cleaner.suo b/cleaner/windows/vcproject/NBI Native Cleaner.suo
new file mode 100644
index 0000000..189f7a2
Binary files /dev/null and b/cleaner/windows/vcproject/NBI Native Cleaner.suo differ
diff --git a/cleaner/windows/vcproject/NBI Native Cleaner.vcproj b/cleaner/windows/vcproject/NBI Native Cleaner.vcproj
new file mode 100644
index 0000000..dd72b1f
--- /dev/null
+++ b/cleaner/windows/vcproject/NBI Native Cleaner.vcproj
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="NBI Native Cleaner"
+ ProjectGUID="{0DB81F65-E9E6-4506-BE27-C020AAD1B04A}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ FavorSizeOrSpeed="2"
+ AdditionalIncludeDirectories="C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="0"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Shell32.lib"
+ OutputFile="..\dist\cleaner.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="false"
+ AdditionalLibraryDirectories="C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib"
+ GenerateManifest="false"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ EntryPointSymbol="WinMain"
+ TargetMachine="1"
+ ErrorReporting="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\src\main.c"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/cleaner/windows/vcproject/NBI Native Cleaner.vcproj.user b/cleaner/windows/vcproject/NBI Native Cleaner.vcproj.user
new file mode 100644
index 0000000..a5ca4f9
--- /dev/null
+++ b/cleaner/windows/vcproject/NBI Native Cleaner.vcproj.user
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?><VisualStudioUserFile ProjectType="Visual C++" Version="8.00" ShowAllFiles="true"></VisualStudioUserFile>
\ No newline at end of file
diff --git a/jnilib/.common/src/CommonUtils.c b/jnilib/.common/src/CommonUtils.c
new file mode 100644
index 0000000..9699f2a
--- /dev/null
+++ b/jnilib/.common/src/CommonUtils.c
@@ -0,0 +1,404 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#include "CommonUtils.h"
+
+jbyteArray getStringBytes(JNIEnv* jEnv, jstring jString) {
+ jbyteArray result = NULL;
+
+ if (jString != NULL) {
+ jmethodID jGetBytesMethod = (*jEnv)->GetMethodID(jEnv, (*jEnv)->GetObjectClass(jEnv, jString), "getBytes", "()[B");
+
+ if (jGetBytesMethod != NULL) {
+ jbyteArray jBuffer = (jbyteArray) (*jEnv)->CallObjectMethod(jEnv, jString, jGetBytesMethod);
+
+ if (jBuffer != NULL) {
+ jsize jLength = (*jEnv)->GetArrayLength(jEnv, jBuffer);
+
+ result = (*jEnv)->NewByteArray(jEnv, jLength + 1);
+ if (jLength != 0) {
+ jbyte* jChars = (*jEnv)->GetByteArrayElements(jEnv, jBuffer, NULL);
+ (*jEnv)->SetByteArrayRegion(jEnv, result, 0, jLength, jChars);
+ (*jEnv)->ReleaseByteArrayElements(jEnv, jBuffer, jChars, JNI_ABORT);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jBuffer);
+ }
+ //(*jEnv)->DeleteLocalRef(jEnv, getBytesMethod);
+ }
+ }
+
+ return result;
+}
+
+
+jstring newStringFromJByteArray(JNIEnv* jEnv, jbyteArray jByteArray, int length) {
+ jstring result = NULL;
+
+ jclass jStringClass = (*jEnv)->FindClass(jEnv, "java/lang/String");
+ if (jStringClass != NULL) {
+ jmethodID jStringConstructor = (*jEnv)->GetMethodID(jEnv, jStringClass, "<init>", "([BII)V");
+
+ if (jStringConstructor != NULL) {
+ result = (jstring) (*jEnv)->NewObject(jEnv, jStringClass, jStringConstructor, jByteArray, 0, length);
+ //(*jEnv)->DeleteLocalRef(jEnv, stringConstructor);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jStringClass);
+ }
+
+ return result;
+}
+
+
+jstring newStringFromJCharArray(JNIEnv* jEnv, jcharArray jCharArray, int length) {
+ jstring result = NULL;
+
+ jclass jStringClass = (*jEnv)->FindClass(jEnv, "java/lang/String");
+ if (jStringClass != NULL) {
+ jmethodID jStringConstructor = (*jEnv)->GetMethodID(jEnv, jStringClass, "<init>", "([CII)V");
+
+ if (jStringConstructor != NULL) {
+ result = (jstring) (*jEnv)->NewObject(jEnv, jStringClass, jStringConstructor, jCharArray, 0, length);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jStringClass);
+ }
+
+ return result;
+}
+
+jstring getString(JNIEnv* jEnv, const char* chars) {
+ return (jstring) getStringWithLength(jEnv, chars, (int) STRLEN(chars));
+}
+
+jstring getStringW(JNIEnv* jEnv, const wchar_t * chars) {
+ return (jstring) getStringWithLengthW(jEnv, chars, (int) WCSLEN(chars));
+}
+
+jstring getStringWithLength(JNIEnv* jEnv, const char* chars, int length) {
+ jstring result = NULL;
+
+ if (chars != NULL) {
+ if (length == 0) {
+ result = (*jEnv)->NewString(jEnv, (const jchar *) L"", 0);
+ } else {
+ jbyteArray jByteArray = (*jEnv)->NewByteArray(jEnv, length);
+
+ if (jByteArray != NULL) {
+ (*jEnv)->SetByteArrayRegion(jEnv, jByteArray, 0, length, (jbyte*) chars);
+ result = newStringFromJByteArray(jEnv, jByteArray, length);
+ (*jEnv)->DeleteLocalRef(jEnv, jByteArray);
+ }
+ }
+ }
+
+ return result;
+}
+
+
+jstring getStringWithLengthW(JNIEnv* jEnv, const wchar_t* chars, int length) {
+ jstring result = NULL;
+
+ if (chars != NULL) {
+ if (length == 0) {
+ result = (*jEnv)->NewString(jEnv, (const jchar *) L"", 0);
+ } else {
+ jcharArray jCharArray = (*jEnv)->NewCharArray(jEnv, length);
+
+ if (jCharArray != NULL) {
+ (*jEnv)->SetCharArrayRegion(jEnv, jCharArray, 0, length, (jchar*) chars);
+ result = newStringFromJCharArray(jEnv, jCharArray, length);
+ (*jEnv)->DeleteLocalRef(jEnv, jCharArray);
+ }
+ }
+ }
+
+ return result;
+}
+
+
+char* getChars(JNIEnv* jEnv, jstring jString) {
+ char* result = NULL;
+
+ jbyteArray jByteArray = getStringBytes(jEnv, jString);
+ if (jByteArray != NULL) {
+ jbyte* jBytes = (*jEnv)->GetByteArrayElements(jEnv, jByteArray, NULL);
+
+ long index = 0;
+ if (jBytes != NULL) {
+ int length = (int) STRLEN((char*) jBytes);
+
+ result = (char*) MALLOC(sizeof(char) * (length + 1));
+ if (result != NULL) {
+ ZERO(result, length);
+ STRNCPY(result, (char*) jBytes, length);
+ result[length] = 0;
+ }
+ (*jEnv)->ReleaseByteArrayElements(jEnv, jByteArray, jBytes, JNI_ABORT);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jByteArray);
+ }
+
+ return result;
+}
+
+char* getStringFromMethod(JNIEnv* jEnv, jobject object, const char* methodName) {
+ char* result = NULL;
+
+ jclass clazz = (*jEnv)->GetObjectClass(jEnv, object);
+ if (clazz != NULL) {
+ jmethodID method = (*jEnv)->GetMethodID(jEnv, clazz, methodName, "()Ljava/lang/String;");
+ if (method != NULL) {
+ jstring string = (jstring) (*jEnv)->CallObjectMethod(jEnv, object, method);
+ if (string != NULL) {
+ result = getChars(jEnv, string);
+ (*jEnv)->DeleteLocalRef(jEnv, string);
+ }
+ //(*jEnv)->DeleteLocalRef(jEnv, method);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, clazz);
+ }
+
+ return result;
+}
+
+wchar_t * getWideStringFromMethod(JNIEnv* jEnv, jobject object, const char* methodName) {
+ wchar_t* result = NULL;
+
+ jclass clazz = (*jEnv)->GetObjectClass(jEnv, object);
+ if (clazz != NULL) {
+ jmethodID method = (*jEnv)->GetMethodID(jEnv, clazz, methodName, "()Ljava/lang/String;");
+ if (method != NULL) {
+ jstring string = (jstring) (*jEnv)->CallObjectMethod(jEnv, object, method);
+ if (string != NULL) {
+ result = getWideChars(jEnv, string);
+ (*jEnv)->DeleteLocalRef(jEnv, string);
+ }
+ //(*jEnv)->DeleteLocalRef(jEnv, method);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, clazz);
+ }
+
+ return result;
+}
+
+jboolean isInstanceOf(JNIEnv* jEnv, jobject object, const char* className) {
+ jboolean result = 0;
+ jclass clazz = clazz = (*jEnv)->FindClass(jEnv, className);
+
+ if (clazz != NULL) {
+ result = (*jEnv)->IsInstanceOf(jEnv, object, clazz);
+ (*jEnv)->DeleteLocalRef(jEnv, clazz);
+ }
+ return result;
+}
+
+jint getIntFromMethod(JNIEnv* jEnv, jobject object, const char* methodName) {
+ jint value = 0;
+
+ jclass clazz = (*jEnv)->GetObjectClass(jEnv, object);
+ if (clazz != NULL) {
+ jmethodID method = (*jEnv)->GetMethodID(jEnv, clazz, methodName, "()I");
+ if (method != NULL) {
+ value = (*jEnv)->CallIntMethod(jEnv, object, method);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, clazz);
+ }
+
+ return value;
+}
+
+void throwException(JNIEnv* jEnv, const char* message) {
+ jclass clazz = (*jEnv)->FindClass(jEnv, "org/netbeans/installer/utils/exceptions/NativeException");
+ if (clazz != NULL) {
+ (*jEnv)->ThrowNew(jEnv, clazz, message);
+ (*jEnv)->DeleteLocalRef(jEnv, clazz);
+ }
+}
+
+void writeLog(JNIEnv* jEnv, int level, const char* message) {
+ const char* prefix = "[jni] ";
+
+ jclass clazz = (*jEnv)->FindClass(jEnv, "org/netbeans/installer/utils/LogManager");
+ if (clazz != NULL) {
+ jmethodID method = (*jEnv)->GetStaticMethodID(jEnv, clazz, "log", "(ILjava/lang/String;)V");
+ if (method != NULL) {
+ jstring jMessage = NULL;
+ int prefix_length = STRLEN(prefix);
+ int message_length = STRLEN(message);
+ char* string = (char*) MALLOC(sizeof(char) * (prefix_length + message_length + 1));
+ int i = 0;
+ for(i=0;i<prefix_length;i++) {
+ string[i]=prefix[i];
+ }
+
+ for(i=0;i<message_length;i++) {
+ string[i + prefix_length]=message[i];
+ }
+ string[i+prefix_length + message_length] = '\0';
+
+
+ jMessage = getString(jEnv, string);
+
+ if (jMessage != NULL) {
+ (*jEnv)->CallStaticVoidMethod(jEnv, clazz, method, (jint) level, jMessage);
+ (*jEnv)->DeleteLocalRef(jEnv, jMessage);
+ }
+
+ FREE(string);
+ //(*jEnv)->DeleteLocalRef(jEnv, method);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, clazz);
+ }
+}
+
+int createDirs(JNIEnv* jEnv, jstring jPath) {
+ int result = 0;
+ jclass jFileClass = (*jEnv)->FindClass(jEnv, "java/io/File");
+ if (jFileClass != NULL) {
+ jmethodID jFileConstructor = (*jEnv)->GetMethodID(jEnv, jFileClass, "<init>", "(Ljava/lang/String;)V");
+ jmethodID jGetParentFileMethod = (*jEnv)->GetMethodID(jEnv, jFileClass, "getParentFile", "()Ljava/io/File;");
+ jmethodID jExistsMethod = (*jEnv)->GetMethodID(jEnv, jFileClass, "exists", "()Z");
+ jmethodID jMkdirsMethod = (*jEnv)->GetMethodID(jEnv, jFileClass, "mkdirs", "()Z");
+
+ if ((jFileConstructor != NULL) && (jGetParentFileMethod != NULL) && (jExistsMethod != NULL) && (jMkdirsMethod != NULL)) {
+ jobject jFile = (*jEnv)->NewObject(jEnv, jFileClass, jFileConstructor, jPath);
+ if (jFile != NULL ) {
+ if(!((*jEnv)->CallBooleanMethod(jEnv, jFile, jExistsMethod))) {
+ jobject jParent = (*jEnv)->CallObjectMethod(jEnv, jFile, jGetParentFileMethod);
+ if (jParent != NULL) {
+ result = (*jEnv)->CallBooleanMethod(jEnv, jParent, jExistsMethod);
+ if (!result) {
+ result = (*jEnv)->CallBooleanMethod(jEnv, jParent, jMkdirsMethod);
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jParent);
+ }
+ } else {
+ result = 1;
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jFile);
+ }
+ }
+ (*jEnv)->DeleteLocalRef(jEnv, jFileClass);
+ }
+ return result;
+}
+
+int mkdirs(JNIEnv* jEnv, const char *path) {
+ int result = 1;
+ jstring jPath = getString(jEnv, path);
+ if (jPath != NULL) {
+ result = createDirs(jEnv, jPath);
+ (*jEnv)->DeleteLocalRef(jEnv, jPath);
+ }
+ return result;
+}
+
+
+int mkdirsW(JNIEnv* jEnv, const wchar_t *path) {
+ int result = 1;
+ jstring jPath = getStringW(jEnv, path);
+ if (jPath != NULL) {
+ result = createDirs(jEnv, jPath);
+ (*jEnv)->DeleteLocalRef(jEnv, jPath);
+ }
+
+ return result;
+}
+
+
+
+unsigned char* getByteFromMultiString(JNIEnv *jEnv, jobjectArray jObjectArray, unsigned long* size) {
+ unsigned short * result = NULL;
+
+ int totalLength = 0;
+ unsigned int arrayLength = (*jEnv)->GetArrayLength(jEnv, jObjectArray);
+ jstring jString = NULL;
+
+ unsigned int i, j; // just counters
+
+ for (i = 0; i < arrayLength; i++) {
+ jString = (jstring) (*jEnv)->GetObjectArrayElement(jEnv, jObjectArray, i);
+ totalLength += (*jEnv)->GetStringLength(jEnv, jString) + 1;
+ }
+ totalLength++; // add null to the end of array
+
+ result = (unsigned short*) MALLOC(sizeof(unsigned short) * totalLength);
+ if (result != NULL) {
+ int index = 0 ;
+
+ for (i = 0; i < arrayLength; i++) {
+ jString = (jstring) (*jEnv)->GetObjectArrayElement(jEnv, jObjectArray, i);
+
+ if (jString != NULL) {
+ wchar_t * chars = getWideChars(jEnv, jString);
+ if (chars != NULL) {
+ for (j = 0; j < (WCSLEN(chars)); j++) {
+ result[index++] = chars[j];
+ }
+
+ FREE(chars);
+ }
+ }
+ result[index++] = '\0';
+ }
+ result[index++] = '\0'; //double \0 at the end
+ }
+ * size = sizeof(unsigned short) * totalLength;
+ return (unsigned char*)result;
+}
+
+wchar_t * getWideChars(JNIEnv *jEnv, jstring jString) {
+ if(jString==NULL) {
+ return NULL;
+ } else {
+ long length = (*jEnv)->GetStringLength( jEnv, jString);
+ const jchar * unicodeStr = (*jEnv)->GetStringChars( jEnv, jString, 0 );
+ wchar_t * copy = (wchar_t *) MALLOC(sizeof(wchar_t) * (length + 1));
+ ZERO(copy, sizeof(wchar_t)*(length + 1));
+ WCSNCPY(copy, (const wchar_t *) unicodeStr, length + 1);
+ (*jEnv)->ReleaseStringChars( jEnv, jString, unicodeStr);
+ return copy;
+ }
+
+}
diff --git a/jnilib/.common/src/CommonUtils.h b/jnilib/.common/src/CommonUtils.h
new file mode 100644
index 0000000..5047daf
--- /dev/null
+++ b/jnilib/.common/src/CommonUtils.h
@@ -0,0 +1,142 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <wchar.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+#include <windows.h>
+#endif
+
+#ifndef _CommonUtils_H
+#define _CommonUtils_H
+
+
+#ifdef _MSC_VER
+#define FREE(x) { if((x)!=NULL) { LocalFree(x); (x)=NULL;}}
+#else
+#define FREE(x) { if((x)!=NULL) { free(x); (x)=NULL;}}
+#endif
+
+#ifdef _MSC_VER
+#define MALLOC(x) LocalAlloc(LPTR, x)
+#else
+#define MALLOC(x) malloc(x)
+#endif
+
+
+#ifdef _MSC_VER
+#define ZERO(x,y) SecureZeroMemory((x),(y))
+#else
+#define ZERO(x,y) memset((x),0,(y))
+#endif
+
+
+#ifdef _MSC_VER
+#define STRLEN(x) lstrlenA(x)
+#else
+#define STRLEN(x) strlen(x)
+#endif
+
+
+#ifdef _MSC_VER
+#define WCSLEN(x) ((unsigned long)lstrlenW(x))
+#else
+#define WCSLEN(x) ((unsigned long)wcslen(x))
+#endif
+
+
+#ifdef _MSC_VER
+#define STRNCPY(x,y,z) lstrcpynA((x),(y),(z))
+#else
+#define STRNCPY(x,y,z) strncpy((x),(y),(z))
+#endif
+
+#ifdef _MSC_VER
+#define WCSNCPY(x,y,z) lstrcpynW((x),(y),(z))
+#else
+#define WCSNCPY(x,y,z) wcsncpy((x),(y),(z))
+#endif
+
+
+#define LOG_DEBUG 4
+#define LOG_MESSAGE 3
+#define LOG_WARNING 2
+#define LOG_ERROR 1
+#define LOG_CRITICAL 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+jbyteArray getStringBytes(JNIEnv* jEnv, jstring jString);
+
+jstring newStringFromJByteArray(JNIEnv* jEnv, jbyteArray jByteArray, int length);
+jstring newStringFromJCharArray(JNIEnv* jEnv, jcharArray jCharArray, int length);
+
+jstring getString (JNIEnv* jEnv, const char* chars);
+jstring getStringW(JNIEnv* jEnv, const wchar_t * chars);
+
+
+jstring getStringWithLength(JNIEnv* jEnv, const char* chars, int length);
+jstring getStringWithLengthW(JNIEnv* jEnv, const wchar_t * chars, int length);
+
+char* getChars(JNIEnv* jEnv, jstring jString);
+wchar_t * getWideChars(JNIEnv *jEnv, jstring str);
+
+char* getStringFromMethod(JNIEnv* jEnv, jobject object, const char* methodName);
+wchar_t* getWideStringFromMethod(JNIEnv* jEnv, jobject object, const char* methodName) ;
+
+jint getIntFromMethod(JNIEnv* jEnv, jobject object, const char* methodName);
+
+jboolean isInstanceOf(JNIEnv* jEnv, jobject object, const char* className);
+
+void throwException(JNIEnv* jEnv, const char* message);
+
+void writeLog(JNIEnv* jEnv, int level, const char* message);
+
+int mkdirs (JNIEnv* jEnv, const char *path);
+int mkdirsW(JNIEnv* jEnv, const wchar_t *path);
+
+unsigned char* getByteFromMultiString(JNIEnv *jEnv, jobjectArray jObjectArray, unsigned long* size);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _CommonUtils_H */
diff --git a/jnilib/.unix/src/jni_UnixNativeUtils.c b/jnilib/.unix/src/jni_UnixNativeUtils.c
new file mode 100644
index 0000000..8b4489c
--- /dev/null
+++ b/jnilib/.unix/src/jni_UnixNativeUtils.c
@@ -0,0 +1,128 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "../../.common/src/CommonUtils.h"
+#include "jni_UnixNativeUtils.h"
+
+
+jboolean statMode(const char *path, int *mode) {
+ struct stat sb;
+ if (stat(path, &sb) == 0) {
+ *mode = sb.st_mode;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+
+JNIEXPORT jlong JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_getFreeSpace0(JNIEnv* jEnv, jobject jObject, jstring jPath) {
+ char* path = getChars(jEnv, jPath);
+ jlong result = 0;
+
+ struct statvfs fsstat;
+ if(memset(&fsstat, 0, sizeof(struct statvfs)) != NULL) {
+ if(statvfs(path, &fsstat) == 0) {
+ result = (jlong) fsstat.f_frsize;
+ result *= (jlong) fsstat.f_bfree;
+ }
+ }
+
+
+ FREE(path);
+ return result;
+}
+
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_setPermissions0(JNIEnv *jEnv, jobject jObject, jstring jPath, jint jMode, jint jChange) {
+ char* path = getChars(jEnv, jPath);
+ int currentMode = 0 ;
+ char * msg = NULL;
+ if(statMode(path, ¤tMode)) {
+ switch (jChange) {
+ case MODE_CHANGE_SET:
+ currentMode |= (S_IRWXU | S_IRWXG | S_IRWXO);
+ currentMode &= jMode;
+ break;
+ case MODE_CHANGE_ADD:
+ currentMode |= jMode;
+ break;
+ case MODE_CHANGE_REMOVE:
+ currentMode &= ~jMode;
+ break;
+ default:
+ msg = (char*) malloc(sizeof(char) * 60);
+ memset(msg, 0, sizeof(char) * 60);
+ sprintf(msg, "Selected change mode (%ld) is not supported", jChange);
+ throwException(jEnv, msg);
+ FREE(msg);
+ FREE(path);
+ return;
+ }
+ chmod(path, currentMode);
+ } else {
+ throwException(jEnv, "Can`t get file current permissions");
+ }
+ FREE(path);
+}
+
+
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_getPermissions0(JNIEnv *jEnv, jobject jObject, jstring jPath) {
+ char* path = getChars(jEnv, jPath);
+ int currentMode;
+ if(statMode(path, ¤tMode)) {
+ return currentMode & (S_IRWXU | S_IRWXG | S_IRWXO);
+ } else {
+ throwException(jEnv, "Can`t get file current permissions");
+ }
+
+ FREE(path);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_isCurrentUserAdmin0 (JNIEnv *jEnv, jobject jObject) {
+ return (geteuid()==0);
+}
diff --git a/jnilib/.unix/src/jni_UnixNativeUtils.h b/jnilib/.unix/src/jni_UnixNativeUtils.h
new file mode 100644
index 0000000..8f8c92c
--- /dev/null
+++ b/jnilib/.unix/src/jni_UnixNativeUtils.h
@@ -0,0 +1,103 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+/* Header for class org_netbeans_installer_utils_system_UnixNativeUtils */
+
+#ifndef _Included_org_netbeans_installer_utils_system_UnixNativeUtils
+#define _Included_org_netbeans_installer_utils_system_UnixNativeUtils
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define MODE_RU 1L
+#define MODE_WU 2L
+#define MODE_EU 4L
+#define MODE_RG 8L
+#define MODE_WG 16L
+#define MODE_EG 32L
+#define MODE_RO 64L
+#define MODE_WO 128L
+#define MODE_EO 256L
+
+#define MODE_CHANGE_SET 1L
+#define MODE_CHANGE_ADD 2L
+#define MODE_CHANGE_REMOVE 4L
+
+
+
+/*
+ * Class: org_netbeans_installer_utils_system_UnixNativeUtils
+ * Method: getFreeSpace0
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_getFreeSpace0
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_UnixNativeUtils
+ * Method: setPermission0
+ * Signature: (Ljava/lang/String;II)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_setPermissions0
+ (JNIEnv *, jobject, jstring, jint, jint);
+
+/*
+ * Class: org_netbeans_installer_utils_system_UnixNativeUtils
+ * Method: getPermissions0
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_getPermissions0
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_UnixNativeUtils
+ * Method: isCurrentUserAdmin0
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_UnixNativeUtils_isCurrentUserAdmin0
+ (JNIEnv *, jobject);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/jnilib/linux/Makefile b/jnilib/linux/Makefile
new file mode 100644
index 0000000..64e76e1
--- /dev/null
+++ b/jnilib/linux/Makefile
@@ -0,0 +1,129 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/jnilib/linux/nbproject/configurations.xml b/jnilib/linux/nbproject/configurations.xml
new file mode 100644
index 0000000..018e1ec
--- /dev/null
+++ b/jnilib/linux/nbproject/configurations.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<configurationDescriptor version="35">
+ <logicalFolder name="root" displayName="root" projectFiles="true">
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.c</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.h</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <defaultConf>0</defaultConf>
+ <confs>
+ <conf name="Debug" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>2</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/linux</directoryPath>
+ </includeDirectories>
+ <commandLine>-shared -m32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/linux</directoryPath>
+ </includeDirectories>
+ <commandLine>-shared -m32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/linux.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Release" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>2</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>5</developmentMode>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>5</developmentMode>
+ </ccCompilerTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_amd64" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>2</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/linux</directoryPath>
+ </includeDirectories>
+ <commandLine>-shared -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/linux</directoryPath>
+ </includeDirectories>
+ <commandLine>-shared -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/linux-amd64.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/jnilib/linux/nbproject/project.properties b/jnilib/linux/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/jnilib/linux/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/jnilib/linux/nbproject/project.xml b/jnilib/linux/nbproject/project.xml
new file mode 100644
index 0000000..f47994a
--- /dev/null
+++ b/jnilib/linux/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Library: Linux</name>
+ <make-project-type>0</make-project-type>
+ </data>
+ </configuration>
+</project>
diff --git a/jnilib/macosx/Makefile b/jnilib/macosx/Makefile
new file mode 100644
index 0000000..64e76e1
--- /dev/null
+++ b/jnilib/macosx/Makefile
@@ -0,0 +1,129 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/jnilib/macosx/nbproject/configurations.xml b/jnilib/macosx/nbproject/configurations.xml
new file mode 100644
index 0000000..d08e612
--- /dev/null
+++ b/jnilib/macosx/nbproject/configurations.xml
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright (c) 2007, 2016 Oracle and/or its affiliates. All rights reserved.
+
+Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+Other names may be trademarks of their respective owners.
+
+The contents of this file are subject to the terms of either the GNU
+General Public License Version 2 only ("GPL") or the Common
+Development and Distribution License("CDDL") (collectively, the
+"License"). You may not use this file except in compliance with the
+License. You can obtain a copy of the License at
+http://www.netbeans.org/cddl-gplv2.html
+or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+specific language governing permissions and limitations under the
+License. When distributing the software, include this License Header
+Notice in each file and include the License file at
+nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the GPL Version 2 section of the License file that
+accompanied this code. If applicable, add the following below the
+License Header, with the fields enclosed by brackets [] replaced by
+your own identifying information:
+"Portions Copyrighted [year] [name of copyright owner]"
+
+If you wish your version of this file to be governed by only the CDDL
+or only the GPL Version 2, indicate your decision by adding
+"[Contributor] elects to include this software in this distribution
+under the [CDDL or GPL Version 2] license." If you do not indicate a
+single choice of license, a recipient has the option to distribute
+your version of this file under either the CDDL, the GPL Version 2 or
+to extend the choice of license to its licensees as provided above.
+However, if you add GPL Version 2 code and therefore, elected the GPL
+Version 2 license, then the option applies only if the new code is
+made subject to such option by the copyright holder.
+
+Contributor(s):
+-->
+<configurationDescriptor version="45">
+ <logicalFolder name="root" displayName="root" projectFiles="true">
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.h</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.c</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <sourceEncoding>UTF-8</sourceEncoding>
+ <projectmakefile>Makefile</projectmakefile>
+ <confs>
+ <conf name="Debug" type="2">
+ <toolsSet>
+ <compilerSet>GNU|GNU</compilerSet>
+ <platform>4</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/Library/Java/Home/include</directoryPath>
+ </includeDirectories>
+ <commandLine>-arch i386 -arch ppc -arch ppc64 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -dynamiclib</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/Library/Java/Home/include</directoryPath>
+ </includeDirectories>
+ <commandLine>-arch i386 -arch ppc -arch ppc64 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -dynamiclib</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/macosx.dylib</output>
+ <linkerLibItems>
+ </linkerLibItems>
+ <commandLine>-Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc -arch ppc64 -arch x86_64</commandLine>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Release" type="2">
+ <toolsSet>
+ <compilerSet>GNU|GNU</compilerSet>
+ <platform>4</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>5</developmentMode>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>5</developmentMode>
+ </ccCompilerTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/jnilib/macosx/nbproject/project.properties b/jnilib/macosx/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/jnilib/macosx/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/jnilib/macosx/nbproject/project.xml b/jnilib/macosx/nbproject/project.xml
new file mode 100644
index 0000000..08fb3de
--- /dev/null
+++ b/jnilib/macosx/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Library: MacOS X</name>
+ <make-project-type>0</make-project-type>
+ <make-dep-projects/>
+ </data>
+ </configuration>
+</project>
diff --git a/jnilib/solaris-sparc/Makefile b/jnilib/solaris-sparc/Makefile
new file mode 100644
index 0000000..64e76e1
--- /dev/null
+++ b/jnilib/solaris-sparc/Makefile
@@ -0,0 +1,129 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/jnilib/solaris-sparc/nbproject/configurations.xml b/jnilib/solaris-sparc/nbproject/configurations.xml
new file mode 100644
index 0000000..f37cec3
--- /dev/null
+++ b/jnilib/solaris-sparc/nbproject/configurations.xml
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<configurationDescriptor version="35">
+ <logicalFolder name="root" displayName="root" projectFiles="true">
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.c</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.h</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <defaultConf>0</defaultConf>
+ <confs>
+ <conf name="Debug" type="2">
+ <toolsSet>
+ <compilerSet>Sun12</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>0</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-sparc.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Release" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>0</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>5</developmentMode>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>5</developmentMode>
+ </ccCompilerTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_x64" type="2">
+ <toolsSet>
+ <compilerSet>Sun12</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>0</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-fPIC -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-fPIC -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-sparcv9.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_gnu" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>0</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -fPIC -shared -static-libgcc -mimpure-text -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -fPIC -shared -static-libgcc -mimpure-text -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-sparc.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_x64_gnu" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>0</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-fPIC -shared -static-libgcc -mimpure-text -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-fPIC -shared -static-libgcc -mimpure-text -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-sparcv9.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/jnilib/solaris-sparc/nbproject/project.properties b/jnilib/solaris-sparc/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/jnilib/solaris-sparc/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/jnilib/solaris-sparc/nbproject/project.xml b/jnilib/solaris-sparc/nbproject/project.xml
new file mode 100644
index 0000000..be61aca
--- /dev/null
+++ b/jnilib/solaris-sparc/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Library: Solaris Sparc</name>
+ <make-project-type>0</make-project-type>
+ </data>
+ </configuration>
+</project>
diff --git a/jnilib/solaris-x86/Makefile b/jnilib/solaris-x86/Makefile
new file mode 100644
index 0000000..64e76e1
--- /dev/null
+++ b/jnilib/solaris-x86/Makefile
@@ -0,0 +1,129 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/jnilib/solaris-x86/nbproject/configurations.xml b/jnilib/solaris-x86/nbproject/configurations.xml
new file mode 100644
index 0000000..ec55f70
--- /dev/null
+++ b/jnilib/solaris-x86/nbproject/configurations.xml
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<configurationDescriptor version="35">
+ <logicalFolder name="root" displayName="root" projectFiles="true">
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.c</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.h</itemPath>
+ <itemPath>../.unix/src/jni_UnixNativeUtils.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <defaultConf>0</defaultConf>
+ <confs>
+ <conf name="Debug" type="2">
+ <toolsSet>
+ <compilerSet>Sun12</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>1</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -fPIC -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -fPIC -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-x86.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Release" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>0</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>5</developmentMode>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>5</developmentMode>
+ </ccCompilerTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_x64" type="2">
+ <toolsSet>
+ <compilerSet>Sun12</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>1</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-KPIC -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-KPIC -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -xO2 -Xa</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-amd64.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_gnu" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>1</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -fPIC -static-libgcc -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-m32 -fPIC -static-libgcc -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-x86.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Debug_x64_gnu" type="2">
+ <toolsSet>
+ <compilerSet>GNU</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>1</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-fPIC -static-libgcc -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <sixtyfourBits>true</sixtyfourBits>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/solaris</directoryPath>
+ </includeDirectories>
+ <commandLine>-fPIC -static-libgcc -shared -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/solaris-amd64.so</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerNorunpath>false</linkerNorunpath>
+ <linkerLibItems>
+ </linkerLibItems>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.unix/src/jni_UnixNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/jnilib/solaris-x86/nbproject/project.properties b/jnilib/solaris-x86/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/jnilib/solaris-x86/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/jnilib/solaris-x86/nbproject/project.xml b/jnilib/solaris-x86/nbproject/project.xml
new file mode 100644
index 0000000..3fd2701
--- /dev/null
+++ b/jnilib/solaris-x86/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Library: Solaris X86</name>
+ <make-project-type>0</make-project-type>
+ </data>
+ </configuration>
+</project>
diff --git a/jnilib/windows/Makefile b/jnilib/windows/Makefile
new file mode 100644
index 0000000..64e76e1
--- /dev/null
+++ b/jnilib/windows/Makefile
@@ -0,0 +1,129 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/jnilib/windows/Makefile-vc b/jnilib/windows/Makefile-vc
new file mode 100644
index 0000000..131aee1
--- /dev/null
+++ b/jnilib/windows/Makefile-vc
@@ -0,0 +1,76 @@
+#
+#
+
+
+!include <$(PLATFORM_SDK)/include/win32.mak>
+
+# define the compiler and linker for all the platforms
+CC32="$(VC_2005)\Bin\cl.exe"
+L32="$(VC_2005)\Bin\link.exe"
+
+CC32_OPTS=/O1 /Os /I "$(VC_2005)\include" /I "$(PLATFORM_SDK)\Include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "NBIJNILIBRARY_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_STATIC_CPPLIB" /D "_LITTLE_ENDIAN" /D "_WINDLL" /FD /MT /Fo".\build\32bit\\" /W3 /WX /c /Wp64 /Gd /TC
+L32_OPTS=/OUT:".\dist\windows-x86.dll" /INCREMENTAL:NO /LIBPATH:"$(PLATFORM_SDK)\Lib" /LIBPATH:"$(VC_2005)\lib" /DLL /MANIFEST:NO /IGNOREIDL /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
+
+
+CC64="$(PLATFORM_SDK)\Bin\win64\x86\AMD64\cl.exe"
+L64="$(PLATFORM_SDK)\Bin\win64\x86\AMD64\link.exe"
+
+CC64_OPTS=/O1 /Os /I "$(VC_2005)\include" /I "$(PLATFORM_SDK)\Include" /I "$(PLATFORM_SDK)\Include\win64\crt\amd64" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "NBIJNILIBRARY_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_STATIC_CPPLIB" /D "_LITTLE_ENDIAN" /D "_WINDLL" /FD /MT /Fo".\build\64bit\\" /W3 /c /Wp64 /Gd /TC
+L64_OPTS=/OUT:".\dist\windows-x64.dll" /INCREMENTAL:NO /LIBPATH:"$(PLATFORM_SDK)\Lib\amd64" /LIBPATH:"$(VC_2005)\lib" /DLL /MANIFEST:NO /IGNOREIDL /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:AMD64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib bufferoverflowU.lib
+
+CCIA64="$(PLATFORM_SDK)\Bin\win64\cl.exe"
+LIA64="$(PLATFORM_SDK)\Bin\win64\link.exe"
+
+CCIA64_OPTS=/O1 /Os /I "$(VC_2005)\include" /I "$(PLATFORM_SDK)\Include" /I "$(PLATFORM_SDK)\Include\win64\crt\amd64" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "NBIJNILIBRARY_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_STATIC_CPPLIB" /D "_LITTLE_ENDIAN" /D "_WINDLL" /FD /MT /Fo".\build\ia64\\" /W3 /c /Wp64 /Gd /TC
+LIA64_OPTS=/OUT:".\dist\windows-ia64.dll" /INCREMENTAL:NO /LIBPATH:"$(PLATFORM_SDK)\Lib\ia64" /LIBPATH:"$(VC_2005)\lib" /DLL /MANIFEST:NO /IGNOREIDL /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:IA64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib bufferoverflowU.lib
+
+
+all: init build-32 build-64 build-ia64
+
+init:
+ - md .\build\32bit
+ - md .\build\64bit
+ - md .\build\ia64
+ - md .\dist
+
+ del /Q /S build
+
+ del /Q .\dist\windows-x86.*
+ del /Q .\dist\windows-x64.*
+ del /Q .\dist\windows-ia64.*
+
+build-32:
+ Set CPU=i386
+ Set Lib=%PLATFORM_SDK%\Lib;%Lib%
+ Set Include=%PLATFORM_SDK%\Include;%Include%
+ Set Path=%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%VC_2005_PATH%;%path%
+ Set APPVER=5.01
+ Set TARGETOS=WINNT
+
+ $(CC32) $(CC32_OPTS) .\src\WindowsUtils.c .\src\jni_WindowsRegistry.c .\src\jni_WindowsNativeUtils.c .\..\.common\src\CommonUtils.c
+ $(L32) $(L32_OPTS) ".\build\32bit\WindowsUtils.obj" ".\build\32bit\jni_WindowsRegistry.obj" ".\build\32bit\jni_WindowsNativeUtils.obj" ".\build\32bit\CommonUtils.obj"
+
+
+build-64:
+ Set CPU=AMD64
+ Set Lib=%PLATFORM_SDK%\Lib\AMD64;%PLATFORM_SDK%\Lib\AMD64\atlmfc;
+ Set Include=%PLATFORM_SDK%\Include;%PLATFORM_SDK%\Include\crt;%PLATFORM_SDK%\Include\crt\sys;%PLATFORM_SDK%\Include\mfc;%PLATFORM_SDK%\Include\atl
+ Set Path=%PLATFORM_SDK%\Bin\Win64\x86\AMD64;%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%path%
+ Set APPVER=5.02
+ Set TARGETOS=WINNT
+
+ $(CC64) $(CC64_OPTS) .\src\WindowsUtils.c .\src\jni_WindowsRegistry.c .\src\jni_WindowsNativeUtils.c .\..\.common\src\CommonUtils.c
+ $(L64) $(L64_OPTS) ".\build\64bit\WindowsUtils.obj" ".\build\64bit\jni_WindowsRegistry.obj" ".\build\64bit\jni_WindowsNativeUtils.obj" ".\build\64bit\CommonUtils.obj"
+
+
+build-ia64:
+ Set CPU=IA64
+ Set Lib=%PLATFORM_SDK%\Lib\IA64;%PLATFORM_SDK%\Lib\IA64\atlmfc;
+ Set Include=%PLATFORM_SDK%\Include;%PLATFORM_SDK%\Include\crt;%PLATFORM_SDK%\Include\crt\sys;%PLATFORM_SDK%\Include\mfc;%PLATFORM_SDK%\Include\atl
+ Set Path=%PLATFORM_SDK%\Bin\Win64;%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%path%
+ Set APPVER=5.02
+ Set TARGETOS=WINNT
+
+ $(CCIA64) $(CCIA64_OPTS) .\src\WindowsUtils.c .\src\jni_WindowsRegistry.c .\src\jni_WindowsNativeUtils.c .\..\.common\src\CommonUtils.c
+ $(LIA64) $(LIA64_OPTS) ".\build\ia64\WindowsUtils.obj" ".\build\ia64\jni_WindowsRegistry.obj" ".\build\ia64\jni_WindowsNativeUtils.obj" ".\build\ia64\CommonUtils.obj"
+
diff --git a/jnilib/windows/Makefile-vc-wo-crt b/jnilib/windows/Makefile-vc-wo-crt
new file mode 100644
index 0000000..e344b28
--- /dev/null
+++ b/jnilib/windows/Makefile-vc-wo-crt
@@ -0,0 +1,79 @@
+#
+#
+
+
+!include <$(PLATFORM_SDK)/include/win32.mak>
+
+# define the compiler and linker for all the platforms
+CC32="$(VC_2005)\Bin\cl.exe"
+L32="$(VC_2005)\Bin\link.exe"
+
+L32_LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
+CC32_OPTS=/GS- /O1 /Os /I "$(VC_2005)\include" /I "$(PLATFORM_SDK)\Include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "NBIJNILIBRARY_EXPORTS" /D "_LITTLE_ENDIAN" /D "_WINDLL" /FD /MD /Fo".\build\32bit\\" /W3 /WX /c /Wp64 /Gd /TC
+L32_OPTS=/NOENTRY /NODEFAULTLIB /OUT:".\dist\windows-x86.dll" /INCREMENTAL:NO /LIBPATH:"$(PLATFORM_SDK)\Lib" /LIBPATH:"$(VC_2005)\lib" /DLL /MANIFEST:NO /IGNOREIDL /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 $(L32_LIBS)
+
+
+CC64="$(PLATFORM_SDK)\Bin\win64\x86\AMD64\cl.exe"
+L64="$(PLATFORM_SDK)\Bin\win64\x86\AMD64\link.exe"
+
+L64_LIBS=$(L32_LIBS)
+CC64_OPTS=/O1 /Os /GS- /I "$(VC_2005)\include" /I "$(PLATFORM_SDK)\Include" /I "$(PLATFORM_SDK)\Include\win64\crt\amd64" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "NBIJNILIBRARY_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_LITTLE_ENDIAN" /D "_WINDLL" /FD /MD /Fo".\build\64bit\\" /W3 /c /Wp64 /Gd /TC
+L64_OPTS=/NOENTRY /NODEFAULTLIB /OUT:".\dist\windows-x64.dll" /INCREMENTAL:NO /LIBPATH:"$(PLATFORM_SDK)\Lib\amd64" /LIBPATH:"$(VC_2005)\lib" /DLL /MANIFEST:NO /IGNOREIDL /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:AMD64 $(L64_LIBS)
+
+CCIA64="$(PLATFORM_SDK)\Bin\win64\cl.exe"
+LIA64="$(PLATFORM_SDK)\Bin\win64\link.exe"
+
+LIA64_LIBS=$(L32_LIBS)
+CCIA64_OPTS=/O1 /Os /GS- /I "$(VC_2005)\include" /I "$(PLATFORM_SDK)\Include" /I "$(PLATFORM_SDK)\Include\win64\crt\amd64" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "NBIJNILIBRARY_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_LITTLE_ENDIAN" /D "_WINDLL" /FD /MD /Fo".\build\ia64\\" /W3 /c /Wp64 /Gd /TC
+LIA64_OPTS=/NOENTRY /NODEFAULTLIB /OUT:".\dist\windows-ia64.dll" /INCREMENTAL:NO /LIBPATH:"$(PLATFORM_SDK)\Lib\ia64" /LIBPATH:"$(VC_2005)\lib" /DLL /MANIFEST:NO /IGNOREIDL /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:IA64 $(LIA64_LIBS)
+
+
+all: init build-32 build-64 build-ia64
+
+init:
+ - md .\build\32bit
+ - md .\build\64bit
+ - md .\build\ia64
+ - md .\dist
+
+ del /Q /S build
+
+ del /Q .\dist\windows-x86.*
+ del /Q .\dist\windows-x64.*
+ del /Q .\dist\windows-ia64.*
+
+build-32:
+ Set CPU=i386
+ Set Lib=%PLATFORM_SDK%\Lib;%Lib%
+ Set Include=%PLATFORM_SDK%\Include;%Include%
+ Set Path=%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%VC_2005_PATH%;%path%
+ Set APPVER=5.01
+ Set TARGETOS=WINNT
+
+ $(CC32) $(CC32_OPTS) .\src\WindowsUtils.c .\src\jni_WindowsRegistry.c .\src\jni_WindowsNativeUtils.c .\..\.common\src\CommonUtils.c
+ $(L32) $(L32_OPTS) ".\build\32bit\WindowsUtils.obj" ".\build\32bit\jni_WindowsRegistry.obj" ".\build\32bit\jni_WindowsNativeUtils.obj" ".\build\32bit\CommonUtils.obj"
+
+
+build-64:
+ Set CPU=AMD64
+ Set Lib=%PLATFORM_SDK%\Lib\AMD64;%PLATFORM_SDK%\Lib\AMD64\atlmfc;
+ Set Include=%PLATFORM_SDK%\Include;%PLATFORM_SDK%\Include\crt;%PLATFORM_SDK%\Include\crt\sys;%PLATFORM_SDK%\Include\mfc;%PLATFORM_SDK%\Include\atl
+ Set Path=%PLATFORM_SDK%\Bin\Win64\x86\AMD64;%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%path%
+ Set APPVER=5.02
+ Set TARGETOS=WINNT
+
+ $(CC64) $(CC64_OPTS) .\src\WindowsUtils.c .\src\jni_WindowsRegistry.c .\src\jni_WindowsNativeUtils.c .\..\.common\src\CommonUtils.c
+ $(L64) $(L64_OPTS) ".\build\64bit\WindowsUtils.obj" ".\build\64bit\jni_WindowsRegistry.obj" ".\build\64bit\jni_WindowsNativeUtils.obj" ".\build\64bit\CommonUtils.obj"
+
+
+build-ia64:
+ Set CPU=IA64
+ Set Lib=%PLATFORM_SDK%\Lib\IA64;%PLATFORM_SDK%\Lib\IA64\atlmfc;
+ Set Include=%PLATFORM_SDK%\Include;%PLATFORM_SDK%\Include\crt;%PLATFORM_SDK%\Include\crt\sys;%PLATFORM_SDK%\Include\mfc;%PLATFORM_SDK%\Include\atl
+ Set Path=%PLATFORM_SDK%\Bin\Win64;%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%path%
+ Set APPVER=5.02
+ Set TARGETOS=WINNT
+
+ $(CCIA64) $(CCIA64_OPTS) .\src\WindowsUtils.c .\src\jni_WindowsRegistry.c .\src\jni_WindowsNativeUtils.c .\..\.common\src\CommonUtils.c
+ $(LIA64) $(LIA64_OPTS) ".\build\ia64\WindowsUtils.obj" ".\build\ia64\jni_WindowsRegistry.obj" ".\build\ia64\jni_WindowsNativeUtils.obj" ".\build\ia64\CommonUtils.obj"
+
diff --git a/jnilib/windows/nbproject/configurations.xml b/jnilib/windows/nbproject/configurations.xml
new file mode 100644
index 0000000..8cb7437
--- /dev/null
+++ b/jnilib/windows/nbproject/configurations.xml
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<configurationDescriptor version="35">
+ <logicalFolder name="root" displayName="root" projectFiles="true">
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.c</itemPath>
+ <itemPath>src/jni_WindowsNativeUtils.c</itemPath>
+ <itemPath>src/jni_WindowsRegistry.c</itemPath>
+ <itemPath>src/WindowsUtils.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>../.common/src/CommonUtils.h</itemPath>
+ <itemPath>src/jni_WindowsNativeUtils.h</itemPath>
+ <itemPath>src/jni_WindowsRegistry.h</itemPath>
+ <itemPath>src/WindowsUtils.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <defaultConf>0</defaultConf>
+ <confs>
+ <conf name="Default-32bit" type="2">
+ <toolsSet>
+ <compilerSet>Cygwin</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>3</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/win32</directoryPath>
+ </includeDirectories>
+ <commandLine>-mno-cygwin</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include\win32</directoryPath>
+ </includeDirectories>
+ <commandLine>-mno-cygwin</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/windows.dll</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerLibItems>
+ <linkerOptionItem>-lole32</linkerOptionItem>
+ <linkerOptionItem>-luuid</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-Wl,--add-stdcall-alias</commandLine>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="src/WindowsUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="src/WindowsUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="src/jni_WindowsNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="src/jni_WindowsNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="src/jni_WindowsRegistry.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="src/jni_WindowsRegistry.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ <conf name="Default-64bit" type="2">
+ <toolsSet>
+ <compilerSet>Cygwin</compilerSet>
+ <cRequired>true</cRequired>
+ <cppRequired>true</cppRequired>
+ <fortranRequired>false</fortranRequired>
+ <platform>3</platform>
+ </toolsSet>
+ <compileType>
+ <cCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include/win32</directoryPath>
+ </includeDirectories>
+ <commandLine>-mno-cygwin</commandLine>
+ </cCompilerTool>
+ <ccCompilerTool>
+ <developmentMode>0</developmentMode>
+ <stripSymbols>true</stripSymbols>
+ <includeDirectories>
+ <directoryPath>/usr/java/include</directoryPath>
+ <directoryPath>/usr/java/include\win32</directoryPath>
+ </includeDirectories>
+ <commandLine>-mno-cygwin</commandLine>
+ </ccCompilerTool>
+ <linkerTool>
+ <output>dist/windows.dll</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerLibItems>
+ <linkerOptionItem>-lole32</linkerOptionItem>
+ <linkerOptionItem>-luuid</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-Wl,--add-stdcall-alias</commandLine>
+ </linkerTool>
+ </compileType>
+ <item path="../.common/src/CommonUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="../.common/src/CommonUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="src/WindowsUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="src/WindowsUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="src/jni_WindowsNativeUtils.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="src/jni_WindowsNativeUtils.h">
+ <itemTool>3</itemTool>
+ </item>
+ <item path="src/jni_WindowsRegistry.c">
+ <itemTool>0</itemTool>
+ </item>
+ <item path="src/jni_WindowsRegistry.h">
+ <itemTool>3</itemTool>
+ </item>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/jnilib/windows/nbproject/project.properties b/jnilib/windows/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/jnilib/windows/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/jnilib/windows/nbproject/project.xml b/jnilib/windows/nbproject/project.xml
new file mode 100644
index 0000000..a3307ff
--- /dev/null
+++ b/jnilib/windows/nbproject/project.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Library: Windows</name>
+ <make-project-type>0</make-project-type>
+ </data>
+ </configuration>
+</project>
diff --git a/jnilib/windows/src/WindowsUtils.c b/jnilib/windows/src/WindowsUtils.c
new file mode 100644
index 0000000..b658710
--- /dev/null
+++ b/jnilib/windows/src/WindowsUtils.c
@@ -0,0 +1,166 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <windows.h>
+#include <winreg.h>
+#include <winnt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "../../.common/src/CommonUtils.h"
+#include "WindowsUtils.h"
+#include "jni_WindowsRegistry.h"
+
+HKEY getHKEY(jint jSection) {
+ switch (jSection) {
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CLASSES_ROOT:
+ return HKEY_CLASSES_ROOT;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CURRENT_USER:
+ return HKEY_CURRENT_USER;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_LOCAL_MACHINE:
+ return HKEY_LOCAL_MACHINE;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_USERS:
+ return HKEY_USERS;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CURRENT_CONFIG:
+ return HKEY_CURRENT_CONFIG;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_DYN_DATA:
+ return HKEY_DYN_DATA;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_DATA:
+ return HKEY_PERFORMANCE_DATA;
+ default:
+ return NULL;
+ }
+}
+
+LONG getMode(jint jmode) {
+ switch (jmode) {
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_DEFAULT:
+ return 0L;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_32BIT:
+ return KEY_WOW64_32KEY;
+ case org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_64BIT:
+ return KEY_WOW64_64KEY;
+ default:
+ return 0L;
+ }
+}
+
+
+int queryValue(int mode, HKEY section, const unsigned short* key, const unsigned short* name, DWORD* type, DWORD* size, byte** value, int expand) {
+ int result = 1;
+
+ HKEY hkey = 0;
+ int tempType = 0;
+ int tempSize = 0;
+ byte* tempValue = NULL;
+
+ if (RegOpenKeyExW(section, key, 0, KEY_QUERY_VALUE | mode, &hkey) == ERROR_SUCCESS) {
+ if (RegQueryValueExW(hkey, name, NULL, (LPDWORD) &tempType, NULL, (LPDWORD) &tempSize) == ERROR_SUCCESS) {
+ tempValue = (byte*) MALLOC(tempSize + 8);
+
+ if (tempValue != NULL) {
+ ZERO(tempValue, tempSize + 8);
+
+ if (RegQueryValueExW(hkey, name, NULL, (LPDWORD) &tempType, tempValue, (LPDWORD) &tempSize) == ERROR_SUCCESS) {
+ if (expand && (tempType == REG_EXPAND_SZ)) {
+ int expandedSize = (int) WCSLEN((unsigned short*) tempValue) + 2;
+ byte* expandedValue = (byte*) MALLOC(expandedSize * sizeof(wchar_t));
+ int expandedCharsNumber = 0;
+ ZERO(expandedValue, expandedSize);
+ expandedCharsNumber = ExpandEnvironmentStringsW((unsigned short*) tempValue, (unsigned short*) expandedValue, tempSize);
+ if (expandedCharsNumber > tempSize) {
+ FREE(expandedValue);
+ expandedValue = (byte*) MALLOC(expandedCharsNumber * sizeof(wchar_t));
+ expandedCharsNumber = ExpandEnvironmentStringsW((unsigned short*) tempValue, (unsigned short*) expandedValue, expandedCharsNumber);
+ }
+
+ FREE(tempValue);
+ tempValue = expandedValue;
+ }
+ } else {
+ FREE(tempValue);
+ result = 0;
+ }
+ }
+ } else {
+ result = 0;
+ }
+ } else {
+ result = 0;
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ if (type != NULL) {
+ *type = tempType;
+ }
+ if (size != NULL) {
+ *size = tempSize;
+ }
+ if ((value != NULL) && (tempValue != NULL)) {
+ *value = tempValue;
+ }
+
+ return result;
+}
+
+int setValue(int mode, HKEY section, const unsigned short* key, const unsigned short* name, DWORD type, const byte* data, int size, int expand) {
+ int result = 1;
+
+ HKEY hkey = 0;
+
+ if (RegOpenKeyExW(section, key, 0, KEY_SET_VALUE | mode, &hkey) == ERROR_SUCCESS) {
+ if (!(RegSetValueExW(hkey, name, 0, type, data, size) == ERROR_SUCCESS)) {
+ result = 0;
+ }
+ } else {
+ result = 0;
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ return result;
+}
diff --git a/jnilib/windows/src/WindowsUtils.h b/jnilib/windows/src/WindowsUtils.h
new file mode 100644
index 0000000..4a8868c
--- /dev/null
+++ b/jnilib/windows/src/WindowsUtils.h
@@ -0,0 +1,68 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <windows.h>
+#include <winreg.h>
+#include <winnt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "../../.common/src/CommonUtils.h"
+
+#ifndef _WindowsUtils_H
+#define _WindowsUtils_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+HKEY getHKEY(jint jSection);
+
+int queryValue(int mode, HKEY section, const unsigned short * key, const unsigned short * name, DWORD* type, DWORD* size, byte** value, int expand);
+
+int setValue(int mode, HKEY section, const unsigned short * key, const unsigned short * name, DWORD type, const byte* data, int size, int expand);
+
+LONG getMode(jint jmode);
+#ifdef __cplusplus
+}
+#endif
+#endif // _WindowsUtils_H
diff --git a/jnilib/windows/src/jni_WindowsNativeUtils.c b/jnilib/windows/src/jni_WindowsNativeUtils.c
new file mode 100644
index 0000000..762d45c
--- /dev/null
+++ b/jnilib/windows/src/jni_WindowsNativeUtils.c
@@ -0,0 +1,420 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <windows.h>
+#include <lmcons.h>
+#include <shlguid.h>
+#include <shlobj.h>
+
+#include "../../.common/src/CommonUtils.h"
+#include "WindowsUtils.h"
+#include "jni_WindowsNativeUtils.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// Functions
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_isCurrentUserAdmin0(JNIEnv* jEnv, jobject jObject) {
+ BOOL result = FALSE;
+
+ PACL pACL = NULL;
+ PSID psidAdmin = NULL;
+ HANDLE token = NULL;
+ HANDLE duplToken = NULL;
+ PSECURITY_DESCRIPTOR adminDescriptor = NULL;
+
+ SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
+ DWORD aclSize;
+
+ const DWORD ACCESS_READ = 1;
+ const DWORD ACCESS_WRITE = 2;
+
+ GENERIC_MAPPING mapping;
+
+ PRIVILEGE_SET ps;
+ DWORD status;
+ DWORD structSize = sizeof(PRIVILEGE_SET);
+
+ // MS KB 118626
+ while (TRUE) {
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY, TRUE, &token)) {
+ if (GetLastError() != ERROR_NO_TOKEN) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | TOKEN_QUERY, &token)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+ }
+
+ if (!DuplicateToken(token, SecurityImpersonation, &duplToken)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ if (!AllocateAndInitializeSid(&SystemSidAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdmin)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ adminDescriptor = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
+ if (adminDescriptor == NULL) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+ if (!InitializeSecurityDescriptor(adminDescriptor, SECURITY_DESCRIPTOR_REVISION)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ aclSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidAdmin) - sizeof(DWORD);
+
+ pACL = (PACL) LocalAlloc(LPTR, aclSize);
+ if (pACL == NULL) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+ if (!InitializeAcl(pACL, aclSize, ACL_REVISION2)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ if (!AddAccessAllowedAce(pACL, ACL_REVISION2, ACCESS_READ | ACCESS_WRITE , psidAdmin)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+ if (!SetSecurityDescriptorDacl(adminDescriptor, TRUE, pACL, FALSE)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ SetSecurityDescriptorGroup(adminDescriptor, psidAdmin, FALSE);
+ SetSecurityDescriptorOwner(adminDescriptor, psidAdmin, FALSE);
+
+ if (!IsValidSecurityDescriptor(adminDescriptor)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ mapping.GenericRead = ACCESS_READ;
+ mapping.GenericWrite = ACCESS_WRITE;
+ mapping.GenericExecute = 0;
+ mapping.GenericAll = ACCESS_READ | ACCESS_WRITE;
+
+ if (!AccessCheck(adminDescriptor, duplToken, ACCESS_READ, &mapping, &ps, &structSize, &status, &result)) {
+ throwException(jEnv, "Native error");
+ break;
+ }
+
+ break;
+ }
+
+ if (pACL) {
+ LocalFree(pACL);
+ }
+ if (adminDescriptor) {
+ LocalFree(adminDescriptor);
+ }
+ if (psidAdmin) {
+ FreeSid(psidAdmin);
+ }
+ if (duplToken) {
+ CloseHandle(duplToken);
+ }
+ if (token) {
+ CloseHandle(token);
+ }
+
+ return result;
+}
+
+JNIEXPORT jlong JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_getFreeSpace0(JNIEnv* jEnv, jobject jObject, jstring jPath) {
+ WCHAR* path = getWideChars(jEnv, jPath);
+ jlong size = 0;
+ typedef struct int64s { unsigned long Low, High; } int64t;
+ int64t bytes;
+ if (GetDiskFreeSpaceExW(path, (PULARGE_INTEGER) &bytes, NULL, NULL)) {
+ unsigned long h = bytes.High;
+ // workaround of using missing _allmul function
+ // replace multiplication by sum
+ // (2^32 * high + low) = 2^32 + 2^32 + ... (bytes.High times total) + bytes.Low
+ // can be relatively expensive on big sizes (peta bytes and more)
+ while(h > 0) {
+ h--;
+ size+=4294967296L;
+ }
+ size+= bytes.Low;
+ } else {
+ throwException(jEnv, "Native error");
+ }
+
+ FREE(path);
+
+ return size;
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_createShortcut0(JNIEnv* jEnv, jobject jObject, jobject jShortcut) {
+ unsigned short *shortcutPath = getWideStringFromMethod(jEnv, jShortcut, "getPath");
+ unsigned short *targetPath = getWideStringFromMethod(jEnv, jShortcut, "getTargetPath");
+ unsigned short *description = getWideStringFromMethod(jEnv, jShortcut, "getDescription");
+ unsigned short *iconPath = getWideStringFromMethod(jEnv, jShortcut, "getIconPath");
+ jint iconIndex = getIntFromMethod (jEnv, jShortcut, "getIconIndex");
+ unsigned short *workingDirectory = getWideStringFromMethod(jEnv, jShortcut, "getWorkingDirectoryPath");
+ unsigned short *arguments = getWideStringFromMethod(jEnv, jShortcut, "getArgumentsString");
+
+ HRESULT tempResult;
+ IShellLinkW* shell;
+
+ HRESULT comStart = CoInitialize(NULL);
+ int errorCode = 0;
+
+ tempResult = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (void **) &shell);
+
+ if (SUCCEEDED(tempResult)) {
+ IPersistFile *persistFile;
+ // we will save the shell link in persistent storage
+ tempResult = shell->lpVtbl->QueryInterface(shell, &IID_IPersistFile, (void **) &persistFile);
+
+ if (SUCCEEDED(tempResult)) {
+ tempResult = shell->lpVtbl->SetPath(shell, targetPath);
+ if (!SUCCEEDED(tempResult)) {
+ throwException(jEnv, "Native error (-2)");
+ errorCode = -2;
+ }
+ // make sure description length is less than MAX_PATH
+ if ((errorCode == 0) && (description != NULL)) {
+ if (WCSLEN(description) < MAX_PATH) {
+ if (!SUCCEEDED(shell->lpVtbl->SetDescription(shell, description))) {
+ throwException(jEnv, "Native error (-3)");
+ errorCode = -3;
+ }
+ } else {
+ unsigned short *desc = (unsigned short *) MALLOC(sizeof(unsigned short) * MAX_PATH);
+ ZERO(desc, sizeof(unsigned short) * MAX_PATH);
+ desc = WCSNCPY(desc, description, MAX_PATH);
+ if (!SUCCEEDED(shell->lpVtbl->SetDescription(shell, desc))) {
+ throwException(jEnv, "Native error (-4)");
+ errorCode = -4;
+ }
+ FREE(desc);
+ }
+ }
+ if ((errorCode == 0) && (arguments != NULL)) {
+ if (!SUCCEEDED(shell->lpVtbl->SetArguments(shell, arguments))) {
+ throwException(jEnv, "Native error (-5)");
+ errorCode = -5;
+ }
+ }
+ if ((errorCode == 0) && (workingDirectory != NULL)) {
+ if (!SUCCEEDED(shell->lpVtbl->SetWorkingDirectory(shell, workingDirectory))) {
+ throwException(jEnv, "Native error (-6)");
+ errorCode = -6;
+ }
+ }
+ if ((errorCode == 0) && (iconPath != NULL)) {
+ if (!SUCCEEDED(shell->lpVtbl->SetIconLocation(shell, iconPath, iconIndex))) {
+ throwException(jEnv, "Native error (-7)");
+ errorCode = -7;
+ }
+ }
+ // use normal window.
+ if (errorCode == 0) {
+ if (!SUCCEEDED(shell->lpVtbl->SetShowCmd(shell, SW_NORMAL))) {
+ throwException(jEnv, "Native error (-8)");
+ errorCode = -8;
+ }
+ }
+ if (errorCode == 0) {
+ if (mkdirsW(jEnv, shortcutPath)) {
+ if (!SUCCEEDED(persistFile->lpVtbl->Save(persistFile, shortcutPath, TRUE))) {
+ throwException(jEnv, "Native error (-9)");
+ errorCode = -9;
+ }
+ } else {
+ throwException(jEnv, "Native error (-10)");
+ errorCode = -10;
+ }
+ }
+
+ if (errorCode == 0) {
+ persistFile->lpVtbl->Release(persistFile);
+ }
+ } else {
+ throwException(jEnv, "Native error (-11)");
+ errorCode = -11;
+ }
+ shell->lpVtbl->Release(shell);
+ } else {
+ throwException(jEnv, "Native error (-12)");
+ errorCode = -12;
+ }
+
+ if (comStart == S_OK) {
+ CoUninitialize();
+ }
+
+ FREE(shortcutPath);
+ FREE(targetPath);
+ FREE(description);
+ FREE(iconPath);
+ FREE(workingDirectory);
+ FREE(arguments);
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_deleteFileOnReboot0(JNIEnv* jEnv, jobject jObject, jstring jPath) {
+ unsigned short * path = getWideChars(jEnv, jPath);
+
+ if (!MoveFileExW(path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) {
+ throwException(jEnv, "Native error");
+ }
+
+ FREE(path);
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_createProcessWithoutHandles0(JNIEnv* jEnv, jobject jObject, jstring jCommand) {
+ unsigned short * command = getWideChars(jEnv, jCommand);
+ STARTUPINFOW si;
+ PROCESS_INFORMATION pi;
+
+ ZERO(&si, sizeof(si));
+ si.cb = sizeof(si);
+ ZERO(&pi, sizeof(pi));
+ if(!CreateProcessW(NULL, // executable name - use command line
+ command, // command line
+ NULL, // process security attribute
+ NULL, // thread security attribute
+ FALSE, // inherits system handles
+ 0, // no creation flags
+ NULL, // use parent's environment block
+ NULL, // use parent's starting directory
+ &si, // (in) startup information
+ &pi)) { // (out) process information
+ throwException(jEnv, "Cannot create process.\n");
+ }
+
+
+ FREE(command);
+}
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_notifyAssociationChanged0(JNIEnv *jEnv, jobject jObj) {
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_notifyEnvironmentChanged0(JNIEnv *jEnv, jobject jObj) {
+ /* maximum 1 sec timeout for each window in the system */
+ DWORD dwReturnValue = 0;
+ LRESULT result = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &dwReturnValue);
+ return (result!=0);
+}
+
+
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_checkAccessTokenAccessLevel0(JNIEnv *jEnv, jobject jObj, jstring jPath, jint jLevel) {
+ unsigned short * path = getWideChars(jEnv, jPath);
+ PSECURITY_DESCRIPTOR pSD;
+ DWORD nLength;
+
+ PRIVILEGE_SET PrivilegeSet;
+ DWORD PrivSetSize = sizeof (PRIVILEGE_SET);
+
+ HANDLE hToken;
+
+ GENERIC_MAPPING GenericMapping;
+ DWORD DesiredAccess = (DWORD) jLevel ;
+
+ BOOL bAccessGranted;
+ DWORD GrantedAccess;
+
+ // create memory for storing user's security descriptor
+ GetFileSecurityW(path, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, NULL, 0, &nLength);
+
+ pSD = (PSECURITY_DESCRIPTOR) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength);
+
+ if (pSD == NULL) {
+ throwException(jEnv, "Unable to allocate memory to store security descriptor.\n");
+ return -1;
+ }
+ // Get the security descriptor
+ if (!GetFileSecurityW(path, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, pSD, nLength, &nLength)) {
+ throwException(jEnv, "Unable to obtain security descriptor.\n");
+ FREE(path);
+ return (-3);
+ }
+ FREE(path);
+
+ /* Perform security impersonation of the user and open */
+ /* the resulting thread token. */
+ if (!ImpersonateSelf(SecurityImpersonation)) {
+ throwException(jEnv, "Unable to perform security impersonation.\n");
+ HeapFree(GetProcessHeap(), 0, pSD);
+ return (-4);
+ }
+
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY, FALSE, &hToken)) {
+ throwException(jEnv, "Unable to get current thread's token.\n");
+ HeapFree(GetProcessHeap(), 0, pSD);
+ return (-5);
+ }
+ RevertToSelf();
+
+ ZERO(&GenericMapping, sizeof (GENERIC_MAPPING));
+
+ DesiredAccess = DesiredAccess | STANDARD_RIGHTS_READ;
+ GenericMapping.GenericRead = FILE_GENERIC_READ;
+
+ if(jLevel & FILE_WRITE_DATA) {
+ GenericMapping.GenericWrite = FILE_GENERIC_WRITE;
+ }
+
+ MapGenericMask(&DesiredAccess, &GenericMapping);
+
+ /* Perform access check using the token. */
+ if (!AccessCheck(pSD, hToken, DesiredAccess, &GenericMapping, &PrivilegeSet, &PrivSetSize, &GrantedAccess, &bAccessGranted)) {
+ throwException(jEnv, "Unable to perform access check.\n");
+ CloseHandle(hToken);
+ HeapFree(GetProcessHeap(), 0, pSD);
+ return (-6);
+ }
+ /* Clean up. */
+ HeapFree(GetProcessHeap(), 0, pSD);
+ CloseHandle(hToken);
+ return (bAccessGranted);
+}
+
+
diff --git a/jnilib/windows/src/jni_WindowsNativeUtils.h b/jnilib/windows/src/jni_WindowsNativeUtils.h
new file mode 100644
index 0000000..47372b4
--- /dev/null
+++ b/jnilib/windows/src/jni_WindowsNativeUtils.h
@@ -0,0 +1,129 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+/* Header for class org_netbeans_installer_utils_system_WindowsNativeUtils */
+
+#ifndef _Included_org_netbeans_installer_utils_system_WindowsNativeUtils
+#define _Included_org_netbeans_installer_utils_system_WindowsNativeUtils
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#undef org_netbeans_installer_utils_system_WindowsNativeUtils_MIN_UID_INDEX
+#define org_netbeans_installer_utils_system_WindowsNativeUtils_MIN_UID_INDEX 1L
+
+#undef org_netbeans_installer_utils_system_WindowsNativeUtils_MAX_UID_INDEX
+#define org_netbeans_installer_utils_system_WindowsNativeUtils_MAX_UID_INDEX 100L
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: isCurrentUserAdmin0
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_isCurrentUserAdmin0
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: getFreeSpace0
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_getFreeSpace0
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: createShortcut0
+ * Signature: (Lorg/netbeans/installer/utils/system/shortcut/FileShortcut;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_createShortcut0
+ (JNIEnv *, jobject, jobject);
+
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: deleteFileOnReboot0
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_deleteFileOnReboot0
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: createProcessWithoutHandles0
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_createProcessWithoutHandles0
+ (JNIEnv *, jobject, jstring);
+
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: notifyAssociationChanged0
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_notifyAssociationChanged0
+ (JNIEnv *, jobject);
+
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: checkAccessTokenAccessLevel0
+ * Signature: (Ljava/lang/String;I)I
+ */
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_checkAccessTokenAccessLevel0
+ (JNIEnv *, jobject, jstring, jint);
+
+
+/*
+ * Class: org_netbeans_installer_utils_system_WindowsNativeUtils
+ * Method: notifyEnvironmentChanged0
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_WindowsNativeUtils_notifyEnvironmentChanged0
+ (JNIEnv *, jobject);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/jnilib/windows/src/jni_WindowsRegistry.c b/jnilib/windows/src/jni_WindowsRegistry.c
new file mode 100644
index 0000000..b586a2f
--- /dev/null
+++ b/jnilib/windows/src/jni_WindowsRegistry.c
@@ -0,0 +1,652 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+#include <windows.h>
+#include <winreg.h>
+#include <winnt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+
+#include "../../.common/src/CommonUtils.h"
+#include "WindowsUtils.h"
+#include "jni_WindowsRegistry.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// Globals
+
+// maximum length of a registry value
+const DWORD MAX_LEN_VALUE_NAME = 16383;
+
+////////////////////////////////////////////////////////////////////////////////
+// Functions
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_checkKeyAccess0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jint jLevel) {
+ HKEY hkey = 0;
+ unsigned short * key = getWideChars(jEnv, jKey);
+
+ jboolean result = FALSE;
+ REGSAM access = (jLevel==0) ? KEY_READ : KEY_ALL_ACCESS;
+ result = (RegOpenKeyExW(getHKEY(jSection), key, 0, access | getMode(jMode), &hkey) == ERROR_SUCCESS);
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+
+ return result;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_valueExists0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
+ HKEY hkey = 0;
+ unsigned short * key = getWideChars(jEnv, jKey);
+ unsigned short * value = getWideChars(jEnv, jName);
+ jboolean result = FALSE;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ result = (RegQueryValueExW(hkey, value, NULL, NULL, NULL, NULL) == ERROR_SUCCESS);
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+ FREE(key);
+ FREE(value);
+
+ return result;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_keyEmpty0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+
+ DWORD subkeys = 1;
+ DWORD values = 1;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_READ | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, &subkeys, NULL, NULL, &values, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+
+ return (values + subkeys == 0);
+}
+
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_countSubKeys0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+
+ DWORD count = 0;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_READ | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if(RegQueryInfoKeyW(hkey, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+
+ return count;
+}
+
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_countValues0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+
+ DWORD count = 0;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_READ | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+
+ return count;
+}
+
+JNIEXPORT jobjectArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getSubkeyNames0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ DWORD number = 0;
+ int err = 0;
+ int index = 0 ;
+
+ unsigned short* buffer = (unsigned short*) MALLOC(sizeof(char) * MAX_LEN_VALUE_NAME);
+
+ jobjectArray result = NULL;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_READ | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, &number, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
+ jclass stringClazz = (*jEnv)->FindClass(jEnv, "java/lang/String");
+ result = (*jEnv)->NewObjectArray(jEnv, number, stringClazz, NULL);
+
+ do {
+ DWORD size = MAX_LEN_VALUE_NAME;
+ buffer[0] = 0;
+
+ err = RegEnumKeyExW(hkey, index, buffer, &size, NULL, NULL, NULL, NULL);
+ if (err == ERROR_SUCCESS) {
+ (*jEnv)->SetObjectArrayElement(jEnv, result, index, getStringW(jEnv, buffer));
+ } else {
+ if (err != ERROR_NO_MORE_ITEMS) {
+ throwException(jEnv, "Cannot get key names");
+ }
+ }
+
+ index++;
+ } while (err == ERROR_SUCCESS);
+ } else {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(buffer);
+
+ return result;
+}
+
+JNIEXPORT jobjectArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getValueNames0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ DWORD valuesCount = 0;
+ int err = 0;
+ int index = 0;
+
+ unsigned short* buffer = (unsigned short*) MALLOC(sizeof(char) * MAX_LEN_VALUE_NAME);
+
+ jobjectArray result = NULL;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, &valuesCount, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
+ jclass stringClazz = (*jEnv)->FindClass(jEnv, "java/lang/String");
+ result = (*jEnv)->NewObjectArray(jEnv, valuesCount, stringClazz, NULL);
+
+ do {
+ DWORD size = MAX_LEN_VALUE_NAME;
+ buffer[0] = 0;
+
+ err = RegEnumValueW(hkey, index, buffer, &size, NULL, NULL, NULL, NULL);
+ if (err == ERROR_SUCCESS) {
+ (*jEnv)->SetObjectArrayElement(jEnv, result, index, getStringW(jEnv, buffer));
+ } else {
+ if (err != ERROR_NO_MORE_ITEMS) {
+ throwException(jEnv, "Cannot get value names");
+ }
+ }
+
+ index++;
+ } while (err == ERROR_SUCCESS);
+ } else {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(buffer);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getValueType0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
+ HKEY hkey =0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* value = getWideChars(jEnv, jName);
+
+ DWORD type = REG_NONE;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if (RegQueryValueExW(hkey, value, NULL, &type, NULL, NULL) != ERROR_SUCCESS) {
+ throwException(jEnv, "Cannot read value");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(value);
+
+ return type;
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_createKey0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jParent, jstring jChild) {
+ HKEY hkey = 0;
+ HKEY newKey = 0;
+ unsigned short* parent = getWideChars(jEnv, jParent);
+ unsigned short* child = getWideChars(jEnv, jChild);
+
+ if (RegOpenKeyExW(getHKEY(jSection), parent, 0, KEY_CREATE_SUB_KEY | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ LONG result = RegCreateKeyExW(hkey, child, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE | getMode(jMode), NULL, &newKey, NULL);
+ if (result == ERROR_SUCCESS) {
+ if (newKey != 0) {
+ RegCloseKey(newKey);
+ }
+ } else if (result == ERROR_ACCESS_DENIED) {
+ throwException(jEnv, "Could not create a new key (access denied)");
+ } else {
+ throwException(jEnv, "Could not create a new key");
+ }
+ } else {
+ throwException(jEnv, "Could not open the parent key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(parent);
+ FREE(child);
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_deleteKey0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jParent, jstring jChild) {
+ HKEY hkey = 0;
+ unsigned short* jParentS = getWideChars(jEnv, jParent);
+ unsigned short* jChildS = getWideChars(jEnv, jChild);
+
+
+ if (RegOpenKeyExW(getHKEY(jSection), jParentS, 0, KEY_READ | KEY_WRITE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ LONG mode = getMode(jMode);
+ if(mode==0) {
+ if (RegDeleteKeyW(hkey, jChildS) != ERROR_SUCCESS) {
+ throwException(jEnv, "Could not delete key");
+ }
+ } else {
+ typedef LONG (WINAPI *LPFN_REGDELETEKEYEXW) (HKEY, LPCWSTR, REGSAM, DWORD);
+ LPFN_REGDELETEKEYEXW regDeleteKeyExW;
+ HMODULE hModule = GetModuleHandle(TEXT("advapi32.dll"));
+ if(hModule == NULL) {
+ hModule = LoadLibraryA("advapi32.dll");
+ }
+ regDeleteKeyExW = (LPFN_REGDELETEKEYEXW) GetProcAddress(hModule,"RegDeleteKeyExW");
+ if (NULL != regDeleteKeyExW) {
+ if (regDeleteKeyExW(hkey, jChildS, mode, 0) != ERROR_SUCCESS) {
+ throwException(jEnv, "Could not delete key");
+ }
+ } else {
+ throwException(jEnv, "Cannot load function RegDeleteKeyExW");
+ }
+ }
+ } else {
+ throwException(jEnv, "Could not open the parent key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(jParentS);
+ FREE(jChildS);
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_deleteValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* value = getWideChars(jEnv, jName);
+
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_SET_VALUE | getMode(jMode) , &hkey) == ERROR_SUCCESS) {
+ if (RegDeleteValueW(hkey, value) != ERROR_SUCCESS) {
+ throwException(jEnv, "Cannot delete value");
+ }
+ } else {
+ throwException(jEnv, "Canont open key");
+ }
+
+ if(hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(value);
+}
+
+JNIEXPORT jstring JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getStringValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName, jboolean jExpand) {
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* name = getWideChars(jEnv, jName);
+ DWORD type = REG_NONE;
+ byte* value = NULL;
+
+ jstring result = NULL;
+
+ if (queryValue(getMode(jMode), getHKEY(jSection), key, name, &type, NULL, &value, jExpand)) {
+ if (type == REG_SZ || type == REG_EXPAND_SZ) {
+ result = getStringW(jEnv, (unsigned short*) value);
+ } else {
+ throwException(jEnv, "Value has wrong type");
+ }
+ } else {
+ throwException(jEnv, "Cannot read value");
+ }
+
+ FREE(key);
+ FREE(name);
+ FREE(value);
+
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setStringValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName, jstring jValue, jboolean jExpand) {
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* name = getWideChars(jEnv, jName);
+ unsigned short* value = getWideChars(jEnv, jValue);
+
+ if (!setValue(getMode(jMode), getHKEY(jSection), key, name, jExpand ? REG_EXPAND_SZ : REG_SZ, (byte*) value, ((int) WCSLEN(value)) * sizeof(unsigned short), 0)) {
+ throwException(jEnv, "Could not set value");
+ }
+
+ FREE(key);
+ FREE(name);
+ FREE(value);
+}
+
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_get32BitValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* value = getWideChars(jEnv, jName);
+
+ jint result = -1;
+ if(RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ DWORD dwType = 0;
+ DWORD dwValue = 0;
+ DWORD dwBufSize = sizeof(dwValue);
+
+ if (RegQueryValueExW(hkey, value, NULL, &dwType, (LPBYTE) &dwValue, &dwBufSize) == ERROR_SUCCESS) {
+ if ((dwType == REG_DWORD) || (dwType == REG_DWORD_BIG_ENDIAN)) {
+ result = dwValue;
+ } else {
+ throwException(jEnv, "Value is of wrong type");
+ }
+ } else {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Could not open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(value);
+
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_set32BitValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName, jint jValue) {
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* name = getWideChars(jEnv, jName);
+ DWORD dword = (DWORD) jValue;
+ LPBYTE byteValue = (LPBYTE) &dword;
+
+ if (!setValue(getMode(jMode),getHKEY(jSection), key, name, REG_DWORD, byteValue, sizeof(name), 0)) {
+ throwException(jEnv, "Cannot set value");
+ }
+
+ FREE(key);
+ FREE(name);
+}
+
+JNIEXPORT jobjectArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getMultiStringValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* value = getWideChars(jEnv, jName);
+
+ int i, start, count, cnt;
+ LONG regErr = 0;
+ unsigned short* data = 0;
+ jstring string;
+ jclass strClass;
+ DWORD dwType;
+ DWORD size = 0;
+
+ jarray result = 0;
+ if(RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ if (RegQueryValueExW(hkey, value, NULL, &dwType, NULL, &size) == ERROR_SUCCESS) {
+ if (dwType == REG_MULTI_SZ) {
+ data = (unsigned short*) LocalAlloc(LPTR, size + 8);
+
+ if (data != NULL) {
+ if (RegQueryValueExW(hkey, value, NULL, &dwType, (byte*) data, &size) == ERROR_SUCCESS) {
+ for (count = 0, i = 0; i < (int) size; i++) {
+ if (data[i] == '\0') { // \0 - end of a single string
+ count++;
+ if (data[i + 1] == '\0') { // two \0 's in a row - end of all strings
+ break;
+ }
+ }
+ }
+
+ strClass = (*jEnv)->FindClass(jEnv, "java/lang/String");
+ if (strClass != NULL) {
+ result = (*jEnv)->NewObjectArray(jEnv, (jsize) count, strClass, NULL);
+ if (result != NULL) {
+ for (cnt = 0, start = 0, i = 0; (i < (int) size) && (cnt < count); i++) {
+ if (data[i] == '\0') {
+ string = getStringWithLengthW(jEnv, &data[start], i - start);
+
+ if (string != NULL) {
+ (*jEnv)->SetObjectArrayElement(jEnv, (jobjectArray) result, (jsize) cnt++, string);
+
+ start = i + 1;
+ if (data[start] == '\0') {
+ break;
+ }
+ } else {
+ throwException(jEnv, "Cannot create an array element");
+ break;
+ }
+ }
+ }
+ } else {
+ throwException(jEnv, "Cannot create resulting array");
+ }
+ } else {
+ throwException(jEnv, "Cannot find java.lang.String");
+ }
+ } else {
+ throwException(jEnv, "Cannot read value data");
+ }
+ FREE(data);
+ } else {
+ throwException(jEnv, "Cannot allocate memory for value");
+ }
+ } else {
+ throwException(jEnv, "Value is of wrong type");
+ }
+ } else {
+ throwException(jEnv, "Cannot read key data");
+ }
+ } else {
+ throwException(jEnv, "Cannot open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(value);
+
+ return (jobjectArray) result;
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setMultiStringValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName, jobjectArray jValue) {
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* name = getWideChars(jEnv, jName);
+ DWORD size = 0;
+ BYTE* data = getByteFromMultiString(jEnv, jValue, &size);
+
+ if (!setValue(getMode(jMode),getHKEY(jSection), key, name, REG_MULTI_SZ, data, size, 0)) {
+ throwException(jEnv, "Cannot set value");
+ }
+
+ FREE(key);
+ FREE(name);
+ FREE(data);
+}
+
+JNIEXPORT jbyteArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getBinaryValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
+ HKEY hkey = 0;
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* value = getWideChars(jEnv, jName);
+
+ jbyteArray result = NULL;
+ if (RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
+ DWORD dwType = 0;
+ DWORD dwValue = 0;
+ DWORD size = 0;
+ BYTE* data = NULL;
+
+ if (RegQueryValueExW(hkey, value, NULL, &dwType, NULL, &size) == ERROR_SUCCESS) {
+ if (dwType == REG_BINARY || dwType == REG_NONE) {
+ data = (BYTE*) LocalAlloc(LPTR, size + 8);
+ if (RegQueryValueExW(hkey, value, NULL, &dwType, (BYTE*) data, &size) == ERROR_SUCCESS) {
+ if (data != NULL) {
+ result = (*jEnv)->NewByteArray(jEnv, (jsize) size);
+ (*jEnv)->SetByteArrayRegion(jEnv, result, 0, (jsize) size, (jbyte*) data);
+ }
+ } else {
+ throwException(jEnv, "Could not read key data");
+ }
+ FREE(data);
+ } else {
+ throwException(jEnv, "Value is of wrong type");
+ }
+ } else {
+ throwException(jEnv, "Could not read key data");
+ }
+ } else {
+ throwException(jEnv, "Could not open key");
+ }
+
+ if (hkey != 0) {
+ RegCloseKey(hkey);
+ }
+
+ FREE(key);
+ FREE(value);
+
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setBinaryValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName, jbyteArray jValue) {
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* name = getWideChars(jEnv, jName);
+ BYTE* data = (BYTE*) (*jEnv)->GetByteArrayElements(jEnv, jValue, 0);
+ DWORD length = (*jEnv)->GetArrayLength(jEnv, jValue);
+
+ if (!setValue(getMode(jMode),getHKEY(jSection), key, name, REG_BINARY, data, length, 0)) {
+ throwException(jEnv, "Cannot set value");
+ }
+
+ FREE(key);
+ FREE(name);
+ if (data != NULL) {
+ (*jEnv)->ReleaseByteArrayElements(jEnv, jValue, (jbyte*) data, JNI_ABORT);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setNoneValue0(JNIEnv *jEnv, jobject jobj, jint jMode, jint jSection, jstring jKey, jstring jName, jbyteArray jValue) {
+ unsigned short* key = getWideChars(jEnv, jKey);
+ unsigned short* name = getWideChars(jEnv, jName);
+ BYTE* data = (BYTE*) (*jEnv)->GetByteArrayElements(jEnv, jValue, 0);
+ DWORD length = (*jEnv)->GetArrayLength(jEnv, jValue);
+
+ if (!setValue(getMode(jMode),getHKEY(jSection), key, name, REG_NONE, data, length, 0)) {
+ throwException(jEnv, "Cannot set value");
+ }
+
+ FREE(key);
+ FREE(name);
+ if (data != NULL) {
+ (*jEnv)->ReleaseByteArrayElements(jEnv, jValue, (jbyte*) data, JNI_ABORT);
+ }
+}
+
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_IsWow64Process0(JNIEnv *jEnv, jobject jObject) {
+ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+ LPFN_ISWOW64PROCESS fnIsWow64Process;
+ BOOL IsWow64 = FALSE;
+
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
+
+ if (NULL != fnIsWow64Process)
+ {
+ if (!fnIsWow64Process(GetCurrentProcess(),&IsWow64))
+ {
+ }
+ }
+ return IsWow64;
+}
diff --git a/jnilib/windows/src/jni_WindowsRegistry.h b/jnilib/windows/src/jni_WindowsRegistry.h
new file mode 100644
index 0000000..b80248b
--- /dev/null
+++ b/jnilib/windows/src/jni_WindowsRegistry.h
@@ -0,0 +1,286 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <jni.h>
+/* Header for class org_netbeans_installer_utils_system_windows_WindowsRegistry */
+
+#ifndef _Included_org_netbeans_installer_utils_system_windows_WindowsRegistry
+#define _Included_org_netbeans_installer_utils_system_windows_WindowsRegistry
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CLASSES_ROOT
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CLASSES_ROOT 0L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CURRENT_USER
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CURRENT_USER 1L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_LOCAL_MACHINE
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_LOCAL_MACHINE 2L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_USERS
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_USERS 3L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CURRENT_CONFIG
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_CURRENT_CONFIG 4L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_DYN_DATA
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_DYN_DATA 5L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_DATA
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_DATA 6L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_NLSTEXT
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_NLSTEXT 7L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_TEXT
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKEY_PERFORMANCE_TEXT 8L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKCR
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKCR 0L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKCU
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKCU 1L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_HKLM
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_HKLM 2L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_NONE
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_NONE 0L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_SZ
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_SZ 1L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_EXPAND_SZ
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_EXPAND_SZ 2L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_BINARY
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_BINARY 3L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_DWORD_LITTLE_ENDIAN
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_DWORD_LITTLE_ENDIAN 4L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_DWORD
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_DWORD 4L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_DWORD_BIG_ENDIAN
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_DWORD_BIG_ENDIAN 5L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_LINK
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_LINK 6L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_MULTI_SZ
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_MULTI_SZ 7L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_RESOURCE_LIST
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_RESOURCE_LIST 8L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_FULL_RESOURCE_DESCRIPTOR
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_FULL_RESOURCE_DESCRIPTOR 9L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_RESOURCE_REQUIREMENTS_LIST
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_RESOURCE_REQUIREMENTS_LIST 10L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_QWORD_LITTLE_ENDIAN
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_QWORD_LITTLE_ENDIAN 11L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_QWORD
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_REG_QWORD 11L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_DEFAULT
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_DEFAULT 0L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_32BIT
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_32BIT 1L
+#undef org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_64BIT
+#define org_netbeans_installer_utils_system_windows_WindowsRegistry_MODE_64BIT 2L
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: checkKeyAccess0
+ * Signature: (IILjava/lang/String;I;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_checkKeyAccess0
+ (JNIEnv *, jobject, jint, jint, jstring, jint);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: valueExists0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_valueExists0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: keyEmpty0
+ * Signature: (IILjava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_keyEmpty0
+ (JNIEnv *, jobject, jint, jint, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: countSubKeys0
+ * Signature: (IILjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_countSubKeys0
+ (JNIEnv *, jobject, jint, jint, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: countValues0
+ * Signature: (IILjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_countValues0
+ (JNIEnv *, jobject, jint, jint, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: getSubkeyNames0
+ * Signature: (IILjava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getSubkeyNames0
+ (JNIEnv *, jobject, jint, jint, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: getValueNames0
+ * Signature: (IILjava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getValueNames0
+ (JNIEnv *, jobject, jint, jint, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: getValueType0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getValueType0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: createKey0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_createKey0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: deleteKey0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_deleteKey0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: deleteValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_deleteValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: getStringValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getStringValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring, jboolean);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: setStringValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setStringValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring, jstring, jboolean);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: get32BitValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_get32BitValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: set32BitValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_set32BitValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring, jint);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: getMultiStringValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getMultiStringValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: setMultiStringValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setMultiStringValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring, jobjectArray);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: getBinaryValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getBinaryValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: setBinaryValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;[B)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setBinaryValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring, jbyteArray);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: setNoneValue0
+ * Signature: (IILjava/lang/String;Ljava/lang/String;[B)V
+ */
+JNIEXPORT void JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_setNoneValue0
+ (JNIEnv *, jobject, jint, jint, jstring, jstring, jbyteArray);
+
+/*
+ * Class: org_netbeans_installer_utils_system_windows_WindowsRegistry
+ * Method: IsWow64Process0
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_IsWow64Process0
+ (JNIEnv *, jobject);
+
+
+#ifndef KEY_WOW64_32KEY
+#define KEY_WOW64_32KEY 0x0200
+#endif
+#ifndef KEY_WOW64_64KEY
+#define KEY_WOW64_64KEY 0x0100
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/jnilib/windows/vcproject/NBI JNI Library.ncb b/jnilib/windows/vcproject/NBI JNI Library.ncb
new file mode 100644
index 0000000..9057eba
--- /dev/null
+++ b/jnilib/windows/vcproject/NBI JNI Library.ncb
@@ -0,0 +1 @@
+Microsoft C/C++ MSF 7.00
diff --git a/jnilib/windows/vcproject/NBI JNI Library.sln b/jnilib/windows/vcproject/NBI JNI Library.sln
new file mode 100644
index 0000000..4410e6f
--- /dev/null
+++ b/jnilib/windows/vcproject/NBI JNI Library.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NBI JNI Library", "NBI JNI Library.vcproj", "{AF9FBB45-6887-41CE-8DC2-915C5FB2AD45}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Default-32bit|Windows = Default-32bit|Windows
+ Default-64bit|Windows = Default-64bit|Windows
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AF9FBB45-6887-41CE-8DC2-915C5FB2AD45}.Default-32bit|Windows.ActiveCfg = Default-32bit|Win32
+ {AF9FBB45-6887-41CE-8DC2-915C5FB2AD45}.Default-32bit|Windows.Build.0 = Default-32bit|Win32
+ {AF9FBB45-6887-41CE-8DC2-915C5FB2AD45}.Default-64bit|Windows.ActiveCfg = Default-32bit|Win32
+ {AF9FBB45-6887-41CE-8DC2-915C5FB2AD45}.Default-64bit|Windows.Build.0 = Default-32bit|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/jnilib/windows/vcproject/NBI JNI Library.suo b/jnilib/windows/vcproject/NBI JNI Library.suo
new file mode 100644
index 0000000..8a45057
Binary files /dev/null and b/jnilib/windows/vcproject/NBI JNI Library.suo differ
diff --git a/jnilib/windows/vcproject/NBI JNI Library.vcproj b/jnilib/windows/vcproject/NBI JNI Library.vcproj
new file mode 100644
index 0000000..4cbd1b7
--- /dev/null
+++ b/jnilib/windows/vcproject/NBI JNI Library.vcproj
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="NBI JNI Library"
+ ProjectGUID="{AF9FBB45-6887-41CE-8DC2-915C5FB2AD45}"
+ RootNamespace="NBI JNI Library"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Default-32bit|Win32"
+ OutputDirectory="Default-32bit"
+ IntermediateDirectory="Default-32bit"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ UseUnicodeResponseFiles="true"
+ Optimization="1"
+ FavorSizeOrSpeed="2"
+ AdditionalIncludeDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";"C:\Program Files\Java\jdk1.5.0_11\include";"C:\Program Files\Java\jdk1.5.0_11\include\win32""
+ PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;NBIJNILIBRARY_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_STATIC_CPPLIB;_LITTLE_ENDIAN"
+ MinimalRebuild="false"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="0"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="0"
+ CallingConvention="0"
+ CompileAs="1"
+ ShowIncludes="false"
+ OmitDefaultLibName="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkLibraryDependencies="false"
+ UseLibraryDependencyInputs="false"
+ ShowProgress="1"
+ OutputFile="..\dist\windows-x86.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib""
+ GenerateManifest="false"
+ IgnoreEmbeddedIDL="true"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Default-64bit|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ UseUnicodeResponseFiles="true"
+ Optimization="1"
+ FavorSizeOrSpeed="2"
+ AdditionalIncludeDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";"C:\Program Files\Java\jdk1.5.0_11\include";"C:\Program Files\Java\jdk1.5.0_11\include\win32""
+ PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;NBIJNILIBRARY_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_STATIC_CPPLIB;_LITTLE_ENDIAN"
+ MinimalRebuild="false"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="0"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="0"
+ CallingConvention="0"
+ CompileAs="1"
+ ShowIncludes="false"
+ OmitDefaultLibName="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkLibraryDependencies="false"
+ UseLibraryDependencyInputs="false"
+ ShowProgress="0"
+ OutputFile="..\dist\windows-x64.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib""
+ GenerateManifest="false"
+ IgnoreEmbeddedIDL="true"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\.common\src\CommonUtils.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\jni_WindowsNativeUtils.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\jni_WindowsRegistry.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\WindowsUtils.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\.common\src\CommonUtils.c"
+ >
+ </File>
+ <File
+ RelativePath="..\src\jni_WindowsNativeUtils.c"
+ >
+ </File>
+ <File
+ RelativePath="..\src\jni_WindowsRegistry.c"
+ >
+ </File>
+ <File
+ RelativePath="..\src\WindowsUtils.c"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/jnilib/windows/vcproject/NBI JNI Library.vcproj.user b/jnilib/windows/vcproject/NBI JNI Library.vcproj.user
new file mode 100644
index 0000000..a5ca4f9
--- /dev/null
+++ b/jnilib/windows/vcproject/NBI JNI Library.vcproj.user
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?><VisualStudioUserFile ProjectType="Visual C++" Version="8.00" ShowAllFiles="true"></VisualStudioUserFile>
\ No newline at end of file
diff --git a/jnilib/windows/vcproject/vc80.idb b/jnilib/windows/vcproject/vc80.idb
new file mode 100644
index 0000000..3169052
Binary files /dev/null and b/jnilib/windows/vcproject/vc80.idb differ
diff --git a/launcher/unix/i18n/launcher.properties b/launcher/unix/i18n/launcher.properties
new file mode 100644
index 0000000..3fbc316
--- /dev/null
+++ b/launcher/unix/i18n/launcher.properties
@@ -0,0 +1,71 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+nlu.jvm.notfoundmessage=Java SE Development Kit (JDK) was not found on this computer\nJDK 8 is required for installing the NetBeans IDE. Make sure that the JDK is properly installed and run installer again.\nYou can specify valid JDK location using {0} installer argument.\n\nTo download the JDK, visit http://www.oracle.com/technetwork/java/javase/downloads
+nlu.jvm.usererror=Java Runtime Environment (JRE) was not found at the specified location {0}
+nlu.jvm.uncompatible=Unsupported JVM version at {0}.\nTry to specify another JVM location using parameter {1}
+nlu.freespace=There is not enough free disk space to extract installation data\n{0} MB of free disk space is required in a temporary folder.\nClean up the disk space and run installer again. You can specify a temporary folder with sufficient disk space using {1} installer argument
+nlu.integrity=\nInstaller file {0} seems to be corrupted
+nlu.missing.external.resource=Can`t run NetBeans Installer.\nAn external file with necessary data is required but missing:\n{0}
+nlu.cannot.create.tmpdir=Cannot create temporary directory {0}
+nlu.cannot.extract.bundled.jvm=Cannot prepare bundled JVM to run the installer.\nMost probably the bundled JVM is not compatible with the current platform.\nSee FAQ at http://wiki.netbeans.org/FaqUnableToPrepareBundledJdk for more information.
+nlu.cannot.unpack.jvm.file=Cannot unpack file {0}
+nlu.error.verify.bundled.jvm=Cannot verify bundled JVM, try to search JVM on the system
+
+nlu.running=Running the installer wizard...
+nlu.starting=Configuring the installer...
+nlu.extracting=Extracting installation data...
+nlu.prepare.jvm=Preparing bundled JVM ...
+nlu.jvm.search=Searching for JVM on the system...
+
+nlu.msg.usage=\nUsage:
+nlu.arg.javahome=\t{0}\t<dir>\tUsing java from <dir> for running application
+nlu.arg.verbose=\t{0}\t\tUse verbose output
+nlu.arg.output=\t{0}\t<out>\tRedirect all output to file <out>
+nlu.arg.disable.space.check=\t{0}\t\tDisable free space check
+nlu.arg.extract=\t{0}\t[dir]\tExtract all bundled data to <dir>.\n\t\t\t\tIf <dir> is not specified then extract to the current directory
+nlu.arg.tempdir=\t{0}\t<dir>\tUse <dir> for extracting temporary data
+nlu.arg.cpa=\t{0} <cp>\tAppend classpath with <cp>
+nlu.arg.cpp=\t{0} <cp>\tPrepend classpath with <cp>
+nlu.arg.locale=\t{0}\t<locale>\tOverride default locale with specified <locale>
+nlu.arg.silent=\t{0}\t\tRun installer silently
+nlu.arg.help=\t{0}\t\tShow this help
+
+
+nlu.java.application.name.macosx=NetBeans IDE Installer
diff --git a/launcher/unix/src/launcher.sh b/launcher/unix/src/launcher.sh
new file mode 100644
index 0000000..0db024b
--- /dev/null
+++ b/launcher/unix/src/launcher.sh
@@ -0,0 +1,1685 @@
+#!/bin/sh
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2013 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+ARG_JAVAHOME="--javahome"
+ARG_VERBOSE="--verbose"
+ARG_OUTPUT="--output"
+ARG_EXTRACT="--extract"
+ARG_JAVA_ARG_PREFIX="-J"
+ARG_TEMPDIR="--tempdir"
+ARG_CLASSPATHA="--classpath-append"
+ARG_CLASSPATHP="--classpath-prepend"
+ARG_HELP="--help"
+ARG_SILENT="--silent"
+ARG_NOSPACECHECK="--nospacecheck"
+ARG_LOCALE="--locale"
+
+USE_DEBUG_OUTPUT=0
+PERFORM_FREE_SPACE_CHECK=1
+SILENT_MODE=0
+EXTRACT_ONLY=0
+SHOW_HELP_ONLY=0
+LOCAL_OVERRIDDEN=0
+APPEND_CP=
+PREPEND_CP=
+LAUNCHER_APP_ARGUMENTS=
+LAUNCHER_JVM_ARGUMENTS=
+ERROR_OK=0
+ERROR_TEMP_DIRECTORY=2
+ERROR_TEST_JVM_FILE=3
+ERROR_JVM_NOT_FOUND=4
+ERROR_JVM_UNCOMPATIBLE=5
+ERROR_EXTRACT_ONLY=6
+ERROR_INPUTOUPUT=7
+ERROR_FREESPACE=8
+ERROR_INTEGRITY=9
+ERROR_MISSING_RESOURCES=10
+ERROR_JVM_EXTRACTION=11
+ERROR_JVM_UNPACKING=12
+ERROR_VERIFY_BUNDLED_JVM=13
+
+VERIFY_OK=1
+VERIFY_NOJAVA=2
+VERIFY_UNCOMPATIBLE=3
+
+MSG_ERROR_JVM_NOT_FOUND="nlu.jvm.notfoundmessage"
+MSG_ERROR_USER_ERROR="nlu.jvm.usererror"
+MSG_ERROR_JVM_UNCOMPATIBLE="nlu.jvm.uncompatible"
+MSG_ERROR_INTEGRITY="nlu.integrity"
+MSG_ERROR_FREESPACE="nlu.freespace"
+MSG_ERROP_MISSING_RESOURCE="nlu.missing.external.resource"
+MSG_ERROR_TMPDIR="nlu.cannot.create.tmpdir"
+
+MSG_ERROR_EXTRACT_JVM="nlu.cannot.extract.bundled.jvm"
+MSG_ERROR_UNPACK_JVM_FILE="nlu.cannot.unpack.jvm.file"
+MSG_ERROR_VERIFY_BUNDLED_JVM="nlu.error.verify.bundled.jvm"
+
+MSG_RUNNING="nlu.running"
+MSG_STARTING="nlu.starting"
+MSG_EXTRACTING="nlu.extracting"
+MSG_PREPARE_JVM="nlu.prepare.jvm"
+MSG_JVM_SEARCH="nlu.jvm.search"
+MSG_ARG_JAVAHOME="nlu.arg.javahome"
+MSG_ARG_VERBOSE="nlu.arg.verbose"
+MSG_ARG_OUTPUT="nlu.arg.output"
+MSG_ARG_EXTRACT="nlu.arg.extract"
+MSG_ARG_TEMPDIR="nlu.arg.tempdir"
+MSG_ARG_CPA="nlu.arg.cpa"
+MSG_ARG_CPP="nlu.arg.cpp"
+MSG_ARG_DISABLE_FREE_SPACE_CHECK="nlu.arg.disable.space.check"
+MSG_ARG_LOCALE="nlu.arg.locale"
+MSG_ARG_SILENT="nlu.arg.silent"
+MSG_ARG_HELP="nlu.arg.help"
+MSG_USAGE="nlu.msg.usage"
+
+isSymlink=
+
+entryPoint() {
+ initSymlinkArgument
+ CURRENT_DIRECTORY=`pwd`
+ LAUNCHER_NAME=`echo $0`
+ parseCommandLineArguments "$@"
+ initializeVariables
+ setLauncherLocale
+ debugLauncherArguments "$@"
+ if [ 1 -eq $SHOW_HELP_ONLY ] ; then
+ showHelp
+ fi
+
+ message "$MSG_STARTING"
+ createTempDirectory
+ checkFreeSpace "$TOTAL_BUNDLED_FILES_SIZE" "$LAUNCHER_EXTRACT_DIR"
+
+ extractJVMData
+ if [ 0 -eq $EXTRACT_ONLY ] ; then
+ searchJava
+ fi
+
+ extractBundledData
+ verifyIntegrity
+
+ if [ 0 -eq $EXTRACT_ONLY ] ; then
+ executeMainClass
+ else
+ exitProgram $ERROR_OK
+ fi
+}
+
+initSymlinkArgument() {
+ testSymlinkErr=`test -L / 2>&1 > /dev/null`
+ if [ -z "$testSymlinkErr" ] ; then
+ isSymlink=-L
+ else
+ isSymlink=-h
+ fi
+}
+
+debugLauncherArguments() {
+ debug "Launcher Command : $0"
+ argCounter=1
+ while [ $# != 0 ] ; do
+ debug "... argument [$argCounter] = $1"
+ argCounter=`expr "$argCounter" + 1`
+ shift
+ done
+}
+isLauncherCommandArgument() {
+ case "$1" in
+ $ARG_VERBOSE | $ARG_NOSPACECHECK | $ARG_OUTPUT | $ARG_HELP | $ARG_JAVAHOME | $ARG_TEMPDIR | $ARG_EXTRACT | $ARG_SILENT | $ARG_LOCALE | $ARG_CLASSPATHP | $ARG_CLASSPATHA)
+ echo 1
+ ;;
+ *)
+ echo 0
+ ;;
+ esac
+}
+
+parseCommandLineArguments() {
+ while [ $# != 0 ]
+ do
+ case "$1" in
+ $ARG_VERBOSE)
+ USE_DEBUG_OUTPUT=1;;
+ $ARG_NOSPACECHECK)
+ PERFORM_FREE_SPACE_CHECK=0
+ parseJvmAppArgument "$1"
+ ;;
+ $ARG_OUTPUT)
+ if [ -n "$2" ] ; then
+ OUTPUT_FILE="$2"
+ if [ -f "$OUTPUT_FILE" ] ; then
+ # clear output file first
+ rm -f "$OUTPUT_FILE" > /dev/null 2>&1
+ touch "$OUTPUT_FILE"
+ fi
+ shift
+ fi
+ ;;
+ $ARG_HELP)
+ SHOW_HELP_ONLY=1
+ ;;
+ $ARG_JAVAHOME)
+ if [ -n "$2" ] ; then
+ LAUNCHER_JAVA="$2"
+ shift
+ fi
+ ;;
+ $ARG_TEMPDIR)
+ if [ -n "$2" ] ; then
+ LAUNCHER_JVM_TEMP_DIR="$2"
+ shift
+ fi
+ ;;
+ $ARG_EXTRACT)
+ EXTRACT_ONLY=1
+ if [ -n "$2" ] && [ `isLauncherCommandArgument "$2"` -eq 0 ] ; then
+ LAUNCHER_EXTRACT_DIR="$2"
+ shift
+ else
+ LAUNCHER_EXTRACT_DIR="$CURRENT_DIRECTORY"
+ fi
+ ;;
+ $ARG_SILENT)
+ SILENT_MODE=1
+ parseJvmAppArgument "$1"
+ ;;
+ $ARG_LOCALE)
+ SYSTEM_LOCALE="$2"
+ LOCAL_OVERRIDDEN=1
+ parseJvmAppArgument "$1"
+ ;;
+ $ARG_CLASSPATHP)
+ if [ -n "$2" ] ; then
+ if [ -z "$PREPEND_CP" ] ; then
+ PREPEND_CP="$2"
+ else
+ PREPEND_CP="$2":"$PREPEND_CP"
+ fi
+ shift
+ fi
+ ;;
+ $ARG_CLASSPATHA)
+ if [ -n "$2" ] ; then
+ if [ -z "$APPEND_CP" ] ; then
+ APPEND_CP="$2"
+ else
+ APPEND_CP="$APPEND_CP":"$2"
+ fi
+ shift
+ fi
+ ;;
+
+ *)
+ parseJvmAppArgument "$1"
+ esac
+ shift
+ done
+}
+
+setLauncherLocale() {
+ if [ 0 -eq $LOCAL_OVERRIDDEN ] ; then
+ SYSTEM_LOCALE="$LANG"
+ debug "Setting initial launcher locale from the system : $SYSTEM_LOCALE"
+ else
+ debug "Setting initial launcher locale using command-line argument : $SYSTEM_LOCALE"
+ fi
+
+ LAUNCHER_LOCALE="$SYSTEM_LOCALE"
+
+ if [ -n "$LAUNCHER_LOCALE" ] ; then
+ # check if $LAUNCHER_LOCALE is in UTF-8
+ if [ 0 -eq $LOCAL_OVERRIDDEN ] ; then
+ removeUTFsuffix=`echo "$LAUNCHER_LOCALE" | sed "s/\.UTF-8//"`
+ isUTF=`ifEquals "$removeUTFsuffix" "$LAUNCHER_LOCALE"`
+ if [ 1 -eq $isUTF ] ; then
+ #set launcher locale to the default if the system locale name doesn`t containt UTF-8
+ LAUNCHER_LOCALE=""
+ fi
+ fi
+
+ localeChanged=0
+ localeCounter=0
+ while [ $localeCounter -lt $LAUNCHER_LOCALES_NUMBER ] ; do
+ localeVar="$""LAUNCHER_LOCALE_NAME_$localeCounter"
+ arg=`eval "echo \"$localeVar\""`
+ if [ -n "$arg" ] ; then
+ # if not a default locale
+ # $comp length shows the difference between $SYSTEM_LOCALE and $arg
+ # the less the length the less the difference and more coincedence
+
+ comp=`echo "$SYSTEM_LOCALE" | sed -e "s/^${arg}//"`
+ length1=`getStringLength "$comp"`
+ length2=`getStringLength "$LAUNCHER_LOCALE"`
+ if [ $length1 -lt $length2 ] ; then
+ # more coincidence between $SYSTEM_LOCALE and $arg than between $SYSTEM_LOCALE and $arg
+ compare=`ifLess "$comp" "$LAUNCHER_LOCALE"`
+
+ if [ 1 -eq $compare ] ; then
+ LAUNCHER_LOCALE="$arg"
+ localeChanged=1
+ debug "... setting locale to $arg"
+ fi
+ if [ -z "$comp" ] ; then
+ # means that $SYSTEM_LOCALE equals to $arg
+ break
+ fi
+ fi
+ else
+ comp="$SYSTEM_LOCALE"
+ fi
+ localeCounter=`expr "$localeCounter" + 1`
+ done
+ if [ $localeChanged -eq 0 ] ; then
+ #set default
+ LAUNCHER_LOCALE=""
+ fi
+ fi
+
+
+ debug "Final Launcher Locale : $LAUNCHER_LOCALE"
+}
+
+escapeBackslash() {
+ echo "$1" | sed "s/\\\/\\\\\\\/g"
+}
+
+ifLess() {
+ arg1=`escapeBackslash "$1"`
+ arg2=`escapeBackslash "$2"`
+ compare=`awk 'END { if ( a < b ) { print 1 } else { print 0 } }' a="$arg1" b="$arg2" < /dev/null`
+ echo $compare
+}
+
+formatVersion() {
+ formatted=`echo "$1" | sed "s/-ea//g;s/-rc[0-9]*//g;s/-beta[0-9]*//g;s/-preview[0-9]*//g;s/-dp[0-9]*//g;s/-alpha[0-9]*//g;s/-fcs//g;s/_/./g;s/-/\./g"`
+ formatted=`echo "$formatted" | sed "s/^\(\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\)\.b\([0-9][0-9]*\)/\1\.0\.\5/g"`
+ formatted=`echo "$formatted" | sed "s/\.b\([0-9][0-9]*\)/\.\1/g"`
+ echo "$formatted"
+
+}
+
+compareVersions() {
+ current1=`formatVersion "$1"`
+ current2=`formatVersion "$2"`
+ compresult=
+ #0 - equals
+ #-1 - less
+ #1 - more
+
+ while [ -z "$compresult" ] ; do
+ value1=`echo "$current1" | sed "s/\..*//g"`
+ value2=`echo "$current2" | sed "s/\..*//g"`
+
+
+ removeDots1=`echo "$current1" | sed "s/\.//g"`
+ removeDots2=`echo "$current2" | sed "s/\.//g"`
+
+ if [ 1 -eq `ifEquals "$current1" "$removeDots1"` ] ; then
+ remainder1=""
+ else
+ remainder1=`echo "$current1" | sed "s/^$value1\.//g"`
+ fi
+ if [ 1 -eq `ifEquals "$current2" "$removeDots2"` ] ; then
+ remainder2=""
+ else
+ remainder2=`echo "$current2" | sed "s/^$value2\.//g"`
+ fi
+
+ current1="$remainder1"
+ current2="$remainder2"
+
+ if [ -z "$value1" ] || [ 0 -eq `ifNumber "$value1"` ] ; then
+ value1=0
+ fi
+ if [ -z "$value2" ] || [ 0 -eq `ifNumber "$value2"` ] ; then
+ value2=0
+ fi
+ if [ "$value1" -gt "$value2" ] ; then
+ compresult=1
+ break
+ elif [ "$value2" -gt "$value1" ] ; then
+ compresult=-1
+ break
+ fi
+
+ if [ -z "$current1" ] && [ -z "$current2" ] ; then
+ compresult=0
+ break
+ fi
+ done
+ echo $compresult
+}
+
+ifVersionLess() {
+ compareResult=`compareVersions "$1" "$2"`
+ if [ -1 -eq $compareResult ] ; then
+ echo 1
+ else
+ echo 0
+ fi
+}
+
+ifVersionGreater() {
+ compareResult=`compareVersions "$1" "$2"`
+ if [ 1 -eq $compareResult ] ; then
+ echo 1
+ else
+ echo 0
+ fi
+}
+
+ifGreater() {
+ arg1=`escapeBackslash "$1"`
+ arg2=`escapeBackslash "$2"`
+
+ compare=`awk 'END { if ( a > b ) { print 1 } else { print 0 } }' a="$arg1" b="$arg2" < /dev/null`
+ echo $compare
+}
+
+ifEquals() {
+ arg1=`escapeBackslash "$1"`
+ arg2=`escapeBackslash "$2"`
+
+ compare=`awk 'END { if ( a == b ) { print 1 } else { print 0 } }' a="$arg1" b="$arg2" < /dev/null`
+ echo $compare
+}
+
+ifNumber()
+{
+ result=0
+ if [ -n "$1" ] ; then
+ num=`echo "$1" | sed 's/[0-9]*//g' 2>/dev/null`
+ if [ -z "$num" ] ; then
+ result=1
+ fi
+ fi
+ echo $result
+}
+getStringLength() {
+ strlength=`awk 'END{ print length(a) }' a="$1" < /dev/null`
+ echo $strlength
+}
+
+resolveRelativity() {
+ if [ 1 -eq `ifPathRelative "$1"` ] ; then
+ echo "$CURRENT_DIRECTORY"/"$1" | sed 's/\"//g' 2>/dev/null
+ else
+ echo "$1"
+ fi
+}
+
+ifPathRelative() {
+ param="$1"
+ removeRoot=`echo "$param" | sed "s/^\\\///" 2>/dev/null`
+ echo `ifEquals "$param" "$removeRoot"` 2>/dev/null
+}
+
+
+initializeVariables() {
+ debug "Launcher name is $LAUNCHER_NAME"
+ systemName=`uname`
+ debug "System name is $systemName"
+ isMacOSX=`ifEquals "$systemName" "Darwin"`
+ isSolaris=`ifEquals "$systemName" "SunOS"`
+ if [ 1 -eq $isSolaris ] ; then
+ POSSIBLE_JAVA_EXE_SUFFIX="$POSSIBLE_JAVA_EXE_SUFFIX_SOLARIS"
+ else
+ POSSIBLE_JAVA_EXE_SUFFIX="$POSSIBLE_JAVA_EXE_SUFFIX_COMMON"
+ fi
+ if [ 1 -eq $isMacOSX ] ; then
+ # set default userdir and cachedir on MacOS
+ DEFAULT_USERDIR_ROOT="${HOME}/Library/Application Support/NetBeans"
+ DEFAULT_CACHEDIR_ROOT="${HOME}/Library/Caches/NetBeans"
+ else
+ # set default userdir and cachedir on unix systems
+ DEFAULT_USERDIR_ROOT=${HOME}/.netbeans
+ DEFAULT_CACHEDIR_ROOT=${HOME}/.cache/netbeans
+ fi
+ systemInfo=`uname -a 2>/dev/null`
+ debug "System Information:"
+ debug "$systemInfo"
+ debug ""
+ DEFAULT_DISK_BLOCK_SIZE=512
+ LAUNCHER_TRACKING_SIZE=$LAUNCHER_STUB_SIZE
+ LAUNCHER_TRACKING_SIZE_BYTES=`expr "$LAUNCHER_STUB_SIZE" \* "$FILE_BLOCK_SIZE"`
+ getLauncherLocation
+}
+
+parseJvmAppArgument() {
+ param="$1"
+ arg=`echo "$param" | sed "s/^-J//"`
+ argEscaped=`escapeString "$arg"`
+
+ if [ "$param" = "$arg" ] ; then
+ LAUNCHER_APP_ARGUMENTS="$LAUNCHER_APP_ARGUMENTS $argEscaped"
+ else
+ LAUNCHER_JVM_ARGUMENTS="$LAUNCHER_JVM_ARGUMENTS $argEscaped"
+ fi
+}
+
+getLauncherLocation() {
+ # if file path is relative then prepend it with current directory
+ LAUNCHER_FULL_PATH=`resolveRelativity "$LAUNCHER_NAME"`
+ debug "... normalizing full path"
+ LAUNCHER_FULL_PATH=`normalizePath "$LAUNCHER_FULL_PATH"`
+ debug "... getting dirname"
+ LAUNCHER_DIR=`dirname "$LAUNCHER_FULL_PATH"`
+ debug "Full launcher path = $LAUNCHER_FULL_PATH"
+ debug "Launcher directory = $LAUNCHER_DIR"
+}
+
+getLauncherSize() {
+ lsOutput=`ls -l --block-size=1 "$LAUNCHER_FULL_PATH" 2>/dev/null`
+ if [ $? -ne 0 ] ; then
+ #default block size
+ lsOutput=`ls -l "$LAUNCHER_FULL_PATH" 2>/dev/null`
+ fi
+ echo "$lsOutput" | awk ' { print $5 }' 2>/dev/null
+}
+
+verifyIntegrity() {
+ size=`getLauncherSize`
+ extractedSize=$LAUNCHER_TRACKING_SIZE_BYTES
+ if [ 1 -eq `ifNumber "$size"` ] ; then
+ debug "... check integrity"
+ debug "... minimal size : $extractedSize"
+ debug "... real size : $size"
+
+ if [ $size -lt $extractedSize ] ; then
+ debug "... integration check FAILED"
+ message "$MSG_ERROR_INTEGRITY" `normalizePath "$LAUNCHER_FULL_PATH"`
+ exitProgram $ERROR_INTEGRITY
+ fi
+ debug "... integration check OK"
+ fi
+}
+showHelp() {
+ msg0=`message "$MSG_USAGE"`
+ msg1=`message "$MSG_ARG_JAVAHOME $ARG_JAVAHOME"`
+ msg2=`message "$MSG_ARG_TEMPDIR $ARG_TEMPDIR"`
+ msg3=`message "$MSG_ARG_EXTRACT $ARG_EXTRACT"`
+ msg4=`message "$MSG_ARG_OUTPUT $ARG_OUTPUT"`
+ msg5=`message "$MSG_ARG_VERBOSE $ARG_VERBOSE"`
+ msg6=`message "$MSG_ARG_CPA $ARG_CLASSPATHA"`
+ msg7=`message "$MSG_ARG_CPP $ARG_CLASSPATHP"`
+ msg8=`message "$MSG_ARG_DISABLE_FREE_SPACE_CHECK $ARG_NOSPACECHECK"`
+ msg9=`message "$MSG_ARG_LOCALE $ARG_LOCALE"`
+ msg10=`message "$MSG_ARG_SILENT $ARG_SILENT"`
+ msg11=`message "$MSG_ARG_HELP $ARG_HELP"`
+ out "$msg0"
+ out "$msg1"
+ out "$msg2"
+ out "$msg3"
+ out "$msg4"
+ out "$msg5"
+ out "$msg6"
+ out "$msg7"
+ out "$msg8"
+ out "$msg9"
+ out "$msg10"
+ out "$msg11"
+ exitProgram $ERROR_OK
+}
+
+exitProgram() {
+ if [ 0 -eq $EXTRACT_ONLY ] ; then
+ if [ -n "$LAUNCHER_EXTRACT_DIR" ] && [ -d "$LAUNCHER_EXTRACT_DIR" ]; then
+ debug "Removing directory $LAUNCHER_EXTRACT_DIR"
+ rm -rf "$LAUNCHER_EXTRACT_DIR" > /dev/null 2>&1
+ fi
+ fi
+ debug "exitCode = $1"
+ exit $1
+}
+
+debug() {
+ if [ $USE_DEBUG_OUTPUT -eq 1 ] ; then
+ timestamp=`date '+%Y-%m-%d %H:%M:%S'`
+ out "[$timestamp]> $1"
+ fi
+}
+
+out() {
+
+ if [ -n "$OUTPUT_FILE" ] ; then
+ printf "%s\n" "$@" >> "$OUTPUT_FILE"
+ elif [ 0 -eq $SILENT_MODE ] ; then
+ printf "%s\n" "$@"
+ fi
+}
+
+message() {
+ msg=`getMessage "$@"`
+ out "$msg"
+}
+
+
+createTempDirectory() {
+ if [ 0 -eq $EXTRACT_ONLY ] ; then
+ if [ -z "$LAUNCHER_JVM_TEMP_DIR" ] ; then
+ if [ 0 -eq $EXTRACT_ONLY ] ; then
+ if [ -n "$TEMP" ] && [ -d "$TEMP" ] ; then
+ debug "TEMP var is used : $TEMP"
+ LAUNCHER_JVM_TEMP_DIR="$TEMP"
+ elif [ -n "$TMP" ] && [ -d "$TMP" ] ; then
+ debug "TMP var is used : $TMP"
+ LAUNCHER_JVM_TEMP_DIR="$TMP"
+ elif [ -n "$TEMPDIR" ] && [ -d "$TEMPDIR" ] ; then
+ debug "TEMPDIR var is used : $TEMPDIR"
+ LAUNCHER_JVM_TEMP_DIR="$TEMPDIR"
+ elif [ -d "/tmp" ] ; then
+ debug "Using /tmp for temp"
+ LAUNCHER_JVM_TEMP_DIR="/tmp"
+ else
+ debug "Using home dir for temp"
+ LAUNCHER_JVM_TEMP_DIR="$HOME"
+ fi
+ else
+ #extract only : to the curdir
+ LAUNCHER_JVM_TEMP_DIR="$CURRENT_DIRECTORY"
+ fi
+ fi
+ # if temp dir does not exist then try to create it
+ if [ ! -d "$LAUNCHER_JVM_TEMP_DIR" ] ; then
+ mkdir -p "$LAUNCHER_JVM_TEMP_DIR" > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ message "$MSG_ERROR_TMPDIR" "$LAUNCHER_JVM_TEMP_DIR"
+ exitProgram $ERROR_TEMP_DIRECTORY
+ fi
+ fi
+ debug "Launcher TEMP ROOT = $LAUNCHER_JVM_TEMP_DIR"
+ subDir=`date '+%u%m%M%S'`
+ subDir=`echo ".nbi-$subDir.tmp"`
+ LAUNCHER_EXTRACT_DIR="$LAUNCHER_JVM_TEMP_DIR/$subDir"
+ else
+ #extracting to the $LAUNCHER_EXTRACT_DIR
+ debug "Launcher Extracting ROOT = $LAUNCHER_EXTRACT_DIR"
+ fi
+
+ if [ ! -d "$LAUNCHER_EXTRACT_DIR" ] ; then
+ mkdir -p "$LAUNCHER_EXTRACT_DIR" > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ message "$MSG_ERROR_TMPDIR" "$LAUNCHER_EXTRACT_DIR"
+ exitProgram $ERROR_TEMP_DIRECTORY
+ fi
+ else
+ debug "$LAUNCHER_EXTRACT_DIR is directory and exist"
+ fi
+ debug "Using directory $LAUNCHER_EXTRACT_DIR for extracting data"
+}
+extractJVMData() {
+ debug "Extracting testJVM file data..."
+ extractTestJVMFile
+ debug "Extracting bundled JVMs ..."
+ extractJVMFiles
+ debug "Extracting JVM data done"
+}
+extractBundledData() {
+ message "$MSG_EXTRACTING"
+ debug "Extracting bundled jars data..."
+ extractJars
+ debug "Extracting other data..."
+ extractOtherData
+ debug "Extracting bundled data finished..."
+}
+
+setTestJVMClasspath() {
+ testjvmname=`basename "$TEST_JVM_PATH"`
+ removeClassSuffix=`echo "$testjvmname" | sed 's/\.class$//'`
+ notClassFile=`ifEquals "$testjvmname" "$removeClassSuffix"`
+
+ if [ -d "$TEST_JVM_PATH" ] ; then
+ TEST_JVM_CLASSPATH="$TEST_JVM_PATH"
+ debug "... testJVM path is a directory"
+ elif [ $isSymlink "$TEST_JVM_PATH" ] && [ $notClassFile -eq 1 ] ; then
+ TEST_JVM_CLASSPATH="$TEST_JVM_PATH"
+ debug "... testJVM path is a link but not a .class file"
+ else
+ if [ $notClassFile -eq 1 ] ; then
+ debug "... testJVM path is a jar/zip file"
+ TEST_JVM_CLASSPATH="$TEST_JVM_PATH"
+ else
+ debug "... testJVM path is a .class file"
+ TEST_JVM_CLASSPATH=`dirname "$TEST_JVM_PATH"`
+ fi
+ fi
+ debug "... testJVM classpath is : $TEST_JVM_CLASSPATH"
+}
+
+extractTestJVMFile() {
+ TEST_JVM_PATH=`resolveResourcePath "TEST_JVM_FILE"`
+ extractResource "TEST_JVM_FILE"
+ setTestJVMClasspath
+
+}
+
+installJVM() {
+ message "$MSG_PREPARE_JVM"
+ jvmFile=`resolveRelativity "$1"`
+ jvmDir=`dirname "$jvmFile"`/_jvm
+ debug "JVM Directory : $jvmDir"
+ mkdir "$jvmDir" > /dev/null 2>&1
+ if [ $? != 0 ] ; then
+ message "$MSG_ERROR_EXTRACT_JVM"
+ exitProgram $ERROR_JVM_EXTRACTION
+ fi
+ chmod +x "$jvmFile" > /dev/null 2>&1
+ jvmFileEscaped=`escapeString "$jvmFile"`
+ jvmDirEscaped=`escapeString "$jvmDir"`
+ cd "$jvmDir"
+ runCommand "$jvmFileEscaped"
+ ERROR_CODE=$?
+
+ cd "$CURRENT_DIRECTORY"
+
+ if [ $ERROR_CODE != 0 ] ; then
+ message "$MSG_ERROR_EXTRACT_JVM"
+ exitProgram $ERROR_JVM_EXTRACTION
+ fi
+
+ files=`find "$jvmDir" -name "*.jar.pack.gz" -print`
+ debug "Packed files : $files"
+ f="$files"
+ fileCounter=1;
+ while [ -n "$f" ] ; do
+ f=`echo "$files" | sed -n "${fileCounter}p" 2>/dev/null`
+ debug "... next file is $f"
+ if [ -n "$f" ] ; then
+ debug "... packed file = $f"
+ unpacked=`echo "$f" | sed s/\.pack\.gz//`
+ debug "... unpacked file = $unpacked"
+ fEsc=`escapeString "$f"`
+ uEsc=`escapeString "$unpacked"`
+ cmd="$jvmDirEscaped/bin/unpack200 -r $fEsc $uEsc"
+ runCommand "$cmd"
+ if [ $? != 0 ] ; then
+ message "$MSG_ERROR_UNPACK_JVM_FILE" "$f"
+ exitProgram $ERROR_JVM_UNPACKING
+ fi
+ fi
+ fileCounter=`expr "$fileCounter" + 1`
+ done
+
+ verifyJVM "$jvmDir"
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ message "$MSG_ERROR_VERIFY_BUNDLED_JVM"
+ exitProgram $ERROR_VERIFY_BUNDLED_JVM
+ fi
+}
+
+resolveResourcePath() {
+ resourcePrefix="$1"
+ resourceVar="$""$resourcePrefix""_PATH"
+ resourceName=`eval "echo \"$resourceVar\""`
+ resourcePath=`resolveString "$resourceName"`
+ echo "$resourcePath"
+
+}
+
+resolveResourceSize() {
+ resourcePrefix="$1"
+ resourceVar="$""$resourcePrefix""_SIZE"
+ resourceSize=`eval "echo \"$resourceVar\""`
+ echo "$resourceSize"
+}
+
+resolveResourceMd5() {
+ resourcePrefix="$1"
+ resourceVar="$""$resourcePrefix""_MD5"
+ resourceMd5=`eval "echo \"$resourceVar\""`
+ echo "$resourceMd5"
+}
+
+resolveResourceType() {
+ resourcePrefix="$1"
+ resourceVar="$""$resourcePrefix""_TYPE"
+ resourceType=`eval "echo \"$resourceVar\""`
+ echo "$resourceType"
+}
+
+extractResource() {
+ debug "... extracting resource"
+ resourcePrefix="$1"
+ debug "... resource prefix id=$resourcePrefix"
+ resourceType=`resolveResourceType "$resourcePrefix"`
+ debug "... resource type=$resourceType"
+ if [ $resourceType -eq 0 ] ; then
+ resourceSize=`resolveResourceSize "$resourcePrefix"`
+ debug "... resource size=$resourceSize"
+ resourcePath=`resolveResourcePath "$resourcePrefix"`
+ debug "... resource path=$resourcePath"
+ extractFile "$resourceSize" "$resourcePath"
+ resourceMd5=`resolveResourceMd5 "$resourcePrefix"`
+ debug "... resource md5=$resourceMd5"
+ checkMd5 "$resourcePath" "$resourceMd5"
+ debug "... done"
+ fi
+ debug "... extracting resource finished"
+
+}
+
+extractJars() {
+ counter=0
+ while [ $counter -lt $JARS_NUMBER ] ; do
+ extractResource "JAR_$counter"
+ counter=`expr "$counter" + 1`
+ done
+}
+
+extractOtherData() {
+ counter=0
+ while [ $counter -lt $OTHER_RESOURCES_NUMBER ] ; do
+ extractResource "OTHER_RESOURCE_$counter"
+ counter=`expr "$counter" + 1`
+ done
+}
+
+extractJVMFiles() {
+ javaCounter=0
+ debug "... total number of JVM files : $JAVA_LOCATION_NUMBER"
+ while [ $javaCounter -lt $JAVA_LOCATION_NUMBER ] ; do
+ extractResource "JAVA_LOCATION_$javaCounter"
+ javaCounter=`expr "$javaCounter" + 1`
+ done
+}
+
+
+processJarsClasspath() {
+ JARS_CLASSPATH=""
+ jarsCounter=0
+ while [ $jarsCounter -lt $JARS_NUMBER ] ; do
+ resolvedFile=`resolveResourcePath "JAR_$jarsCounter"`
+ debug "... adding jar to classpath : $resolvedFile"
+ if [ ! -f "$resolvedFile" ] && [ ! -d "$resolvedFile" ] && [ ! $isSymlink "$resolvedFile" ] ; then
+ message "$MSG_ERROP_MISSING_RESOURCE" "$resolvedFile"
+ exitProgram $ERROR_MISSING_RESOURCES
+ else
+ if [ -z "$JARS_CLASSPATH" ] ; then
+ JARS_CLASSPATH="$resolvedFile"
+ else
+ JARS_CLASSPATH="$JARS_CLASSPATH":"$resolvedFile"
+ fi
+ fi
+
+ jarsCounter=`expr "$jarsCounter" + 1`
+ done
+ debug "Jars classpath : $JARS_CLASSPATH"
+}
+
+extractFile() {
+ start=$LAUNCHER_TRACKING_SIZE
+ size=$1 #absolute size
+ name="$2" #relative part
+ fullBlocks=`expr $size / $FILE_BLOCK_SIZE`
+ fullBlocksSize=`expr "$FILE_BLOCK_SIZE" \* "$fullBlocks"`
+ oneBlocks=`expr $size - $fullBlocksSize`
+ oneBlocksStart=`expr "$start" + "$fullBlocks"`
+
+ checkFreeSpace $size "$name"
+ LAUNCHER_TRACKING_SIZE_BYTES=`expr "$LAUNCHER_TRACKING_SIZE" \* "$FILE_BLOCK_SIZE"`
+
+ if [ 0 -eq $diskSpaceCheck ] ; then
+ dir=`dirname "$name"`
+ message "$MSG_ERROR_FREESPACE" "$size" "$ARG_TEMPDIR"
+ exitProgram $ERROR_FREESPACE
+ fi
+
+ if [ 0 -lt "$fullBlocks" ] ; then
+ # file is larger than FILE_BLOCK_SIZE
+ dd if="$LAUNCHER_FULL_PATH" of="$name" \
+ bs="$FILE_BLOCK_SIZE" count="$fullBlocks" skip="$start"\
+ > /dev/null 2>&1
+ LAUNCHER_TRACKING_SIZE=`expr "$LAUNCHER_TRACKING_SIZE" + "$fullBlocks"`
+ LAUNCHER_TRACKING_SIZE_BYTES=`expr "$LAUNCHER_TRACKING_SIZE" \* "$FILE_BLOCK_SIZE"`
+ fi
+ if [ 0 -lt "$oneBlocks" ] ; then
+ dd if="$LAUNCHER_FULL_PATH" of="$name.tmp.tmp" bs="$FILE_BLOCK_SIZE" count=1\
+ skip="$oneBlocksStart"\
+ > /dev/null 2>&1
+
+ dd if="$name.tmp.tmp" of="$name" bs=1 count="$oneBlocks" seek="$fullBlocksSize"\
+ > /dev/null 2>&1
+
+ rm -f "$name.tmp.tmp"
+ LAUNCHER_TRACKING_SIZE=`expr "$LAUNCHER_TRACKING_SIZE" + 1`
+
+ LAUNCHER_TRACKING_SIZE_BYTES=`expr "$LAUNCHER_TRACKING_SIZE_BYTES" + "$oneBlocks"`
+ fi
+}
+
+md5_program=""
+no_md5_program_id="no_md5_program"
+
+initMD5program() {
+ if [ -z "$md5_program" ] ; then
+ type digest >> /dev/null 2>&1
+ if [ 0 -eq $? ] ; then
+ md5_program="digest -a md5"
+ else
+ type md5sum >> /dev/null 2>&1
+ if [ 0 -eq $? ] ; then
+ md5_program="md5sum"
+ else
+ type gmd5sum >> /dev/null 2>&1
+ if [ 0 -eq $? ] ; then
+ md5_program="gmd5sum"
+ else
+ type md5 >> /dev/null 2>&1
+ if [ 0 -eq $? ] ; then
+ md5_program="md5 -q"
+ else
+ md5_program="$no_md5_program_id"
+ fi
+ fi
+ fi
+ fi
+ debug "... program to check: $md5_program"
+ fi
+}
+
+checkMd5() {
+ name="$1"
+ md5="$2"
+ if [ 32 -eq `getStringLength "$md5"` ] ; then
+ #do MD5 check
+ initMD5program
+ if [ 0 -eq `ifEquals "$md5_program" "$no_md5_program_id"` ] ; then
+ debug "... check MD5 of file : $name"
+ debug "... expected md5: $md5"
+ realmd5=`$md5_program "$name" 2>/dev/null | sed "s/ .*//g"`
+ debug "... real md5 : $realmd5"
+ if [ 32 -eq `getStringLength "$realmd5"` ] ; then
+ if [ 0 -eq `ifEquals "$md5" "$realmd5"` ] ; then
+ debug "... integration check FAILED"
+ message "$MSG_ERROR_INTEGRITY" `normalizePath "$LAUNCHER_FULL_PATH"`
+ exitProgram $ERROR_INTEGRITY
+ fi
+ else
+ debug "... looks like not the MD5 sum"
+ fi
+ fi
+ fi
+}
+searchJavaEnvironment() {
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ # search java in the environment
+
+ ptr="$POSSIBLE_JAVA_ENV"
+ while [ -n "$ptr" ] && [ -z "$LAUNCHER_JAVA_EXE" ] ; do
+ argJavaHome=`echo "$ptr" | sed "s/:.*//"`
+ back=`echo "$argJavaHome" | sed "s/\\\//\\\\\\\\\//g"`
+ end=`echo "$ptr" | sed "s/${back}://"`
+ argJavaHome=`echo "$back" | sed "s/\\\\\\\\\//\\\//g"`
+ ptr="$end"
+ eval evaluated=`echo \\$$argJavaHome` > /dev/null
+ if [ -n "$evaluated" ] ; then
+ debug "EnvVar $argJavaHome=$evaluated"
+ verifyJVM "$evaluated"
+ fi
+ done
+ fi
+}
+
+installBundledJVMs() {
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ # search bundled java in the common list
+ javaCounter=0
+ while [ $javaCounter -lt $JAVA_LOCATION_NUMBER ] && [ -z "$LAUNCHER_JAVA_EXE" ] ; do
+ fileType=`resolveResourceType "JAVA_LOCATION_$javaCounter"`
+
+ if [ $fileType -eq 0 ] ; then # bundled->install
+ argJavaHome=`resolveResourcePath "JAVA_LOCATION_$javaCounter"`
+ installJVM "$argJavaHome"
+ fi
+ javaCounter=`expr "$javaCounter" + 1`
+ done
+ fi
+}
+
+searchJavaOnMacOs() {
+ if [ -x "/usr/libexec/java_home" ]; then
+ javaOnMacHome=`/usr/libexec/java_home --version 1.8+ --failfast`
+ fi
+
+ if [ ! -x "$javaOnMacHome/bin/java" -a -f "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" ] ; then
+ javaOnMacHome=`echo "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"`
+ fi
+
+ verifyJVM "$javaOnMacHome"
+}
+
+searchJavaSystemDefault() {
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ debug "... check default java in the path"
+ java_bin=`which java 2>&1`
+ if [ $? -eq 0 ] && [ -n "$java_bin" ] ; then
+ remove_no_java_in=`echo "$java_bin" | sed "s/no java in//g"`
+ if [ 1 -eq `ifEquals "$remove_no_java_in" "$java_bin"` ] && [ -f "$java_bin" ] ; then
+ debug "... java in path found: $java_bin"
+ # java is in path
+ java_bin=`resolveSymlink "$java_bin"`
+ debug "... java real path: $java_bin"
+ parentDir=`dirname "$java_bin"`
+ if [ -n "$parentDir" ] ; then
+ parentDir=`dirname "$parentDir"`
+ if [ -n "$parentDir" ] ; then
+ debug "... java home path: $parentDir"
+ parentDir=`resolveSymlink "$parentDir"`
+ debug "... java home real path: $parentDir"
+ verifyJVM "$parentDir"
+ fi
+ fi
+ fi
+ fi
+ fi
+}
+
+searchJavaSystemPaths() {
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ # search java in the common system paths
+ javaCounter=0
+ while [ $javaCounter -lt $JAVA_LOCATION_NUMBER ] && [ -z "$LAUNCHER_JAVA_EXE" ] ; do
+ fileType=`resolveResourceType "JAVA_LOCATION_$javaCounter"`
+ argJavaHome=`resolveResourcePath "JAVA_LOCATION_$javaCounter"`
+
+ debug "... next location $argJavaHome"
+
+ if [ $fileType -ne 0 ] ; then # bundled JVMs have already been proceeded
+ argJavaHome=`escapeString "$argJavaHome"`
+ locations=`ls -d -1 $argJavaHome 2>/dev/null`
+ nextItem="$locations"
+ itemCounter=1
+ while [ -n "$nextItem" ] && [ -z "$LAUNCHER_JAVA_EXE" ] ; do
+ nextItem=`echo "$locations" | sed -n "${itemCounter}p" 2>/dev/null`
+ debug "... next item is $nextItem"
+ nextItem=`removeEndSlashes "$nextItem"`
+ if [ -n "$nextItem" ] ; then
+ if [ -d "$nextItem" ] || [ $isSymlink "$nextItem" ] ; then
+ debug "... checking item : $nextItem"
+ verifyJVM "$nextItem"
+ fi
+ fi
+ itemCounter=`expr "$itemCounter" + 1`
+ done
+ fi
+ javaCounter=`expr "$javaCounter" + 1`
+ done
+ fi
+}
+
+searchJavaUserDefined() {
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ if [ -n "$LAUNCHER_JAVA" ] ; then
+ verifyJVM "$LAUNCHER_JAVA"
+
+ if [ $VERIFY_UNCOMPATIBLE -eq $verifyResult ] ; then
+ message "$MSG_ERROR_JVM_UNCOMPATIBLE" "$LAUNCHER_JAVA" "$ARG_JAVAHOME"
+ exitProgram $ERROR_JVM_UNCOMPATIBLE
+ elif [ $VERIFY_NOJAVA -eq $verifyResult ] ; then
+ message "$MSG_ERROR_USER_ERROR" "$LAUNCHER_JAVA"
+ exitProgram $ERROR_JVM_NOT_FOUND
+ fi
+ fi
+ fi
+}
+
+searchJavaInstallFolder() {
+ installFolder="`dirname \"$0\"`"
+ installFolder="`( cd \"$installFolder\" && pwd )`"
+ installFolder="$installFolder/bin/jre"
+ tempJreFolder="$TEST_JVM_CLASSPATH/_jvm"
+
+ if [ -d "$installFolder" ] ; then
+ #copy nested JRE to temp folder
+ cp -r "$installFolder" "$tempJreFolder"
+
+ verifyJVM "$tempJreFolder"
+ fi
+}
+
+searchJava() {
+ message "$MSG_JVM_SEARCH"
+ if [ ! -f "$TEST_JVM_CLASSPATH" ] && [ ! $isSymlink "$TEST_JVM_CLASSPATH" ] && [ ! -d "$TEST_JVM_CLASSPATH" ]; then
+ debug "Cannot find file for testing JVM at $TEST_JVM_CLASSPATH"
+ message "$MSG_ERROR_JVM_NOT_FOUND" "$ARG_JAVAHOME"
+ exitProgram $ERROR_TEST_JVM_FILE
+ else
+ searchJavaInstallFolder
+ searchJavaUserDefined
+ installBundledJVMs
+ searchJavaEnvironment
+ searchJavaSystemDefault
+ searchJavaSystemPaths
+ if [ 1 -eq $isMacOSX ] ; then
+ searchJavaOnMacOs
+ fi
+ fi
+
+ if [ -z "$LAUNCHER_JAVA_EXE" ] ; then
+ message "$MSG_ERROR_JVM_NOT_FOUND" "$ARG_JAVAHOME"
+ exitProgram $ERROR_JVM_NOT_FOUND
+ fi
+}
+
+normalizePath() {
+ argument="$1"
+
+ # replace all /./ to /
+ while [ 0 -eq 0 ] ; do
+ testArgument=`echo "$argument" | sed 's/\/\.\//\//g' 2> /dev/null`
+ if [ -n "$testArgument" ] && [ 0 -eq `ifEquals "$argument" "$testArgument"` ] ; then
+ # something changed
+ argument="$testArgument"
+ else
+ break
+ fi
+ done
+
+ # replace XXX/../YYY to 'dirname XXX'/YYY
+ while [ 0 -eq 0 ] ; do
+ beforeDotDot=`echo "$argument" | sed "s/\/\.\.\/.*//g" 2> /dev/null`
+ if [ 0 -eq `ifEquals "$beforeDotDot" "$argument"` ] && [ 0 -eq `ifEquals "$beforeDotDot" "."` ] && [ 0 -eq `ifEquals "$beforeDotDot" ".."` ] ; then
+ esc=`echo "$beforeDotDot" | sed "s/\\\//\\\\\\\\\//g"`
+ afterDotDot=`echo "$argument" | sed "s/^$esc\/\.\.//g" 2> /dev/null`
+ parent=`dirname "$beforeDotDot"`
+ argument=`echo "$parent""$afterDotDot"`
+ else
+ break
+ fi
+ done
+
+ # replace XXX/.. to 'dirname XXX'
+ while [ 0 -eq 0 ] ; do
+ beforeDotDot=`echo "$argument" | sed "s/\/\.\.$//g" 2> /dev/null`
+ if [ 0 -eq `ifEquals "$beforeDotDot" "$argument"` ] && [ 0 -eq `ifEquals "$beforeDotDot" "."` ] && [ 0 -eq `ifEquals "$beforeDotDot" ".."` ] ; then
+ argument=`dirname "$beforeDotDot"`
+ else
+ break
+ fi
+ done
+
+ # remove /. a the end (if the resulting string is not zero)
+ testArgument=`echo "$argument" | sed 's/\/\.$//' 2> /dev/null`
+ if [ -n "$testArgument" ] ; then
+ argument="$testArgument"
+ fi
+
+ # replace more than 2 separators to 1
+ testArgument=`echo "$argument" | sed 's/\/\/*/\//g' 2> /dev/null`
+ if [ -n "$testArgument" ] ; then
+ argument="$testArgument"
+ fi
+
+ echo "$argument"
+}
+
+resolveSymlink() {
+ pathArg="$1"
+ while [ $isSymlink "$pathArg" ] ; do
+ ls=`ls -ld "$pathArg"`
+ link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
+
+ if expr "$link" : '^/' 2> /dev/null >/dev/null; then
+ pathArg="$link"
+ else
+ pathArg="`dirname "$pathArg"`"/"$link"
+ fi
+ pathArg=`normalizePath "$pathArg"`
+ done
+ echo "$pathArg"
+}
+
+verifyJVM() {
+ javaTryPath=`normalizePath "$1"`
+ verifyJavaHome "$javaTryPath"
+ if [ $VERIFY_OK -ne $verifyResult ] ; then
+ savedResult=$verifyResult
+
+ if [ 0 -eq $isMacOSX ] ; then
+ #check private jre
+ javaTryPath="$javaTryPath""/jre"
+ verifyJavaHome "$javaTryPath"
+ else
+ #check MacOSX Home dir
+ javaTryPath="$javaTryPath""/Home"
+ verifyJavaHome "$javaTryPath"
+ fi
+
+ if [ $VERIFY_NOJAVA -eq $verifyResult ] ; then
+ verifyResult=$savedResult
+ fi
+ fi
+}
+
+removeEndSlashes() {
+ arg="$1"
+ tryRemove=`echo "$arg" | sed 's/\/\/*$//' 2>/dev/null`
+ if [ -n "$tryRemove" ] ; then
+ arg="$tryRemove"
+ fi
+ echo "$arg"
+}
+
+checkJavaHierarchy() {
+ # return 0 on no java
+ # return 1 on jre
+ # return 2 on jdk
+
+ tryJava="$1"
+ javaHierarchy=0
+ if [ -n "$tryJava" ] ; then
+ if [ -d "$tryJava" ] || [ $isSymlink "$tryJava" ] ; then # existing directory or a isSymlink
+ javaBin="$tryJava"/"bin"
+
+ if [ -d "$javaBin" ] || [ $isSymlink "$javaBin" ] ; then
+ javaBinJavac="$javaBin"/"javac"
+ if [ -f "$javaBinJavac" ] || [ $isSymlink "$javaBinJavac" ] ; then
+ #definitely JDK as the JRE doesn`t contain javac
+ javaHierarchy=2
+ else
+ #check if we inside JRE
+ javaBinJava="$javaBin"/"java"
+ if [ -f "$javaBinJava" ] || [ $isSymlink "$javaBinJava" ] ; then
+ javaHierarchy=1
+ fi
+ fi
+ fi
+ fi
+ fi
+ if [ 0 -eq $javaHierarchy ] ; then
+ debug "... no java there"
+ elif [ 1 -eq $javaHierarchy ] ; then
+ debug "... JRE there"
+ elif [ 2 -eq $javaHierarchy ] ; then
+ debug "... JDK there"
+ fi
+}
+
+verifyJavaHome() {
+ verifyResult=$VERIFY_NOJAVA
+ java=`removeEndSlashes "$1"`
+ debug "... verify : $java"
+
+ java=`resolveSymlink "$java"`
+ debug "... real path : $java"
+
+ checkJavaHierarchy "$java"
+
+ if [ 0 -ne $javaHierarchy ] ; then
+ testJVMclasspath=`escapeString "$TEST_JVM_CLASSPATH"`
+ testJVMclass=`escapeString "$TEST_JVM_CLASS"`
+
+ pointer="$POSSIBLE_JAVA_EXE_SUFFIX"
+ while [ -n "$pointer" ] && [ -z "$LAUNCHER_JAVA_EXE" ]; do
+ arg=`echo "$pointer" | sed "s/:.*//"`
+ back=`echo "$arg" | sed "s/\\\//\\\\\\\\\//g"`
+ end=`echo "$pointer" | sed "s/${back}://"`
+ arg=`echo "$back" | sed "s/\\\\\\\\\//\\\//g"`
+ pointer="$end"
+ javaExe="$java/$arg"
+
+ if [ -x "$javaExe" ] ; then
+ javaExeEscaped=`escapeString "$javaExe"`
+ command="$javaExeEscaped -classpath $testJVMclasspath $testJVMclass"
+
+ debug "Executing java verification command..."
+ debug "$command"
+ output=`eval "$command" 2>/dev/null`
+ javaVersion=`echo "$output" | sed "2d;3d;4d;5d"`
+ javaVmVersion=`echo "$output" | sed "1d;3d;4d;5d"`
+ vendor=`echo "$output" | sed "1d;2d;4d;5d"`
+ osname=`echo "$output" | sed "1d;2d;3d;5d"`
+ osarch=`echo "$output" | sed "1d;2d;3d;4d"`
+
+ debug "Java :"
+ debug " executable = {$javaExe}"
+ debug " javaVersion = {$javaVersion}"
+ debug " javaVmVersion = {$javaVmVersion}"
+ debug " vendor = {$vendor}"
+ debug " osname = {$osname}"
+ debug " osarch = {$osarch}"
+ comp=0
+
+ if [ -n "$javaVersion" ] && [ -n "$javaVmVersion" ] && [ -n "$vendor" ] && [ -n "$osname" ] && [ -n "$osarch" ] ; then
+ debug "... seems to be java indeed"
+ javaVersionEsc=`escapeBackslash "$javaVersion"`
+ javaVmVersionEsc=`escapeBackslash "$javaVmVersion"`
+ javaVersion=`awk 'END { idx = index(b,a); if(idx!=0) { print substr(b,idx,length(b)) } else { print a } }' a="$javaVersionEsc" b="$javaVmVersionEsc" < /dev/null`
+
+ #remove build number
+ javaVersion=`echo "$javaVersion" | sed 's/-.*$//;s/\ .*//'`
+ verifyResult=$VERIFY_UNCOMPATIBLE
+
+ if [ -n "$javaVersion" ] ; then
+ debug " checking java version = {$javaVersion}"
+ javaCompCounter=0
+
+ while [ $javaCompCounter -lt $JAVA_COMPATIBLE_PROPERTIES_NUMBER ] && [ -z "$LAUNCHER_JAVA_EXE" ] ; do
+ comp=1
+ setJavaCompatibilityProperties_$javaCompCounter
+ debug "Min Java Version : $JAVA_COMP_VERSION_MIN"
+ debug "Max Java Version : $JAVA_COMP_VERSION_MAX"
+ debug "Java Vendor : $JAVA_COMP_VENDOR"
+ debug "Java OS Name : $JAVA_COMP_OSNAME"
+ debug "Java OS Arch : $JAVA_COMP_OSARCH"
+
+ if [ -n "$JAVA_COMP_VERSION_MIN" ] ; then
+ compMin=`ifVersionLess "$javaVersion" "$JAVA_COMP_VERSION_MIN"`
+ if [ 1 -eq $compMin ] ; then
+ comp=0
+ fi
+ fi
+
+ if [ -n "$JAVA_COMP_VERSION_MAX" ] ; then
+ compMax=`ifVersionGreater "$javaVersion" "$JAVA_COMP_VERSION_MAX"`
+ if [ 1 -eq $compMax ] ; then
+ comp=0
+ fi
+ fi
+ if [ -n "$JAVA_COMP_VENDOR" ] ; then
+ debug " checking vendor = {$vendor}, {$JAVA_COMP_VENDOR}"
+ subs=`echo "$vendor" | sed "s/${JAVA_COMP_VENDOR}//"`
+ if [ `ifEquals "$subs" "$vendor"` -eq 1 ] ; then
+ comp=0
+ debug "... vendor incompatible"
+ fi
+ fi
+
+ if [ -n "$JAVA_COMP_OSNAME" ] ; then
+ debug " checking osname = {$osname}, {$JAVA_COMP_OSNAME}"
+ subs=`echo "$osname" | sed "s/${JAVA_COMP_OSNAME}//"`
+
+ if [ `ifEquals "$subs" "$osname"` -eq 1 ] ; then
+ comp=0
+ debug "... osname incompatible"
+ fi
+ fi
+ if [ -n "$JAVA_COMP_OSARCH" ] ; then
+ debug " checking osarch = {$osarch}, {$JAVA_COMP_OSARCH}"
+ subs=`echo "$osarch" | sed "s/${JAVA_COMP_OSARCH}//"`
+
+ if [ `ifEquals "$subs" "$osarch"` -eq 1 ] ; then
+ comp=0
+ debug "... osarch incompatible"
+ fi
+ fi
+ if [ $comp -eq 1 ] ; then
+ LAUNCHER_JAVA_EXE="$javaExe"
+ LAUNCHER_JAVA="$java"
+ verifyResult=$VERIFY_OK
+ fi
+ debug " compatible = [$comp]"
+ javaCompCounter=`expr "$javaCompCounter" + 1`
+ done
+ fi
+ fi
+ fi
+ done
+ fi
+}
+
+checkFreeSpace() {
+ size="$1"
+ path="$2"
+
+ if [ ! -d "$path" ] && [ ! $isSymlink "$path" ] ; then
+ # if checking path is not an existing directory - check its parent dir
+ path=`dirname "$path"`
+ fi
+
+ diskSpaceCheck=0
+
+ if [ 0 -eq $PERFORM_FREE_SPACE_CHECK ] ; then
+ diskSpaceCheck=1
+ else
+ # get size of the atomic entry (directory)
+ freeSpaceDirCheck="$path"/freeSpaceCheckDir
+ debug "Checking space in $path (size = $size)"
+ mkdir -p "$freeSpaceDirCheck"
+ # POSIX compatible du return size in 1024 blocks
+ du --block-size=$DEFAULT_DISK_BLOCK_SIZE "$freeSpaceDirCheck" 1>/dev/null 2>&1
+
+ if [ $? -eq 0 ] ; then
+ debug " getting POSIX du with 512 bytes blocks"
+ atomicBlock=`du --block-size=$DEFAULT_DISK_BLOCK_SIZE "$freeSpaceDirCheck" | awk ' { print $A }' A=1 2>/dev/null`
+ else
+ debug " getting du with default-size blocks"
+ atomicBlock=`du "$freeSpaceDirCheck" | awk ' { print $A }' A=1 2>/dev/null`
+ fi
+ rm -rf "$freeSpaceDirCheck"
+ debug " atomic block size : [$atomicBlock]"
+
+ isBlockNumber=`ifNumber "$atomicBlock"`
+ if [ 0 -eq $isBlockNumber ] ; then
+ out "Can\`t get disk block size"
+ exitProgram $ERROR_INPUTOUPUT
+ fi
+ requiredBlocks=`expr \( "$1" / $DEFAULT_DISK_BLOCK_SIZE \) + $atomicBlock` 1>/dev/null 2>&1
+ if [ `ifNumber $1` -eq 0 ] ; then
+ out "Can\`t calculate required blocks size"
+ exitProgram $ERROR_INPUTOUPUT
+ fi
+ # get free block size
+ column=4
+ df -P --block-size="$DEFAULT_DISK_BLOCK_SIZE" "$path" 1>/dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ # gnu df, use POSIX output
+ debug " getting GNU POSIX df with specified block size $DEFAULT_DISK_BLOCK_SIZE"
+ availableBlocks=`df -P --block-size="$DEFAULT_DISK_BLOCK_SIZE" "$path" | sed "1d" | awk ' { print $A }' A=$column 2>/dev/null`
+ else
+ # try POSIX output
+ df -P "$path" 1>/dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ debug " getting POSIX df with 512 bytes blocks"
+ availableBlocks=`df -P "$path" | sed "1d" | awk ' { print $A }' A=$column 2>/dev/null`
+ # try Solaris df from xpg4
+ elif [ -x /usr/xpg4/bin/df ] ; then
+ debug " getting xpg4 df with default-size blocks"
+ availableBlocks=`/usr/xpg4/bin/df -P "$path" | sed "1d" | awk ' { print $A }' A=$column 2>/dev/null`
+ # last chance to get free space
+ else
+ debug " getting df with default-size blocks"
+ availableBlocks=`df "$path" | sed "1d" | awk ' { print $A }' A=$column 2>/dev/null`
+ fi
+ fi
+ debug " available blocks : [$availableBlocks]"
+ if [ `ifNumber "$availableBlocks"` -eq 0 ] ; then
+ out "Can\`t get the number of the available blocks on the system"
+ exitProgram $ERROR_INPUTOUTPUT
+ fi
+
+ # compare
+ debug " required blocks : [$requiredBlocks]"
+
+ if [ $availableBlocks -gt $requiredBlocks ] ; then
+ debug "... disk space check OK"
+ diskSpaceCheck=1
+ else
+ debug "... disk space check FAILED"
+ fi
+ fi
+ if [ 0 -eq $diskSpaceCheck ] ; then
+ mbDownSize=`expr "$size" / 1024 / 1024`
+ mbUpSize=`expr "$size" / 1024 / 1024 + 1`
+ mbSize=`expr "$mbDownSize" \* 1024 \* 1024`
+ if [ $size -ne $mbSize ] ; then
+ mbSize="$mbUpSize"
+ else
+ mbSize="$mbDownSize"
+ fi
+
+ message "$MSG_ERROR_FREESPACE" "$mbSize" "$ARG_TEMPDIR"
+ exitProgram $ERROR_FREESPACE
+ fi
+}
+
+prepareClasspath() {
+ debug "Processing external jars ..."
+ processJarsClasspath
+
+ LAUNCHER_CLASSPATH=""
+ if [ -n "$JARS_CLASSPATH" ] ; then
+ if [ -z "$LAUNCHER_CLASSPATH" ] ; then
+ LAUNCHER_CLASSPATH="$JARS_CLASSPATH"
+ else
+ LAUNCHER_CLASSPATH="$LAUNCHER_CLASSPATH":"$JARS_CLASSPATH"
+ fi
+ fi
+
+ if [ -n "$PREPEND_CP" ] ; then
+ debug "Appending classpath with [$PREPEND_CP]"
+ PREPEND_CP=`resolveString "$PREPEND_CP"`
+
+ if [ -z "$LAUNCHER_CLASSPATH" ] ; then
+ LAUNCHER_CLASSPATH="$PREPEND_CP"
+ else
+ LAUNCHER_CLASSPATH="$PREPEND_CP":"$LAUNCHER_CLASSPATH"
+ fi
+ fi
+ if [ -n "$APPEND_CP" ] ; then
+ debug "Appending classpath with [$APPEND_CP]"
+ APPEND_CP=`resolveString "$APPEND_CP"`
+ if [ -z "$LAUNCHER_CLASSPATH" ] ; then
+ LAUNCHER_CLASSPATH="$APPEND_CP"
+ else
+ LAUNCHER_CLASSPATH="$LAUNCHER_CLASSPATH":"$APPEND_CP"
+ fi
+ fi
+ debug "Launcher Classpath : $LAUNCHER_CLASSPATH"
+}
+
+resolvePropertyStrings() {
+ args="$1"
+ escapeReplacedString="$2"
+ propertyStart=`echo "$args" | sed "s/^.*\\$P{//"`
+ propertyValue=""
+ propertyName=""
+
+ #Resolve i18n strings and properties
+ if [ 0 -eq `ifEquals "$propertyStart" "$args"` ] ; then
+ propertyName=`echo "$propertyStart" | sed "s/}.*//" 2>/dev/null`
+ if [ -n "$propertyName" ] ; then
+ propertyValue=`getMessage "$propertyName"`
+
+ if [ 0 -eq `ifEquals "$propertyValue" "$propertyName"` ] ; then
+ propertyName="\$P{$propertyName}"
+ args=`replaceString "$args" "$propertyName" "$propertyValue" "$escapeReplacedString"`
+ fi
+ fi
+ fi
+
+ echo "$args"
+}
+
+
+resolveLauncherSpecialProperties() {
+ args="$1"
+ escapeReplacedString="$2"
+ propertyValue=""
+ propertyName=""
+ propertyStart=`echo "$args" | sed "s/^.*\\$L{//"`
+
+
+ if [ 0 -eq `ifEquals "$propertyStart" "$args"` ] ; then
+ propertyName=`echo "$propertyStart" | sed "s/}.*//" 2>/dev/null`
+
+
+ if [ -n "$propertyName" ] ; then
+ case "$propertyName" in
+ "nbi.launcher.tmp.dir")
+ propertyValue="$LAUNCHER_EXTRACT_DIR"
+ ;;
+ "nbi.launcher.java.home")
+ propertyValue="$LAUNCHER_JAVA"
+ ;;
+ "nbi.launcher.user.home")
+ propertyValue="$HOME"
+ ;;
+ "nbi.launcher.parent.dir")
+ propertyValue="$LAUNCHER_DIR"
+ ;;
+ *)
+ propertyValue="$propertyName"
+ ;;
+ esac
+ if [ 0 -eq `ifEquals "$propertyValue" "$propertyName"` ] ; then
+ propertyName="\$L{$propertyName}"
+ args=`replaceString "$args" "$propertyName" "$propertyValue" "$escapeReplacedString"`
+ fi
+ fi
+ fi
+ echo "$args"
+}
+
+resolveString() {
+ args="$1"
+ escapeReplacedString="$2"
+ last="$args"
+ repeat=1
+
+ while [ 1 -eq $repeat ] ; do
+ repeat=1
+ args=`resolvePropertyStrings "$args" "$escapeReplacedString"`
+ args=`resolveLauncherSpecialProperties "$args" "$escapeReplacedString"`
+ if [ 1 -eq `ifEquals "$last" "$args"` ] ; then
+ repeat=0
+ fi
+ last="$args"
+ done
+ echo "$args"
+}
+
+replaceString() {
+ initialString="$1"
+ fromString="$2"
+ toString="$3"
+ if [ -n "$4" ] && [ 0 -eq `ifEquals "$4" "false"` ] ; then
+ toString=`escapeString "$toString"`
+ fi
+ fromString=`echo "$fromString" | sed "s/\\\//\\\\\\\\\//g" 2>/dev/null`
+ toString=`echo "$toString" | sed "s/\\\//\\\\\\\\\//g" 2>/dev/null`
+ replacedString=`echo "$initialString" | sed "s/${fromString}/${toString}/g" 2>/dev/null`
+ echo "$replacedString"
+}
+
+prepareJVMArguments() {
+ debug "Prepare JVM arguments... "
+
+ jvmArgCounter=0
+ debug "... resolving string : $LAUNCHER_JVM_ARGUMENTS"
+ LAUNCHER_JVM_ARGUMENTS=`resolveString "$LAUNCHER_JVM_ARGUMENTS" true`
+ debug "... resolved string : $LAUNCHER_JVM_ARGUMENTS"
+ while [ $jvmArgCounter -lt $JVM_ARGUMENTS_NUMBER ] ; do
+ argumentVar="$""JVM_ARGUMENT_$jvmArgCounter"
+ arg=`eval "echo \"$argumentVar\""`
+ debug "... jvm argument [$jvmArgCounter] [initial] : $arg"
+ arg=`resolveString "$arg"`
+ debug "... jvm argument [$jvmArgCounter] [resolved] : $arg"
+ arg=`escapeString "$arg"`
+ debug "... jvm argument [$jvmArgCounter] [escaped] : $arg"
+ LAUNCHER_JVM_ARGUMENTS="$LAUNCHER_JVM_ARGUMENTS $arg"
+ jvmArgCounter=`expr "$jvmArgCounter" + 1`
+ done
+ if [ ! -z "${DEFAULT_USERDIR_ROOT}" ] ; then
+ debug "DEFAULT_USERDIR_ROOT: $DEFAULT_USERDIR_ROOT"
+ LAUNCHER_JVM_ARGUMENTS="$LAUNCHER_JVM_ARGUMENTS -Dnetbeans.default_userdir_root=\"${DEFAULT_USERDIR_ROOT}\""
+ fi
+ if [ ! -z "${DEFAULT_CACHEDIR_ROOT}" ] ; then
+ debug "DEFAULT_CACHEDIR_ROOT: $DEFAULT_CACHEDIR_ROOT"
+ LAUNCHER_JVM_ARGUMENTS="$LAUNCHER_JVM_ARGUMENTS -Dnetbeans.default_cachedir_root=\"${DEFAULT_CACHEDIR_ROOT}\""
+ fi
+
+ debug "Final JVM arguments : $LAUNCHER_JVM_ARGUMENTS"
+}
+
+prepareAppArguments() {
+ debug "Prepare Application arguments... "
+
+ appArgCounter=0
+ debug "... resolving string : $LAUNCHER_APP_ARGUMENTS"
+ LAUNCHER_APP_ARGUMENTS=`resolveString "$LAUNCHER_APP_ARGUMENTS" true`
+ debug "... resolved string : $LAUNCHER_APP_ARGUMENTS"
+ while [ $appArgCounter -lt $APP_ARGUMENTS_NUMBER ] ; do
+ argumentVar="$""APP_ARGUMENT_$appArgCounter"
+ arg=`eval "echo \"$argumentVar\""`
+ debug "... app argument [$appArgCounter] [initial] : $arg"
+ arg=`resolveString "$arg"`
+ debug "... app argument [$appArgCounter] [resolved] : $arg"
+ arg=`escapeString "$arg"`
+ debug "... app argument [$appArgCounter] [escaped] : $arg"
+ LAUNCHER_APP_ARGUMENTS="$LAUNCHER_APP_ARGUMENTS $arg"
+ appArgCounter=`expr "$appArgCounter" + 1`
+ done
+ debug "Final application arguments : $LAUNCHER_APP_ARGUMENTS"
+}
+
+
+runCommand() {
+ cmd="$1"
+ debug "Running command : $cmd"
+ if [ -n "$OUTPUT_FILE" ] ; then
+ #redirect all stdout and stderr from the running application to the file
+ eval "$cmd" >> "$OUTPUT_FILE" 2>&1
+ elif [ 1 -eq $SILENT_MODE ] ; then
+ # on silent mode redirect all out/err to null
+ eval "$cmd" > /dev/null 2>&1
+ elif [ 0 -eq $USE_DEBUG_OUTPUT ] ; then
+ # redirect all output to null
+ # do not redirect errors there but show them in the shell output
+ eval "$cmd" > /dev/null
+ else
+ # using debug output to the shell
+ # not a silent mode but a verbose one
+ eval "$cmd"
+ fi
+ return $?
+}
+
+executeMainClass() {
+ prepareClasspath
+ prepareJVMArguments
+ prepareAppArguments
+ debug "Running main jar..."
+ message "$MSG_RUNNING"
+ classpathEscaped=`escapeString "$LAUNCHER_CLASSPATH"`
+ mainClassEscaped=`escapeString "$MAIN_CLASS"`
+ launcherJavaExeEscaped=`escapeString "$LAUNCHER_JAVA_EXE"`
+ tmpdirEscaped=`escapeString "$LAUNCHER_JVM_TEMP_DIR"`
+
+ command="$launcherJavaExeEscaped $LAUNCHER_JVM_ARGUMENTS -Djava.io.tmpdir=$tmpdirEscaped -classpath $classpathEscaped $mainClassEscaped $LAUNCHER_APP_ARGUMENTS"
+
+ debug "Running command : $command"
+ runCommand "$command"
+ exitCode=$?
+ debug "... java process finished with code $exitCode"
+ exitProgram $exitCode
+}
+
+escapeString() {
+ echo "$1" | sed "s/\\\/\\\\\\\/g;s/\ /\\\\ /g;s/\"/\\\\\"/g;s/(/\\\\\(/g;s/)/\\\\\)/g;" # escape spaces, commas and parentheses
+}
+
+getMessage() {
+ getLocalizedMessage_$LAUNCHER_LOCALE $@
+}
+
+POSSIBLE_JAVA_ENV="JAVA:JAVA_HOME:JAVAHOME:JAVA_PATH:JAVAPATH:JDK:JDK_HOME:JDKHOME:ANT_JAVA:"
+POSSIBLE_JAVA_EXE_SUFFIX_SOLARIS="bin/java:bin/sparcv9/java:"
+POSSIBLE_JAVA_EXE_SUFFIX_COMMON="bin/java:"
diff --git a/launcher/windows/.dep.inc b/launcher/windows/.dep.inc
new file mode 100644
index 0000000..4560e55
--- /dev/null
+++ b/launcher/windows/.dep.inc
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/launcher/windows/Makefile b/launcher/windows/Makefile
new file mode 100644
index 0000000..2327cb7
--- /dev/null
+++ b/launcher/windows/Makefile
@@ -0,0 +1,129 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+RESCOMP=windres
+
+
+# build
+build: .build-pre .build-impl .build-post
+
+.build-pre:
+ mkdir -p build
+ windres -I resources -o build/icon.o -i resources/res.rc
+
+.build-post:
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-pre .clean-impl .clean-post
+
+.clean-pre:
+ rm -rf build/icon.o
+
+.clean-post:
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-pre .clobber-impl .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post:
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-pre .all-impl .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post:
+# Add your post 'all' code here...
+
+
+# help
+help: .help-pre .help-impl .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post:
+# Add your post 'help' code here...
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/launcher/windows/Makefile-vc b/launcher/windows/Makefile-vc
new file mode 100644
index 0000000..78bc631
--- /dev/null
+++ b/launcher/windows/Makefile-vc
@@ -0,0 +1,92 @@
+#
+#
+
+
+!include <$(PLATFORM_SDK)/include/win32.mak>
+
+# define the compiler and linker for all the platforms
+CC32="$(VC_2005)\Bin\cl.exe"
+L32="$(VC_2005)\Bin\link.exe"
+MT32="$(PLATFORM_SDK)\Bin\mt.exe"
+RC32="$(VC_2005)\Bin\rc.exe"
+
+BUILD_DIR32=.\build\32bit
+OUTPUT_FILE32=.\dist\nlw.exe
+MANIFEST_FILE32=.\resources\nlw.exe.manifest
+#Alternative manifest file - read more in resources\res.rc
+#MANIFEST_FILE32=.\resources\nlw-alt.exe.manifest
+
+SOURCE_FILES=\
+ .\src\ExtractUtils.c \
+ .\src\FileUtils.c \
+ .\src\JavaUtils.c \
+ .\src\Launcher.c \
+ .\src\Main.c \
+ .\src\ProcessUtils.c \
+ .\src\RegistryUtils.c \
+ .\src\StringUtils.c \
+ .\src\SystemUtils.c
+
+
+CC32_OPTS=/O1 /Os \
+ /I "$(VC_2005)\include" \
+ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CRT_SECURE_NO_DEPRECATE" \
+ /FD /EHsc /MT \
+ /Fo"$(BUILD_DIR32)\\" /Fd"$(BUILD_DIR32)\vc80.pdb" \
+ /W3 /nologo /c /Wp64 /TC /errorReport:prompt
+
+LINKING_LIBRARIES=\
+ user32.lib\
+ gdi32.lib \
+ comdlg32.lib \
+ comctl32.lib \
+ advapi32.lib\
+ shell32.lib \
+ ole32.lib \
+ oleaut32.lib \
+ userenv.lib \
+ libcmt.lib \
+ kernel32.lib
+
+L32_OPTS=\
+ /OUT:$(OUTPUT_FILE32) \
+ /INCREMENTAL:NO \
+ /LIBPATH:"$(PLATFORM_SDK)\Lib" \
+ /MANIFEST \
+ /MANIFESTFILE:"$(BUILD_DIR32)\nlw.exe.intermediate.manifest" \
+ /NODEFAULTLIB \
+ /SUBSYSTEM:WINDOWS \
+ /OPT:REF /OPT:ICF \
+ /MACHINE:X86 \
+ /ERRORREPORT:PROMPT \
+ $(LINKING_LIBRARIES)
+
+
+RC32_OPTS=\
+ /I ".\resources" /fo $(BUILD_DIR32)\resources.obj
+
+
+all: init build-32
+
+clean:
+
+
+init:
+ - md $(BUILD_DIR32)
+ - md .\dist
+
+ del /Q /S $(BUILD_DIR32)
+ del /Q $(OUTPUT_FILE32)
+
+build-32:
+ Set CPU=i386
+ Set Lib=%VC_2005%\Lib;%PLATFORM_SDK%\Lib;%Lib%
+ Set Include=%PLATFORM_SDK%\Include;%Include%
+ Set Path=%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%VC_2005_PATH%;%path%
+ Set APPVER=5.01
+ Set TARGETOS=WINNT
+
+ $(CC32) $(CC32_OPTS) $(SOURCE_FILES)
+ $(RC32) $(RC32_OPTS) resources/res.rc
+ $(L32) $(L32_OPTS) $(BUILD_DIR32)\ExtractUtils.obj $(BUILD_DIR32)\FileUtils.obj $(BUILD_DIR32)\JavaUtils.obj $(BUILD_DIR32)\Launcher.obj $(BUILD_DIR32)\Main.obj $(BUILD_DIR32)\ProcessUtils.obj $(BUILD_DIR32)\RegistryUtils.obj $(BUILD_DIR32)\StringUtils.obj $(BUILD_DIR32)\SystemUtils.obj $(BUILD_DIR32)\resources.obj
+ $(MT32) /outputresource:"$(OUTPUT_FILE32);#1" -manifest $(MANIFEST_FILE32) $(BUILD_DIR32)\nlw.exe.intermediate.manifest
diff --git a/launcher/windows/Makefile-vc-wo-crt b/launcher/windows/Makefile-vc-wo-crt
new file mode 100644
index 0000000..6a693f5
--- /dev/null
+++ b/launcher/windows/Makefile-vc-wo-crt
@@ -0,0 +1,92 @@
+#
+#
+
+
+!include <$(PLATFORM_SDK)/include/win32.mak>
+
+# define the compiler and linker for all the platforms
+CC32="$(VC_2005)\Bin\cl.exe"
+L32="$(VC_2005)\Bin\link.exe"
+MT32="$(PLATFORM_SDK)\Bin\mt.exe"
+RC32="$(VC_2005)\Bin\rc.exe"
+
+BUILD_DIR32=.\build\32bit
+OUTPUT_FILE32=.\dist\nlw.exe
+MANIFEST_FILE32=.\resources\nlw.exe.manifest
+#Alternative manifest file - read more in resources\res.rc
+#MANIFEST_FILE32=.\resources\nlw-alt.exe.manifest
+
+SOURCE_FILES=\
+ .\src\ExtractUtils.c \
+ .\src\FileUtils.c \
+ .\src\JavaUtils.c \
+ .\src\Launcher.c \
+ .\src\Main.c \
+ .\src\ProcessUtils.c \
+ .\src\RegistryUtils.c \
+ .\src\StringUtils.c \
+ .\src\SystemUtils.c
+
+
+CC32_OPTS=/O1 /Os \
+ /I "$(VC_2005)\include" \
+ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CRT_SECURE_NO_DEPRECATE" \
+ /FD /EHsc /GS- \
+ /Fo"$(BUILD_DIR32)\\" /Fd"$(BUILD_DIR32)\vc80.pdb" \
+ /W3 /nologo /c /Wp64 /TC /errorReport:prompt
+
+LINKING_LIBRARIES=\
+ user32.lib\
+ gdi32.lib \
+ comdlg32.lib \
+ comctl32.lib \
+ advapi32.lib\
+ shell32.lib \
+ ole32.lib \
+ oleaut32.lib \
+ userenv.lib \
+ kernel32.lib \
+
+L32_OPTS=\
+ /OUT:$(OUTPUT_FILE32) \
+ /INCREMENTAL:NO \
+ /LIBPATH:"$(PLATFORM_SDK)\Lib" \
+ /MANIFEST \
+ /MANIFESTFILE:"$(BUILD_DIR32)\nlw.exe.intermediate.manifest" \
+ /NODEFAULTLIB \
+ /SUBSYSTEM:WINDOWS \
+ /OPT:REF /OPT:ICF \
+ /MACHINE:X86 \
+ /ERRORREPORT:PROMPT \
+ /ENTRY:MyMain \
+ $(LINKING_LIBRARIES)
+
+
+RC32_OPTS=\
+ /I ".\resources" /fo $(BUILD_DIR32)\resources.obj
+
+
+all: init build-32
+
+clean:
+
+
+init:
+ - md $(BUILD_DIR32)
+ - md .\dist
+
+ del /Q /S $(BUILD_DIR32)
+ del /Q $(OUTPUT_FILE32)
+
+build-32:
+ Set CPU=i386
+ Set Lib=%VC_2005%\Lib;%PLATFORM_SDK%\Lib;%Lib%
+ Set Include=%PLATFORM_SDK%\Include;%Include%
+ Set Path=%PLATFORM_SDK%\Bin;%PLATFORM_SDK%\Bin\WinNT;%VC_2005_PATH%;%path%
+ Set APPVER=5.01
+ Set TARGETOS=WINNT
+
+ $(CC32) $(CC32_OPTS) $(SOURCE_FILES)
+ $(RC32) $(RC32_OPTS) resources/res.rc
+ $(L32) $(L32_OPTS) $(BUILD_DIR32)\ExtractUtils.obj $(BUILD_DIR32)\FileUtils.obj $(BUILD_DIR32)\JavaUtils.obj $(BUILD_DIR32)\Launcher.obj $(BUILD_DIR32)\Main.obj $(BUILD_DIR32)\ProcessUtils.obj $(BUILD_DIR32)\RegistryUtils.obj $(BUILD_DIR32)\StringUtils.obj $(BUILD_DIR32)\SystemUtils.obj $(BUILD_DIR32)\resources.obj
+ $(MT32) /outputresource:"$(OUTPUT_FILE32);#1" -manifest $(MANIFEST_FILE32) $(BUILD_DIR32)\nlw.exe.intermediate.manifest
diff --git a/launcher/windows/i18n/launcher.properties b/launcher/windows/i18n/launcher.properties
new file mode 100644
index 0000000..c9de214
--- /dev/null
+++ b/launcher/windows/i18n/launcher.properties
@@ -0,0 +1,74 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+nlw.jvm.notfoundmessage=Java SE Development Kit (JDK) was not found on this computer\nJDK 8 or newer is required for installing the NetBeans IDE. Make sure that the JDK is properly installed and run installer again. You can specify valid JDK location using {0} installer argument.\n\nTo download the JDK, visit http://www.oracle.com/technetwork/java/javase/downloads
+nlw.jvm.usererror=Java Runtime Environment (JRE) was not found\nThere is no JRE at the specified location {0}
+nlw.jvm.unsupportedversion=Unsupported Java VM version\nThe Java VM at {0} has the unsupported version
+nlw.freespace=There is not enough free disk space to extract installation data\n{0} MB of free disk space is required in a temporary folder. Clean up the disk space and run installer again. You can specify a temporary folder with sufficient disk space using {1} installer argument
+nlw.tmpdir=Can't create temporary directory\nThe temporary directory for extracting data {0} was not created
+nlw.integrity=Installer file is corrupted\nInstaller file {0} seems to be corrupted
+nlw.output.error=Data extraction error\nCan't create file {0}!\nThe following error occured :\n{1}
+nlw.java.process.error=An error occured while running java process\n{0}
+nlw.missing.external.resource=Can`t run NetBeans Installer.\nAn external file with necessary data is required but missing:\n{0}
+nlw.bundled.jvm.extract.error=Cannot prepare bundled JVM to run the installer.\nMost probably the bundled JVM is not compatible with the current platform.
+nlw.bundled.jvm.verify.error=An error occured while verifying bundled JVM.\nMost probably the bundled JVM is not compatible with the current platform.
+
+nlw.arg.output={0} <output-file>\n\tRedirect output to file <output-file>
+nlw.arg.javahome={0} <javahomedir>\n\tRun jar file using JVM from <javahomedir>
+nlw.arg.verbose={0}\n\tUse verbose output
+nlw.arg.tempdir={0} <temp-dir>\n\tUse <temp-dir> for extracting data
+nlw.arg.extract={0} [directory]\n\tExtract all bundled data to the specific directory.\n\tIf directory is not specified then extract to the current directory
+nlw.arg.classpatha={0} <classpath>\n\tAppend classpath with <classpath>
+nlw.arg.classpathp={0} <classpath>\n\tPrepend classpath with <classpath>
+nlw.arg.disable.space.check={0}\n\tDisable free space check
+nlw.arg.locale={0} <locale>\n\tOverride system default locale with <locale>
+nlw.arg.silent={0} \n\tRun installer silently
+nlw.arg.help={0}\n\tShow help message
+
+
+nlw.msg.create.tmpdir=Creating temporary directory ...
+nlw.msg.extract=Extracting data ...
+nlw.msg.jvmsearch=Finding JVM on your system ...
+nlw.msg.setoptions=Setting command options ...
+nlw.msg.running=Running JVM ...
+nlw.msg.title=Please wait while the launcher prepares data to run the installer ...
+nlw.msg.messagebox.title=NetBeans IDE Installer
+nlw.msg.progress.title=Configuring the installer ...
+nlw.msg.button.error=Exit Installer
+nlw.msg.main.title=NetBeans IDE Installer
diff --git a/launcher/windows/nbproject/configurations.xml b/launcher/windows/nbproject/configurations.xml
new file mode 100644
index 0000000..a969ca9
--- /dev/null
+++ b/launcher/windows/nbproject/configurations.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright (c) 2007, 2016 Oracle and/or its affiliates. All rights reserved.
+
+Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+Other names may be trademarks of their respective owners.
+
+The contents of this file are subject to the terms of either the GNU
+General Public License Version 2 only ("GPL") or the Common
+Development and Distribution License("CDDL") (collectively, the
+"License"). You may not use this file except in compliance with the
+License. You can obtain a copy of the License at
+http://www.netbeans.org/cddl-gplv2.html
+or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+specific language governing permissions and limitations under the
+License. When distributing the software, include this License Header
+Notice in each file and include the License file at
+nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the GPL Version 2 section of the License file that
+accompanied this code. If applicable, add the following below the
+License Header, with the fields enclosed by brackets [] replaced by
+your own identifying information:
+"Portions Copyrighted [year] [name of copyright owner]"
+
+If you wish your version of this file to be governed by only the CDDL
+or only the GPL Version 2, indicate your decision by adding
+"[Contributor] elects to include this software in this distribution
+under the [CDDL or GPL Version 2] license." If you do not indicate a
+single choice of license, a recipient has the option to distribute
+your version of this file under either the CDDL, the GPL Version 2 or
+to extend the choice of license to its licensees as provided above.
+However, if you add GPL Version 2 code and therefore, elected the GPL
+Version 2 license, then the option applies only if the new code is
+made subject to such option by the copyright holder.
+
+Contributor(s):
+-->
+<configurationDescriptor version="84">
+ <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>src/Errors.h</itemPath>
+ <itemPath>src/ExtractUtils.h</itemPath>
+ <itemPath>src/FileUtils.h</itemPath>
+ <itemPath>src/JavaUtils.h</itemPath>
+ <itemPath>src/Launcher.h</itemPath>
+ <itemPath>src/Main.h</itemPath>
+ <itemPath>src/ProcessUtils.h</itemPath>
+ <itemPath>src/RegistryUtils.h</itemPath>
+ <itemPath>src/StringUtils.h</itemPath>
+ <itemPath>src/SystemUtils.h</itemPath>
+ <itemPath>src/Types.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ <itemPath>resources/res.rc</itemPath>
+ </logicalFolder>
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>src/ExtractUtils.c</itemPath>
+ <itemPath>src/FileUtils.c</itemPath>
+ <itemPath>src/JavaUtils.c</itemPath>
+ <itemPath>src/Launcher.c</itemPath>
+ <itemPath>src/Main.c</itemPath>
+ <itemPath>src/ProcessUtils.c</itemPath>
+ <itemPath>src/RegistryUtils.c</itemPath>
+ <itemPath>src/StringUtils.c</itemPath>
+ <itemPath>src/SystemUtils.c</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <confs>
+ <conf name="Debug" type="1">
+ <toolsSet>
+ <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
+ <compilerSet>Cygwin|Cygwin</compilerSet>
+ </toolsSet>
+ <compileType>
+ <cTool>
+ <stripSymbols>true</stripSymbols>
+ <commandLine>-mno-cygwin</commandLine>
+ <warningLevel>3</warningLevel>
+ </cTool>
+ <ccTool>
+ <stripSymbols>true</stripSymbols>
+ </ccTool>
+ <linkerTool>
+ <output>dist/nlw</output>
+ <stripSymbols>true</stripSymbols>
+ <linkerLibItems>
+ <linkerOptionItem>-lole32 -luuid -lkernel32 -lcomctl32 -luserenv</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-mwindows -mno-cygwin build/icon.o</commandLine>
+ </linkerTool>
+ </compileType>
+ </conf>
+ <conf name="Release" type="1">
+ <toolsSet>
+ <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
+ <compilerSet>Cygwin|Cygwin</compilerSet>
+ </toolsSet>
+ <compileType>
+ <cTool>
+ <developmentMode>5</developmentMode>
+ </cTool>
+ <ccTool>
+ <developmentMode>5</developmentMode>
+ </ccTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ </compileType>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/launcher/windows/nbproject/project.properties b/launcher/windows/nbproject/project.properties
new file mode 100644
index 0000000..75bafc2
--- /dev/null
+++ b/launcher/windows/nbproject/project.properties
@@ -0,0 +1,40 @@
+
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+#
+# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+# Other names may be trademarks of their respective owners.
+#
+# The contents of this file are subject to the terms of either the GNU General Public
+# License Version 2 only ("GPL") or the Common Development and Distribution
+# License("CDDL") (collectively, the "License"). You may not use this file except in
+# compliance with the License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+# License for the specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header Notice in
+# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+# designates this particular file as subject to the "Classpath" exception as provided
+# by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+# If applicable, add the following below the License Header, with the fields enclosed
+# by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original Software
+# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+# Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL or only the
+# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+# this software in this distribution under the [CDDL or GPL Version 2] license." If
+# you do not indicate a single choice of license, a recipient has the option to
+# distribute your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above. However, if you
+# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+# option applies only if the new code is made subject to such option by the copyright
+# holder.
+#
+
diff --git a/launcher/windows/nbproject/project.xml b/launcher/windows/nbproject/project.xml
new file mode 100644
index 0000000..d3ace8f
--- /dev/null
+++ b/launcher/windows/nbproject/project.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved.
+
+ Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ Other names may be trademarks of their respective owners.
+
+ The contents of this file are subject to the terms of either the GNU General Public
+ License Version 2 only ("GPL") or the Common Development and Distribution
+ License("CDDL") (collectively, the "License"). You may not use this file except in
+ compliance with the License. You can obtain a copy of the License at
+ http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ License for the specific language governing permissions and limitations under the
+ License. When distributing the software, include this License Header Notice in
+ each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ designates this particular file as subject to the "Classpath" exception as provided
+ by Oracle in the GPL Version 2 section of the License file that accompanied this code.
+ If applicable, add the following below the License Header, with the fields enclosed
+ by brackets [] replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ The Original Software is NetBeans. The Initial Developer of the Original Software
+ is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ Rights Reserved.
+
+ If you wish your version of this file to be governed by only the CDDL or only the
+ GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ this software in this distribution under the [CDDL or GPL Version 2] license." If
+ you do not indicate a single choice of license, a recipient has the option to
+ distribute your version of this file under either the CDDL, the GPL Version 2 or
+ to extend the choice of license to its licensees as provided above. However, if you
+ add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such option by the copyright
+ holder.
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>NBI Native Launcher : Windows</name>
+ <make-project-type>0</make-project-type>
+ <c-extensions>c</c-extensions>
+ <cpp-extensions/>
+ <header-extensions>h</header-extensions>
+ <sourceEncoding>UTF-8</sourceEncoding>
+ <make-dep-projects/>
+ <sourceRootList/>
+ <confList>
+ <confElem>
+ <name>Debug</name>
+ <type>1</type>
+ </confElem>
+ <confElem>
+ <name>Release</name>
+ <type>1</type>
+ </confElem>
+ </confList>
+ </data>
+ </configuration>
+</project>
diff --git a/launcher/windows/resources/icon.ico b/launcher/windows/resources/icon.ico
new file mode 100644
index 0000000..e730c4a
Binary files /dev/null and b/launcher/windows/resources/icon.ico differ
diff --git a/launcher/windows/resources/nlw-alt.exe.manifest b/launcher/windows/resources/nlw-alt.exe.manifest
new file mode 100644
index 0000000..8821bdc
--- /dev/null
+++ b/launcher/windows/resources/nlw-alt.exe.manifest
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="nlw" type="win32"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
\ No newline at end of file
diff --git a/launcher/windows/resources/nlw.exe.manifest b/launcher/windows/resources/nlw.exe.manifest
new file mode 100644
index 0000000..c3fabc1
--- /dev/null
+++ b/launcher/windows/resources/nlw.exe.manifest
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="nlw" type="win32"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="requireAdministrator"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
\ No newline at end of file
diff --git a/launcher/windows/resources/res.rc b/launcher/windows/resources/res.rc
new file mode 100644
index 0000000..02860db
--- /dev/null
+++ b/launcher/windows/resources/res.rc
@@ -0,0 +1,61 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2007 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ */
+
+
+// Uncomment the following lines to add special "Vista" manifest under Cygwin using GCC and WINDRES
+// Seems that tools from MS Platform SDK/MS VS C++ 2005 EE (C compiler, resource compiler and manifest tool) ignore that
+// (so you can leave that uncommented for both tools at once) but I haven`t check that much.
+// PS. Currently uncommented - seems to be working with GCC compiler (checked by Martin Sladecek)
+#define RT_MANIFEST 24
+#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
+
+
+// Using of nlw.exe.manifest means that on Vista every installer/uninstaller (launcher, in general) invocation would require admin privileges which user would be asked for (evaluation dialog).
+// In that case the executable icon would have "shield" mark.
+// Using of nlw-alt.exe.manifest means that on Vista evaluation dialog is not displayed. To run it with admin right user have to execute "Run as Administrator" explicitely.
+// Without the build-it manifest the following issue can occur (reported Martin Sladecek):
+// When launcher would have "instal" in its name (uninstall.exe for instance), then - due to UAC and it`s method of checking "installer-like" names and code stamps - it would be executed with Administrator`s environment - it is would be different from the user that performed the installation.
+// Only one of the following lines should be commented, the other one should be uncommented.
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "nlw.exe.manifest"
+//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "nlw-alt.exe.manifest"
+
+100 ICON DISCARDABLE "icon.ico"
+
diff --git a/launcher/windows/src/Errors.h b/launcher/windows/src/Errors.h
new file mode 100644
index 0000000..ae89fa1
--- /dev/null
+++ b/launcher/windows/src/Errors.h
@@ -0,0 +1,72 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#ifndef _Errors_H
+#define _Errors_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define ERROR_OK 0
+#define ERROR_INTEGRITY 1000
+#define ERROR_FREESPACE 1001
+#define ERROR_INPUTOUPUT 1002
+#define ERROR_JVM_UNCOMPATIBLE 1003
+#define ERROR_JVM_NOT_FOUND 1004
+#define ERROR_ON_EXECUTE_PROCESS 1005
+#define ERROR_PROCESS_TIMEOUT 1006
+#define ERROR_USER_TERMINATED 1007
+#define EXTERNAL_RESOURCE_MISSING 1008
+#define ERROR_BUNDLED_JVM_EXTRACTION 1009
+#define ERROR_BUNDLED_JVM_VERIFICATION 1010
+
+#define EXIT_CODE_EVENTS_INITIALIZATION_ERROR 1022
+#define EXIT_CODE_GUI_INITIALIZATION_ERROR 1023
+#define EXIT_CODE_STUB 1024
+#define EXIT_CODE_SYSTEM_ERROR 1025
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Errors_H */
+
diff --git a/launcher/windows/src/ExtractUtils.c b/launcher/windows/src/ExtractUtils.c
new file mode 100644
index 0000000..2ca6e5a
--- /dev/null
+++ b/launcher/windows/src/ExtractUtils.c
@@ -0,0 +1,781 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU General
+ * Public License Version 2 only ("GPL") or the Common Development and Distribution
+ * License("CDDL") (collectively, the "License"). You may not use this file except in
+ * compliance with the License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
+ * License for the specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header Notice in
+ * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle
+ * designates this particular file as subject to the "Classpath" exception as
+ * provided by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License Header,
+ * with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original Software
+ * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
+ * Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL or only the
+ * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
+ * this software in this distribution under the [CDDL or GPL Version 2] license." If
+ * you do not indicate a single choice of license, a recipient has the option to
+ * distribute your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above. However, if
+ * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
+ * the option applies only if the new code is made subject to such option by the
+ * copyright holder.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "FileUtils.h"
+#include "StringUtils.h"
+#include "SystemUtils.h"
+#include "JavaUtils.h"
+#include "RegistryUtils.h"
+#include "ExtractUtils.h"
+#include "Launcher.h"
+#include "Main.h"
+
+const DWORD STUB_FILL_SIZE = 450000;
+
+void skipLauncherStub(LauncherProperties * props, DWORD stubSize) {
+ HANDLE hFileRead = props->handler;
+
+ if(hFileRead!=INVALID_HANDLE_VALUE) {
+ // just read stub data.. no need to write it anywhere
+ DWORD read = 0;
+ char * offsetbuf = newpChar(stubSize);
+ DWORD sizeLeft = stubSize;
+ while(ReadFile(hFileRead, offsetbuf, sizeLeft, &read, 0) && sizeLeft && read) {
+ sizeLeft-=read;
+ addProgressPosition(props, read);
+ if(sizeLeft==0) break;
+ if(read==0) { // we need some more bytes to read but we can`t to read
+ props->status = ERROR_INTEGRITY;
+ break;
+ }
+ }
+ FREE(offsetbuf);
+ }
+}
+
+
+void skipStub(LauncherProperties * props) {
+ if(props->isOnlyStub) {
+ WCHAR * os;
+ props->status = EXIT_CODE_STUB;
+ os = appendStringW(NULL, L"It`s only the launcher stub.\nOS: ");
+ if(is9x()) os = appendStringW(os, L"Windows 9x");
+ if(isNT()) os = appendStringW(os, L"Windows NT");
+ if(is2k()) os = appendStringW(os, L"Windows 2000");
+ if(isXP()) os = appendStringW(os, L"Windows XP");
+ if(is2003()) os = appendStringW(os, L"Windows 2003");
+ if(isVista()) os = appendStringW(os, L"Windows Vista");
+ if(is2008()) os = appendStringW(os, L"Windows 2008");
+ if(is7()) os = appendStringW(os, L"Windows 7");
+ if(IsWow64) os = appendStringW(os, L" x64");
+ showMessageW(props, os , 0);
+ FREE(os);
+ } else {
+ skipLauncherStub(props, STUB_FILL_SIZE);
+ if(!isOK(props)) {
+ writeMessageA(props, OUTPUT_LEVEL_NORMAL, 1,
+ "Error! Can`t process launcher stub", 1);
+ showErrorW(props, INTEGRITY_ERROR_PROP, 1, props->exeName);
+ }
+ }
+}
+
+void modifyRestBytes(SizedString* rest, DWORD start) {
+
+ DWORD len = rest->length - start;
+ char * restBytesNew = NULL;
+
+ if(len>0) {
+ DWORD i;
+ restBytesNew = newpChar(len);
+ for(i=start;i<rest->length;i++) {
+ restBytesNew[i-start] = (rest->bytes) [i];
+ }
+ }
+ FREE(rest->bytes);
+ rest->bytes = restBytesNew;
+ rest->length = len;
+}
+
+DWORD readStringFromBuf(SizedString *rest, SizedString * result, DWORD isUnicode) {
+ if((rest->length)!=0) {
+ // we have smth in the restBytes that we have read but haven`t yet proceeded
+ DWORD i=0;
+ for(i=0;i<rest->length;i++) {
+ DWORD check = ((rest->bytes)[i]==0);
+ if(isUnicode) {
+ if ( (i/2)*2==i) {// i is even
+ check = check && (i < rest->length-1 && ((rest->bytes)[i+1]==0));
+ } else {
+ check = 0;
+ }
+ }
+ if( check ) { // we have found null character in the rest bytes
+ result->bytes = appendStringN(NULL, 0, rest->bytes, i);
+ result->length = i;
+ modifyRestBytes(rest, i + 1 + isUnicode);
+ return ERROR_OK;
+ }
+ }
+ //here we have found no \0 character in the rest of bytes...
+ }
+ return ERROR_INPUTOUPUT;
+}
+
+void readString(LauncherProperties * props, SizedString * result, DWORD isUnicode) {
+ DWORD * status = & props->status;
+ HANDLE hFileRead = props->handler;
+ SizedString * rest = props->restOfBytes;
+ DWORD bufferSize = props->bufsize;
+ DWORD read=0;
+ char * buf = NULL;
+
+ if(*status != ERROR_OK ) return;
+
+ if(readStringFromBuf(rest, result, isUnicode)==ERROR_OK) {
+ return;
+ }
+
+ //we need to read file for more data to find \0 character...
+
+ buf = newpChar(bufferSize);
+
+ while (ReadFile(hFileRead, buf, bufferSize, &read, 0) && read) {
+ addProgressPosition(props, read);
+ rest->bytes = appendStringN(rest->bytes, rest->length, buf, read);
+ rest->length = rest->length + read;
+ if(readStringFromBuf(rest, result, isUnicode)==ERROR_OK) {
+ //if(result->bytes!=NULL) {
+ //we have find \0 character
+ break;
+ }
+ ZERO(buf, sizeof(char) * bufferSize);
+ if(read==0) { // we have nothing to read.. smth wrong
+ *status = ERROR_INTEGRITY;
+ break;
+ }
+ }
+ FREE(buf);
+ return;
+}
+
+
+
+void readNumber(LauncherProperties * props, DWORD * result) {
+ if(isOK(props)) {
+
+ SizedString * numberString = createSizedString();
+ DWORD i =0;
+ DWORD number = 0;
+
+ readString(props, numberString, 0);
+ if(!isOK(props)) {
+ freeSizedString(&numberString);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
+ "Error!! Can`t read number string. Most probably integrity error.", 1);
+ return;
+ }
+
+ if(numberString->bytes==NULL) {
+ freeSizedString(&numberString);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
+ "Error!! Can`t read number string (it can`t be NULL). Most probably integrity error.", 1);
+ props->status = ERROR_INTEGRITY;
+ return;
+ }
+
+
+ for(;i<numberString->length;i++) {
+ char c = numberString->bytes[i];
+ if(c>='0' && c<='9') {
+ number = number * 10 + (c - '0');
+ } else if(c==0) {
+ // we have reached the end of number section
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
+ "Can`t read number from string (it contains zero character):", 1);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, numberString->bytes, 1);
+ props->status = ERROR_INTEGRITY;
+ break;
+ } else {
+ // unexpected...
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,
+ "Can`t read number from string (unexpected error):", 1);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, numberString->bytes, 1);
+ props->status = ERROR_INTEGRITY;
+ break;
+ }
+ }
+ freeSizedString(&numberString);
+ *result = number;
+ }
+}
+
+void readStringWithDebugW(LauncherProperties * props, WCHAR ** dest, char * paramName) {
+ SizedString *sizedStr = createSizedString();
+ if(paramName!=NULL) {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Reading ", 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, paramName, 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " : ", 0);
+ }
+ readString(props, sizedStr, 1);
+ if(!isOK(props)) {
+ freeSizedString(&sizedStr);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0,
+ "[ERROR] Can`t read string !! Seems to be integrity error", 1);
+ return;
+ }
+ *dest = createWCHAR(sizedStr);
+ freeSizedString(&sizedStr);
+ if(paramName!=NULL) {
+ if((*dest)!=NULL) {
+ writeMessageW(props, OUTPUT_LEVEL_DEBUG, 0, *dest, 1);
+ } else {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "NULL", 1);
+ }
+ }
+ return;
+}
+
+void readStringWithDebugA(LauncherProperties * props, char ** dest, char * paramName) {
+ SizedString *sizedStr = createSizedString();
+
+ if(paramName!=NULL) {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Reading ", 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, paramName, 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " : ", 0);
+ }
+ readString( props, sizedStr, 0);
+ if(!isOK(props)) {
+ freeSizedString(&sizedStr);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0,
+ "[ERROR] Can`t read string!!! Seems to be integritiy error", 1);
+ return;
+ }
+ *dest = appendString(NULL, sizedStr->bytes);
+ if(paramName!=NULL) {
+ if((*dest)==NULL) {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "NULL", 1);
+ } else {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, *dest, 1);
+ }
+ }
+ freeSizedString(&sizedStr);
+ return;
+}
+
+
+void readNumberWithDebug(LauncherProperties * props, DWORD * dest, char * paramName) {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Reading ", 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, paramName, 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " : ", 0);
+ readNumber(props, dest);
+
+ if(!isOK(props)) {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0,
+ "[ERROR] Can`t read number !!! Seems to be integrity error", 1);
+ return;
+ }
+ writeDWORD(props, OUTPUT_LEVEL_DEBUG, 0, NULL, *dest, 1);
+ return;
+}
+void readBigNumberWithDebug(LauncherProperties * props, int64t * dest, char * paramName) {
+ DWORD low = 0;
+ DWORD high = 0;
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Reading ", 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, paramName, 0);
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " : ", 0);
+
+ readNumber(props, &low);
+ if(isOK(props)) {
+ readNumber(props, &high);
+ }
+ if(!isOK(props)) {
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0,
+ "[ERROR] Can`t read number !!! Seems to be integrity error", 1);
+ return;
+ }
+ dest->High = high;
+ dest->Low = low;
+ writeint64t(props, OUTPUT_LEVEL_DEBUG, 0, "", dest, 1);
+}
+
+// returns: ERROR_OK, ERROR_INPUTOUPUT, ERROR_INTEGRITY
+void extractDataToFile(LauncherProperties * props, WCHAR *output, int64t * fileSize, DWORD expectedCRC ) {
+ if(isOK(props)) {
+ DWORD * status = & props->status;
+ HANDLE hFileRead = props->handler;
+ int64t * size = fileSize;
+ DWORD counter = 0;
+ DWORD crc32 = -1L;
+ HANDLE hFileWrite = CreateFileW(output, GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, hFileRead);
+
+ if (hFileWrite == INVALID_HANDLE_VALUE) {
+ WCHAR * err;
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "[ERROR] Can`t create file ", 0);
+ writeMessageW(props, OUTPUT_LEVEL_DEBUG, 0, output, 1);
+
+ err = getErrorDescription(GetLastError());
+ writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Error description : ", 0);
+ writeMessageW(props, OUTPUT_LEVEL_DEBUG, 0, err, 1);
+
... 6292 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists