Windows: got rid on JNA, thus no more UnsatisfiedLinkError (at least when accessing native OS functions). Fixes #3190

This commit is contained in:
Federico Fissore 2015-05-20 16:13:48 +02:00
parent 026210564d
commit f6546aea45
31 changed files with 109 additions and 1199 deletions

View File

@ -6,7 +6,6 @@
<classpathentry kind="lib" path="app/lib/antlr.jar"/>
<classpathentry kind="lib" path="app/lib/apple.jar"/>
<classpathentry kind="lib" path="app/lib/ecj.jar"/>
<classpathentry kind="lib" path="app/lib/jna.jar"/>
<classpathentry kind="lib" path="app/test-lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="app/test-lib/fest-assert-1.2.jar"/>
<classpathentry kind="lib" path="app/test-lib/fest-reflect-1.2.jar"/>

View File

@ -4,7 +4,6 @@
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/antlr.jar"/>
<classpathentry kind="lib" path="lib/jna.jar"/>
<classpathentry kind="lib" path="lib/ecj.jar"/>
<classpathentry kind="lib" path="lib/apple.jar"/>
<classpathentry kind="lib" path="lib/bcpg-jdk15on-152.jar"/>

View File

@ -14,7 +14,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/serial"/>
<classpathentry combineaccessrules="false" kind="src" path="/video"/>
<classpathentry kind="lib" path="lib/antlr.jar"/>
<classpathentry kind="lib" path="lib/jna.jar"/>
<classpathentry kind="lib" path="lib/ecj.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="processing/app/tools/format/|processing/app/macosx/" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
<classpathentry combineaccessrules="false" kind="src" path="/dxf"/>
<classpathentry combineaccessrules="false" kind="src" path="/net"/>
<classpathentry combineaccessrules="false" kind="src" path="/opengl">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="opengl/library"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/pdf"/>
<classpathentry combineaccessrules="false" kind="src" path="/serial"/>
<classpathentry combineaccessrules="false" kind="src" path="/video"/>
<classpathentry kind="lib" path="lib/antlr.jar"/>
<classpathentry kind="lib" path="lib/jna.jar"/>
<classpathentry kind="lib" path="lib/ecj.jar"/>
<classpathentry kind="lib" path="C:/Users/fry/processing/build/windows/work/java/lib/tools.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1 +0,0 @@
https://github.com/twall/jna/blob/master/LICENSE

Binary file not shown.

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/processing/src/processing/app/Base.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-openjdk-amd64&quot; javaProject=&quot;processing&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/processing/lib/ecj.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/processing/lib/jna.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/processing/lib/jssc-2.6.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;processing-core&quot; type=&quot;1&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;processing&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="processing.app.Base"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="processing"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.library.path=lib/"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:processing}/../build/linux/work"/>
</launchConfiguration>

View File

@ -617,13 +617,6 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="autoAssociateBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="_(&quot;Automatically associate .ino files with Arduino&quot;)" type="code"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="saveVerifyUploadBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">

View File

@ -34,7 +34,6 @@ import processing.app.Editor;
import processing.app.I18n;
import processing.app.PreferencesData;
import processing.app.helpers.FileUtils;
import processing.app.helpers.OSUtils;
import processing.app.legacy.PApplet;
import javax.swing.*;
@ -198,11 +197,6 @@ public class Preferences extends javax.swing.JDialog {
}
});
if (!OSUtils.isWindows() || base.getPortableFolder() != null) {
autoAssociateBox.setEnabled(false);
autoAssociateBox.getParent().remove(autoAssociateBox);
}
showPrerefencesData();
}
@ -256,7 +250,6 @@ public class Preferences extends javax.swing.JDialog {
externalEditorBox = new javax.swing.JCheckBox();
checkUpdatesBox = new javax.swing.JCheckBox();
updateExtensionBox = new javax.swing.JCheckBox();
autoAssociateBox = new javax.swing.JCheckBox();
saveVerifyUploadBox = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -445,9 +438,6 @@ public class Preferences extends javax.swing.JDialog {
updateExtensionBox.setText(_("Update sketch files to new extension on save (.pde -> .ino)"));
checkboxesContainer.add(updateExtensionBox);
autoAssociateBox.setText(_("Automatically associate .ino files with Arduino"));
checkboxesContainer.add(autoAssociateBox);
saveVerifyUploadBox.setText(_("Save when verifying or uploading"));
checkboxesContainer.add(saveVerifyUploadBox);
@ -610,7 +600,6 @@ public class Preferences extends javax.swing.JDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField additionalBoardsManagerField;
private javax.swing.JCheckBox autoAssociateBox;
private javax.swing.JCheckBox checkUpdatesBox;
private javax.swing.JComboBox comboLanguage;
private javax.swing.JComboBox comboWarnings;
@ -683,10 +672,6 @@ public class Preferences extends javax.swing.JDialog {
PreferencesData.setBoolean("editor.update_extension", updateExtensionBox.isSelected());
if (autoAssociateBox != null) {
PreferencesData.setBoolean("platform.auto_file_type_associations", autoAssociateBox.isSelected());
}
PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());
PreferencesData.set("proxy.http.server", proxyHTTPServer.getText());
@ -744,10 +729,6 @@ public class Preferences extends javax.swing.JDialog {
updateExtensionBox.setSelected(PreferencesData.get("editor.update_extension") == null || PreferencesData.getBoolean("editor.update_extension"));
if (autoAssociateBox != null) {
autoAssociateBox.setSelected(PreferencesData.getBoolean("platform.auto_file_type_associations"));
}
saveVerifyUploadBox.setSelected(PreferencesData.getBoolean("editor.save_on_verify"));
proxyHTTPServer.setText(PreferencesData.get("proxy.http.server"));

View File

@ -146,6 +146,8 @@ public class Base {
initPlatform();
getPlatform().init();
BaseNoGui.initPortableFolder();
BaseNoGui.initParameters(args);
@ -284,8 +286,6 @@ public class Base {
}
public Base(String[] args) throws Exception {
getPlatform().init();
String sketchbookPath = BaseNoGui.getSketchbookPath();
// If no path is set, get the default sketchbook folder for this platform

View File

@ -0,0 +1,29 @@
package processing.app.windows;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class RegQueryParserTest {
@Test
public void testRegQueryParser() throws Exception {
String output = "! REG.EXE VERSION 3.0\n" +
"\n" +
"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n" +
"\n" +
" Local AppData REG_SZ C:\\Documents and Settings\\username\\My Documents";
String folderPath = new RegQueryParser(output).getValueOfKey();
assertEquals("C:\\Documents and Settings\\username\\My Documents", folderPath);
}
@Test
public void testRegQueryParser2() throws Exception {
String output = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n" +
" Local AppData REG_SZ C:\\Users\\username\\AppData\\Local";
String folderPath = new RegQueryParser(output).getValueOfKey();
assertEquals("C:\\Users\\username\\AppData\\Local", folderPath);
}
}

View File

@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jna.jar"/>
<classpathentry kind="lib" path="lib/apple.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="lib/jmdns-3.4.1.jar"/>

View File

@ -1 +0,0 @@
https://github.com/twall/jna/blob/master/LICENSE

Binary file not shown.

View File

@ -425,8 +425,6 @@ public class BaseNoGui {
}
static public void init(String[] args) throws Exception {
getPlatform().init();
String sketchbookPath = getSketchbookPath();
// If no path is set, get the default sketchbook folder for this platform
@ -740,7 +738,9 @@ public class BaseNoGui {
Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE));
initPlatform();
getPlatform().init();
initPortableFolder();
initParameters(args);

View File

@ -57,6 +57,8 @@ public class Platform extends processing.app.Platform {
}
public void init() throws IOException {
super.init();
System.setProperty("apple.laf.useScreenMenuBar", "true");
discoverRealOsArch();

View File

@ -1,335 +0,0 @@
package processing.app.windows;
/*
* Advapi32.java
*
* Created on 6. August 2007, 11:24
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.*;
/**
*
* @author TB
*/
public interface Advapi32 extends StdCallLibrary {
Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32", Advapi32.class, Options.UNICODE_OPTIONS);
/*
BOOL WINAPI LookupAccountName(
LPCTSTR lpSystemName,
LPCTSTR lpAccountName,
PSID Sid,
LPDWORD cbSid,
LPTSTR ReferencedDomainName,
LPDWORD cchReferencedDomainName,
PSID_NAME_USE peUse
);*/
public boolean LookupAccountName(String lpSystemName, String lpAccountName,
byte[] Sid, IntByReference cbSid, char[] ReferencedDomainName,
IntByReference cchReferencedDomainName, PointerByReference peUse);
/*
BOOL WINAPI LookupAccountSid(
LPCTSTR lpSystemName,
PSID lpSid,
LPTSTR lpName,
LPDWORD cchName,
LPTSTR lpReferencedDomainName,
LPDWORD cchReferencedDomainName,
PSID_NAME_USE peUse
);*/
public boolean LookupAccountSid(String lpSystemName, byte[] Sid,
char[] lpName, IntByReference cchName, char[] ReferencedDomainName,
IntByReference cchReferencedDomainName, PointerByReference peUse);
/*
BOOL ConvertSidToStringSid(
PSID Sid,
LPTSTR* StringSid
);*/
public boolean ConvertSidToStringSid(byte[] Sid, PointerByReference StringSid);
/*
BOOL WINAPI ConvertStringSidToSid(
LPCTSTR StringSid,
PSID* Sid
);*/
public boolean ConvertStringSidToSid(String StringSid, PointerByReference Sid);
/*
SC_HANDLE WINAPI OpenSCManager(
LPCTSTR lpMachineName,
LPCTSTR lpDatabaseName,
DWORD dwDesiredAccess
);*/
public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName, int dwDesiredAccess);
/*
BOOL WINAPI CloseServiceHandle(
SC_HANDLE hSCObject
);*/
public boolean CloseServiceHandle(Pointer hSCObject);
/*
SC_HANDLE WINAPI OpenService(
SC_HANDLE hSCManager,
LPCTSTR lpServiceName,
DWORD dwDesiredAccess
);*/
public Pointer OpenService(Pointer hSCManager, String lpServiceName, int dwDesiredAccess);
/*
BOOL WINAPI StartService(
SC_HANDLE hService,
DWORD dwNumServiceArgs,
LPCTSTR* lpServiceArgVectors
);*/
public boolean StartService(Pointer hService, int dwNumServiceArgs, char[] lpServiceArgVectors);
/*
BOOL WINAPI ControlService(
SC_HANDLE hService,
DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus
);*/
public boolean ControlService(Pointer hService, int dwControl, SERVICE_STATUS lpServiceStatus);
/*
BOOL WINAPI StartServiceCtrlDispatcher(
const SERVICE_TABLE_ENTRY* lpServiceTable
);*/
public boolean StartServiceCtrlDispatcher(Structure[] lpServiceTable);
/*
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandler(
LPCTSTR lpServiceName,
LPHANDLER_FUNCTION lpHandlerProc
);*/
public Pointer RegisterServiceCtrlHandler(String lpServiceName, Handler lpHandlerProc);
/*
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerEx(
LPCTSTR lpServiceName,
LPHANDLER_FUNCTION_EX lpHandlerProc,
LPVOID lpContext
);*/
public Pointer RegisterServiceCtrlHandlerEx(String lpServiceName, HandlerEx lpHandlerProc, Pointer lpContext);
/*
BOOL WINAPI SetServiceStatus(
SERVICE_STATUS_HANDLE hServiceStatus,
LPSERVICE_STATUS lpServiceStatus
);*/
public boolean SetServiceStatus(Pointer hServiceStatus, SERVICE_STATUS lpServiceStatus);
/*
SC_HANDLE WINAPI CreateService(
SC_HANDLE hSCManager,
LPCTSTR lpServiceName,
LPCTSTR lpDisplayName,
DWORD dwDesiredAccess,
DWORD dwServiceType,
DWORD dwStartType,
DWORD dwErrorControl,
LPCTSTR lpBinaryPathName,
LPCTSTR lpLoadOrderGroup,
LPDWORD lpdwTagId,
LPCTSTR lpDependencies,
LPCTSTR lpServiceStartName,
LPCTSTR lpPassword
);*/
public Pointer CreateService(Pointer hSCManager, String lpServiceName, String lpDisplayName,
int dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl,
String lpBinaryPathName, String lpLoadOrderGroup, IntByReference lpdwTagId,
String lpDependencies, String lpServiceStartName, String lpPassword);
/*
BOOL WINAPI DeleteService(
SC_HANDLE hService
);*/
public boolean DeleteService(Pointer hService);
/*
BOOL WINAPI ChangeServiceConfig2(
SC_HANDLE hService,
DWORD dwInfoLevel,
LPVOID lpInfo
);*/
public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel, ChangeServiceConfig2Info lpInfo);
/*
LONG WINAPI RegOpenKeyEx(
HKEY hKey,
LPCTSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult
);*/
public int RegOpenKeyEx(int hKey, String lpSubKey, int ulOptions, int samDesired, IntByReference phkResult);
/*
LONG WINAPI RegQueryValueEx(
HKEY hKey,
LPCTSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);*/
public int RegQueryValueEx(int hKey, String lpValueName, IntByReference lpReserved, IntByReference lpType, byte[] lpData, IntByReference lpcbData);
/*
LONG WINAPI RegCloseKey(
HKEY hKey
);*/
public int RegCloseKey(int hKey);
/*
LONG WINAPI RegDeleteValue(
HKEY hKey,
LPCTSTR lpValueName
);*/
public int RegDeleteValue(int hKey, String lpValueName);
/*
LONG WINAPI RegSetValueEx(
HKEY hKey,
LPCTSTR lpValueName,
DWORD Reserved,
DWORD dwType,
const BYTE* lpData,
DWORD cbData
);*/
public int RegSetValueEx(int hKey, String lpValueName, int Reserved, int dwType, byte[] lpData, int cbData);
/*
LONG WINAPI RegCreateKeyEx(
HKEY hKey,
LPCTSTR lpSubKey,
DWORD Reserved,
LPTSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition
);*/
public int RegCreateKeyEx(int hKey, String lpSubKey, int Reserved, String lpClass, int dwOptions,
int samDesired, WINBASE.SECURITY_ATTRIBUTES lpSecurityAttributes, IntByReference phkResult,
IntByReference lpdwDisposition);
/*
LONG WINAPI RegDeleteKey(
HKEY hKey,
LPCTSTR lpSubKey
);*/
public int RegDeleteKey(int hKey, String name);
/*
LONG WINAPI RegEnumKeyEx(
HKEY hKey,
DWORD dwIndex,
LPTSTR lpName,
LPDWORD lpcName,
LPDWORD lpReserved,
LPTSTR lpClass,
LPDWORD lpcClass,
PFILETIME lpftLastWriteTime
);*/
public int RegEnumKeyEx(int hKey, int dwIndex, char[] lpName, IntByReference lpcName, IntByReference reserved,
char[] lpClass, IntByReference lpcClass, WINBASE.FILETIME lpftLastWriteTime);
/*
LONG WINAPI RegEnumValue(
HKEY hKey,
DWORD dwIndex,
LPTSTR lpValueName,
LPDWORD lpcchValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);*/
public int RegEnumValue(int hKey, int dwIndex, char[] lpValueName, IntByReference lpcchValueName, IntByReference reserved,
IntByReference lpType, byte[] lpData, IntByReference lpcbData);
interface SERVICE_MAIN_FUNCTION extends StdCallCallback {
/*
VOID WINAPI ServiceMain(
DWORD dwArgc,
LPTSTR* lpszArgv
);*/
public void callback(int dwArgc, Pointer lpszArgv);
}
interface Handler extends StdCallCallback {
/*
VOID WINAPI Handler(
DWORD fdwControl
);*/
public void callback(int fdwControl);
}
interface HandlerEx extends StdCallCallback {
/*
DWORD WINAPI HandlerEx(
DWORD dwControl,
DWORD dwEventType,
LPVOID lpEventData,
LPVOID lpContext
);*/
public void callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext);
}
/*
typedef struct _SERVICE_STATUS {
DWORD dwServiceType;
DWORD dwCurrentState;
DWORD dwControlsAccepted;
DWORD dwWin32ExitCode;
DWORD dwServiceSpecificExitCode;
DWORD dwCheckPoint;
DWORD dwWaitHint;
} SERVICE_STATUS,
*LPSERVICE_STATUS;*/
public static class SERVICE_STATUS extends Structure {
public int dwServiceType;
public int dwCurrentState;
public int dwControlsAccepted;
public int dwWin32ExitCode;
public int dwServiceSpecificExitCode;
public int dwCheckPoint;
public int dwWaitHint;
}
/*
typedef struct _SERVICE_TABLE_ENTRY {
LPTSTR lpServiceName;
LPSERVICE_MAIN_FUNCTION lpServiceProc;
} SERVICE_TABLE_ENTRY,
*LPSERVICE_TABLE_ENTRY;*/
public static class SERVICE_TABLE_ENTRY extends Structure {
public String lpServiceName;
public SERVICE_MAIN_FUNCTION lpServiceProc;
}
public static class ChangeServiceConfig2Info extends Structure {
}
/*
typedef struct _SERVICE_DESCRIPTION {
LPTSTR lpDescription;
} SERVICE_DESCRIPTION,
*LPSERVICE_DESCRIPTION;*/
public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info {
public String lpDescription;
}
}

View File

@ -1,28 +0,0 @@
/*
* Options.java
*
* Created on 8. August 2007, 17:07
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package processing.app.windows;
import static com.sun.jna.Library.*;
import com.sun.jna.win32.*;
import java.util.*;
/**
*
* @author TB
*/
public interface Options {
@SuppressWarnings("serial")
Map<String, Object> UNICODE_OPTIONS = new HashMap<String, Object>() {
{
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
}
};
}

View File

@ -24,126 +24,51 @@ package processing.app.windows;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.Executor;
import processing.app.PreferencesData;
import processing.app.debug.TargetPackage;
import processing.app.legacy.PApplet;
import processing.app.legacy.PConstants;
import processing.app.tools.CollectStdOutExecutor;
import processing.app.windows.Registry.REGISTRY_ROOT_KEY;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
// http://developer.apple.com/documentation/QuickTime/Conceptual/QT7Win_Update_Guide/Chapter03/chapter_3_section_1.html
// HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\QuickTime\QTSysDir
// HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion -> 1.6 (String)
// HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion\1.6\JavaHome -> c:\jdk-1.6.0_05
public class Platform extends processing.app.Platform {
static final String openCommand =
System.getProperty("user.dir").replace('/', '\\') +
"\\arduino.exe \"%1\"";
static final String DOC = "Arduino.Document";
private File settingsFolder;
private File defaultSketchbookFolder;
public void init() throws IOException {
super.init();
checkAssociations();
checkQuickTime();
checkPath();
recoverSettingsFolderPath();
recoverDefaultSketchbookFolder();
}
/**
* Make sure that .pde files are associated with processing.exe.
*/
protected void checkAssociations() {
try {
String knownCommand =
Registry.getStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT,
DOC + "\\shell\\open\\command", "");
if (knownCommand == null) {
if (PreferencesData.getBoolean("platform.auto_file_type_associations")) {
setAssociations();
}
} else if (!knownCommand.equals(openCommand)) {
// If the value is set differently, just change the registry setting.
if (PreferencesData.getBoolean("platform.auto_file_type_associations")) {
setAssociations();
}
}
} catch (Exception e) {
e.printStackTrace();
}
private void recoverSettingsFolderPath() throws IOException {
String path = getFolderPathFromRegistry("AppData");
this.settingsFolder = new File(path, "Arduino15");
}
/**
* Associate .pde files with this version of Processing.
*/
protected void setAssociations() throws UnsupportedEncodingException {
if (Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
"", ".ino") &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT,
".ino", "", DOC) &&
Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, "", DOC) &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, DOC, "",
"Arduino Source Code") &&
Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
DOC, "shell") &&
Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
DOC + "\\shell", "open") &&
Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT,
DOC + "\\shell\\open", "command") &&
Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT,
DOC + "\\shell\\open\\command", "",
openCommand)) {
// everything ok
// hooray!
} else {
PreferencesData.setBoolean("platform.auto_file_type_associations", false);
}
private void recoverDefaultSketchbookFolder() throws IOException {
String path = getFolderPathFromRegistry("Personal");
this.defaultSketchbookFolder = new File(path, "Arduino");
}
private String getFolderPathFromRegistry(String folderType) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Executor executor = new CollectStdOutExecutor(baos);
/**
* Find QuickTime for Java installation.
*/
protected void checkQuickTime() {
try {
String qtsystemPath =
Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE,
"Software\\Apple Computer, Inc.\\QuickTime",
"QTSysDir");
// Could show a warning message here if QT not installed, but that
// would annoy people who don't want anything to do with QuickTime.
if (qtsystemPath != null) {
File qtjavaZip = new File(qtsystemPath, "QTJava.zip");
if (qtjavaZip.exists()) {
String qtjavaZipPath = qtjavaZip.getAbsolutePath();
String cp = System.getProperty("java.class.path");
System.setProperty("java.class.path",
cp + File.pathSeparator + qtjavaZipPath);
}
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
CommandLine toDevicePath = CommandLine.parse("reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\" /v \"" + folderType + "\"");
executor.execute(toDevicePath);
return new RegQueryParser(new String(baos.toByteArray())).getValueOfKey();
}
/**
* Remove extra quotes, slashes, and garbage from the Windows PATH.
*/
@ -178,54 +103,15 @@ public class Platform extends processing.app.Platform {
}
}
// looking for Documents and Settings/blah/Application Data/Processing
public File getSettingsFolder() throws Exception {
// HKEY_CURRENT_USER\Software\Microsoft
// \Windows\CurrentVersion\Explorer\Shell Folders
// Value Name: AppData
// Value Type: REG_SZ
// Value Data: path
String keyPath =
"Software\\Microsoft\\Windows\\CurrentVersion" +
"\\Explorer\\Shell Folders";
String appDataPath =
Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "AppData");
File dataFolder = new File(appDataPath, "Arduino15");
return dataFolder;
public File getSettingsFolder() {
return settingsFolder;
}
// looking for Documents and Settings/blah/My Documents/Processing
// (though using a reg key since it's different on other platforms)
public File getDefaultSketchbookFolder() throws Exception {
// http://support.microsoft.com/?kbid=221837&sd=RMVP
// http://support.microsoft.com/kb/242557/en-us
// The path to the My Documents folder is stored in the following
// registry key, where path is the complete path to your storage location
// HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
// Value Name: Personal
// Value Type: REG_SZ
// Value Data: path
// in some instances, this may be overridden by a policy, in which case check:
// HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
String keyPath =
"Software\\Microsoft\\Windows\\CurrentVersion" +
"\\Explorer\\Shell Folders";
String personalPath =
Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "Personal");
return new File(personalPath, "Arduino");
return defaultSketchbookFolder;
}
public void openURL(String url) throws Exception {
// this is not guaranteed to work, because who knows if the
// path will always be c:\progra~1 et al. also if the user has

View File

@ -0,0 +1,35 @@
package processing.app.windows;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import java.util.Arrays;
import java.util.List;
public class RegQueryParser {
private String valueOfKey;
public RegQueryParser(String regQueryOutput) {
parse(regQueryOutput);
}
private void parse(String regQueryOutput) {
List<String> rows = Arrays.asList(regQueryOutput.replace("\r", "\n").replace("\n\n", "\n").split("\n"));
String row = Iterables.find(rows, new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.startsWith(" ");
}
});
String[] cols = row.split(" ");
assert cols.length == 4;
this.valueOfKey = cols[3];
}
public String getValueOfKey() {
return valueOfKey;
}
}

View File

@ -1,456 +0,0 @@
package processing.app.windows;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.TreeSet;
import com.sun.jna.ptr.IntByReference;
/**
* Methods for accessing the Windows Registry. Only String and DWORD values supported at the moment.
*/
public class Registry {
public static enum REGISTRY_ROOT_KEY{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE, USERS};
private final static HashMap<REGISTRY_ROOT_KEY, Integer> rootKeyMap = new HashMap<REGISTRY_ROOT_KEY, Integer>();
static {
rootKeyMap.put(REGISTRY_ROOT_KEY.CLASSES_ROOT, WINREG.HKEY_CLASSES_ROOT);
rootKeyMap.put(REGISTRY_ROOT_KEY.CURRENT_USER, WINREG.HKEY_CURRENT_USER);
rootKeyMap.put(REGISTRY_ROOT_KEY.LOCAL_MACHINE, WINREG.HKEY_LOCAL_MACHINE);
rootKeyMap.put(REGISTRY_ROOT_KEY.USERS, WINREG.HKEY_USERS);
}
/**
* Testing.
*
* @param args arguments
* @throws java.lang.Exception on error
*/
public static void main(String[] args) throws Exception {
}
/**
* Gets one of the root keys.
*
* @param key key type
* @return root key
*/
private static int getRegistryRootKey(REGISTRY_ROOT_KEY key) {
Advapi32 advapi32;
IntByReference pHandle;
int handle = 0;
advapi32 = Advapi32.INSTANCE;
pHandle = new IntByReference();
if(advapi32.RegOpenKeyEx(rootKeyMap.get(key), null, 0, 0, pHandle) == WINERROR.ERROR_SUCCESS) {
handle = pHandle.getValue();
}
return(handle);
}
/**
* Opens a key.
*
* @param rootKey root key
* @param subKeyName name of the key
* @param access access mode
* @return handle to the key or 0
*/
private static int openKey(REGISTRY_ROOT_KEY rootKey, String subKeyName, int access) {
Advapi32 advapi32;
IntByReference pHandle;
int rootKeyHandle;
advapi32 = Advapi32.INSTANCE;
rootKeyHandle = getRegistryRootKey(rootKey);
pHandle = new IntByReference();
if(advapi32.RegOpenKeyEx(rootKeyHandle, subKeyName, 0, access, pHandle) == WINERROR.ERROR_SUCCESS) {
return(pHandle.getValue());
} else {
return(0);
}
}
/**
* Converts a Windows buffer to a Java String.
*
* @param buf buffer
* @throws java.io.UnsupportedEncodingException on error
* @return String
*/
private static String convertBufferToString(byte[] buf) throws UnsupportedEncodingException {
return(new String(buf, 0, buf.length - 2, "UTF-16LE"));
}
/**
* Converts a Windows buffer to an int.
*
* @param buf buffer
* @return int
*/
private static int convertBufferToInt(byte[] buf) {
return(((int)(buf[0] & 0xff)) + (((int)(buf[1] & 0xff)) << 8) + (((int)(buf[2] & 0xff)) << 16) + (((int)(buf[3] & 0xff)) << 24));
}
/**
* Read a String value.
*
* @param rootKey root key
* @param subKeyName key name
* @param name value name
* @throws java.io.UnsupportedEncodingException on error
* @return String or null
*/
public static String getStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) throws UnsupportedEncodingException {
Advapi32 advapi32;
IntByReference pType, lpcbData;
byte[] lpData = new byte[1];
int handle = 0;
String ret = null;
advapi32 = Advapi32.INSTANCE;
pType = new IntByReference();
lpcbData = new IntByReference();
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ);
if(handle != 0) {
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) {
lpData = new byte[lpcbData.getValue()];
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) {
ret = convertBufferToString(lpData);
}
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Read an int value.
*
*
* @return int or 0
* @param rootKey root key
* @param subKeyName key name
* @param name value name
*/
public static int getIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) {
Advapi32 advapi32;
IntByReference pType, lpcbData;
byte[] lpData = new byte[1];
int handle = 0;
int ret = 0;
advapi32 = Advapi32.INSTANCE;
pType = new IntByReference();
lpcbData = new IntByReference();
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ);
if(handle != 0) {
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) {
lpData = new byte[lpcbData.getValue()];
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) {
ret = convertBufferToInt(lpData);
}
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Delete a value.
*
* @param rootKey root key
* @param subKeyName key name
* @param name value name
* @return true on success
*/
public static boolean deleteValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) {
Advapi32 advapi32;
int handle;
boolean ret = true;
advapi32 = Advapi32.INSTANCE;
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE);
if(handle != 0) {
if(advapi32.RegDeleteValue(handle, name) == WINERROR.ERROR_SUCCESS) {
ret = true;
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Writes a String value.
*
* @param rootKey root key
* @param subKeyName key name
* @param name value name
* @param value value
* @throws java.io.UnsupportedEncodingException on error
* @return true on success
*/
public static boolean setStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, String value) throws UnsupportedEncodingException {
Advapi32 advapi32;
int handle;
byte[] data;
boolean ret = false;
// appears to be Java 1.6 syntax, removing [fry]
//data = Arrays.copyOf(value.getBytes("UTF-16LE"), value.length() * 2 + 2);
data = new byte[value.length() * 2 + 2];
byte[] src = value.getBytes("UTF-16LE");
System.arraycopy(src, 0, data, 0, src.length);
advapi32 = Advapi32.INSTANCE;
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE);
if(handle != 0) {
if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_SZ, data, data.length) == WINERROR.ERROR_SUCCESS) {
ret = true;
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Writes an int value.
*
*
* @return true on success
* @param rootKey root key
* @param subKeyName key name
* @param name value name
* @param value value
*/
public static boolean setIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, int value) {
Advapi32 advapi32;
int handle;
byte[] data;
boolean ret = false;
data = new byte[4];
data[0] = (byte)(value & 0xff);
data[1] = (byte)((value >> 8) & 0xff);
data[2] = (byte)((value >> 16) & 0xff);
data[3] = (byte)((value >> 24) & 0xff);
advapi32 = Advapi32.INSTANCE;
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE);
if(handle != 0) {
if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_DWORD, data, data.length) == WINERROR.ERROR_SUCCESS) {
ret = true;
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Check for existence of a value.
*
* @param rootKey root key
* @param subKeyName key name
* @param name value name
* @return true if exists
*/
public static boolean valueExists(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) {
Advapi32 advapi32;
IntByReference pType, lpcbData;
byte[] lpData = new byte[1];
int handle = 0;
boolean ret = false;
advapi32 = Advapi32.INSTANCE;
pType = new IntByReference();
lpcbData = new IntByReference();
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ);
if(handle != 0) {
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) != WINERROR.ERROR_FILE_NOT_FOUND) {
ret = true;
} else {
ret = false;
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Create a new key.
*
* @param rootKey root key
* @param parent name of parent key
* @param name key name
* @return true on success
*/
public static boolean createKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) {
Advapi32 advapi32;
IntByReference hkResult, dwDisposition;
int handle = 0;
boolean ret = false;
advapi32 = Advapi32.INSTANCE;
hkResult = new IntByReference();
dwDisposition = new IntByReference();
handle = openKey(rootKey, parent, WINNT.KEY_READ);
if(handle != 0) {
if(advapi32.RegCreateKeyEx(handle, name, 0, null, WINNT.REG_OPTION_NON_VOLATILE, WINNT.KEY_READ, null,
hkResult, dwDisposition) == WINERROR.ERROR_SUCCESS) {
ret = true;
advapi32.RegCloseKey(hkResult.getValue());
} else {
ret = false;
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Delete a key.
*
* @param rootKey root key
* @param parent name of parent key
* @param name key name
* @return true on success
*/
public static boolean deleteKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) {
Advapi32 advapi32;
int handle = 0;
boolean ret = false;
advapi32 = Advapi32.INSTANCE;
handle = openKey(rootKey, parent, WINNT.KEY_READ);
if(handle != 0) {
if(advapi32.RegDeleteKey(handle, name) == WINERROR.ERROR_SUCCESS) {
ret = true;
} else {
ret = false;
}
advapi32.RegCloseKey(handle);
}
return(ret);
}
/**
* Get all sub keys of a key.
*
* @param rootKey root key
* @param parent key name
* @return array with all sub key names
*/
public static String[] getSubKeys(REGISTRY_ROOT_KEY rootKey, String parent) {
Advapi32 advapi32;
int handle = 0, dwIndex;
char[] lpName;
IntByReference lpcName;
WINBASE.FILETIME lpftLastWriteTime;
TreeSet<String> subKeys = new TreeSet<String>();
advapi32 = Advapi32.INSTANCE;
handle = openKey(rootKey, parent, WINNT.KEY_READ);
lpName = new char[256];
lpcName = new IntByReference(256);
lpftLastWriteTime = new WINBASE.FILETIME();
if(handle != 0) {
dwIndex = 0;
while(advapi32.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null,
null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) {
subKeys.add(new String(lpName, 0, lpcName.getValue()));
lpcName.setValue(256);
dwIndex++;
}
advapi32.RegCloseKey(handle);
}
return(subKeys.toArray(new String[]{}));
}
/**
* Get all values under a key.
*
* @param rootKey root key
* @param key jey name
* @throws java.io.UnsupportedEncodingException on error
* @return TreeMap with name and value pairs
*/
public static TreeMap<String, Object> getValues(REGISTRY_ROOT_KEY rootKey, String key) throws UnsupportedEncodingException {
Advapi32 advapi32;
int handle = 0, dwIndex, result = 0;
char[] lpValueName;
byte[] lpData;
IntByReference lpcchValueName, lpType, lpcbData;
String name;
TreeMap<String, Object> values = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
advapi32 = Advapi32.INSTANCE;
handle = openKey(rootKey, key, WINNT.KEY_READ);
lpValueName = new char[16384];
lpcchValueName = new IntByReference(16384);
lpType = new IntByReference();
lpData = new byte[1];
lpcbData = new IntByReference();
if(handle != 0) {
dwIndex = 0;
do {
lpcbData.setValue(0);
result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null,
lpType, lpData, lpcbData);
if(result == WINERROR.ERROR_MORE_DATA) {
lpData = new byte[lpcbData.getValue()];
lpcchValueName = new IntByReference(16384);
result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null,
lpType, lpData, lpcbData);
if(result == WINERROR.ERROR_SUCCESS) {
name = new String(lpValueName, 0, lpcchValueName.getValue());
switch(lpType.getValue()) {
case WINNT.REG_SZ:
values.put(name, convertBufferToString(lpData));
break;
case WINNT.REG_DWORD:
values.put(name, convertBufferToInt(lpData));
break;
default:
break;
}
}
}
dwIndex++;
} while(result == WINERROR.ERROR_SUCCESS);
advapi32.RegCloseKey(handle);
}
return(values);
}
}

View File

@ -1,43 +0,0 @@
/*
* WINBASE.java
*
* Created on 5. September 2007, 11:24
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package processing.app.windows;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
/**
*
* @author TB
*/
public interface WINBASE {
/*
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES,
*PSECURITY_ATTRIBUTES,
*LPSECURITY_ATTRIBUTES;*/
public static class SECURITY_ATTRIBUTES extends Structure {
public int nLength;
public Pointer lpSecurityDescriptor;
public boolean bInheritHandle;
}
/*
typedef struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;*/
public static class FILETIME extends Structure {
public int dwLowDateTime;
public int dwHighDateTime;
}
}

View File

@ -1,22 +0,0 @@
/*
* WINERROR.java
*
* Created on 7. August 2007, 08:09
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package processing.app.windows;
/**
*
* @author TB
*/
public interface WINERROR {
public final static int ERROR_SUCCESS = 0;
public final static int NO_ERROR = 0;
public final static int ERROR_FILE_NOT_FOUND = 2;
public final static int ERROR_MORE_DATA = 234;
}

View File

@ -1,73 +0,0 @@
/*
* WINNT.java
*
* Created on 8. August 2007, 13:41
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package processing.app.windows;
/**
*
* @author TB
*/
public interface WINNT {
public final static int DELETE = 0x00010000;
public final static int READ_CONTROL = 0x00020000;
public final static int WRITE_DAC = 0x00040000;
public final static int WRITE_OWNER = 0x00080000;
public final static int SYNCHRONIZE = 0x00100000;
public final static int STANDARD_RIGHTS_REQUIRED = 0x000F0000;
public final static int STANDARD_RIGHTS_READ = READ_CONTROL;
public final static int STANDARD_RIGHTS_WRITE = READ_CONTROL;
public final static int STANDARD_RIGHTS_EXECUTE = READ_CONTROL;
public final static int STANDARD_RIGHTS_ALL = 0x001F0000;
public final static int SPECIFIC_RIGHTS_ALL = 0x0000FFFF;
public final static int GENERIC_EXECUTE = 0x20000000;
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
public final static int KEY_QUERY_VALUE = 0x0001;
public final static int KEY_SET_VALUE = 0x0002;
public final static int KEY_CREATE_SUB_KEY = 0x0004;
public final static int KEY_ENUMERATE_SUB_KEYS = 0x0008;
public final static int KEY_NOTIFY = 0x0010;
public final static int KEY_CREATE_LINK = 0x0020;
public final static int KEY_READ = ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE));
public final static int KEY_WRITE = ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE));
public final static int REG_NONE = 0; // No value type
public final static int REG_SZ = 1; // Unicode nul terminated string
public final static int REG_EXPAND_SZ = 2; // Unicode nul terminated string
// (with environment variable references)
public final static int REG_BINARY = 3; // Free form binary
public final static int REG_DWORD = 4; // 32-bit number
public final static int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
public final static int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number
public final static int REG_LINK = 6; // Symbolic Link (unicode)
public final static int REG_MULTI_SZ = 7; // Multiple Unicode strings
public final static int REG_RESOURCE_LIST = 8; // Resource list in the resource map
public final static int REG_FULL_RESOURCE_DESCRIPTOR = 9; // Resource list in the hardware description
public final static int REG_RESOURCE_REQUIREMENTS_LIST = 10;
public final static int REG_OPTION_RESERVED = 0x00000000; // Parameter is reserved
public final static int REG_OPTION_NON_VOLATILE = 0x00000000; // Key is preserved
// when system is rebooted
public final static int REG_OPTION_VOLATILE = 0x00000001; // Key is not preserved
// when system is rebooted
public final static int REG_OPTION_CREATE_LINK = 0x00000002; // Created key is a
// symbolic link
public final static int REG_OPTION_BACKUP_RESTORE = 0x00000004; // open for backup or restore
// special access rules
// privilege required
public final static int REG_OPTION_OPEN_LINK = 0x00000008; // Open symbolic link
}

View File

@ -1,21 +0,0 @@
/*
* WINREG.java
*
* Created on 17. August 2007, 14:32
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package processing.app.windows;
/**
*
* @author TB
*/
public interface WINREG {
public final static int HKEY_CLASSES_ROOT = 0x80000000;
public final static int HKEY_CURRENT_USER = 0x80000001;
public final static int HKEY_LOCAL_MACHINE = 0x80000002;
public final static int HKEY_USERS = 0x80000003;
}

16
build/.editorconfig Normal file
View File

@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
[*.{md,adoc}]
indent_style = space
trim_trailing_whitespace = false

View File

@ -26,7 +26,6 @@ cp -r ../shared/lib processing/
cp -r ../shared/libraries processing/
cp ../../app/lib/antlr.jar processing/lib/
cp ../../app/lib/ecj.jar processing/lib/
cp ../../app/lib/jna.jar processing/lib/
cp ../shared/revisions.txt processing/
# add the libraries folder with source

View File

@ -9,7 +9,7 @@ javadoc -public -notimestamp -d core \
# setting this up right, so if anyone knows how to do it without specifying
# all the directories like this, please let us know.
javadoc -public -notimestamp -d everything \
-classpath ../../app/lib/antlr.jar:../../app/lib/jna.jar:../../serial/library/jssc-2.6.0.jar:../../opengl/library/jogl.jar:../../pdf/library/itext.jar:../../app/lib/ecj.jar \
-classpath ../../app/lib/antlr.jar:../../serial/library/jssc-2.6.0.jar:../../opengl/library/jogl.jar:../../pdf/library/itext.jar:../../app/lib/ecj.jar \
../../core/src/processing/core/*.java \
../../core/src/processing/xml/*.java \
../../app/src/antlr/*.java \

View File

@ -97,7 +97,7 @@
<!-- In 0149, removed /System/Library/Java from the CLASSPATH because
it can cause problems if users have installed weird files there.
http://dev.processing.org/bugs/show_bug.cgi?id=1045 -->
<string>$JAVAROOT/antlr.jar:$JAVAROOT/apple.jar:$JAVAROOT/arduino-core.jar:$JAVAROOT/bcpg-jdk15on-152.jar:$JAVAROOT/bcprov-jdk15on-152.jar:$JAVAROOT/commons-codec-1.7.jar:$JAVAROOT/commons-compress-1.8.jar:$JAVAROOT/commons-exec-1.1.jar:$JAVAROOT/commons-httpclient-3.1.jar:$JAVAROOT/commons-lang3-3.3.2.jar:$JAVAROOT/commons-logging-1.0.4.jar:$JAVAROOT/ecj.jar:$JAVAROOT/guava-18.0.jar:$JAVAROOT/jackson-annotations-2.2.3.jar:$JAVAROOT/jackson-core-2.2.3.jar:$JAVAROOT/jackson-databind-2.2.3.jar:$JAVAROOT/jackson-module-mrbean-2.2.3.jar:$JAVAROOT/java-semver-0.8.0.jar:$JAVAROOT/jmdns-3.4.1.jar:$JAVAROOT/jna.jar:$JAVAROOT/jsch-0.1.50.jar:$JAVAROOT/jssc-2.8.0.jar:$JAVAROOT/pde.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/rsyntaxtextarea-2.5.6.1+arduino.jar</string>
<string>$JAVAROOT/antlr.jar:$JAVAROOT/apple.jar:$JAVAROOT/arduino-core.jar:$JAVAROOT/bcpg-jdk15on-152.jar:$JAVAROOT/bcprov-jdk15on-152.jar:$JAVAROOT/commons-codec-1.7.jar:$JAVAROOT/commons-compress-1.8.jar:$JAVAROOT/commons-exec-1.1.jar:$JAVAROOT/commons-httpclient-3.1.jar:$JAVAROOT/commons-lang3-3.3.2.jar:$JAVAROOT/commons-logging-1.0.4.jar:$JAVAROOT/ecj.jar:$JAVAROOT/guava-18.0.jar:$JAVAROOT/jackson-annotations-2.2.3.jar:$JAVAROOT/jackson-core-2.2.3.jar:$JAVAROOT/jackson-databind-2.2.3.jar:$JAVAROOT/jackson-module-mrbean-2.2.3.jar:$JAVAROOT/java-semver-0.8.0.jar:$JAVAROOT/jmdns-3.4.1.jar:$JAVAROOT/jsch-0.1.50.jar:$JAVAROOT/jssc-2.8.0.jar:$JAVAROOT/pde.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/rsyntaxtextarea-2.5.6.1+arduino.jar</string>
<key>JVMArchs</key>
<array>

View File

@ -34,7 +34,6 @@
<cp>lib/jackson-module-mrbean-2.2.3.jar</cp>
<cp>lib/java-semver-0.8.0.jar</cp>
<cp>lib/jmdns-3.4.1.jar</cp>
<cp>lib/jna.jar</cp>
<cp>lib/jsch-0.1.50.jar</cp>
<cp>lib/jssc-2.8.0.jar</cp>
<cp>lib/pde.jar</cp>
@ -45,7 +44,6 @@
<runtimeBits>32</runtimeBits>
<opt>-splash:./lib/splash.png</opt>
<opt>-Dsun.java2d.d3d=false</opt>
<opt>-Djna.nosys=true</opt>
</jre>
<messages>
<startupErr>An error occurred while starting the application.</startupErr>

View File

@ -34,7 +34,6 @@
<cp>lib/jackson-module-mrbean-2.2.3.jar</cp>
<cp>lib/java-semver-0.8.0.jar</cp>
<cp>lib/jmdns-3.4.1.jar</cp>
<cp>lib/jna.jar</cp>
<cp>lib/jsch-0.1.50.jar</cp>
<cp>lib/jssc-2.8.0.jar</cp>
<cp>lib/pde.jar</cp>
@ -44,7 +43,6 @@
<path>java</path>
<runtimeBits>32</runtimeBits>
<opt>-Dsun.java2d.d3d=false</opt>
<opt>-Djna.nosys=true</opt>
</jre>
<messages>
<startupErr>An error occurred while starting the application.</startupErr>