Merge branch 'develop-pipe' into develop
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
||||
/cpp/Pipe/.settings
|
||||
/cpp/pipe/.settings
|
||||
/cpp/pipe/Debug/src
|
||||
/cpp/pipe/Release/src
|
||||
|
||||
@@ -1,154 +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.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<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"/>
|
||||
</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">
|
||||
<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 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" 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.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<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"/>
|
||||
</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">
|
||||
<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 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" 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,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Pipe</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,262 +0,0 @@
|
||||
#include <windows.h>
|
||||
#include <strsafe.h>
|
||||
#include <jni.h>
|
||||
#include "pipe.h"
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipes_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_Pipes_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_Pipes_GetLastError
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass className
|
||||
)
|
||||
{
|
||||
DWORD errorNumber = GetLastError();
|
||||
return (jint) errorNumber;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_CloseHandle
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass className,
|
||||
jint hNamedPipe
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
result = CloseHandle(pipeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jbyteArray JNICALL Java_pipe_Pipes_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_Pipes_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_Pipes_FlushFileBuffers
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass className,
|
||||
jint hNamedPipe
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
result = FlushFileBuffers(pipeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_DisconnectNamedPipe
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass className,
|
||||
jint hNamedPipe
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
HANDLE pipeHandler = (HANDLE) hNamedPipe;
|
||||
result = DisconnectNamedPipe(pipeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipes_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_Pipes_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_Pipes_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_Pipes_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,109 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class Pipes */
|
||||
|
||||
#ifndef _Included_pipe
|
||||
#define _Included_pipe
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: CreateNamedPipe
|
||||
* Signature: (Ljava/lang/String;IIIIIII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipes_CreateNamedPipe
|
||||
(JNIEnv *, jclass, jstring, jint, jint, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: ConnectNamedPipe
|
||||
* Signature: (II)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_ConnectNamedPipe
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: GetLastError
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipes_GetLastError
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: CloseHandle
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_CloseHandle
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: ReadFile
|
||||
* Signature: (II)[B
|
||||
*/
|
||||
JNIEXPORT jbyteArray JNICALL Java_pipe_Pipes_ReadFile
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: WriteFile
|
||||
* Signature: (I[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipes_WriteFile
|
||||
(JNIEnv *, jclass, jint, jbyteArray, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: FlushFileBuffers
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_FlushFileBuffers
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: DisconnectNamedPipe
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_DisconnectNamedPipe
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: CreateFile
|
||||
* Signature: (Ljava/lang/String;IIIIII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_pipe_Pipes_CreateFile
|
||||
(JNIEnv *, jclass, jstring, jint, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: WaitNamedPipe
|
||||
* Signature: (Ljava/lang/String;I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_pipe_Pipes_WaitNamedPipe
|
||||
(JNIEnv *, jclass, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: FormatMessage
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_pipe_Pipes_FormatMessage
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: Pipes
|
||||
* Method: Print
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_pipe_Pipes_Print
|
||||
(JNIEnv *, jclass, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
<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="target" type="VALUE_TEXT" value="pipe"/>
|
||||
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.7.0"/>
|
||||
</macros>
|
||||
<externalSettings>
|
||||
@@ -24,12 +24,12 @@
|
||||
</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">
|
||||
<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 id="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug.268346771" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug">
|
||||
<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"/>
|
||||
@@ -53,7 +53,7 @@
|
||||
</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" superClass="gnu.cpp.link.option.flags" value="-Wl,--kill-at -static-libgcc" valueType="string"/>
|
||||
<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)"/>
|
||||
@@ -69,7 +69,7 @@
|
||||
<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="target" type="VALUE_TEXT" value="pipe"/>
|
||||
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.7.0"/>
|
||||
</macros>
|
||||
<externalSettings>
|
||||
@@ -87,7 +87,7 @@
|
||||
</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">
|
||||
<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"/>
|
||||
@@ -116,7 +116,7 @@
|
||||
</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" superClass="gnu.cpp.link.option.flags" value="-Wl,--kill-at -static-libgcc" valueType="string"/>
|
||||
<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)"/>
|
||||
|
||||
1
cpp/pipe/Debug/copy.bat
Normal file
1
cpp/pipe/Debug/copy.bat
Normal file
@@ -0,0 +1 @@
|
||||
copy pipe.dll ..\..\..\java\pipe.dll
|
||||
BIN
cpp/pipe/Debug/pipe.dll
Normal file
BIN
cpp/pipe/Debug/pipe.dll
Normal file
Binary file not shown.
1
cpp/pipe/Release/copy.bat
Normal file
1
cpp/pipe/Release/copy.bat
Normal file
@@ -0,0 +1 @@
|
||||
copy pipe.dll ..\..\..\java\pipe.dll
|
||||
BIN
cpp/pipe/Release/pipe.dll
Normal file
BIN
cpp/pipe/Release/pipe.dll
Normal file
Binary file not shown.
BIN
java/pipe.dll
Normal file
BIN
java/pipe.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user