- Timestamp:
- 05/09/06 05:56:05 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/F-Script Anywhere/Source/mach_inject/mach_inject.h
r153 r217 1 /**************************************************************************************** 2 mach_inject.h $Revision: 1.1.1.1 $ 1 /******************************************************************************* 2 mach_inject.h 3 Copyright (c) 2003-2005 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com> 4 Some rights reserved: <http://creativecommons.org/licenses/by/2.0/> 5 6 ***************************************************************************/ 3 7 4 Copyright (c) 2003 Red Shed Software. All rights reserved. 5 by Jonathan 'Wolf' Rentzsch (jon * redshed * net) 8 /***************************************************************************//** 9 @mainpage mach_inject 10 @author Jonathan 'Wolf' Rentzsch: <http://rentzsch.com> 6 11 7 ************************************************************************************/ 8 9 /************************************************************************************/ /** 10 @mainpage mach_inject 11 @author Jonathan 'Wolf' Rentzsch (jon * redshed * net) 12 13 This package, coded in C to the Mach API, allows you to "inject" code into an 14 arbitrary process. "Injection" means both 1) copying over the necessary code into the 15 target's address space and 2) remotely creating a new thread to execute the code. 12 This package, coded in C to the Mach API, allows you to "inject" code into 13 an arbitrary process. "Injection" means both 1) copying over the necessary 14 code into the target's address space and 2) remotely creating a new thread 15 to execute the code. 16 16 17 *************************************************************************** *********/17 ***************************************************************************/ 18 18 19 19 #ifndef _mach_inject_ 20 20 #define _mach_inject_ 21 21 22 #ifdef __cplusplus23 extern "C" {24 #endif25 26 22 #include <sys/types.h> 27 23 #include <mach/error.h> 28 24 #include <mach/vm_types.h> 29 #include <stddef.h> 25 #include <stddef.h> // for ptrdiff_t 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 30 31 31 #define err_threadEntry_image_not_found (err_local|1) 32 #define err_threadEntry_init_failed (err_local|2)33 32 34 33 #define INJECT_ENTRY injectEntry 35 34 #define INJECT_ENTRY_SYMBOL "injectEntry" 36 35 37 typedef void (*mach_inject_entry)( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize ); 36 typedef void (*mach_inject_entry)( ptrdiff_t codeOffset, void *paramBlock, 37 size_t paramSize, void* dummy_pthread_data ); 38 38 39 /*************************************************************************** *********//**39 /***************************************************************************//** 40 40 Starts executing threadEntry in a new thread in the process specified by 41 41 targetProcess. 42 42 43 @param threadEntry -> Required pointer to injected thread's entry point. 44 @param paramBlock -> Optional pointer to block of memory to pass to the 45 injected thread. 43 @param threadEntry -> Required pointer to injected thread's entry 44 point. 45 @param paramBlock -> Optional pointer to block of memory to pass to 46 the injected thread. 46 47 @param paramSize -> Optional size of paramBlock. 47 48 @param targetProcess -> Required target process ID. 48 @param stackSize -> Optional stack size of threadEntry's thread. Set to zero49 for default (currently 8K usable).49 @param stackSize -> Optional stack size of threadEntry's thread. Set 50 to zero for default (currently 8K usable). 50 51 @result <- mach_error_t 51 52 52 *************************************************************************** *********/53 ***************************************************************************/ 53 54 54 55 mach_error_t … … 60 61 vm_size_t stackSize ); 61 62 62 /*************************************************************************** *********//**63 /***************************************************************************//** 63 64 Given a pointer, returns its Mach-O image and image size. 64 65 65 @param pointer -> Required pointer. 66 @param image <- Optional returned pointer to image (really a mach_header). 67 @param size <- Optional returned size of the image. 68 @result <- mach_error_t 66 @param pointer -> Required pointer. 67 @param image <- Optional returned pointer to image (really a 68 mach_header). 69 @param size <- Optional returned size of the image. 70 @param jumpTableOffset <- Optional returned offset of jump table within image (useful on intel) 71 @param jumpTableSize <- Optional returned size of jump table (useful on intel) 72 @result <- mach_error_t 69 73 70 *************************************************************************** *********/74 ***************************************************************************/ 71 75 72 76 mach_error_t … … 74 78 const void *pointer, 75 79 const void **image, 76 unsigned long *size ); 80 unsigned long *size, 81 unsigned int *jumpTableOffset, 82 unsigned int *jumpTableSize ); 77 83 78 #ifdef 79 }84 #ifdef __cplusplus 85 } 80 86 #endif 81 82 87 #endif // _mach_inject_
Note:
See TracChangeset
for help on using the changeset viewer.