1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

[225874][wince][api] Rename org.eclipse.tm.rapi.OS to Rapi

This commit is contained in:
Martin Oberhuber 2008-04-09 12:55:32 +00:00
parent 17f0268688
commit 7be39dbed3
19 changed files with 263 additions and 262 deletions

View file

@ -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();

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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();
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="jrapi"
ProjectGUID="{7A9CC697-2EEB-40B9-B540-7FFC195B3D4F}"
RootNamespace="jrapi"
@ -181,7 +181,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\native\OS.cpp"
RelativePath="..\native\Rapi.cpp"
>
</File>
<File
@ -223,7 +223,7 @@
>
</File>
<File
RelativePath="..\native\org_eclipse_tm_rapi_OS.h"
RelativePath="..\native\org_eclipse_tm_rapi_Rapi.h"
>
</File>
</Filter>

View file

@ -13,9 +13,9 @@
#include <WinSock2.h>
#include <rapi2.h>
#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)

View file

@ -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 <jni.h>
/* 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

View file

@ -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 <jni.h>
/* 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

View file

@ -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]);

View file

@ -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;

View file

@ -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]);

View file

@ -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$

View file

@ -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]);

View file

@ -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;

View file

@ -30,7 +30,7 @@ public abstract class IUnknown {
* Releases the underlying <code>IUnknown<code> object.
*/
public void release() {
OS.ReleaseIUnknown(addr);
Rapi.ReleaseIUnknown(addr);
}
}

View file

@ -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.
*/

View file

@ -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);
}
}