You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
220 lines
10 KiB
220 lines
10 KiB
6 years ago
|
package Sense4;
|
||
|
|
||
|
import com.sun.jna.Native;
|
||
|
import com.sun.jna.Structure;
|
||
|
import com.sun.jna.ptr.IntByReference;
|
||
|
import com.sun.jna.ptr.LongByReference;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
public interface Sense64 extends com.sun.jna.Library
|
||
|
{
|
||
6 years ago
|
Sense64 instance = (Sense64) Native.loadLibrary("EL", Sense64.class);
|
||
6 years ago
|
|
||
|
public static final long S4_USER_PIN = 0x000000a1;
|
||
|
public static final long S4_DEV_PIN = 0x000000a2;
|
||
|
public static final long S4_AUTHEN_PIN = 0x000000a3;
|
||
|
public static final long S4_CREATE_NEW = 0x000000a5;
|
||
|
public static final long S4_UPDATE_FILE = 0x000000a6;
|
||
|
|
||
|
// #define S4_EXE_FILE 0x00000008 /** executable file of virtual machine*/
|
||
|
public static final byte S4_EXE_FILE = 0x00000008;
|
||
|
public static final byte S4_DATA_FILE = 0x00000009;
|
||
|
public static final long S4_FILE_EXIST = 0x00006a80;
|
||
|
|
||
|
// #define S4_LED_DOWN 0x00000008 /** LED down*/
|
||
|
public static final long S4_LED_DOWN = 0x00000008;
|
||
|
// #define S4_LED_WINK 0x00000028 /** LED wink*/
|
||
|
public static final long S4_LED_WINK = 0x00000028;
|
||
|
|
||
|
public static final long S4_GET_SERIAL_NUMBER = 0x00000026;
|
||
|
|
||
|
// #define S4_EXCLUSIZE_MODE 0 /** exclusive mode*/
|
||
|
// #define S4_SHARE_MODE 1 /** sharable mode*/
|
||
|
public static final long S4_EXCLUSIZE_MODE = 0x00000000;
|
||
|
public static final long S4_SHARE_MODE = 0x00000001;
|
||
|
|
||
|
// #define S4_CREATE_ROOT_DIR 0x000000ab /** create root directory*/
|
||
|
public static final long S4_CREATE_ROOT_DIR = 0x000000ab;
|
||
|
|
||
|
public static class RTC_TIME_T extends Structure
|
||
|
{
|
||
|
|
||
|
public byte second; /* second (0-59) */
|
||
|
public byte minute; /* minute (0-59) */
|
||
|
public byte hour; /* hour (0-23) */
|
||
|
public byte day; /* day of month (1-31) */
|
||
|
public byte week; /* day of week (0-6, sunday is 0) */
|
||
|
public byte month; /* month (0-11) */
|
||
|
public short year; /* year (0- 138, 1900 - 2038) */
|
||
|
protected List<String> getFieldOrder() {
|
||
|
List<String> list = new ArrayList<String>();
|
||
|
list.add("second");
|
||
|
list.add("minute");
|
||
|
list.add("hour");
|
||
|
list.add("day");
|
||
|
list.add("week");
|
||
|
list.add("month");
|
||
|
list.add("year");
|
||
|
return list;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static class SENSE4_CONTEXT extends Structure {
|
||
|
public long dwIndex; /** device index; index begins at zero*/
|
||
|
public long dwVersion; /** device version*/
|
||
|
public long hLock; /** device handle*/
|
||
|
public byte[] reserve = new byte[12*2]; /** reserved*/
|
||
|
public byte[] bAtr = new byte[56]; /** ATR*/
|
||
|
public byte[] bID = new byte[8]; /** device ID*/
|
||
|
public long dwAtrLen; /** ATR length*/
|
||
|
protected List<String> getFieldOrder() {
|
||
|
List<String> list = new ArrayList<String>();
|
||
|
list.add("dwIndex");
|
||
|
list.add("dwVersion");
|
||
|
list.add("hLock");
|
||
|
list.add("reserve");
|
||
|
list.add("bAtr");
|
||
|
list.add("bID");
|
||
|
list.add("dwAtrLen");
|
||
|
return list;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/** Netlock Module infomation definition*/
|
||
|
// typedef struct _S4MODULEINFO {
|
||
|
// WORD wModuleID; /* Module ID*/
|
||
|
// WORD wLicenseCount; /* License Count */
|
||
|
// } S4MODULEINFO;
|
||
|
public static class S4MODULEINFO extends Structure {
|
||
|
public int wModuleID;
|
||
|
public int wLicenseCount;
|
||
|
protected List<String> getFieldOrder() {
|
||
|
List<String> list = new ArrayList<String>();
|
||
|
list.add("wModuleID");
|
||
|
list.add("wLicenseCount");
|
||
|
return list;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// typedef struct _S4NETCONFIG {
|
||
|
// DWORD dwLicenseMode; /* License Mode */
|
||
|
// DWORD dwModuleCount; /* Module Count */
|
||
|
// S4MODULEINFO ModuleInfo[16]; /* Module detail infomation */
|
||
|
// } S4NETCONFIG;
|
||
|
public static class S4NETCONFIG extends Structure {
|
||
|
public long dwLicenseMode;
|
||
|
public long dwModuleCount;
|
||
|
public S4MODULEINFO[] ModuleInfo = new S4MODULEINFO[16];
|
||
|
protected List<String> getFieldOrder() {
|
||
|
List<String> list = new ArrayList<String>();
|
||
|
list.add("dwLicenseMode");
|
||
|
list.add("dwModuleCount");
|
||
|
list.add("ModuleInfo");
|
||
|
return list;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
// S4CREATEDIRINFO structure definition
|
||
|
// typedef struct _S4CREATEDIRINFO {
|
||
|
// DWORD dwS4CreateDirInfoSize; /* size of the structure*/
|
||
|
// BYTE szAtr[8]; /* ATR information */
|
||
|
// S4NETCONFIG NetConfig; /* netlock config infomation */
|
||
|
// } S4CREATEDIRINFO;
|
||
|
public static class S4CREATEDIRINFO extends Structure {
|
||
|
public long dwS4CreateDirInfoSize;
|
||
|
public byte[] szAtr = new byte[8];
|
||
|
public S4NETCONFIG NetConfig;
|
||
|
protected List<String> getFieldOrder() {
|
||
|
List<String> list = new ArrayList<String>();
|
||
|
list.add("dwS4CreateDirInfoSize");
|
||
|
list.add("szAtr");
|
||
|
list.add("NetConfig");
|
||
|
return list;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// typedef struct _S4OPENINFO {
|
||
|
// DWORD dwS4OpenInfoSize; /* size of the structure*/
|
||
|
// DWORD dwShareMode; /* share mode*/
|
||
|
// } S4OPENINFO;
|
||
|
public static class S4OPENINFO extends Structure {
|
||
|
public long dwS4OpenInfoSize;
|
||
|
public long dwShareMode;
|
||
|
protected List<String> getFieldOrder() {
|
||
|
List<String> list = new ArrayList<String>();
|
||
|
list.add("dwS4OpenInfoSize");
|
||
|
list.add("dwShareMode");
|
||
|
return list;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public long S4Enum(SENSE4_CONTEXT ctx, LongByReference pSize);
|
||
|
|
||
|
|
||
|
public long S4Open(SENSE4_CONTEXT ctx);
|
||
|
|
||
|
// DWORD WINAPI S4Control(
|
||
|
// IN SENSE4_CONTEXT *pS4Ctx,
|
||
|
// IN DWORD dwCtlCode,
|
||
|
// IN VOID *pInBuffer,
|
||
|
// IN DWORD dwInBufferLen,
|
||
|
// OUT VOID *pOutBuffer,
|
||
|
// IN DWORD dwOutBufferLen,
|
||
|
// OUT DWORD *pdwBytesReturned
|
||
|
// );
|
||
|
public long S4Control(
|
||
|
SENSE4_CONTEXT ctx,
|
||
|
long dwCtlCode,
|
||
|
byte[] pInBuffer,
|
||
|
long dwInBufferLen,
|
||
|
byte[] pOutBuffer,
|
||
|
long dwOutBufferLen,
|
||
|
LongByReference pdwBytesReturned
|
||
|
);
|
||
|
|
||
|
public long S4ChangeDir(SENSE4_CONTEXT ctx, String dir);
|
||
|
|
||
|
//
|
||
|
public long S4EraseDir(SENSE4_CONTEXT ctx, String dir);
|
||
|
|
||
|
public long S4VerifyPin(SENSE4_CONTEXT ctx, String passwd, long passwdLen, long type);
|
||
|
public long S4WriteFile(SENSE4_CONTEXT ctx,
|
||
|
String lpszFileID,
|
||
|
long dwOffset,
|
||
|
byte lpBuffer[],
|
||
|
long dwBufferSize,
|
||
|
long dwFileSize,
|
||
|
LongByReference pdwBytesWritten,
|
||
|
long dwFlags,
|
||
|
byte bFileType);
|
||
|
|
||
|
|
||
|
public int S4Execute(Sense64.SENSE4_CONTEXT ctx, String fileID, byte[] inputBuf, int inputSize, byte[] outputBuf, int outputSize, IntByReference pSize);
|
||
|
public long S4Close(SENSE4_CONTEXT ctx);
|
||
|
|
||
|
// DWORD WINAPI S4CreateDirEx(
|
||
|
// IN SENSE4_CONTEXT *pS4Ctx,
|
||
|
// IN LPCSTR lpszDirID,
|
||
|
// IN DWORD dwDirSize,
|
||
|
// IN DWORD dwFlags,
|
||
|
// IN S4CREATEDIRINFO *pCreateDirInfo
|
||
|
// );
|
||
|
public long S4CreateDirEx(
|
||
|
SENSE4_CONTEXT ctx,
|
||
|
String lpszDirID,
|
||
|
long dwDirSize,
|
||
|
long dwFlags,
|
||
|
S4CREATEDIRINFO pCreateDirInfo
|
||
|
);
|
||
|
|
||
|
// DWORD WINAPI S4OpenEx(
|
||
|
// IN OUT SENSE4_CONTEXT *pS4Ctx,
|
||
|
// IN S4OPENINFO *pS4OpenInfo
|
||
|
// );
|
||
|
|
||
|
public long S4OpenEx(SENSE4_CONTEXT ctx, S4OPENINFO pS4OpenInfo);
|
||
|
}
|