Remove all c++ code, moved to dedicated projects
This commit is contained in:
@@ -1,150 +0,0 @@
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://github.com/Boukefalos/jlibloader/raw/mvn-repo/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.github.boukefalos:jlibloader:0.2'
|
||||
}
|
||||
|
||||
group = 'com.github.boukefalos'
|
||||
project.archivesBaseName = 'jlibmimis'
|
||||
version = '0.1'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '1.12'
|
||||
}
|
||||
|
||||
model {
|
||||
platforms {
|
||||
windows_i386 {
|
||||
architecture 'i386'
|
||||
operatingSystem 'windows'
|
||||
}
|
||||
windows_amd64 {
|
||||
architecture 'amd64'
|
||||
operatingSystem 'windows'
|
||||
}
|
||||
}
|
||||
toolChains {
|
||||
gcc(Gcc) {
|
||||
addPlatformConfiguration(new TargetPlatformConfiguration() {
|
||||
boolean supportsPlatform(Platform platform) {
|
||||
platform.operatingSystem.current && platform.operatingSystem.name == 'windows' &&
|
||||
platform.architecture.name == 'amd64'
|
||||
}
|
||||
List<String> getCppCompilerArgs() { ['-m64', '-fpermissive'] }
|
||||
List<String> getCCompilerArgs() { ['-m64'] }
|
||||
List<String> getObjectiveCCompilerArgs() { ['-m64'] }
|
||||
List<String> getObjectiveCppCompilerArgs() { ['-m64'] }
|
||||
List<String> getAssemblerArgs() { ['--64'] }
|
||||
List<String> getLinkerArgs() { ['-m64'] }
|
||||
List<String> getStaticLibraryArchiverArgs() { [] }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def jniHeadersDir = file("$buildDir/headers")
|
||||
|
||||
task jniHeaders(dependsOn: compileJava) {
|
||||
def outputFile = file("$jniHeadersDir/mimis.h")
|
||||
inputs.files sourceSets.main.output
|
||||
outputs.file outputFile
|
||||
exec {
|
||||
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
|
||||
args '-o', outputFile
|
||||
args '-classpath', sourceSets.main.output.classesDir
|
||||
args '-classpath', file("$buildDir/../bin")
|
||||
args 'mimis.util.Native'
|
||||
}
|
||||
}
|
||||
|
||||
libraries {
|
||||
main {
|
||||
baseName project.archivesBaseName
|
||||
}
|
||||
all {
|
||||
binaries.all {
|
||||
cppCompiler.args '-I' + jniHeadersDir
|
||||
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
|
||||
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
|
||||
linker.args '-Wl,--kill-at', '-static-libgcc', '-static-libstdc++'
|
||||
tasks.withType(CppCompile) { task ->
|
||||
task.dependsOn jniHeaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Upload) {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
repository(url: uri('../../.maven'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
jni
|
||||
}
|
||||
|
||||
def deployer = uploadJni.repositories.mavenDeployer
|
||||
|
||||
binaries.withType(SharedLibraryBinary) { binary ->
|
||||
if (!buildable) {
|
||||
return
|
||||
}
|
||||
def variantName = "${targetPlatform.operatingSystem.name}-${targetPlatform.architecture.name}"
|
||||
def taskName = "jar-${variantName}"
|
||||
def nativeJar = project.tasks.findByName(taskName)
|
||||
if (nativeJar == null) {
|
||||
nativeJar = project.task(taskName, type: Jar) {
|
||||
baseName = "${project.archivesBaseName}-$variantName"
|
||||
}
|
||||
artifacts {
|
||||
jni nativeJar
|
||||
}
|
||||
def jniPom = deployer.addFilter(variantName) { artifact, file ->
|
||||
return file == nativeJar.archivePath
|
||||
}
|
||||
jniPom.groupId = project.group
|
||||
jniPom.artifactId = nativeJar.baseName
|
||||
jniPom.version = project.version
|
||||
jniPom.scopeMappings.mappings.clear()
|
||||
}
|
||||
def builderTask = binary.tasks.builder
|
||||
def libraryDirectory = project.group.replace('.', '/') + "/${project.archivesBaseName}/${variantName}"
|
||||
nativeJar.into(libraryDirectory) { from builderTask.outputFile }
|
||||
nativeJar.dependsOn builderTask
|
||||
}
|
||||
|
||||
def mainPom = uploadArchives.repositories.mavenDeployer.pom
|
||||
mainPom.groupId = project.group
|
||||
mainPom.artifactId = jar.baseName
|
||||
mainPom.version = project.version
|
||||
mainPom.scopeMappings.mappings.clear()
|
||||
mainPom.withXml { provider ->
|
||||
def node = provider.asNode()
|
||||
def deps = node.appendNode('dependencies')
|
||||
['windows-amd64', 'windows-i386'].each { platform ->
|
||||
def dep = deps.appendNode('dependency')
|
||||
dep.appendNode('groupId', project.group)
|
||||
dep.appendNode('artifactId', "${project.archivesBaseName}-${platform}")
|
||||
dep.appendNode('version', project.version)
|
||||
}
|
||||
def dep = deps.appendNode('dependency')
|
||||
dep.appendNode('groupId', 'com.github.boukefalos')
|
||||
dep.appendNode('artifactId', 'jlibloader')
|
||||
dep.appendNode('version', '0.2')
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
BIN
cpp/jlibmimis/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
cpp/jlibmimis/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
#Sun Nov 09 12:02:22 GMT 2014
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
|
||||
164
cpp/jlibmimis/gradlew
vendored
164
cpp/jlibmimis/gradlew
vendored
@@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
90
cpp/jlibmimis/gradlew.bat
vendored
90
cpp/jlibmimis/gradlew.bat
vendored
@@ -1,90 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,89 +0,0 @@
|
||||
#include "mimis.h"
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
|
||||
bool getProcessEntry32(const char *program, PROCESSENTRY32 *pe32) {
|
||||
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (hSnapshot == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
bool bFound = false;
|
||||
while (Process32Next(hSnapshot, pe32) != false) {
|
||||
if (strcmp(program, pe32->szExeFile) == 0) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CloseHandle(hSnapshot);
|
||||
return bFound;
|
||||
}
|
||||
|
||||
bool getProcess(const char *program, HANDLE *hProcess) {
|
||||
PROCESSENTRY32 *pe32 = new PROCESSENTRY32;
|
||||
bool bResult = false;
|
||||
if (getProcessEntry32(program, pe32)) {
|
||||
*hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pe32->th32ProcessID);
|
||||
bResult = true;
|
||||
}
|
||||
delete pe32;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mimis_util_Native_getHandle(JNIEnv *env, jclass cls, jstring jwindow) {
|
||||
const char *window = env->GetStringUTFChars(jwindow, 0);
|
||||
return (int) FindWindow(window, NULL);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mimis_util_Native_sendMessage(JNIEnv *env, jclass cls, jint handle, jint message, jint wParam, jint lParam) {
|
||||
return SendMessage((HWND) handle, message, wParam, lParam);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mimis_util_Native_postMessage(JNIEnv *env, jclass cls, jint handle, jint message, jint wParam, jint lParam) {
|
||||
return PostMessage((HWND) handle, message, wParam, lParam);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mimis_util_Native_mapVirtualKey(JNIEnv *env, jclass cls, jint map, jint type) {
|
||||
return MapVirtualKey(map, type);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_mimis_util_Native_isRunning(JNIEnv *env, jclass cls, jstring jprogram) {
|
||||
const char *program = env->GetStringUTFChars(jprogram, 0);
|
||||
PROCESSENTRY32 *pe32 = new PROCESSENTRY32;
|
||||
bool bRunning = getProcessEntry32(program, pe32);
|
||||
delete pe32;
|
||||
return bRunning;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_mimis_util_Native_terminate(JNIEnv *env, jclass cls, jstring jprogram) {
|
||||
const char *program = env->GetStringUTFChars(jprogram, 0);
|
||||
HANDLE *hProcess = new HANDLE;
|
||||
bool bResult = false;
|
||||
if (getProcess(program, hProcess)) {
|
||||
bResult = TerminateProcess(*hProcess, 0);
|
||||
}
|
||||
delete hProcess;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_mimis_util_Native_getValue(JNIEnv *env, jclass cls, jint registry, jstring jkey, jstring jname) {
|
||||
const char *key = env->GetStringUTFChars(jkey, 0);
|
||||
const char *name = env->GetStringUTFChars(jname, 0);
|
||||
HKEY hKey;
|
||||
char *value = NULL;
|
||||
if (RegOpenKey((HKEY) registry, key, &hKey) == ERROR_SUCCESS) {
|
||||
char nameBuffer[255];
|
||||
byte valueBuffer[255];
|
||||
DWORD dwNameSize = sizeof(nameBuffer);
|
||||
DWORD dwValueSize = sizeof(valueBuffer);
|
||||
int i = 0;
|
||||
while (RegEnumValue(hKey, i++, nameBuffer, &dwNameSize, NULL, NULL, valueBuffer, &dwValueSize) == ERROR_SUCCESS) {
|
||||
if (strcmp(name, nameBuffer) == 0) {
|
||||
value = (char*) valueBuffer;
|
||||
break;
|
||||
}
|
||||
dwNameSize = sizeof(nameBuffer);
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return env->NewStringUTF(value);
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
tlhelp32.h - Include file for Tool help functions.
|
||||
|
||||
Written by Mumit Khan <khan@nanotech.wisc.edu>
|
||||
|
||||
This file is part of a free library for the Win32 API.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*/
|
||||
#ifndef _TLHELP32_H
|
||||
#define _TLHELP32_H
|
||||
#if __GNUC__ >=3
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define HF32_DEFAULT 1
|
||||
#define HF32_SHARED 2
|
||||
#define LF32_FIXED 0x1
|
||||
#define LF32_FREE 0x2
|
||||
#define LF32_MOVEABLE 0x4
|
||||
#define MAX_MODULE_NAME32 255
|
||||
#define TH32CS_SNAPHEAPLIST 0x1
|
||||
#define TH32CS_SNAPPROCESS 0x2
|
||||
#define TH32CS_SNAPTHREAD 0x4
|
||||
#define TH32CS_SNAPMODULE 0x8
|
||||
#define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST|TH32CS_SNAPPROCESS|TH32CS_SNAPTHREAD|TH32CS_SNAPMODULE)
|
||||
#define TH32CS_INHERIT 0x80000000
|
||||
typedef struct tagHEAPLIST32 {
|
||||
DWORD dwSize;
|
||||
DWORD th32ProcessID;
|
||||
DWORD th32HeapID;
|
||||
DWORD dwFlags;
|
||||
} HEAPLIST32,*PHEAPLIST32,*LPHEAPLIST32;
|
||||
typedef struct tagHEAPENTRY32 {
|
||||
DWORD dwSize;
|
||||
HANDLE hHandle;
|
||||
DWORD dwAddress;
|
||||
DWORD dwBlockSize;
|
||||
DWORD dwFlags;
|
||||
DWORD dwLockCount;
|
||||
DWORD dwResvd;
|
||||
DWORD th32ProcessID;
|
||||
DWORD th32HeapID;
|
||||
} HEAPENTRY32,*PHEAPENTRY32,*LPHEAPENTRY32;
|
||||
typedef struct tagPROCESSENTRY32W {
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ProcessID;
|
||||
DWORD th32DefaultHeapID;
|
||||
DWORD th32ModuleID;
|
||||
DWORD cntThreads;
|
||||
DWORD th32ParentProcessID;
|
||||
LONG pcPriClassBase;
|
||||
DWORD dwFlags;
|
||||
WCHAR szExeFile[MAX_PATH];
|
||||
} PROCESSENTRY32W,*PPROCESSENTRY32W,*LPPROCESSENTRY32W;
|
||||
typedef struct tagPROCESSENTRY32 {
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ProcessID;
|
||||
DWORD th32DefaultHeapID;
|
||||
DWORD th32ModuleID;
|
||||
DWORD cntThreads;
|
||||
DWORD th32ParentProcessID;
|
||||
LONG pcPriClassBase;
|
||||
DWORD dwFlags;
|
||||
CHAR szExeFile[MAX_PATH];
|
||||
} PROCESSENTRY32,*PPROCESSENTRY32,*LPPROCESSENTRY32;
|
||||
typedef struct tagTHREADENTRY32 {
|
||||
DWORD dwSize;
|
||||
DWORD cntUsage;
|
||||
DWORD th32ThreadID;
|
||||
DWORD th32OwnerProcessID;
|
||||
LONG tpBasePri;
|
||||
LONG tpDeltaPri;
|
||||
DWORD dwFlags;
|
||||
} THREADENTRY32,*PTHREADENTRY32,*LPTHREADENTRY32;
|
||||
typedef struct tagMODULEENTRY32W {
|
||||
DWORD dwSize;
|
||||
DWORD th32ModuleID;
|
||||
DWORD th32ProcessID;
|
||||
DWORD GlblcntUsage;
|
||||
DWORD ProccntUsage;
|
||||
BYTE *modBaseAddr;
|
||||
DWORD modBaseSize;
|
||||
HMODULE hModule;
|
||||
WCHAR szModule[MAX_MODULE_NAME32 + 1];
|
||||
WCHAR szExePath[MAX_PATH];
|
||||
} MODULEENTRY32W,*PMODULEENTRY32W,*LPMODULEENTRY32W;
|
||||
typedef struct tagMODULEENTRY32 {
|
||||
DWORD dwSize;
|
||||
DWORD th32ModuleID;
|
||||
DWORD th32ProcessID;
|
||||
DWORD GlblcntUsage;
|
||||
DWORD ProccntUsage;
|
||||
BYTE *modBaseAddr;
|
||||
DWORD modBaseSize;
|
||||
HMODULE hModule;
|
||||
char szModule[MAX_MODULE_NAME32 + 1];
|
||||
char szExePath[MAX_PATH];
|
||||
} MODULEENTRY32,*PMODULEENTRY32,*LPMODULEENTRY32;
|
||||
BOOL WINAPI Heap32First(LPHEAPENTRY32,DWORD,DWORD);
|
||||
BOOL WINAPI Heap32ListFirst(HANDLE,LPHEAPLIST32);
|
||||
BOOL WINAPI Heap32ListNext(HANDLE,LPHEAPLIST32);
|
||||
BOOL WINAPI Heap32Next(LPHEAPENTRY32);
|
||||
BOOL WINAPI Module32First(HANDLE,LPMODULEENTRY32);
|
||||
BOOL WINAPI Module32FirstW(HANDLE,LPMODULEENTRY32W);
|
||||
BOOL WINAPI Module32Next(HANDLE,LPMODULEENTRY32);
|
||||
BOOL WINAPI Module32NextW(HANDLE,LPMODULEENTRY32W);
|
||||
BOOL WINAPI Process32First(HANDLE,LPPROCESSENTRY32);
|
||||
BOOL WINAPI Process32FirstW(HANDLE,LPPROCESSENTRY32W);
|
||||
BOOL WINAPI Process32Next(HANDLE,LPPROCESSENTRY32);
|
||||
BOOL WINAPI Process32NextW(HANDLE,LPPROCESSENTRY32W);
|
||||
BOOL WINAPI Thread32First(HANDLE,LPTHREADENTRY32);
|
||||
BOOL WINAPI Thread32Next(HANDLE,LPTHREADENTRY32);
|
||||
BOOL WINAPI Toolhelp32ReadProcessMemory(DWORD,LPCVOID,LPVOID,DWORD,LPDWORD);
|
||||
HANDLE WINAPI CreateToolhelp32Snapshot(DWORD,DWORD);
|
||||
#ifdef UNICODE
|
||||
#define LPMODULEENTRY32 LPMODULEENTRY32W
|
||||
#define LPPROCESSENTRY32 LPPROCESSENTRY32W
|
||||
#define MODULEENTRY32 MODULEENTRY32W
|
||||
#define Module32First Module32FirstW
|
||||
#define Module32Next Module32NextW
|
||||
#define PMODULEENTRY32 PMODULEENTRY32W
|
||||
#define PPROCESSENTRY32 PPROCESSENTRY32W
|
||||
#define PROCESSENTRY32 PROCESSENTRY32W
|
||||
#define Process32First Process32FirstW
|
||||
#define Process32Next Process32NextW
|
||||
#endif /* UNICODE */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _TLHELP32_H */
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package mimis.util;
|
||||
|
||||
import mimis.value.Registry;
|
||||
import mimis.value.Windows;
|
||||
|
||||
public class Native {
|
||||
static {
|
||||
com.github.boukefalos.jlibloader.Native.load("com.github.boukefalos", "jlibmimis");
|
||||
}
|
||||
|
||||
public native static int getHandle(String window);
|
||||
|
||||
public static int sendMessage(int handle, Windows windows, int wParam, int lParam) {
|
||||
return sendMessage(handle, windows.getCode(), wParam, lParam);
|
||||
}
|
||||
|
||||
public native static int sendMessage(int handle, int message, int wParam, int lParam);
|
||||
|
||||
public static int postMessage(int handle, Windows windows, int wParam, int lParam) {
|
||||
return postMessage(handle, windows.getCode(), wParam, lParam);
|
||||
}
|
||||
|
||||
public native static int postMessage(int handle, int message, int wParam, int lParam);
|
||||
|
||||
public static int mapVirtualKey(int code, Windows windows) {
|
||||
return mapVirtualKey(code, windows.getCode());
|
||||
}
|
||||
|
||||
public native static int mapVirtualKey(int code, int type);
|
||||
|
||||
public native static boolean isRunning(String program);
|
||||
|
||||
public native static boolean terminate(String program);
|
||||
|
||||
public static String getValue(Registry registry, String key) {
|
||||
return getValue(registry, key, "");
|
||||
}
|
||||
|
||||
public static String getValue(Registry registry, String key, String name) {
|
||||
return getValue(registry.getCode(), key, name);
|
||||
}
|
||||
|
||||
public native static String getValue(int registry, String key, String name);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package mimis.value;
|
||||
|
||||
public enum Registry {
|
||||
CLASSES_ROOT (0x80000000),
|
||||
CURRENT_USER (0x80000001),
|
||||
LOCAL_MACHINE (0x80000002),
|
||||
USERS (0x80000003),
|
||||
PERFORMANCE_DATA (0x80000004),
|
||||
CURRENT_CONFIG (0x80000005),
|
||||
DYN_DATA (0x80000006);
|
||||
|
||||
protected int code;
|
||||
|
||||
private Registry(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package mimis.value;
|
||||
|
||||
public enum Windows {
|
||||
WM_CLOSE (0x0010),
|
||||
WM_COMMAND (0x0111),
|
||||
WM_SYSCOMMAND (0x0112),
|
||||
WM_APPCOMMAND (0x0319),
|
||||
WM_USER (0x0400),
|
||||
MAPVK_VK_TO_VSC (0);
|
||||
|
||||
protected int code;
|
||||
|
||||
private Windows(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.so.debug.1813551917">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.so.debug.1813551917" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<macros>
|
||||
<stringMacro name="target" type="VALUE_TEXT" value="pipe"/>
|
||||
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.7.0"/>
|
||||
</macros>
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/Pipe"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/Pipe/Debug"/>
|
||||
<entry flags="RESOLVED" kind="libraryFile" name="Pipe" srcPrefixMapping="" srcRootPath=""/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="dll" artifactName="${target}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.so.debug.1813551917" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.so.debug" postbuildStep="./copy.bat">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.mingw.so.debug.1813551917." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.debug.139919199" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.debug">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.debug.1189720953" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.debug"/>
|
||||
<builder buildPath="${workspace_loc:/Pipe/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.482966139" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
||||
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug.268346771" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.665305624" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1220825669" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug.1175271295" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug">
|
||||
<option id="gnu.cpp.compiler.mingw.so.debug.option.optimization.level.1125922986" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.mingw.so.debug.option.debugging.level.1641613502" name="Debug Level" superClass="gnu.cpp.compiler.mingw.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.939510920" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.1399500702" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug">
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.so.debug.option.optimization.level.234429006" name="Optimization Level" superClass="gnu.c.compiler.mingw.so.debug.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.mingw.so.debug.option.debugging.level.1525375982" name="Debug Level" superClass="gnu.c.compiler.mingw.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.88885521" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${jdk}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/include}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.747324638" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug.1007471610" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug">
|
||||
<option defaultValue="true" id="gnu.c.link.mingw.so.debug.option.shared.1850054546" name="Shared (-shared)" superClass="gnu.c.link.mingw.so.debug.option.shared" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.2022087314" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug">
|
||||
<option defaultValue="true" id="gnu.cpp.link.mingw.so.debug.option.shared.357933903" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.debug.option.shared" valueType="boolean"/>
|
||||
<option id="gnu.cpp.link.option.flags.1387180659" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-Wl,--kill-at -static-libgcc" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2125675597" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
<outputType id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.output.216466795" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.output"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.so.release.2043271336">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.so.release.2043271336" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<macros>
|
||||
<stringMacro name="target" type="VALUE_TEXT" value="pipe"/>
|
||||
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.7.0"/>
|
||||
</macros>
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/Pipe"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/Pipe/Release"/>
|
||||
<entry flags="RESOLVED" kind="libraryFile" name="Pipe" srcPrefixMapping="" srcRootPath=""/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="dll" artifactName="${target}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.so.release.2043271336" name="Release" parent="cdt.managedbuild.config.gnu.mingw.so.release" postbuildStep="./copy.bat">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.mingw.so.release.2043271336." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.release.1271980283" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.release">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.release.368721242" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.release"/>
|
||||
<builder buildPath="${workspace_loc:/Pipe/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.2065732021" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
||||
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.mingw.so.release.109377381" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.689046683" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1183393349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release.726851992" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release">
|
||||
<option id="gnu.cpp.compiler.mingw.so.release.option.optimization.level.2002053108" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.so.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.mingw.so.release.option.debugging.level.907936589" name="Debug Level" superClass="gnu.cpp.compiler.mingw.so.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.204761037" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.1321746613" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.so.release.option.optimization.level.735179609" name="Optimization Level" superClass="gnu.c.compiler.mingw.so.release.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.mingw.so.release.option.debugging.level.265400846" name="Debug Level" superClass="gnu.c.compiler.mingw.so.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.1576117703" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${jdk}/include""/>
|
||||
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/include}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1173268559" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release.1652830435" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release">
|
||||
<option defaultValue="true" id="gnu.c.link.mingw.so.release.option.shared.1257748519" name="Shared (-shared)" superClass="gnu.c.link.mingw.so.release.option.shared" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.1600111105" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release">
|
||||
<option defaultValue="true" id="gnu.cpp.link.mingw.so.release.option.shared.684498624" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.release.option.shared" valueType="boolean"/>
|
||||
<option id="gnu.cpp.link.option.flags.51892807" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-Wl,--kill-at -static-libgcc" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.656026656" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
<outputType id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.output.432743873" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.output"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Pipe.cdt.managedbuild.target.gnu.mingw.so.1070782613" name="Shared Library" projectType="cdt.managedbuild.target.gnu.mingw.so"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.debug.1813551917;cdt.managedbuild.config.gnu.mingw.so.debug.1813551917.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug.1175271295;cdt.managedbuild.tool.gnu.cpp.compiler.input.939510920">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.release.2043271336;cdt.managedbuild.config.gnu.mingw.so.release.2043271336.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release.726851992;cdt.managedbuild.tool.gnu.cpp.compiler.input.204761037">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.release.2043271336;cdt.managedbuild.config.gnu.mingw.so.release.2043271336.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.1321746613;cdt.managedbuild.tool.gnu.c.compiler.input.1173268559">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.debug.1813551917;cdt.managedbuild.config.gnu.mingw.so.debug.1813551917.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.1399500702;cdt.managedbuild.tool.gnu.c.compiler.input.747324638">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
</cproject>
|
||||
@@ -1,150 +0,0 @@
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'c'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://github.com/Boukefalos/jlibloader/raw/mvn-repo/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.github.boukefalos:jlibloader:0.2'
|
||||
}
|
||||
|
||||
group = 'com.github.boukefalos'
|
||||
project.archivesBaseName = 'jlibpipe'
|
||||
version = '0.1'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '1.12'
|
||||
}
|
||||
|
||||
model {
|
||||
platforms {
|
||||
windows_i386 {
|
||||
architecture 'i386'
|
||||
operatingSystem 'windows'
|
||||
}
|
||||
windows_amd64 {
|
||||
architecture 'amd64'
|
||||
operatingSystem 'windows'
|
||||
}
|
||||
}
|
||||
toolChains {
|
||||
gcc(Gcc) {
|
||||
addPlatformConfiguration(new TargetPlatformConfiguration() {
|
||||
boolean supportsPlatform(Platform platform) {
|
||||
platform.operatingSystem.current && platform.operatingSystem.name == 'windows' &&
|
||||
platform.architecture.name == 'amd64'
|
||||
}
|
||||
List<String> getCppCompilerArgs() { ['-m64', '-fpermissive'] }
|
||||
List<String> getCCompilerArgs() { ['-m64'] }
|
||||
List<String> getObjectiveCCompilerArgs() { ['-m64'] }
|
||||
List<String> getObjectiveCppCompilerArgs() { ['-m64'] }
|
||||
List<String> getAssemblerArgs() { ['--64'] }
|
||||
List<String> getLinkerArgs() { ['-m64'] }
|
||||
List<String> getStaticLibraryArchiverArgs() { [] }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def jniHeadersDir = file("$buildDir/headers")
|
||||
|
||||
task jniHeaders(dependsOn: compileJava) {
|
||||
def outputFile = file("$jniHeadersDir/pipe.h")
|
||||
inputs.files sourceSets.main.output
|
||||
outputs.file outputFile
|
||||
exec {
|
||||
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
|
||||
args '-o', outputFile
|
||||
args '-classpath', sourceSets.main.output.classesDir
|
||||
args '-classpath', file("$buildDir/../bin")
|
||||
args 'pipe.Pipe'
|
||||
}
|
||||
}
|
||||
|
||||
libraries {
|
||||
main {
|
||||
baseName project.archivesBaseName
|
||||
}
|
||||
all {
|
||||
binaries.all {
|
||||
cCompiler.args '-I' + jniHeadersDir
|
||||
cCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
|
||||
cCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
|
||||
linker.args '-Wl,--kill-at', '-static-libgcc', '-static-libstdc++'
|
||||
tasks.withType(CCompile) { task ->
|
||||
task.dependsOn jniHeaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Upload) {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
repository(url: uri('../../.maven'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
jni
|
||||
}
|
||||
|
||||
def deployer = uploadJni.repositories.mavenDeployer
|
||||
|
||||
binaries.withType(SharedLibraryBinary) { binary ->
|
||||
if (!buildable) {
|
||||
return
|
||||
}
|
||||
def variantName = "${targetPlatform.operatingSystem.name}-${targetPlatform.architecture.name}"
|
||||
def taskName = "jar-${variantName}"
|
||||
def nativeJar = project.tasks.findByName(taskName)
|
||||
if (nativeJar == null) {
|
||||
nativeJar = project.task(taskName, type: Jar) {
|
||||
baseName = "${project.archivesBaseName}-$variantName"
|
||||
}
|
||||
artifacts {
|
||||
jni nativeJar
|
||||
}
|
||||
def jniPom = deployer.addFilter(variantName) { artifact, file ->
|
||||
return file == nativeJar.archivePath
|
||||
}
|
||||
jniPom.groupId = project.group
|
||||
jniPom.artifactId = nativeJar.baseName
|
||||
jniPom.version = project.version
|
||||
jniPom.scopeMappings.mappings.clear()
|
||||
}
|
||||
def builderTask = binary.tasks.builder
|
||||
def libraryDirectory = project.group.replace('.', '/') + "/${project.archivesBaseName}/${variantName}"
|
||||
nativeJar.into(libraryDirectory) { from builderTask.outputFile }
|
||||
nativeJar.dependsOn builderTask
|
||||
}
|
||||
|
||||
def mainPom = uploadArchives.repositories.mavenDeployer.pom
|
||||
mainPom.groupId = project.group
|
||||
mainPom.artifactId = jar.baseName
|
||||
mainPom.version = project.version
|
||||
mainPom.scopeMappings.mappings.clear()
|
||||
mainPom.withXml { provider ->
|
||||
def node = provider.asNode()
|
||||
def deps = node.appendNode('dependencies')
|
||||
['windows-amd64', 'windows-i386'].each { platform ->
|
||||
def dep = deps.appendNode('dependency')
|
||||
dep.appendNode('groupId', project.group)
|
||||
dep.appendNode('artifactId', "${project.archivesBaseName}-${platform}")
|
||||
dep.appendNode('version', project.version)
|
||||
}
|
||||
def dep = deps.appendNode('dependency')
|
||||
dep.appendNode('groupId', 'com.github.boukefalos')
|
||||
dep.appendNode('artifactId', 'jlibloader')
|
||||
dep.appendNode('version', '0.2')
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
BIN
cpp/jlibpipe/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
cpp/jlibpipe/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
#Sun Nov 09 12:02:22 GMT 2014
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
|
||||
164
cpp/jlibpipe/gradlew
vendored
164
cpp/jlibpipe/gradlew
vendored
@@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
90
cpp/jlibpipe/gradlew.bat
vendored
90
cpp/jlibpipe/gradlew.bat
vendored
@@ -1,90 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,192 +0,0 @@
|
||||
#include <windows.h>
|
||||
#include <strsafe.h>
|
||||
#include <jni.h>
|
||||
#include "pipe.h"
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipe_CreateNamedPipe(JNIEnv *env,
|
||||
jclass className, jstring sPipeName, jint dwOpenMode, jint dwPipeMode,
|
||||
jint nMaxInstances, jint nOutBufferSize, jint nInBufferSize,
|
||||
jint nDefaultTimeOut, jint lpSecurityAttributes) {
|
||||
HANDLE pipeHandler;
|
||||
LPCSTR pipeName;
|
||||
pipeName = (*env)->GetStringUTFChars(env, sPipeName, NULL );
|
||||
if (pipeName == NULL )
|
||||
return -1;
|
||||
|
||||
if (DEBUG) {
|
||||
printf("Native: Pipe Name %s\n", pipeName);
|
||||
printf("Native: dwOpenMode %d\n", dwOpenMode);
|
||||
printf("Native: dwPipeMode %d\n", dwPipeMode);
|
||||
printf("Native: nMaxInstances %d\n", nMaxInstances);
|
||||
printf("Native: nOutBufferSize %d\n", nOutBufferSize);
|
||||
printf("Native: nInBufferSize %d\n", nInBufferSize);
|
||||
printf("Native: nDefaultTimeOut %d\n", nDefaultTimeOut);
|
||||
}
|
||||
|
||||
pipeHandler = CreateNamedPipe((LPCSTR) pipeName, dwOpenMode, dwPipeMode,
|
||||
nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut,
|
||||
(LPSECURITY_ATTRIBUTES) lpSecurityAttributes);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, sPipeName, pipeName);
|
||||
return (jint) pipeHandler;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipe_ConnectNamedPipe(JNIEnv *env,
|
||||
jclass className, jint hNamedPipe, jint lpOverlapped) {
|
||||
BOOL fConnected;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
fConnected = ConnectNamedPipe(pipeHandler, (LPOVERLAPPED) lpOverlapped);
|
||||
return fConnected;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipe_GetLastError(JNIEnv *env,
|
||||
jclass className) {
|
||||
DWORD errorNumber = GetLastError();
|
||||
return (jint) errorNumber;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipe_CloseHandle(JNIEnv *env,
|
||||
jclass className, jint hNamedPipe) {
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
result = CloseHandle(pipeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jbyteArray JNICALL Java_pipe_Pipe_ReadFile(JNIEnv *env,
|
||||
jclass className, jint hNamedPipe, jint nNumberOfBytesToRead) {
|
||||
int bytesRead = 0;
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
LPVOID buffer;
|
||||
jbyteArray lpBuffer;
|
||||
|
||||
buffer = (LPVOID) LocalAlloc(LMEM_ZEROINIT, nNumberOfBytesToRead);
|
||||
|
||||
if (DEBUG) {
|
||||
printf(
|
||||
"Native: Before ReadFile pipeHandler %d nNumberOfBytesToRead %d\n",
|
||||
pipeHandler, nNumberOfBytesToRead);
|
||||
}
|
||||
result = ReadFile(pipeHandler, (LPVOID) buffer,
|
||||
(DWORD) nNumberOfBytesToRead, &bytesRead, (LPOVERLAPPED) 0);
|
||||
if (result) {
|
||||
lpBuffer = (*env)->NewByteArray(env, (jsize) bytesRead);
|
||||
(*env)->SetByteArrayRegion(env, lpBuffer, 0, (jsize) bytesRead,
|
||||
(jbyte *) buffer);
|
||||
} else
|
||||
bytesRead = 0;
|
||||
|
||||
LocalFree(buffer);
|
||||
|
||||
if (DEBUG) {
|
||||
printf("Native: After ReadFile BytesRead %d\n", bytesRead);
|
||||
}
|
||||
return lpBuffer;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipe_WriteFile(JNIEnv *env, jclass className,
|
||||
jint hNamedPipe, jbyteArray lpBuffer, jint nNumberOfBytesToWrite) {
|
||||
int bytesWritten = 0;
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
LPVOID buffer;
|
||||
|
||||
buffer = (LPVOID) LocalAlloc(LMEM_ZEROINIT, nNumberOfBytesToWrite);
|
||||
|
||||
(*env)->GetByteArrayRegion(env, lpBuffer, 0, nNumberOfBytesToWrite, buffer);
|
||||
result = WriteFile(pipeHandler, buffer, (DWORD) nNumberOfBytesToWrite,
|
||||
(LPDWORD) &bytesWritten, (LPOVERLAPPED) 0);
|
||||
LocalFree(buffer);
|
||||
|
||||
if (DEBUG) {
|
||||
printf("Native: After WriteFile BytesReadWritten %d\n", bytesWritten);
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
if (GetLastError() != ERROR_IO_PENDING)
|
||||
result = 0;
|
||||
else
|
||||
result = 1;
|
||||
}
|
||||
if (!result) {
|
||||
bytesWritten = -1;
|
||||
}
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipe_FlushFileBuffers(JNIEnv *env,
|
||||
jclass className, jint hNamedPipe) {
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
result = FlushFileBuffers(pipeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipe_DisconnectNamedPipe(JNIEnv *env,
|
||||
jclass className, jint hNamedPipe) {
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
result = DisconnectNamedPipe(pipeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipe_CreateFile(JNIEnv *env, jclass className,
|
||||
jstring lpFileName, jint dwDesiredAccess, jint dwShareMode,
|
||||
jint lpSecurityAttributes, jint dwCreationDisposition,
|
||||
jint dwFlagsAndAttributes, jint hTemplateFile) {
|
||||
HANDLE pipeHandler;
|
||||
const jbyte *fileName;
|
||||
fileName = (*env)->GetStringUTFChars(env, lpFileName, NULL );
|
||||
if (fileName == NULL )
|
||||
return -1;
|
||||
pipeHandler = CreateFile((LPCSTR) fileName, (DWORD) dwDesiredAccess,
|
||||
(DWORD) dwShareMode, (LPSECURITY_ATTRIBUTES) lpSecurityAttributes,
|
||||
(DWORD) dwCreationDisposition, (DWORD) dwFlagsAndAttributes,
|
||||
(HANDLE) hTemplateFile);
|
||||
return (jint) pipeHandler;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipe_WaitNamedPipe(JNIEnv *env,
|
||||
jclass className, jstring lpNamedPipeName, jint nTimeOut) {
|
||||
BOOL result;
|
||||
const jbyte *pipeName;
|
||||
pipeName = (*env)->GetStringUTFChars(env, lpNamedPipeName, NULL );
|
||||
if (pipeName == NULL )
|
||||
return 0;
|
||||
result = WaitNamedPipe((LPCSTR) pipeName, (DWORD) nTimeOut);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_pipe_Pipe_FormatMessage(JNIEnv *env,
|
||||
jclass className, jint errorCode) {
|
||||
LPVOID lpMsgBuf;
|
||||
LPVOID lpDisplayBuf;
|
||||
DWORD dw = (DWORD) errorCode;
|
||||
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
|
||||
| FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0,
|
||||
NULL );
|
||||
|
||||
lpDisplayBuf = (LPVOID) LocalAlloc(LMEM_ZEROINIT,
|
||||
(lstrlen((LPCTSTR) lpMsgBuf) + 40) * sizeof(TCHAR));
|
||||
StringCchPrintf((LPTSTR) lpDisplayBuf,
|
||||
LocalSize(lpDisplayBuf) / sizeof(TCHAR),
|
||||
TEXT("Failed with error %d: %s"), dw, lpMsgBuf);
|
||||
return (jstring) (*env)->NewStringUTF(env, lpDisplayBuf);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_pipe_Pipe_Print(JNIEnv *env, jclass className,
|
||||
jstring lpMsgBuf) {
|
||||
const jbyte *str;
|
||||
str = (*env)->GetStringUTFChars(env, lpMsgBuf, NULL );
|
||||
if (str == NULL )
|
||||
return;
|
||||
printf("Native: %s\n", str);
|
||||
(*env)->ReleaseStringUTFChars(env, lpMsgBuf, str);
|
||||
return;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package pipe;
|
||||
|
||||
import com.github.boukefalos.jlibloader.Native;
|
||||
|
||||
/**
|
||||
* @author Vikram S Khatri vikram.khatri@us.ibm.com
|
||||
*/
|
||||
public class Pipe {
|
||||
static final int ERROR_PIPE_CONNECTED = 535;
|
||||
static final int ERROR_BROKEN_PIPE = 109;
|
||||
static final int PIPE_ACCESS_DUPLEX = 0x00000003;
|
||||
static final int PIPE_WAIT = 0x00000000;
|
||||
|
||||
static {
|
||||
Native.load("com.github.boukefalos", "jlibpipe");
|
||||
}
|
||||
|
||||
public static final native int CreateNamedPipe(
|
||||
String pipeName,
|
||||
int ppenMode,
|
||||
int pipeMode,
|
||||
int maxInstances,
|
||||
int outBufferSize,
|
||||
int inBufferSize,
|
||||
int defaultTimeOut,
|
||||
int securityAttributes);
|
||||
|
||||
public static final native boolean ConnectNamedPipe(int namedPipeHandle, int overlapped);
|
||||
|
||||
public static final native int GetLastError();
|
||||
|
||||
public static final native boolean CloseHandle(int bbject);
|
||||
|
||||
public static final native byte[] ReadFile(int file, int numberOfBytesToRead);
|
||||
|
||||
public static final native int WriteFile(int file, byte[] buffer, int numberOfBytesToWrite);
|
||||
|
||||
public static final native boolean FlushFileBuffers(int file);
|
||||
|
||||
public static final native boolean DisconnectNamedPipe(int namedPipeHandle);
|
||||
|
||||
public static final native int CreateFile(
|
||||
String fileName,
|
||||
int desiredAccess,
|
||||
int shareMode,
|
||||
int securityAttributes,
|
||||
int creationDisposition,
|
||||
int flagsAndAttributes,
|
||||
int templateFile);
|
||||
|
||||
public static final native boolean WaitNamedPipe(String namedPipeName, int timeOut);
|
||||
|
||||
public static final native String FormatMessage(int errorCode);
|
||||
|
||||
public static final native void Print(String message);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package pipe;
|
||||
|
||||
import java.io.RandomAccessFile;
|
||||
|
||||
public class Client {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// Connect to the pipe
|
||||
RandomAccessFile pipe = new RandomAccessFile("\\\\.\\pipe\\detest", "rw");
|
||||
String echoText = "Hello word\n";
|
||||
|
||||
// write to pipe
|
||||
pipe.write(echoText.getBytes());
|
||||
|
||||
// read response
|
||||
String echoResponse = pipe.readLine();
|
||||
System.out.println(echoResponse);
|
||||
pipe.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package pipe;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class TestPipe {
|
||||
|
||||
private int namedPipeHandle;
|
||||
private String pipeName, srcFile;
|
||||
private int pipeBuffer = 131072, fileBuffer = 8192;
|
||||
|
||||
public TestPipe(String pipeName, String srcFile) {
|
||||
this.pipeName = pipeName;
|
||||
this.srcFile = srcFile;
|
||||
}
|
||||
|
||||
private void log(String message) {
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
private boolean createPipe() {
|
||||
namedPipeHandle = Pipe.CreateNamedPipe(
|
||||
pipeName,
|
||||
Pipe.PIPE_ACCESS_DUPLEX,
|
||||
Pipe.PIPE_WAIT,
|
||||
5,
|
||||
pipeBuffer,
|
||||
pipeBuffer,
|
||||
0xffffffff,
|
||||
0);
|
||||
if (namedPipeHandle == -1) {
|
||||
log("CreateNamedPipe failed for " + pipeName + " for error Message " + Pipe.FormatMessage(Pipe.GetLastError()));
|
||||
} else {
|
||||
log("Named Pipe " + pipeName + " created successfully Handle=" + namedPipeHandle);
|
||||
}
|
||||
return namedPipeHandle != -1;
|
||||
}
|
||||
|
||||
private boolean connectToPipe() {
|
||||
log("Waiting for a client to connect to pipe " + pipeName);
|
||||
boolean connected = Pipe.ConnectNamedPipe(namedPipeHandle, 0);
|
||||
if (!connected) {
|
||||
int lastError = Pipe.GetLastError();
|
||||
if (lastError == Pipe.ERROR_PIPE_CONNECTED)
|
||||
connected = true;
|
||||
}
|
||||
log((connected ? "Connected to the pipe " : "Falied to connect to the pipe ") + pipeName);
|
||||
return connected;
|
||||
}
|
||||
|
||||
public void runPipe() {
|
||||
if (createPipe() && connectToPipe()) {
|
||||
log("Client connected.");
|
||||
try {
|
||||
File f1 = new File(this.srcFile);
|
||||
InputStream in = new FileInputStream(f1);
|
||||
log("Sending data to the pipe");
|
||||
byte[] buf = new byte[fileBuffer];
|
||||
int len, bytesWritten;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
bytesWritten = Pipe.WriteFile(namedPipeHandle, buf, len);
|
||||
log("Sent " + len + "/" + bytesWritten + " bytes to the pipe");
|
||||
if (bytesWritten == -1) {
|
||||
int errorNumber = Pipe.GetLastError();
|
||||
log("Error Writing to pipe " + Pipe.FormatMessage(errorNumber));
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
Pipe.FlushFileBuffers(namedPipeHandle);
|
||||
Pipe.CloseHandle(namedPipeHandle);
|
||||
Pipe.DisconnectNamedPipe(namedPipeHandle);
|
||||
log("Writing to the pipe completed.");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String pipeName = "\\\\.\\pipe\\detest";
|
||||
String fileName = "C:\\Users\\Rik\\Music\\Artists\\+44\\When Your Heart Stops Beating\\+44 - 155.mp3";
|
||||
TestPipe testPipe = new TestPipe(pipeName, fileName);
|
||||
testPipe.runPipe();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user