From 1843a96321ef3697d2b6b070ed6c16ce38d0c29b Mon Sep 17 00:00:00 2001 From: Chris Eagle Date: Mon, 7 Sep 2015 14:12:43 -0700 Subject: [PATCH] update jave binding to follow apit change of uc_mem_read and uc_mem_write --- bindings/java/unicorn/UnicornConst.java | 24 +++++++++++++----------- bindings/java/unicorn_Unicorn.c | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/bindings/java/unicorn/UnicornConst.java b/bindings/java/unicorn/UnicornConst.java index 1b12da05..99e5af69 100644 --- a/bindings/java/unicorn/UnicornConst.java +++ b/bindings/java/unicorn/UnicornConst.java @@ -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; diff --git a/bindings/java/unicorn_Unicorn.c b/bindings/java/unicorn_Unicorn.c index f0fbbbff..6a454a5a 100644 --- a/bindings/java/unicorn_Unicorn.c +++ b/bindings/java/unicorn_Unicorn.c @@ -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); }