Commit Graph

76 Commits

Author SHA1 Message Date
c37b2582d7 modify header guard of unicorn_dynload.h for consistency 2015-12-05 11:20:22 +07:00
77f946f2fc Added MSVC++ support for unicorn
This lets you import the pre-built unicorn.dll files with Microsoft
Visual C++ projects.

There is support for static and dynamic linking of dlls. This has been
tested as working for both 32bit and 64bit versions.

The dynamic linking code should also work in Linux, though I have not
tested it.
2015-12-04 22:09:24 +11:00
2f297bdd3a handle some errors properly so avoid exit() during initialization. this fixes issue #237 2015-11-12 01:43:41 +08:00
4127179fe3 fix compilation with capstone next 2015-11-07 16:55:42 +01:00
b1d41d414b on some hook events, uc_hook_add() should not allow more than 1 handler. this add UC_ERR_HOOK_EXIST error type 2015-10-10 18:01:47 +08:00
9e64cba6ec Rename some hook related enums:
- UC_ERR_READ_INVALID -> UC_ERR_READ_UNMAPPED
 - UC_ERR_WRITE_INVALID -> UC_ERR_WRITE_UNMAPPED
 - UC_ERR_FETCH_INVALID -> UC_ERR_FETCH_UNMAPPED
 - UC_MEM_READ_INVALID -> UC_MEM_READ_UNMAPPED
 - UC_MEM_WRITE_INVALID -> UC_MEM_WRITE_UNMAPPED
 - UC_MEM_FETCH_INVALID -> UC_MEM_FETCH_UNMAPPED
 - UC_HOOK_MEM_READ_INVALID -> UC_HOOK_MEM_READ_UNMAPPED
 - UC_HOOK_MEM_WRITE_INVALID -> UC_HOOK_MEM_WRITE_UNMAPPED
 - UC_HOOK_MEM_FETCH_INVALID -> UC_HOOK_MEM_FETCH_UNMAPPED
 - UC_HOOK_MEM_INVALID -> UC_HOOK_MEM_UNMAPPED

This also renames some newly added macros to use _INVALID postfix:

 - UC_HOOK_MEM_READ_ERR -> UC_HOOK_MEM_READ_INVALID
 - UC_HOOK_MEM_WRITE_ERR -> UC_HOOK_MEM_WRITE_INVALID
 - UC_HOOK_MEM_FETCH_ERR -> UC_HOOK_MEM_FETCH_INVALID
 - UC_HOOK_MEM_ERR -> UC_HOOK_MEM_INVALID

Fixed all the bindings Java, Go & Python.
2015-09-30 14:46:55 +08:00
5055899514 clarify that UC_HOOK_INTR is also for handling syscall events 2015-09-27 11:29:19 +08:00
dc1e9d3626 remove UC_HOOK_*_ALL hook types as they are not for same hook handlers 2015-09-24 23:23:05 +08:00
aa546ba7d6 add UC_HOOK_MEM_ALL macro to hook all kind of memory accesses 2015-09-24 20:59:45 +08:00
2599d41404 add some hooking macros for all kind of memory access events 2015-09-24 19:21:31 +08:00
738b8d89f9 correct instructions for uc_cb_hookmem_t & uc_cb_eventmem_t. this fixes a part of issue #151 2015-09-24 18:50:49 +08:00
90eb8f2e72 This commit continues the PR #111
- Allow to register handler separately for invalid memory access
- Add new memory events for hooking:
   - UC_MEM_READ_INVALID, UC_MEM_WRITE_INVALID, UC_MEM_FETCH_INVALID
   - UC_HOOK_MEM_READ_PROT, UC_HOOK_MEM_WRITE_PROT, UC_HOOK_MEM_FETCH_PROT
- Rename UC_ERR_EXEC_PROT to UC_ERR_FETCH_PROT
- Change API uc_hook_add() so event type @type can be combined from hooking types
2015-09-24 14:18:02 +08:00
dfb4a9d9ad Revert "Remove uc_cb_eventmem_t as it is identical to uc_cb_hookmem_t"
As pointed out by aquynh the return types are actually different. A
uc_cb_eventmem_t callback returns a bool, while uc_cb_hookmem_t has a
void return type.

This reverts commit cb2b97f26c.
2015-09-23 12:51:47 +07:00
2ef59e5727 Renamed UC_HOOK_MEM_INVALID_[READ/WRITE/FETCH] to
UC_HOOK_MEM_[READ/WRITE/FETCH]_INVALID as per aquynh's feedback.
2015-09-23 12:48:13 +07:00
cb2b97f26c Remove uc_cb_eventmem_t as it is identical to uc_cb_hookmem_t, as per
issue #111
2015-09-22 12:37:05 +07:00
75c5904ec1 Makes the hook types consistent, with a single indicator for each of
read, write and fetch.

This commit only adds the enum values. The functionality still has to be
updated.

As per issue #111
2015-09-22 12:26:01 +07:00
1638372793 fix small whitespace issue 2015-09-14 20:48:31 -07:00
d4d5631181 updated the sparc.h header so the alignment of certain registers was correct 2015-09-14 20:42:41 -07:00
113245e12a fix some comments in unicorn.h 2015-09-09 17:00:00 +08:00
39ac1bcb4e rename UC_ERR_INVAL to UC_ERR_ARG 2015-09-09 16:54:47 +08:00
d7ef204398 rename error codes ERR_MEM_READ, ERR_MEM_WRITE, ERR_MEM_FETCH 2015-09-09 16:25:48 +08:00
d3d38d3f21 handle read/write/fetch from unaligned addresses. this adds new error codes UC_ERR_READ_UNALIGNED, UC_ERR_WRITE_UNALIGNED & UC_ERR_FETCH_UNALIGNED 2015-09-09 15:52:15 +08:00
7a5d790ade rename UC_MEM_EXE to UC_MEM_FETCH 2015-09-08 12:55:56 +08:00
f6cecf45d2 change mem read/write APIs to use void*
Don't force the user to use uint8_t pointers, or cast their
pointers-to-other-objects to uint8_t* when calling these APIs.
2015-09-07 12:44:03 -04:00
d1bdbd11e7 rename uchook to uc_hook, ucengine to uc_engine, uc_hook_t to uc_hook_type 2015-09-05 11:20:32 +08:00
41846af60a Add clarity to the documentation of the UC_HOOK_MEM constants.
The previous comments weren't explicit, in all cases, as to what the difference
(mapped versus unmapped) between the access types was.
2015-09-05 00:35:00 +07:00
022f8d82d1 handle memory fetch as invalid memory access. now we can also report error if exec memory is unmapped (UC_ERR_MEM_FETCH) 2015-09-04 11:55:17 +08:00
5f32e2c1ae s/uc_hook_h/uchook/g 2015-09-03 22:39:23 -04:00
da46071c7d bring new code and samples up-to-date with API changes 2015-09-03 22:15:49 -04:00
5e9d07a40a Merge remote-tracking branch 'upstream/master' into change-handle-based-api 2015-09-03 22:01:52 -04:00
0962c4822b cleanup & update bindings' constants 2015-09-04 09:43:31 +08:00
6ca85a72ed simplify uc_mem_protect() & uc_mem_unmap() 2015-09-04 01:02:38 +08:00
5b62d436a9 change public APIs to use ucengine
See #52.
2015-09-02 22:00:09 -04:00
ad877e6af0 Add error value UC_ERR_INVAL and rename UC_ERR_OOM to UC_ERR_NOMEM to provide more error specificity 2015-09-01 13:40:19 -07:00
2c4f3769d4 clean up mem_protect related constants and error codes 2015-09-01 12:10:09 -07:00
658e399776 clean up mem_protect related constants 2015-08-31 19:08:48 -07:00
24dde77ec2 fix uc_mem_type comments 2015-08-30 20:38:38 -07:00
3bd705a060 Merge remote-tracking branch 'upstream/master' into change-handle-based-api 2015-08-30 00:23:51 -04:00
6beb1b8a13 intermediate commit, working unmap of complete blocks, still need sub-blocks, and cross block 2015-08-29 21:17:30 -07:00
160033c36c Merge branch 'master' into mem_map_ex_cse 2015-08-29 00:23:21 -07:00
6d8e5b32f4 Merge pull request #72 from cseagle/java_dev
Java dev
2015-08-29 15:09:16 +08:00
592cbc6eaf conflict resolution with merge master 2015-08-28 23:51:56 -07:00
d725e5fee9 improve instruction for uc_mem_map() in unicorn.h 2015-08-29 14:00:31 +08:00
e29cdbe867 File permissions 2015-08-28 20:56:16 -07:00
1d6bd17a13 Update java bindings for new version of uc_mem_map 2015-08-28 20:54:05 -07:00
94ac0f02e6 file permissions changes 2015-08-28 20:03:36 -07:00
65787d415a rename uc_mem_map_ex to uc_mem_map and all associated changes 2015-08-28 20:02:21 -07:00
eab6167241 Merge branch 'master' into mem_map_ex_cse 2015-08-28 19:00:39 -07:00
9ba59e4988 Step one towards uc_mem_protect, uc_mem_unmap, and support for UC_PROT_EXEC and NX regions 2015-08-28 18:59:45 -07:00
ff46b91a80 chmod -x some more 2015-08-29 09:30:31 +08:00