Merge pull request #121 from cseagle/java_dev

update java binding to follow api change of uc_mem_read and uc_mem_write
This commit is contained in:
Nguyen Anh Quynh 2015-09-08 08:08:02 +08:00
commit 4e9af41345
2 changed files with 15 additions and 13 deletions

View File

@ -43,20 +43,22 @@ public interface UnicornConst {
public static final int UC_ERR_VERSION = 5;
public static final int UC_ERR_MEM_READ = 6;
public static final int UC_ERR_MEM_WRITE = 7;
public static final int UC_ERR_CODE_INVALID = 8;
public static final int UC_ERR_HOOK = 9;
public static final int UC_ERR_INSN_INVALID = 10;
public static final int UC_ERR_MAP = 11;
public static final int UC_ERR_WRITE_PROT = 12;
public static final int UC_ERR_READ_PROT = 13;
public static final int UC_ERR_EXEC_PROT = 14;
public static final int UC_ERR_INVAL = 15;
public static final int UC_ERR_MEM_FETCH = 8;
public static final int UC_ERR_CODE_INVALID = 9;
public static final int UC_ERR_HOOK = 10;
public static final int UC_ERR_INSN_INVALID = 11;
public static final int UC_ERR_MAP = 12;
public static final int UC_ERR_WRITE_PROT = 13;
public static final int UC_ERR_READ_PROT = 14;
public static final int UC_ERR_EXEC_PROT = 15;
public static final int UC_ERR_INVAL = 16;
public static final int UC_MEM_READ = 16;
public static final int UC_MEM_WRITE = 17;
public static final int UC_MEM_READ_WRITE = 18;
public static final int UC_MEM_WRITE_PROT = 19;
public static final int UC_MEM_READ_PROT = 20;
public static final int UC_MEM_EXEC_PROT = 21;
public static final int UC_MEM_EXEC = 19;
public static final int UC_MEM_WRITE_PROT = 20;
public static final int UC_MEM_READ_PROT = 21;
public static final int UC_MEM_EXEC_PROT = 22;
public static final int UC_HOOK_INTR = 32;
public static final int UC_HOOK_INSN = 33;
public static final int UC_HOOK_CODE = 34;

View File

@ -319,7 +319,7 @@ JNIEXPORT void JNICALL Java_unicorn_Unicorn_mem_1write
uc_engine *eng = getEngine(env, self);
jbyte *array = (*env)->GetByteArrayElements(env, bytes, NULL);
jsize size = (*env)->GetArrayLength(env, bytes);
uc_err err = uc_mem_write(eng, (uint64_t)address, (uint8_t *)array, (size_t)size);
uc_err err = uc_mem_write(eng, (uint64_t)address, array, (size_t)size);
if (err != UC_ERR_OK) {
throwException(env, err);
@ -339,7 +339,7 @@ JNIEXPORT jbyteArray JNICALL Java_unicorn_Unicorn_mem_1read
jbyteArray bytes = (*env)->NewByteArray(env, (jsize)size);
jbyte *array = (*env)->GetByteArrayElements(env, bytes, NULL);
uc_err err = uc_mem_read(eng, (uint64_t)address, (uint8_t *)array, (size_t)size);
uc_err err = uc_mem_read(eng, (uint64_t)address, array, (size_t)size);
if (err != UC_ERR_OK) {
throwException(env, err);
}