From 7be39dbed35283a295f0d347f62d063d27410e3d Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Wed, 9 Apr 2008 12:55:32 +0000 Subject: [PATCH] [225874][wince][api] Rename org.eclipse.tm.rapi.OS to Rapi --- .../wince/WinCEConnectorService.java | 4 +- .../wince/files/WinCEFileService.java | 50 +++--- .../tm/rapi/examples/RapiExamples.java | 24 +-- .../tm/rapi/tests/RapiSessionTest.java | 48 +++--- .../eclipse/tm/rapi/tests/RapiTestCase.java | 6 +- wince/org.eclipse.tm.rapi/build/jrapi.vcproj | 6 +- .../lib/os/win32/x86/jrapi.dll | Bin 15872 -> 15872 bytes .../native/{OS.cpp => Rapi.cpp} | 4 +- .../native/org_eclipse_tm_rapi_OS.h | 147 ------------------ .../native/org_eclipse_tm_rapi_Rapi.h | 147 ++++++++++++++++++ .../eclipse/tm/internal/rapi/RapiDesktop.java | 4 +- .../eclipse/tm/internal/rapi/RapiDevice.java | 10 +- .../tm/internal/rapi/RapiEnumDevices.java | 4 +- .../eclipse/tm/internal/rapi/RapiSession.java | 20 +-- .../src/org/eclipse/tm/rapi/IRapiDesktop.java | 4 +- .../src/org/eclipse/tm/rapi/IRapiSession.java | 6 +- .../src/org/eclipse/tm/rapi/IUnknown.java | 2 +- .../eclipse/tm/rapi/{OS.java => Rapi.java} | 33 ++-- .../src/org/eclipse/tm/rapi/RapiFindData.java | 6 +- 19 files changed, 263 insertions(+), 262 deletions(-) rename wince/org.eclipse.tm.rapi/native/{OS.cpp => Rapi.cpp} (93%) delete mode 100644 wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_OS.h create mode 100644 wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_Rapi.h rename wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/{OS.java => Rapi.java} (95%) diff --git a/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/connectorservice/wince/WinCEConnectorService.java b/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/connectorservice/wince/WinCEConnectorService.java index 2c422a2bb99..700508c14b2 100644 --- a/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/connectorservice/wince/WinCEConnectorService.java +++ b/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/connectorservice/wince/WinCEConnectorService.java @@ -19,7 +19,7 @@ import org.eclipse.tm.rapi.IRapiDesktop; import org.eclipse.tm.rapi.IRapiDevice; import org.eclipse.tm.rapi.IRapiEnumDevices; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.RapiException; @@ -39,7 +39,7 @@ public class WinCEConnectorService extends BasicConnectorService implements IRap protected void internalConnect(IProgressMonitor monitor) throws Exception { fireCommunicationsEvent(CommunicationsEvent.BEFORE_CONNECT); - OS.CoInitializeEx(0, OS.COINIT_MULTITHREADED); + Rapi.CoInitializeEx(0, Rapi.COINIT_MULTITHREADED); desktop = IRapiDesktop.getInstance(); enumDevices = desktop.enumDevices(); device = enumDevices.next(); diff --git a/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java b/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java index e744ee7ff2c..ce2c533e88f 100644 --- a/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java +++ b/wince/org.eclipse.rse.subsystems.wince/src/org/eclipse/rse/internal/services/wince/files/WinCEFileService.java @@ -34,7 +34,7 @@ import org.eclipse.rse.services.files.IFileService; import org.eclipse.rse.services.files.IHostFile; import org.eclipse.rse.services.files.RemoteFileException; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.RapiException; import org.eclipse.tm.rapi.RapiFindData; @@ -71,8 +71,8 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi try { IRapiSession session = sessionProvider.getSession(); RapiFindData[] foundFiles = session.findAllFiles(concat(parentPath,"*"), //$NON-NLS-1$ - OS.FAF_NAME | OS.FAF_ATTRIBUTES | OS.FAF_LASTWRITE_TIME | - OS.FAF_SIZE_HIGH | OS.FAF_SIZE_LOW); + Rapi.FAF_NAME | Rapi.FAF_ATTRIBUTES | Rapi.FAF_LASTWRITE_TIME | + Rapi.FAF_SIZE_HIGH | Rapi.FAF_SIZE_LOW); for (int i = 0 ; i < foundFiles.length ; i++) { String fileName = foundFiles[i].fileName; if (fileMatcher.matches(fileName)) { @@ -90,9 +90,9 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi } private WinCEHostFile makeHostFile(String parentPath, String fileName, RapiFindData findData) { - boolean isDirectory = (findData.fileAttributes & OS.FILE_ATTRIBUTE_DIRECTORY) != 0; + boolean isDirectory = (findData.fileAttributes & Rapi.FILE_ATTRIBUTE_DIRECTORY) != 0; boolean isRoot = "\\".equals(parentPath) && "\\".equals(fileName); //$NON-NLS-1$ //$NON-NLS-2$ - long lastModified = (findData.lastWriteTime / 10000) - OS.TIME_DIFF; + long lastModified = (findData.lastWriteTime / 10000) - Rapi.TIME_DIFF; long size = findData.fileSize; return new WinCEHostFile(parentPath, fileName, isDirectory, isRoot, lastModified, size); } @@ -102,7 +102,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi if (attr == -1) { return false; } - return (attr & OS.FILE_ATTRIBUTE_DIRECTORY) != 0; + return (attr & Rapi.FILE_ATTRIBUTE_DIRECTORY) != 0; } private boolean exist(IRapiSession session, String fileName) { @@ -130,7 +130,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi delete(tgtParent, tgtName, monitor); } session.createDirectory(tgtFullPath); - RapiFindData[] allFiles = session.findAllFiles(concat(srcFullPath,"*"), OS.FAF_NAME); //$NON-NLS-1$ + RapiFindData[] allFiles = session.findAllFiles(concat(srcFullPath,"*"), Rapi.FAF_NAME); //$NON-NLS-1$ for (int i = 0 ; i < allFiles.length ; i++) { String fileName = allFiles[i].fileName; copy(srcFullPath, fileName, tgtFullPath, fileName, monitor); @@ -158,8 +158,8 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi String fullPath = concat(remoteParent, fileName); IRapiSession session = sessionProvider.getSession(); try { - int handle = session.createFile(fullPath, OS.GENERIC_WRITE, OS.FILE_SHARE_READ, - OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fullPath, Rapi.GENERIC_WRITE, Rapi.FILE_SHARE_READ, + Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); session.closeHandle(handle); RapiFindData findData = new RapiFindData(); handle = session.findFirstFile(fullPath, findData); @@ -192,7 +192,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi try { if (isDirectory(session, fullPath)) { // recursive delete if it is a directory - RapiFindData[] allFiles = session.findAllFiles(concat(fullPath, "*"), OS.FAF_NAME); //$NON-NLS-1$ + RapiFindData[] allFiles = session.findAllFiles(concat(fullPath, "*"), Rapi.FAF_NAME); //$NON-NLS-1$ for (int i = 0 ; i < allFiles.length ; i++) { delete(fullPath, allFiles[i].fileName, monitor); } @@ -219,11 +219,11 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi } String fullPath = concat(remoteParent, remoteFile); IRapiSession session = sessionProvider.getSession(); - int handle = OS.INVALID_HANDLE_VALUE; + int handle = Rapi.INVALID_HANDLE_VALUE; BufferedOutputStream bos = null; try { - handle = session.createFile(fullPath, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + handle = session.createFile(fullPath, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); bos = new BufferedOutputStream(new FileOutputStream(localFile)); // don't increase the buffer size! the native functions sometimes fail with large buffers, 4K always work byte[] buffer = new byte[4 * 1024]; @@ -242,7 +242,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi //FIXME error handling throw new RemoteFileException(e.getMessage()); } finally { - if (handle != OS.INVALID_HANDLE_VALUE) { + if (handle != Rapi.INVALID_HANDLE_VALUE) { try { session.closeHandle(handle); } catch (RapiException e) { @@ -330,10 +330,10 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi BufferedInputStream bis = new BufferedInputStream(stream); IRapiSession session = sessionProvider.getSession(); String fullPath = concat(remoteParent, remoteFile); - int handle = OS.INVALID_HANDLE_VALUE; + int handle = Rapi.INVALID_HANDLE_VALUE; try { - handle = session.createFile(fullPath, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + handle = session.createFile(fullPath, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); // don't increase the buffer size! the native functions sometimes fail with large buffers, 4K always work byte[] buffer = new byte[4 * 1024]; while (true) { @@ -350,7 +350,7 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi //FIXME error handling throw new RemoteFileException(e.getMessage()); } finally { - if (handle != OS.INVALID_HANDLE_VALUE) { + if (handle != Rapi.INVALID_HANDLE_VALUE) { try { session.closeHandle(handle); } catch (RapiException e) { @@ -384,8 +384,8 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi String fullPath = concat(remoteParent, remoteFile); IRapiSession session = sessionProvider.getSession(); try { - int handle = session.createFile(fullPath, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fullPath, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); return new BufferedInputStream(new WinCEInputStream(session, handle)); } catch (RapiException e) { //FIXME error handling @@ -398,14 +398,14 @@ public class WinCEFileService extends AbstractFileService implements IWinCEServi String fullPath = concat(remoteParent, remoteFile); IRapiSession session = sessionProvider.getSession(); try { - int cd = OS.CREATE_ALWAYS; + int cd = Rapi.CREATE_ALWAYS; if ((options & IFileService.APPEND) == 0) { - cd = OS.CREATE_ALWAYS; + cd = Rapi.CREATE_ALWAYS; } else { - cd = OS.OPEN_EXISTING; + cd = Rapi.OPEN_EXISTING; } - int handle = session.createFile(fullPath, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, cd, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fullPath, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, cd, Rapi.FILE_ATTRIBUTE_NORMAL); return new BufferedOutputStream(new WinCEOutputStream(session, handle)); } catch (RapiException e) { //FIXME error handling diff --git a/wince/org.eclipse.tm.rapi.examples/src/org/eclipse/tm/rapi/examples/RapiExamples.java b/wince/org.eclipse.tm.rapi.examples/src/org/eclipse/tm/rapi/examples/RapiExamples.java index 90eb6ba53ec..268214ad19f 100644 --- a/wince/org.eclipse.tm.rapi.examples/src/org/eclipse/tm/rapi/examples/RapiExamples.java +++ b/wince/org.eclipse.tm.rapi.examples/src/org/eclipse/tm/rapi/examples/RapiExamples.java @@ -14,7 +14,7 @@ import org.eclipse.tm.rapi.IRapiDesktop; import org.eclipse.tm.rapi.IRapiDevice; import org.eclipse.tm.rapi.IRapiEnumDevices; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.ProcessInformation; import org.eclipse.tm.rapi.RapiConnectionInfo; import org.eclipse.tm.rapi.RapiDeviceInfo; @@ -37,7 +37,7 @@ public class RapiExamples { * Initialize the underlying natives. */ public void initRapi() { - OS.CoInitializeEx(0, OS.COINIT_MULTITHREADED); + Rapi.CoInitializeEx(0, Rapi.COINIT_MULTITHREADED); } /** @@ -56,7 +56,7 @@ public class RapiExamples { if (session != null) { session.release(); } - OS.CoUninitialize(); + Rapi.CoUninitialize(); } /** @@ -87,8 +87,8 @@ public class RapiExamples { */ public void createFile(String fileName) throws RapiException { System.out.println(">>> createFile()"); - int handle = session.createFile(fileName, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fileName, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); byte[] content = "Hello world!".getBytes(); session.writeFile(handle, content); session.closeHandle(handle); @@ -99,8 +99,8 @@ public class RapiExamples { */ public void readFile(String fileName) throws RapiException { System.out.println(">>> readFile()"); - int handle = session.createFile(fileName, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fileName, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); byte[] buf = new byte[256]; int br = session.readFile(handle, buf); System.out.println("readFile: " + new String(buf, 0, br)); @@ -113,7 +113,7 @@ public class RapiExamples { * describes a directory. */ boolean isDirectory(RapiFindData findData) { - return (findData.fileAttributes & OS.FILE_ATTRIBUTE_DIRECTORY) != 0; + return (findData.fileAttributes & Rapi.FILE_ATTRIBUTE_DIRECTORY) != 0; } /** @@ -154,7 +154,7 @@ public class RapiExamples { public void listFiles2(String dir) throws RapiException { System.out.println(">>> listFiles2()"); RapiFindData[] fdArr = session.findAllFiles(dir + "*", - OS.FAF_ATTRIBUTES | OS.FAF_NAME | OS.FAF_SIZE_LOW); + Rapi.FAF_ATTRIBUTES | Rapi.FAF_NAME | Rapi.FAF_SIZE_LOW); for (int i = 0 ; i < fdArr.length ; i++) { printFindData(fdArr[i], 0); } @@ -165,8 +165,8 @@ public class RapiExamples { */ public void statFile(String fileName) throws RapiException { System.out.println(">>> statFile()"); - int handle = session.createFile(fileName, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fileName, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); int fileAttributes = session.getFileAttributes(fileName); System.out.println("fileAttributes: " + fileAttributes); long fileSize = session.getFileSize(handle); @@ -182,7 +182,7 @@ public class RapiExamples { */ void printDeviceTree(String dir, int indent) throws RapiException { RapiFindData[] fdArr = session.findAllFiles(dir + "*", - OS.FAF_ATTRIBUTES | OS.FAF_NAME | OS.FAF_SIZE_LOW); + Rapi.FAF_ATTRIBUTES | Rapi.FAF_NAME | Rapi.FAF_SIZE_LOW); if (fdArr == null) { return; } diff --git a/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiSessionTest.java b/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiSessionTest.java index 7a27ebcb0ca..62363958132 100644 --- a/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiSessionTest.java +++ b/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiSessionTest.java @@ -12,7 +12,7 @@ package org.eclipse.tm.rapi.tests; import org.eclipse.tm.rapi.IRapiDesktop; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.RapiException; import org.eclipse.tm.rapi.RapiFindData; @@ -61,7 +61,7 @@ public class RapiSessionTest extends RapiTestCase { if (attr == -1) { return false; } - return (attr & OS.FILE_ATTRIBUTE_DIRECTORY) != 0; + return (attr & Rapi.FILE_ATTRIBUTE_DIRECTORY) != 0; } /** @@ -72,7 +72,7 @@ public class RapiSessionTest extends RapiTestCase { if (attr == -1) { return false; } - return (attr & OS.FILE_ATTRIBUTE_DIRECTORY) == 0; + return (attr & Rapi.FILE_ATTRIBUTE_DIRECTORY) == 0; } /** @@ -88,22 +88,22 @@ public class RapiSessionTest extends RapiTestCase { } // write the test file at once - int handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); session.writeFile(handle, content); session.closeHandle(handle); // try to read the whole file - handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); byte[] contentRead = new byte[TEST_FILE_SIZE]; int br = session.readFile(handle, contentRead); session.closeHandle(handle); assertTrue("Different file content", arraysEqual(content, contentRead, br)); // write the test file by chunks - handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); int off = 0; for (int i = 0 ; i < TEST_FILE_SIZE / CHUNK_SIZE ; i++) { session.writeFile(handle, content, off, CHUNK_SIZE); @@ -112,8 +112,8 @@ public class RapiSessionTest extends RapiTestCase { session.closeHandle(handle); // read the test file by chunks - handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); byte[] contentRead2 = new byte[TEST_FILE_SIZE]; off = 0; int bytesToRead = TEST_FILE_SIZE; @@ -150,8 +150,8 @@ public class RapiSessionTest extends RapiTestCase { * Utility method for creating files. */ void createFile(IRapiSession session, String fileName) throws RapiException { - int handle = session.createFile(fileName, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(fileName, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); session.writeFile(handle, "spam".getBytes()); session.closeHandle(handle); } @@ -222,7 +222,7 @@ public class RapiSessionTest extends RapiTestCase { public void testFindAllFiles() throws RapiException { createInitSession(); createTempFiles(); - RapiFindData[] faf = session.findAllFiles(TEST_FILE_NAME + "?", OS.FAF_NAME); + RapiFindData[] faf = session.findAllFiles(TEST_FILE_NAME + "?", Rapi.FAF_NAME); int filesFound = faf.length; assertTrue("Found " + filesFound + " , expected " + TEMP_FILES_COUNT, filesFound == TEMP_FILES_COUNT); @@ -240,15 +240,15 @@ public class RapiSessionTest extends RapiTestCase { // create test file createFile(session, TEST_FILE_NAME); - session.setFileAttributes(TEST_FILE_NAME, OS.FILE_ATTRIBUTE_READONLY); + session.setFileAttributes(TEST_FILE_NAME, Rapi.FILE_ATTRIBUTE_READONLY); int attr = session.getFileAttributes(TEST_FILE_NAME); assertTrue("Wrong file attributes, expected FILE_ATTRIBUTE_READONLY", - (attr & OS.FILE_ATTRIBUTE_READONLY) != 0); + (attr & Rapi.FILE_ATTRIBUTE_READONLY) != 0); - session.setFileAttributes(TEST_FILE_NAME, OS.FILE_ATTRIBUTE_ARCHIVE); + session.setFileAttributes(TEST_FILE_NAME, Rapi.FILE_ATTRIBUTE_ARCHIVE); attr = session.getFileAttributes(TEST_FILE_NAME); assertTrue("Wrong file attributes, expected FILE_ATTRIBUTE_ARCHIVE", - (attr & OS.FILE_ATTRIBUTE_ARCHIVE) != 0); + (attr & Rapi.FILE_ATTRIBUTE_ARCHIVE) != 0); //clean up session.deleteFile(TEST_FILE_NAME); @@ -260,8 +260,8 @@ public class RapiSessionTest extends RapiTestCase { public void testGetFileSize() throws RapiException { createInitSession(); // create test file - int handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); session.writeFile(handle, "spam".getBytes()); assertTrue("Wrong file size, expected size 4 bytes", 4 == session.getFileSize(handle)); session.closeHandle(handle); @@ -279,14 +279,14 @@ public class RapiSessionTest extends RapiTestCase { long d = System.currentTimeMillis() + 3600000; // create file and set last access time to d - int handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_WRITE, - OS.FILE_SHARE_READ, OS.CREATE_ALWAYS, OS.FILE_ATTRIBUTE_NORMAL); + int handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_WRITE, + Rapi.FILE_SHARE_READ, Rapi.CREATE_ALWAYS, Rapi.FILE_ATTRIBUTE_NORMAL); session.writeFile(handle, "spam".getBytes()); session.setFileLastWriteTime(handle, d); session.closeHandle(handle); // get file last write time and compare to d - handle = session.createFile(TEST_FILE_NAME, OS.GENERIC_READ, - OS.FILE_SHARE_READ, OS.OPEN_EXISTING, OS.FILE_ATTRIBUTE_NORMAL); + handle = session.createFile(TEST_FILE_NAME, Rapi.GENERIC_READ, + Rapi.FILE_SHARE_READ, Rapi.OPEN_EXISTING, Rapi.FILE_ATTRIBUTE_NORMAL); long lwTime = session.getFileLastWriteTime(handle); // the precision of setLastWriteTime should be about 1-2sec assertTrue("Too big difference for lastWriteTime, expected: " + d diff --git a/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiTestCase.java b/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiTestCase.java index d83f2c91852..e2f4033f048 100644 --- a/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiTestCase.java +++ b/wince/org.eclipse.tm.rapi.tests/src/org/eclipse/tm/rapi/tests/RapiTestCase.java @@ -14,7 +14,7 @@ import org.eclipse.tm.rapi.IRapiDesktop; import org.eclipse.tm.rapi.IRapiDevice; import org.eclipse.tm.rapi.IRapiEnumDevices; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import junit.framework.TestCase; @@ -31,7 +31,7 @@ public class RapiTestCase extends TestCase { enumDevices = null; device = null; session = null; - OS.CoInitializeEx(0, OS.COINIT_MULTITHREADED); + Rapi.CoInitializeEx(0, Rapi.COINIT_MULTITHREADED); } protected void tearDown() throws Exception { @@ -48,7 +48,7 @@ public class RapiTestCase extends TestCase { if (session != null) { session.release(); } - OS.CoUninitialize(); + Rapi.CoUninitialize(); } } diff --git a/wince/org.eclipse.tm.rapi/build/jrapi.vcproj b/wince/org.eclipse.tm.rapi/build/jrapi.vcproj index 7c479e350b3..40b7c322135 100644 --- a/wince/org.eclipse.tm.rapi/build/jrapi.vcproj +++ b/wince/org.eclipse.tm.rapi/build/jrapi.vcproj @@ -1,7 +1,7 @@ diff --git a/wince/org.eclipse.tm.rapi/lib/os/win32/x86/jrapi.dll b/wince/org.eclipse.tm.rapi/lib/os/win32/x86/jrapi.dll index 61f8e16e3905c2fe43dbbb2a0d3336a9eecc97af..da109aaf7778a76e79e5f0319b482783b0c8fcf2 100644 GIT binary patch delta 129 zcmZpuX{cGi$h^V#&tzssUuL^lhRMNhmolzqEZ(fhv{?xxx%s-vSw?}Pzrm-D z{gd~eS>zy-u35>td5hWy7UuOp>E+t0jGT8J7#MgR85kTlU)A}@&JvVZkU9B;i7tfk U-9!h%P&GAxFv3k2E;8c)09bi1sQ>@~ delta 124 zcmZpuX{cGi$UK$(_he>9U*;MC#>v5qij1cxmolzq%-*cXv{?xxx%s-vSw;cxTmPjM zMVET)d(gq_)#ekod5hWy7O?bkZB<6j+YSs2oQ@0()|;>Dd}L?x51xF=L>EN;Hqil5 S+NK5|D&BPAL<5dRW*h+73oB;; diff --git a/wince/org.eclipse.tm.rapi/native/OS.cpp b/wince/org.eclipse.tm.rapi/native/Rapi.cpp similarity index 93% rename from wince/org.eclipse.tm.rapi/native/OS.cpp rename to wince/org.eclipse.tm.rapi/native/Rapi.cpp index 476bc59afea..bc64b65b697 100644 --- a/wince/org.eclipse.tm.rapi/native/OS.cpp +++ b/wince/org.eclipse.tm.rapi/native/Rapi.cpp @@ -13,9 +13,9 @@ #include #include -#include "org_eclipse_tm_rapi_OS.h" +#include "org_eclipse_tm_rapi_Rapi.h" -#define RAPI_NATIVE(func) Java_org_eclipse_tm_rapi_OS_##func +#define RAPI_NATIVE(func) Java_org_eclipse_tm_rapi_Rapi_##func JNIEXPORT jint JNICALL RAPI_NATIVE(CoInitializeEx) (JNIEnv *env, jclass that, jint arg0, jint arg1) diff --git a/wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_OS.h b/wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_OS.h deleted file mode 100644 index 63446a78ef0..00000000000 --- a/wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_OS.h +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Radoslav Gerganov - * 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: - * Radoslav Gerganov - initial API and implementation - *******************************************************************************/ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_eclipse_tm_rapi_OS */ - -#ifndef _Included_org_eclipse_tm_rapi_OS -#define _Included_org_eclipse_tm_rapi_OS -#ifdef __cplusplus -extern "C" { -#endif -#undef org_eclipse_tm_rapi_OS_NOERROR -#define org_eclipse_tm_rapi_OS_NOERROR 0L -#undef org_eclipse_tm_rapi_OS_GENERIC_READ -#define org_eclipse_tm_rapi_OS_GENERIC_READ -2147483648L -#undef org_eclipse_tm_rapi_OS_GENERIC_WRITE -#define org_eclipse_tm_rapi_OS_GENERIC_WRITE 1073741824L -#undef org_eclipse_tm_rapi_OS_FILE_SHARE_READ -#define org_eclipse_tm_rapi_OS_FILE_SHARE_READ 1L -#undef org_eclipse_tm_rapi_OS_FILE_SHARE_WRITE -#define org_eclipse_tm_rapi_OS_FILE_SHARE_WRITE 2L -#undef org_eclipse_tm_rapi_OS_CREATE_NEW -#define org_eclipse_tm_rapi_OS_CREATE_NEW 1L -#undef org_eclipse_tm_rapi_OS_CREATE_ALWAYS -#define org_eclipse_tm_rapi_OS_CREATE_ALWAYS 2L -#undef org_eclipse_tm_rapi_OS_OPEN_EXISTING -#define org_eclipse_tm_rapi_OS_OPEN_EXISTING 3L -#undef org_eclipse_tm_rapi_OS_OPEN_ALWAYS -#define org_eclipse_tm_rapi_OS_OPEN_ALWAYS 4L -#undef org_eclipse_tm_rapi_OS_TRUNCATE_EXISTING -#define org_eclipse_tm_rapi_OS_TRUNCATE_EXISTING 5L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_ARCHIVE -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_ARCHIVE 32L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_COMPRESSED -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_COMPRESSED 2048L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_DIRECTORY -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_DIRECTORY 16L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_ENCRYPTED -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_ENCRYPTED 16384L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_HIDDEN -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_HIDDEN 2L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_INROM -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_INROM 64L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_NORMAL -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_NORMAL 128L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_READONLY -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_READONLY 1L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_REPARSE_POINT -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_REPARSE_POINT 1024L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_ROMMODULE -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_ROMMODULE 8192L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_SPARSE_FILE -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_SPARSE_FILE 512L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_SYSTEM -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_SYSTEM 4L -#undef org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_TEMPORARY -#define org_eclipse_tm_rapi_OS_FILE_ATTRIBUTE_TEMPORARY 256L -#undef org_eclipse_tm_rapi_OS_FILE_FLAG_WRITE_THROUGH -#define org_eclipse_tm_rapi_OS_FILE_FLAG_WRITE_THROUGH -2147483648L -#undef org_eclipse_tm_rapi_OS_FILE_FLAG_OVERLAPPED -#define org_eclipse_tm_rapi_OS_FILE_FLAG_OVERLAPPED 1073741824L -#undef org_eclipse_tm_rapi_OS_FILE_FLAG_RANDOM_ACCESS -#define org_eclipse_tm_rapi_OS_FILE_FLAG_RANDOM_ACCESS 268435456L -#undef org_eclipse_tm_rapi_OS_FILE_FLAG_SEQUENTIAL_SCAN -#define org_eclipse_tm_rapi_OS_FILE_FLAG_SEQUENTIAL_SCAN 134217728L -#undef org_eclipse_tm_rapi_OS_FAF_ATTRIB_CHILDREN -#define org_eclipse_tm_rapi_OS_FAF_ATTRIB_CHILDREN 4096L -#undef org_eclipse_tm_rapi_OS_FAF_ATTRIB_NO_HIDDEN -#define org_eclipse_tm_rapi_OS_FAF_ATTRIB_NO_HIDDEN 8192L -#undef org_eclipse_tm_rapi_OS_FAF_FOLDERS_ONLY -#define org_eclipse_tm_rapi_OS_FAF_FOLDERS_ONLY 16384L -#undef org_eclipse_tm_rapi_OS_FAF_NO_HIDDEN_SYS_ROMMODULES -#define org_eclipse_tm_rapi_OS_FAF_NO_HIDDEN_SYS_ROMMODULES 32768L -#undef org_eclipse_tm_rapi_OS_FAF_GETTARGET -#define org_eclipse_tm_rapi_OS_FAF_GETTARGET 65536L -#undef org_eclipse_tm_rapi_OS_FAF_ATTRIBUTES -#define org_eclipse_tm_rapi_OS_FAF_ATTRIBUTES 1L -#undef org_eclipse_tm_rapi_OS_FAF_CREATION_TIME -#define org_eclipse_tm_rapi_OS_FAF_CREATION_TIME 2L -#undef org_eclipse_tm_rapi_OS_FAF_LASTACCESS_TIME -#define org_eclipse_tm_rapi_OS_FAF_LASTACCESS_TIME 4L -#undef org_eclipse_tm_rapi_OS_FAF_LASTWRITE_TIME -#define org_eclipse_tm_rapi_OS_FAF_LASTWRITE_TIME 8L -#undef org_eclipse_tm_rapi_OS_FAF_SIZE_HIGH -#define org_eclipse_tm_rapi_OS_FAF_SIZE_HIGH 16L -#undef org_eclipse_tm_rapi_OS_FAF_SIZE_LOW -#define org_eclipse_tm_rapi_OS_FAF_SIZE_LOW 32L -#undef org_eclipse_tm_rapi_OS_FAF_OID -#define org_eclipse_tm_rapi_OS_FAF_OID 64L -#undef org_eclipse_tm_rapi_OS_FAF_NAME -#define org_eclipse_tm_rapi_OS_FAF_NAME 128L -#undef org_eclipse_tm_rapi_OS_INVALID_HANDLE_VALUE -#define org_eclipse_tm_rapi_OS_INVALID_HANDLE_VALUE -1L -#undef org_eclipse_tm_rapi_OS_TIME_DIFF -#define org_eclipse_tm_rapi_OS_TIME_DIFF 11644473600000i64 -#undef org_eclipse_tm_rapi_OS_COINIT_MULTITHREADED -#define org_eclipse_tm_rapi_OS_COINIT_MULTITHREADED 0L -#undef org_eclipse_tm_rapi_OS_COINIT_APARTMENTTHREADED -#define org_eclipse_tm_rapi_OS_COINIT_APARTMENTTHREADED 2L -#undef org_eclipse_tm_rapi_OS_COINIT_DISABLE_OLE1DDE -#define org_eclipse_tm_rapi_OS_COINIT_DISABLE_OLE1DDE 4L -#undef org_eclipse_tm_rapi_OS_COINIT_SPEED_OVER_MEMORY -#define org_eclipse_tm_rapi_OS_COINIT_SPEED_OVER_MEMORY 8L -/* - * Class: org_eclipse_tm_rapi_OS - * Method: CoInitializeEx - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_tm_rapi_OS_CoInitializeEx - (JNIEnv *, jclass, jint, jint); - -/* - * Class: org_eclipse_tm_rapi_OS - * Method: CoUninitialize - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_eclipse_tm_rapi_OS_CoUninitialize - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_tm_rapi_OS - * Method: CreateRapiDesktop - * Signature: ([I)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_tm_rapi_OS_CreateRapiDesktop - (JNIEnv *, jclass, jintArray); - -/* - * Class: org_eclipse_tm_rapi_OS - * Method: ReleaseIUnknown - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_org_eclipse_tm_rapi_OS_ReleaseIUnknown - (JNIEnv *, jclass, jint); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_Rapi.h b/wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_Rapi.h new file mode 100644 index 00000000000..23e71ae2d02 --- /dev/null +++ b/wince/org.eclipse.tm.rapi/native/org_eclipse_tm_rapi_Rapi.h @@ -0,0 +1,147 @@ +/******************************************************************************* + * Copyright (c) 2008 Radoslav Gerganov + * 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: + * Radoslav Gerganov - initial API and implementation + *******************************************************************************/ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_eclipse_tm_rapi_Rapi */ + +#ifndef _Included_org_eclipse_tm_rapi_Rapi +#define _Included_org_eclipse_tm_rapi_Rapi +#ifdef __cplusplus +extern "C" { +#endif +#undef org_eclipse_tm_rapi_Rapi_NOERROR +#define org_eclipse_tm_rapi_Rapi_NOERROR 0L +#undef org_eclipse_tm_rapi_Rapi_GENERIC_READ +#define org_eclipse_tm_rapi_Rapi_GENERIC_READ -2147483648L +#undef org_eclipse_tm_rapi_Rapi_GENERIC_WRITE +#define org_eclipse_tm_rapi_Rapi_GENERIC_WRITE 1073741824L +#undef org_eclipse_tm_rapi_Rapi_FILE_SHARE_READ +#define org_eclipse_tm_rapi_Rapi_FILE_SHARE_READ 1L +#undef org_eclipse_tm_rapi_Rapi_FILE_SHARE_WRITE +#define org_eclipse_tm_rapi_Rapi_FILE_SHARE_WRITE 2L +#undef org_eclipse_tm_rapi_Rapi_CREATE_NEW +#define org_eclipse_tm_rapi_Rapi_CREATE_NEW 1L +#undef org_eclipse_tm_rapi_Rapi_CREATE_ALWAYS +#define org_eclipse_tm_rapi_Rapi_CREATE_ALWAYS 2L +#undef org_eclipse_tm_rapi_Rapi_OPEN_EXISTING +#define org_eclipse_tm_rapi_Rapi_OPEN_EXISTING 3L +#undef org_eclipse_tm_rapi_Rapi_OPEN_ALWAYS +#define org_eclipse_tm_rapi_Rapi_OPEN_ALWAYS 4L +#undef org_eclipse_tm_rapi_Rapi_TRUNCATE_EXISTING +#define org_eclipse_tm_rapi_Rapi_TRUNCATE_EXISTING 5L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_ARCHIVE +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_ARCHIVE 32L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_COMPRESSED +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_COMPRESSED 2048L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_DIRECTORY +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_DIRECTORY 16L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_ENCRYPTED +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_ENCRYPTED 16384L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_HIDDEN +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_HIDDEN 2L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_INROM +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_INROM 64L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_NORMAL +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_NORMAL 128L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_READONLY +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_READONLY 1L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_REPARSE_POINT +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_REPARSE_POINT 1024L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_ROMMODULE +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_ROMMODULE 8192L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_SPARSE_FILE +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_SPARSE_FILE 512L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_SYSTEM +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_SYSTEM 4L +#undef org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_TEMPORARY +#define org_eclipse_tm_rapi_Rapi_FILE_ATTRIBUTE_TEMPORARY 256L +#undef org_eclipse_tm_rapi_Rapi_FILE_FLAG_WRITE_THROUGH +#define org_eclipse_tm_rapi_Rapi_FILE_FLAG_WRITE_THROUGH -2147483648L +#undef org_eclipse_tm_rapi_Rapi_FILE_FLAG_OVERLAPPED +#define org_eclipse_tm_rapi_Rapi_FILE_FLAG_OVERLAPPED 1073741824L +#undef org_eclipse_tm_rapi_Rapi_FILE_FLAG_RANDOM_ACCESS +#define org_eclipse_tm_rapi_Rapi_FILE_FLAG_RANDOM_ACCESS 268435456L +#undef org_eclipse_tm_rapi_Rapi_FILE_FLAG_SEQUENTIAL_SCAN +#define org_eclipse_tm_rapi_Rapi_FILE_FLAG_SEQUENTIAL_SCAN 134217728L +#undef org_eclipse_tm_rapi_Rapi_FAF_ATTRIB_CHILDREN +#define org_eclipse_tm_rapi_Rapi_FAF_ATTRIB_CHILDREN 4096L +#undef org_eclipse_tm_rapi_Rapi_FAF_ATTRIB_NO_HIDDEN +#define org_eclipse_tm_rapi_Rapi_FAF_ATTRIB_NO_HIDDEN 8192L +#undef org_eclipse_tm_rapi_Rapi_FAF_FOLDERS_ONLY +#define org_eclipse_tm_rapi_Rapi_FAF_FOLDERS_ONLY 16384L +#undef org_eclipse_tm_rapi_Rapi_FAF_NO_HIDDEN_SYS_ROMMODULES +#define org_eclipse_tm_rapi_Rapi_FAF_NO_HIDDEN_SYS_ROMMODULES 32768L +#undef org_eclipse_tm_rapi_Rapi_FAF_GETTARGET +#define org_eclipse_tm_rapi_Rapi_FAF_GETTARGET 65536L +#undef org_eclipse_tm_rapi_Rapi_FAF_ATTRIBUTES +#define org_eclipse_tm_rapi_Rapi_FAF_ATTRIBUTES 1L +#undef org_eclipse_tm_rapi_Rapi_FAF_CREATION_TIME +#define org_eclipse_tm_rapi_Rapi_FAF_CREATION_TIME 2L +#undef org_eclipse_tm_rapi_Rapi_FAF_LASTACCESS_TIME +#define org_eclipse_tm_rapi_Rapi_FAF_LASTACCESS_TIME 4L +#undef org_eclipse_tm_rapi_Rapi_FAF_LASTWRITE_TIME +#define org_eclipse_tm_rapi_Rapi_FAF_LASTWRITE_TIME 8L +#undef org_eclipse_tm_rapi_Rapi_FAF_SIZE_HIGH +#define org_eclipse_tm_rapi_Rapi_FAF_SIZE_HIGH 16L +#undef org_eclipse_tm_rapi_Rapi_FAF_SIZE_LOW +#define org_eclipse_tm_rapi_Rapi_FAF_SIZE_LOW 32L +#undef org_eclipse_tm_rapi_Rapi_FAF_OID +#define org_eclipse_tm_rapi_Rapi_FAF_OID 64L +#undef org_eclipse_tm_rapi_Rapi_FAF_NAME +#define org_eclipse_tm_rapi_Rapi_FAF_NAME 128L +#undef org_eclipse_tm_rapi_Rapi_INVALID_HANDLE_VALUE +#define org_eclipse_tm_rapi_Rapi_INVALID_HANDLE_VALUE -1L +#undef org_eclipse_tm_rapi_Rapi_TIME_DIFF +#define org_eclipse_tm_rapi_Rapi_TIME_DIFF 11644473600000i64 +#undef org_eclipse_tm_rapi_Rapi_COINIT_MULTITHREADED +#define org_eclipse_tm_rapi_Rapi_COINIT_MULTITHREADED 0L +#undef org_eclipse_tm_rapi_Rapi_COINIT_APARTMENTTHREADED +#define org_eclipse_tm_rapi_Rapi_COINIT_APARTMENTTHREADED 2L +#undef org_eclipse_tm_rapi_Rapi_COINIT_DISABLE_OLE1DDE +#define org_eclipse_tm_rapi_Rapi_COINIT_DISABLE_OLE1DDE 4L +#undef org_eclipse_tm_rapi_Rapi_COINIT_SPEED_OVER_MEMORY +#define org_eclipse_tm_rapi_Rapi_COINIT_SPEED_OVER_MEMORY 8L +/* + * Class: org_eclipse_tm_rapi_Rapi + * Method: CoInitializeEx + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_tm_rapi_Rapi_CoInitializeEx + (JNIEnv *, jclass, jint, jint); + +/* + * Class: org_eclipse_tm_rapi_Rapi + * Method: CoUninitialize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_eclipse_tm_rapi_Rapi_CoUninitialize + (JNIEnv *, jclass); + +/* + * Class: org_eclipse_tm_rapi_Rapi + * Method: CreateRapiDesktop + * Signature: ([I)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_tm_rapi_Rapi_CreateRapiDesktop + (JNIEnv *, jclass, jintArray); + +/* + * Class: org_eclipse_tm_rapi_Rapi + * Method: ReleaseIUnknown + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_org_eclipse_tm_rapi_Rapi_ReleaseIUnknown + (JNIEnv *, jclass, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDesktop.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDesktop.java index 0b3c57876c3..8b5c257af74 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDesktop.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDesktop.java @@ -12,7 +12,7 @@ package org.eclipse.tm.internal.rapi; import org.eclipse.tm.rapi.IRapiDesktop; import org.eclipse.tm.rapi.IRapiEnumDevices; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.RapiException; /** @@ -29,7 +29,7 @@ public class RapiDesktop extends IRapiDesktop { public IRapiEnumDevices enumDevices() throws RapiException { int[] ppIEnum = new int[1]; int rc = EnumDevices(addr, ppIEnum); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("EnumDevices failed", rc); //$NON-NLS-1$ } return new RapiEnumDevices(ppIEnum[0]); diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDevice.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDevice.java index 46f8fa8c58a..0167a15e3f4 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDevice.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiDevice.java @@ -12,7 +12,7 @@ package org.eclipse.tm.internal.rapi; import org.eclipse.tm.rapi.IRapiDevice; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.RapiConnectionInfo; import org.eclipse.tm.rapi.RapiDeviceInfo; import org.eclipse.tm.rapi.RapiException; @@ -31,7 +31,7 @@ public class RapiDevice extends IRapiDevice { public IRapiSession createSession() throws RapiException { int[] ppISession = new int[1]; int rc = CreateSession(addr, ppISession); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("CreateSession failed", rc); //$NON-NLS-1$ } return new RapiSession(ppISession[0]); @@ -40,7 +40,7 @@ public class RapiDevice extends IRapiDevice { public RapiConnectionInfo getConnectionInfo() throws RapiException { RapiConnectionInfo connInfo = new RapiConnectionInfo(); int rc = GetConnectionInfo(addr, connInfo); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("GetConnectionInfo failed", rc); //$NON-NLS-1$ } return connInfo; @@ -49,7 +49,7 @@ public class RapiDevice extends IRapiDevice { public RapiDeviceInfo getDeviceInfo() throws RapiException { RapiDeviceInfo devInfo = new RapiDeviceInfo(); int rc = GetDeviceInfo(addr, devInfo); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("GetDeviceInfo failed", rc); //$NON-NLS-1$ } return devInfo; @@ -58,7 +58,7 @@ public class RapiDevice extends IRapiDevice { public boolean isConnected() throws RapiException { int[] status = new int[1]; int rc = GetConnectStat(addr, status); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("GetConnectStat failed", rc); //$NON-NLS-1$ } return status[0] == 1; diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiEnumDevices.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiEnumDevices.java index 5d962e7f771..4e5ee04a477 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiEnumDevices.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiEnumDevices.java @@ -12,7 +12,7 @@ package org.eclipse.tm.internal.rapi; import org.eclipse.tm.rapi.IRapiDevice; import org.eclipse.tm.rapi.IRapiEnumDevices; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.RapiException; /** @@ -29,7 +29,7 @@ public class RapiEnumDevices extends IRapiEnumDevices { public IRapiDevice next() throws RapiException { int[] ppIDevice = new int[1]; int rc = Next(addr, ppIDevice); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("Next failed", rc); //$NON-NLS-1$ } return new RapiDevice(ppIDevice[0]); diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiSession.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiSession.java index 8f69a14052f..5426a209d7c 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiSession.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/internal/rapi/RapiSession.java @@ -11,7 +11,7 @@ package org.eclipse.tm.internal.rapi; import org.eclipse.tm.rapi.IRapiSession; -import org.eclipse.tm.rapi.OS; +import org.eclipse.tm.rapi.Rapi; import org.eclipse.tm.rapi.ProcessInformation; import org.eclipse.tm.rapi.RapiException; import org.eclipse.tm.rapi.RapiFindData; @@ -40,14 +40,14 @@ public class RapiSession extends IRapiSession { public void init() throws RapiException { int rc = CeRapiInit(addr); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("CeRapiInit failed", rc); //$NON-NLS-1$ } } public void uninit() throws RapiException { int rc = CeRapiUninit(addr); - if (rc != OS.NOERROR) { + if (rc != Rapi.NOERROR) { throw new RapiException("CeRapiUninit failed", rc); //$NON-NLS-1$ } } @@ -57,7 +57,7 @@ public class RapiSession extends IRapiSession { int handle = CeCreateFile(addr, fileName, desiredAccess, shareMode, creationDisposition, flagsAndAttributes); - if (handle == OS.INVALID_HANDLE_VALUE) { + if (handle == Rapi.INVALID_HANDLE_VALUE) { throw new RapiException("CeCreateFile failed", getError()); //$NON-NLS-1$ } return handle; @@ -163,7 +163,7 @@ public class RapiSession extends IRapiSession { public int findFirstFile(String fileName, RapiFindData findData) throws RapiException { int handle = CeFindFirstFile(addr, fileName, findData); - if (handle == OS.INVALID_HANDLE_VALUE) { + if (handle == Rapi.INVALID_HANDLE_VALUE) { throw new RapiException("CeFindFirstFile failed", getError()); //$NON-NLS-1$ } return handle; @@ -197,7 +197,7 @@ public class RapiSession extends IRapiSession { findDataArr[i] = new RapiFindData(); } int hRes = CeFindAllFilesEx(addr, count, dataArr[0], findDataArr); - if (hRes != OS.NOERROR) { + if (hRes != Rapi.NOERROR) { throw new RapiException("CeFindAllFilesEx failed", hRes); //$NON-NLS-1$ } return findDataArr; @@ -225,7 +225,7 @@ public class RapiSession extends IRapiSession { if (!res) { throw new RapiException("CeGetFileTime failed", getError()); //$NON-NLS-1$ } - return (crTime[0] / 10000) - OS.TIME_DIFF; + return (crTime[0] / 10000) - Rapi.TIME_DIFF; } public long getFileLastAccessTime(int handle) throws RapiException { @@ -236,7 +236,7 @@ public class RapiSession extends IRapiSession { if (!res) { throw new RapiException("CeGetFileTime failed", getError()); //$NON-NLS-1$ } - return (laTime[0] / 10000) - OS.TIME_DIFF; + return (laTime[0] / 10000) - Rapi.TIME_DIFF; } public long getFileLastWriteTime(int handle) throws RapiException { @@ -247,7 +247,7 @@ public class RapiSession extends IRapiSession { if (!res) { throw new RapiException("CeGetFileTime failed", getError()); //$NON-NLS-1$ } - return (lwTime[0] / 10000) - OS.TIME_DIFF; + return (lwTime[0] / 10000) - Rapi.TIME_DIFF; } public void setFileAttributes(String fileName, int fileAttributes) throws RapiException { @@ -261,7 +261,7 @@ public class RapiSession extends IRapiSession { if (lastWriteTime < 0) { throw new IllegalArgumentException("Time cannot be negative"); //$NON-NLS-1$ } - long[] lwTime = new long[] {(lastWriteTime + OS.TIME_DIFF) * 10000}; + long[] lwTime = new long[] {(lastWriteTime + Rapi.TIME_DIFF) * 10000}; boolean res = CeSetFileTime(addr, handle, null, null, lwTime); if (!res) { throw new RapiException("CeSetFileTime failed", getError()); //$NON-NLS-1$ diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiDesktop.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiDesktop.java index 0f0e0e72d9a..0b983fefb08 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiDesktop.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiDesktop.java @@ -33,8 +33,8 @@ public abstract class IRapiDesktop extends IUnknown { */ public synchronized static IRapiDesktop getInstance() throws RapiException { int[] rapiDesktop = new int[1]; - int rc = OS.CreateRapiDesktop(rapiDesktop); - if (rc != OS.NOERROR) { + int rc = Rapi.CreateRapiDesktop(rapiDesktop); + if (rc != Rapi.NOERROR) { throw new RapiException("CreateRapiDesktop failed", rc); //$NON-NLS-1$ } return new RapiDesktop(rapiDesktop[0]); diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiSession.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiSession.java index a86d79fa231..8268f3ec266 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiSession.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IRapiSession.java @@ -245,9 +245,9 @@ public abstract class IRapiSession extends IUnknown { * Sets the attributes of the specified file on the remote device. * @param fileName the target file * @param fileAttributes the new attributes; this parameter is combination of the - * following values: {@link OS#FILE_ATTRIBUTE_ARCHIVE}, {@link OS#FILE_ATTRIBUTE_HIDDEN}, - * {@link OS#FILE_ATTRIBUTE_NORMAL}, {@link OS#FILE_ATTRIBUTE_READONLY}, - * {@link OS#FILE_ATTRIBUTE_SYSTEM}, {@link OS#FILE_ATTRIBUTE_TEMPORARY} + * following values: {@link Rapi#FILE_ATTRIBUTE_ARCHIVE}, {@link Rapi#FILE_ATTRIBUTE_HIDDEN}, + * {@link Rapi#FILE_ATTRIBUTE_NORMAL}, {@link Rapi#FILE_ATTRIBUTE_READONLY}, + * {@link Rapi#FILE_ATTRIBUTE_SYSTEM}, {@link Rapi#FILE_ATTRIBUTE_TEMPORARY} * @throws RapiException if an error occurs. */ public abstract void setFileAttributes(String fileName, int fileAttributes) throws RapiException; diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IUnknown.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IUnknown.java index 1d5b0163436..c79a87f082c 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IUnknown.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/IUnknown.java @@ -30,7 +30,7 @@ public abstract class IUnknown { * Releases the underlying IUnknown object. */ public void release() { - OS.ReleaseIUnknown(addr); + Rapi.ReleaseIUnknown(addr); } } diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/OS.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/Rapi.java similarity index 95% rename from wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/OS.java rename to wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/Rapi.java index e87075e539a..e5a2b870688 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/OS.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/Rapi.java @@ -12,29 +12,30 @@ package org.eclipse.tm.rapi; /** * This class provides access to some native Win32 APIs and constants. - * + * + * @noextend This class is not intended to be subclassed by clients. * @author Radoslav Gerganov */ -public class OS { - +public final class Rapi { + static { System.loadLibrary("jrapi"); //$NON-NLS-1$ } - + public static final int NOERROR = 0; //TODO: add more error codes - + public static final int GENERIC_READ = 0x80000000; public static final int GENERIC_WRITE = 0x40000000; public static final int FILE_SHARE_READ = 0x00000001; public static final int FILE_SHARE_WRITE = 0x00000002; - + public static final int CREATE_NEW = 1; public static final int CREATE_ALWAYS = 2; public static final int OPEN_EXISTING = 3; public static final int OPEN_ALWAYS = 4; public static final int TRUNCATE_EXISTING = 5; - + public static final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; public static final int FILE_ATTRIBUTE_COMPRESSED = 0x00000800; public static final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; @@ -45,10 +46,10 @@ public class OS { public static final int FILE_ATTRIBUTE_READONLY = 0x00000001; public static final int FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400; public static final int FILE_ATTRIBUTE_ROMMODULE = 0x00002000; - public static final int FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200; + public static final int FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200; public static final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; public static final int FILE_ATTRIBUTE_TEMPORARY = 0x00000100; - + public static final int FILE_FLAG_WRITE_THROUGH = 0x80000000; public static final int FILE_FLAG_OVERLAPPED = 0x40000000; public static final int FILE_FLAG_RANDOM_ACCESS = 0x10000000; @@ -59,7 +60,7 @@ public class OS { public static final int FAF_FOLDERS_ONLY = 0x04000; public static final int FAF_NO_HIDDEN_SYS_ROMMODULES = 0x08000; public static final int FAF_GETTARGET = 0x10000; - + public static final int FAF_ATTRIBUTES = 0x01; public static final int FAF_CREATION_TIME = 0x02; public static final int FAF_LASTACCESS_TIME = 0x04; @@ -68,21 +69,21 @@ public class OS { public static final int FAF_SIZE_LOW = 0x20; public static final int FAF_OID = 0x40; public static final int FAF_NAME = 0x80; - + public static final int INVALID_HANDLE_VALUE = -1; - + public static final long TIME_DIFF = 11644473600000L; - + public static final int COINIT_MULTITHREADED = 0x0; public static final int COINIT_APARTMENTTHREADED = 0x2; public static final int COINIT_DISABLE_OLE1DDE = 0x4; - public static final int COINIT_SPEED_OVER_MEMORY = 0x8; - + public static final int COINIT_SPEED_OVER_MEMORY = 0x8; + /** * Initializes the COM library. */ public static final native int CoInitializeEx(int pvReserved, int dwCoInit); - + /** * Closes the COM library on the current thread. */ diff --git a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/RapiFindData.java b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/RapiFindData.java index 390e1968c2f..dd67fc334b8 100644 --- a/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/RapiFindData.java +++ b/wince/org.eclipse.tm.rapi/src/org/eclipse/tm/rapi/RapiFindData.java @@ -28,14 +28,14 @@ public class RapiFindData { public String fileName; public Date getCreationTime() { - return new Date((creationTime / 10000) - OS.TIME_DIFF); + return new Date((creationTime / 10000) - Rapi.TIME_DIFF); } public Date getLastAccessTime() { - return new Date((lastAccessTime / 10000) - OS.TIME_DIFF); + return new Date((lastAccessTime / 10000) - Rapi.TIME_DIFF); } public Date getLastWriteTime() { - return new Date((lastWriteTime / 10000) - OS.TIME_DIFF); + return new Date((lastWriteTime / 10000) - Rapi.TIME_DIFF); } }