Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.java1
-rw-r--r--core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.properties1
-rw-r--r--core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/BaudRate.java1
-rw-r--r--core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/SerialPort.java26
-rw-r--r--core/org.eclipse.cdt.core.win32.x86/os/win32/x86/.gitignore4
-rw-r--r--core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/.gitignore4
-rw-r--r--core/org.eclipse.cdt.core.win32/library/.gitignore8
-rw-r--r--core/org.eclipse.cdt.core.win32/library/cdt-win32.sln47
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/.gitignore2
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/dllmain.cpp28
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/serial.cpp149
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj180
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj.filters36
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/stdafx.cpp14
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/stdafx.h22
-rw-r--r--core/org.eclipse.cdt.core.win32/library/serial/targetver.h18
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/.gitignore1
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/Makefile28
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp28
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp14
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h22
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/targetver.h18
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp304
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj175
-rw-r--r--core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters36
25 files changed, 983 insertions, 184 deletions
diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.java
index cd406359b45..d783d90fffc 100644
--- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.java
+++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.java
@@ -17,6 +17,7 @@ public class Messages extends NLS {
public static String Util_exception_cannotSetTerminalSize;
public static String Util_error_cannotRun;
public static String Util_exception_closeError;
+ public static String SerialPort_PORT_IS_OPEN;
static {
// Initialize resource bundle.
diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.properties b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.properties
index e1ab7f1ac42..cc7a5f26a37 100644
--- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.properties
+++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/internal/core/natives/Messages.properties
@@ -14,3 +14,4 @@ Util_exception_cannotCreatePty=Cannot create pty
Util_exception_closeError=close error
Util_exception_cannotSetTerminalSize=Setting terminal size is not supported
Util_error_cannotRun=Cannot run program "{0}": {1}
+SerialPort_PORT_IS_OPEN=Port is open
diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/BaudRate.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/BaudRate.java
index bb1236d087a..8c1342339fc 100644
--- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/BaudRate.java
+++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/BaudRate.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.utils.serial;
*/
public enum BaudRate {
- B0(0),
B50(50),
B75(75),
B110(110),
diff --git a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/SerialPort.java b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/SerialPort.java
index fdc5c1030e1..7319a16798a 100644
--- a/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/SerialPort.java
+++ b/core/org.eclipse.cdt.core.native/src/org/eclipse/cdt/utils/serial/SerialPort.java
@@ -15,8 +15,12 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
import java.util.regex.Pattern;
+import org.eclipse.cdt.internal.core.natives.Messages;
+import org.eclipse.cdt.utils.WindowsRegistry;
import org.eclipse.core.runtime.Platform;
/**
@@ -32,7 +36,8 @@ public class SerialPort {
private StopBits stopBits = StopBits.S1;
private long handle;
- private static final String PORT_OPEN = "Port is open";
+ private static final String SERIAL_KEY = "HARDWARE\\DEVICEMAP\\SERIALCOMM"; //$NON-NLS-1$
+ private static final String PORT_OPEN = Messages.SerialPort_PORT_IS_OPEN;
static {
System.loadLibrary("serial"); //$NON-NLS-1$
@@ -71,6 +76,22 @@ public class SerialPort {
names[i] = files[i].getAbsolutePath();
}
return names;
+ } else if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ WindowsRegistry reg = WindowsRegistry.getRegistry();
+ if (reg != null) {
+ List<String> ports = new ArrayList<>();
+ int i = 0;
+ String name = reg.getLocalMachineValueName(SERIAL_KEY, i);
+ while (name != null) {
+ String value = reg.getLocalMachineValue(SERIAL_KEY, name);
+ ports.add(value);
+ i++;
+ name = reg.getLocalMachineValueName(SERIAL_KEY, i);
+ }
+ return ports.toArray(new String[ports.size()]);
+ } else {
+ return new String[0];
+ }
} else {
return new String[0];
}
@@ -95,6 +116,7 @@ public class SerialPort {
public void close() throws IOException {
close0(handle);
isOpen = false;
+ handle = 0;
}
private native void close0(long handle) throws IOException;
@@ -136,7 +158,7 @@ public class SerialPort {
return parity;
}
- public void setStopBit(StopBits stopBits) throws IOException {
+ public void setStopBits(StopBits stopBits) throws IOException {
if (isOpen) {
throw new IOException(PORT_OPEN);
}
diff --git a/core/org.eclipse.cdt.core.win32.x86/os/win32/x86/.gitignore b/core/org.eclipse.cdt.core.win32.x86/os/win32/x86/.gitignore
new file mode 100644
index 00000000000..4f2c11e49d6
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32.x86/os/win32/x86/.gitignore
@@ -0,0 +1,4 @@
+*.exp
+*.lib
+*.pdb
+
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/.gitignore b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/.gitignore
new file mode 100644
index 00000000000..4f2c11e49d6
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/.gitignore
@@ -0,0 +1,4 @@
+*.exp
+*.lib
+*.pdb
+
diff --git a/core/org.eclipse.cdt.core.win32/library/.gitignore b/core/org.eclipse.cdt.core.win32/library/.gitignore
new file mode 100644
index 00000000000..4d4ec54ac04
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/.gitignore
@@ -0,0 +1,8 @@
+/ipch/
+*.obj
+*.idb
+*.pdb
+*.sdf
+*.suo
+*.pch
+*.log
diff --git a/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln b/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln
new file mode 100644
index 00000000000..da36400d228
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln
@@ -0,0 +1,47 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "serial", "serial\serial.vcxproj", "{2E2DB53A-62BE-4690-8FCB-209885DD9B3C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winreg", "winreg\winreg.vcxproj", "{4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Debug|Win32.Build.0 = Debug|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Debug|x64.ActiveCfg = Debug|x64
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Debug|x64.Build.0 = Debug|x64
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Release|Win32.ActiveCfg = Release|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Release|Win32.Build.0 = Release|Win32
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Release|x64.ActiveCfg = Release|x64
+ {2E2DB53A-62BE-4690-8FCB-209885DD9B3C}.Release|x64.Build.0 = Release|x64
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Win32.Build.0 = Debug|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|x64.ActiveCfg = Debug|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Win32.ActiveCfg = Release|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Win32.Build.0 = Release|Win32
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|x64.ActiveCfg = Release|x64
+ {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/.gitignore b/core/org.eclipse.cdt.core.win32/library/serial/.gitignore
new file mode 100644
index 00000000000..5d72c45d207
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/.gitignore
@@ -0,0 +1,2 @@
+/serial.tlog/
+/serial.vcxproj.user
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/dllmain.cpp b/core/org.eclipse.cdt.core.win32/library/serial/dllmain.cpp
new file mode 100644
index 00000000000..6e297985f3b
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/dllmain.cpp
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#include "stdafx.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/serial.cpp b/core/org.eclipse.cdt.core.win32/library/serial/serial.cpp
new file mode 100644
index 00000000000..69a1de31a31
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/serial.cpp
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#include "stdafx.h"
+
+extern "C"
+JNIEXPORT jlong JNICALL Java_org_eclipse_cdt_utils_serial_SerialPort_open0
+(JNIEnv *env, jobject jobj, jstring portName, jint baudRate, jint byteSize, jint parity, jint stopBits)
+{
+ const wchar_t * cportName = (const wchar_t *) env->GetStringChars(portName, NULL);
+ HANDLE handle = CreateFile(cportName,
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_OVERLAPPED,
+ NULL);
+
+ if (handle != INVALID_HANDLE_VALUE) {
+ DCB dcb = { 0 };
+
+ if (!GetCommState(handle, &dcb)) {
+ fprintf(stderr, "Error getting DCB: %S\n", cportName);
+ return -1;
+ }
+
+ dcb.BaudRate = baudRate;
+ dcb.ByteSize = (BYTE) byteSize;
+
+ switch (parity) {
+ case 0: // None
+ dcb.fParity = FALSE;
+ break;
+ case 1: // Even
+ dcb.fParity = TRUE;
+ dcb.Parity = EVENPARITY;
+ break;
+ case 2: // Odd
+ dcb.fParity = TRUE;
+ dcb.Parity = ODDPARITY;
+ break;
+ }
+
+ switch (stopBits) {
+ case 0:
+ dcb.StopBits = ONESTOPBIT;
+ break;
+ case 1:
+ dcb.StopBits = TWOSTOPBITS;
+ break;
+ }
+
+ if (!SetCommState(handle, &dcb)) {
+ fprintf(stderr, "Error setting DCB: %S\n", cportName);
+ return -1;
+ }
+ }
+
+ return (jlong) handle;
+}
+
+extern "C"
+JNIEXPORT void JNICALL Java_org_eclipse_cdt_utils_serial_SerialPort_close0
+(JNIEnv *env, jobject jobj, jlong handle)
+{
+ CloseHandle((HANDLE) handle);
+}
+
+extern "C"
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_serial_SerialPort_read0
+(JNIEnv *env, jobject jobj, jlong jhandle)
+{
+ OVERLAPPED olp = { 0 };
+
+ olp.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if (olp.hEvent == NULL) {
+ fprintf(stderr, "Error creating event\n");
+ fflush(stderr);
+ return -1;
+ }
+
+ char buff;
+ DWORD nwritten;
+ HANDLE handle = (HANDLE)jhandle;
+
+ if (!ReadFile(handle, &buff, sizeof(buff), &nwritten, &olp)) {
+ if (GetLastError() != ERROR_IO_PENDING) {
+ fprintf(stderr, "Error reading from port: %d\n", GetLastError());
+ fflush(stderr);
+ return -1;
+ }
+ else {
+ switch (WaitForSingleObject(olp.hEvent, INFINITE)) {
+ case WAIT_OBJECT_0:
+ if (!GetOverlappedResult(handle, &olp, &nwritten, FALSE)) {
+ if (GetLastError() != ERROR_OPERATION_ABORTED) {
+ fprintf(stderr, "Error waiting for read: %d\n", GetLastError());
+ fflush(stderr);
+ }
+ return -1;
+ }
+ break;
+ }
+ }
+ }
+
+ CloseHandle(olp.hEvent);
+ return buff;
+}
+
+extern "C"
+JNIEXPORT void JNICALL Java_org_eclipse_cdt_utils_serial_SerialPort_write0
+(JNIEnv *env, jobject jobj, jlong jhandle, jint b)
+{
+ OVERLAPPED olp = { 0 };
+
+ olp.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if (olp.hEvent == NULL) {
+ fprintf(stderr, "Error creating event\n");
+ return;
+ }
+
+ char buff = (char) b;
+ DWORD nwritten;
+ HANDLE handle = (HANDLE) jhandle;
+
+ if (!WriteFile(handle, &buff, sizeof(buff), &nwritten, &olp)) {
+ if (GetLastError() != ERROR_IO_PENDING) {
+ fprintf(stderr, "Error writing to port\n");
+ }
+ else {
+ switch (WaitForSingleObject(olp.hEvent, INFINITE)) {
+ case WAIT_OBJECT_0:
+ if (!GetOverlappedResult(handle, &olp, &nwritten, FALSE)) {
+ fprintf(stderr, "Error waiting for write\n");
+ }
+ }
+ }
+ }
+
+ CloseHandle(olp.hEvent);
+}
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj b/core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj
new file mode 100644
index 00000000000..8e8c5b153d1
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{2E2DB53A-62BE-4690-8FCB-209885DD9B3C}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>serial</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86\os\win32\x86\</OutDir>
+ <IntDir />
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86_64\os\win32\x86_64\</OutDir>
+ <IntDir />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SERIAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SERIAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SERIAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SERIAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="dllmain.cpp">
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ </PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ </PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ </PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="serial.cpp" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj.filters b/core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj.filters
new file mode 100644
index 00000000000..240d00d0c19
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/serial.vcxproj.filters
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="targetver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="serial.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dllmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/stdafx.cpp b/core/org.eclipse.cdt.core.win32/library/serial/stdafx.cpp
new file mode 100644
index 00000000000..c97de4cd232
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/stdafx.cpp
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/stdafx.h b/core/org.eclipse.cdt.core.win32/library/serial/stdafx.h
new file mode 100644
index 00000000000..0babced30e7
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/stdafx.h
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+#include <jni.h>
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/core/org.eclipse.cdt.core.win32/library/serial/targetver.h b/core/org.eclipse.cdt.core.win32/library/serial/targetver.h
new file mode 100644
index 00000000000..d27181a16d6
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/serial/targetver.h
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/.gitignore b/core/org.eclipse.cdt.core.win32/library/winreg/.gitignore
new file mode 100644
index 00000000000..7d9b212a579
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/.gitignore
@@ -0,0 +1 @@
+/winreg.tlog/
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/Makefile b/core/org.eclipse.cdt.core.win32/library/winreg/Makefile
deleted file mode 100644
index 8335a7dc55d..00000000000
--- a/core/org.eclipse.cdt.core.win32/library/winreg/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-ifeq ($(JAVA_HOME),)
-$(error JAVA_HOME not set in environment)
-endif
-
-TARGET = $(INSTALL_DIR)/winreg.dll
-
-OBJS = winreg.o
-
-OS = win32
-ARCH = x86
-
-JDK_INCLUDES = "$(JAVA_HOME)/include"
-JDK_OS_INCLUDES = "$(JAVA_HOME)/include/$(OS)"
-
-CXX = g++
-CXXFLAGS = -DUNICODE -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
-
-INSTALL_DIR = ../../../org.eclipse.cdt.core.$(OS).$(ARCH)/os/$(OS)/$(ARCH)
-
-all: $(TARGET)
-
-rebuild: clean all
-
-clean :
- $(RM) $(OBJS)
-
-$(TARGET) : $(OBJS)
- $(CXX) -Wl,--kill-at -shared -o $(TARGET) $(OBJS)
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp b/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp
new file mode 100644
index 00000000000..6e297985f3b
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#include "stdafx.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp
new file mode 100644
index 00000000000..c97de4cd232
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h
new file mode 100644
index 00000000000..0babced30e7
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+#include <jni.h>
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h b/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h
new file mode 100644
index 00000000000..d27181a16d6
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp
index 50818020978..231910a1f77 100644
--- a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp
@@ -1,153 +1,151 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 QNX Software Systems
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-#include <windows.h>
-#include <jni.h>
-#include <string.h>
-
-static jstring getValue(JNIEnv * env, HKEY key, jstring subkey, jstring name) {
- const jchar * csubkey = env->GetStringChars(subkey, NULL);
- const jchar * cname = env->GetStringChars(name, NULL);
- jstring result = NULL;
-
- HKEY skey;
- LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey);
- if (rc == ERROR_SUCCESS) {
- DWORD type;
- wchar_t buffer[256];
- DWORD len = sizeof(buffer);
- rc = RegQueryValueEx(skey, (const wchar_t *)cname, NULL, &type, (BYTE *)&buffer, &len);
- if (rc == ERROR_SUCCESS) {
- result = env->NewString((jchar *)buffer, wcslen(buffer));
- }
- RegCloseKey(skey);
- }
-
- env->ReleaseStringChars(subkey, csubkey);
- env->ReleaseStringChars(name, cname);
-
- return result;
-}
-
-extern "C"
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValue(
- JNIEnv * env, jobject obj, jstring subkey, jstring name)
-{
- return getValue(env, HKEY_LOCAL_MACHINE, subkey, name);
-}
-
-extern "C"
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValue(
- JNIEnv * env, jobject obj, jstring subkey, jstring name)
-{
- return getValue(env, HKEY_CURRENT_USER, subkey, name);
-}
-
-/*
- * Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0)
- * to the key's array of values, return the name of the indexed value.
- * The return value is null on any error or when the index is invalid.
- */
-
-static jstring getValueName(JNIEnv * env, HKEY key, jstring subkey, jint index) {
- const jchar * csubkey = env->GetStringChars(subkey, NULL);
- jstring result = NULL;
-
- HKEY skey;
- LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey);
- if (rc != ERROR_SUCCESS)
- return NULL;
-
- wchar_t valueName[256];
- DWORD nameSize = sizeof(valueName) + 2;
-
- rc = RegEnumValue(skey, index,
- valueName, // UNICODE string
- &nameSize,
- NULL, NULL,
- NULL, // data string
- NULL); // size in BYTE of data.
-
- if (rc == ERROR_SUCCESS)
- {
- result = env->NewString((jchar *)valueName, nameSize);
- }
-
- RegCloseKey(skey);
-
- env->ReleaseStringChars(subkey, csubkey);
-
- return result;
-}
-
-extern "C"
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValueName(
- JNIEnv * env, jobject obj, jstring subkey, jint index)
-{
- return getValueName(env, HKEY_LOCAL_MACHINE, subkey, index);
-}
-
-extern "C"
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValueName(
- JNIEnv * env, jobject obj, jstring subkey, jint index)
-{
- return getValueName(env, HKEY_CURRENT_USER, subkey, index);
-}
-
-/*
- * Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0)
- * to the key's array of keys, return the name of the indexed key.
- * The return value is null on any error or when the index is invalid.
- */
-
-static jstring getKeyName(JNIEnv * env, HKEY key, jstring subkey, jint index) {
- const jchar * csubkey = env->GetStringChars(subkey, NULL);
- jstring result = NULL;
-
- HKEY skey;
- LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey);
- if (rc != ERROR_SUCCESS)
- return NULL;
-
- wchar_t keyName[256];
- DWORD nameSize = sizeof(keyName) + 2;
-
- rc = RegEnumKeyEx(skey, index,
- keyName, // UNICODE string
- &nameSize,
- NULL, NULL,
- NULL,
- NULL); // size in BYTE of data.
-
- if (rc == ERROR_SUCCESS)
- {
- result = env->NewString((jchar *)keyName, nameSize);
- }
-
- RegCloseKey(skey);
-
- env->ReleaseStringChars(subkey, csubkey);
-
- return result;
-}
-
-extern "C"
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineKeyName(
- JNIEnv * env, jobject obj, jstring subkey, jint index)
-{
- return getKeyName(env, HKEY_LOCAL_MACHINE, subkey, index);
-}
-
-extern "C"
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserKeyName(
- JNIEnv * env, jobject obj, jstring subkey, jint index)
-{
- return getKeyName(env, HKEY_CURRENT_USER, subkey, index);
-}
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+#include "stdafx.h"
+
+static jstring getValue(JNIEnv * env, HKEY key, jstring subkey, jstring name) {
+ const jchar * csubkey = env->GetStringChars(subkey, NULL);
+ const jchar * cname = env->GetStringChars(name, NULL);
+ jstring result = NULL;
+
+ HKEY skey;
+ LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey);
+ if (rc == ERROR_SUCCESS) {
+ DWORD type;
+ wchar_t buffer[256];
+ DWORD len = sizeof(buffer);
+ rc = RegQueryValueEx(skey, (const wchar_t *)cname, NULL, &type, (BYTE *)&buffer, &len);
+ if (rc == ERROR_SUCCESS) {
+ result = env->NewString((jchar *) buffer, (jsize) wcslen(buffer));
+ }
+ RegCloseKey(skey);
+ }
+
+ env->ReleaseStringChars(subkey, csubkey);
+ env->ReleaseStringChars(name, cname);
+
+ return result;
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValue(
+JNIEnv * env, jobject obj, jstring subkey, jstring name)
+{
+ return getValue(env, HKEY_LOCAL_MACHINE, subkey, name);
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValue(
+JNIEnv * env, jobject obj, jstring subkey, jstring name)
+{
+ return getValue(env, HKEY_CURRENT_USER, subkey, name);
+}
+
+/*
+* Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0)
+* to the key's array of values, return the name of the indexed value.
+* The return value is null on any error or when the index is invalid.
+*/
+
+static jstring getValueName(JNIEnv * env, HKEY key, jstring subkey, jint index) {
+ const jchar * csubkey = env->GetStringChars(subkey, NULL);
+ jstring result = NULL;
+
+ HKEY skey;
+ LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey);
+ if (rc != ERROR_SUCCESS)
+ return NULL;
+
+ wchar_t valueName[256];
+ DWORD nameSize = sizeof(valueName) + 2;
+
+ rc = RegEnumValue(skey, index,
+ valueName, // UNICODE string
+ &nameSize,
+ NULL, NULL,
+ NULL, // data string
+ NULL); // size in BYTE of data.
+
+ if (rc == ERROR_SUCCESS)
+ {
+ result = env->NewString((jchar *)valueName, nameSize);
+ }
+
+ RegCloseKey(skey);
+
+ env->ReleaseStringChars(subkey, csubkey);
+
+ return result;
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValueName(
+JNIEnv * env, jobject obj, jstring subkey, jint index)
+{
+ return getValueName(env, HKEY_LOCAL_MACHINE, subkey, index);
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValueName(
+JNIEnv * env, jobject obj, jstring subkey, jint index)
+{
+ return getValueName(env, HKEY_CURRENT_USER, subkey, index);
+}
+
+/*
+* Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0)
+* to the key's array of keys, return the name of the indexed key.
+* The return value is null on any error or when the index is invalid.
+*/
+
+static jstring getKeyName(JNIEnv * env, HKEY key, jstring subkey, jint index) {
+ const jchar * csubkey = env->GetStringChars(subkey, NULL);
+ jstring result = NULL;
+
+ HKEY skey;
+ LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey);
+ if (rc != ERROR_SUCCESS)
+ return NULL;
+
+ wchar_t keyName[256];
+ DWORD nameSize = sizeof(keyName) + 2;
+
+ rc = RegEnumKeyEx(skey, index,
+ keyName, // UNICODE string
+ &nameSize,
+ NULL, NULL,
+ NULL,
+ NULL); // size in BYTE of data.
+
+ if (rc == ERROR_SUCCESS)
+ {
+ result = env->NewString((jchar *)keyName, nameSize);
+ }
+
+ RegCloseKey(skey);
+
+ env->ReleaseStringChars(subkey, csubkey);
+
+ return result;
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineKeyName(
+JNIEnv * env, jobject obj, jstring subkey, jint index)
+{
+ return getKeyName(env, HKEY_LOCAL_MACHINE, subkey, index);
+}
+
+extern "C"
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserKeyName(
+JNIEnv * env, jobject obj, jstring subkey, jint index)
+{
+ return getKeyName(env, HKEY_CURRENT_USER, subkey, index);
+}
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj
new file mode 100644
index 00000000000..994ba556f5a
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>winreg</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86\os\win32\x86\</OutDir>
+ <IntDir />
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86_64\os\win32\x86_64\</OutDir>
+ <IntDir />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="dllmain.cpp">
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ </PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ </PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ </PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="winreg.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters
new file mode 100644
index 00000000000..41d99849235
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="targetver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="winreg.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dllmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file

Back to the top