Main Page | File List | File Members | Related Pages

mach_inject.h File Reference

#include <sys/types.h>
#include <mach/error.h>
#include <mach/vm_types.h>
#include <stddef.h>

Go to the source code of this file.

Defines

#define err_threadEntry_image_not_found   (err_local|1)
#define INJECT_ENTRY   injectEntry
#define INJECT_ENTRY_SYMBOL   "injectEntry"

Typedefs

typedef void(* mach_inject_entry )(ptrdiff_t codeOffset, void *paramBlock, size_t paramSize)

Functions

mach_error_t mach_inject (const mach_inject_entry threadEntry, const void *paramBlock, size_t paramSize, pid_t targetProcess, vm_size_t stackSize)
 Starts executing threadEntry in a new thread in the process specified by targetProcess.

mach_error_t machImageForPointer (const void *pointer, const void **image, unsigned long *size)
 Given a pointer, returns its Mach-O image and image size.


Define Documentation

#define err_threadEntry_image_not_found   (err_local|1)
 

Definition at line 32 of file mach_inject.h.

Referenced by machImageForPointer().

#define INJECT_ENTRY   injectEntry
 

Definition at line 34 of file mach_inject.h.

#define INJECT_ENTRY_SYMBOL   "injectEntry"
 

Definition at line 35 of file mach_inject.h.


Typedef Documentation

typedef void(* mach_inject_entry)( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize )
 

Definition at line 37 of file mach_inject.h.

Referenced by mach_inject().


Function Documentation

mach_error_t mach_inject const mach_inject_entry  threadEntry,
const void *  paramBlock,
size_t  paramSize,
pid_t  targetProcess,
vm_size_t  stackSize
 

Starts executing threadEntry in a new thread in the process specified by targetProcess.

Bug:
We only want an 8K default, fix the plop-in-the-middle code below.

Stack math should be more sophisticated than this (ala redzone).

Todo:
Would be nice to just allocate one block for both the remote stack and* the remoteCode (including the parameter data block once that's written.

Definition at line 32 of file mach_inject.c.

References ASSERT_CAST, mach_inject_entry, and machImageForPointer().

mach_error_t machImageForPointer const void *  pointer,
const void **  image,
unsigned long *  size
 

Given a pointer, returns its Mach-O image and image size.

Parameters:
pointer -> Required pointer.
image <- Optional returned pointer to image (really a mach_header).
size <- Optional returned size of the image.
Returns:
<- mach_error_t

Definition at line 161 of file mach_inject.c.

References ASSERT_CAST, and err_threadEntry_image_not_found.

Referenced by mach_inject().


Generated on Sun Jun 12 22:08:05 2005 for mach_inject by doxygen 1.3.4