Ignore:
Timestamp:
05/09/06 05:56:05 (18 years ago)
Author:
rchin
Message:
  • Updated to new mach_inject with support for x86
  • Updated nib files to 10.2+ format so that future updates to the f-script framework won't break fsa
  • Adjusted some code to work with the new x86 mach_inject (sends an additional argument)
  • Updates code to work with newer defines in cctools
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        ***************************************************************************/
    37       
    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>
    611       
    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.
    1616
    17         ************************************************************************************/
     17        ***************************************************************************/
    1818
    1919#ifndef         _mach_inject_
    2020#define         _mach_inject_
    2121
    22 #ifdef __cplusplus
    23 extern "C" {
    24 #endif
    25 
    2622#include <sys/types.h>
    2723#include <mach/error.h>
    2824#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
    3030
    3131#define err_threadEntry_image_not_found                 (err_local|1)
    32 #define err_threadEntry_init_failed                             (err_local|2)
    3332
    3433#define INJECT_ENTRY            injectEntry
    3534#define INJECT_ENTRY_SYMBOL     "injectEntry"
    3635
    37 typedef void    (*mach_inject_entry)( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize );
     36typedef void    (*mach_inject_entry)( ptrdiff_t codeOffset, void *paramBlock,
     37                                size_t paramSize, void* dummy_pthread_data );
    3838       
    39 /************************************************************************************//**
     39/***************************************************************************//**
    4040        Starts executing threadEntry in a new thread in the process specified by
    4141        targetProcess.
    4242       
    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.
    4647        @param  paramSize               ->      Optional size of paramBlock.
    4748        @param  targetProcess   ->      Required target process ID.
    48         @param  stackSize               ->      Optional stack size of threadEntry's thread. Set to zero
    49                                                                 for default (currently 8K usable).
     49        @param  stackSize               ->      Optional stack size of threadEntry's thread. Set
     50                                                                to zero for default (currently 8K usable).
    5051        @result                                 <-      mach_error_t
    5152
    52         ************************************************************************************/
     53        ***************************************************************************/
    5354
    5455        mach_error_t
     
    6061                vm_size_t                               stackSize );
    6162
    62 /************************************************************************************//**
     63/***************************************************************************//**
    6364        Given a pointer, returns its Mach-O image and image size.
    6465       
    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
    6973       
    70         ************************************************************************************/
     74        ***************************************************************************/
    7175
    7276        mach_error_t
     
    7478                const void *pointer,
    7579                const void **image,
    76                 unsigned long *size );
     80                unsigned long *size,
     81                unsigned int *jumpTableOffset,
     82                unsigned int *jumpTableSize );
    7783
    78 #ifdef __cplusplus
    79 }
     84#ifdef  __cplusplus
     85        }
    8086#endif
    81 
    8287#endif  //      _mach_inject_
Note: See TracChangeset for help on using the changeset viewer.