-
Notifications
You must be signed in to change notification settings - Fork 14
/
lorgnette.h
58 lines (57 loc) · 1.7 KB
/
lorgnette.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// lorgnette.h
// liblorgnette
//
// Created by Dmitry Rodionov on 9/24/14.
// Copyright (c) 2014 rodionovd. All rights reserved.
//
#include <mach/mach.h>
#pragma once
/**
* @abstract
* Locate a symbol inside an arbitrary process' address space.
*
* @note
* This function iterates local symbols first and only then it looks for symbols
* in linked libraries.
*
* @param target
* The target process to inspect.
* @param symbol_name
* The name of the symbol to find. This parameter must not be NULL.
*
* @return
* An address of the given symbol within the given process, or 0 (zero) if this symbol
* could not be found.
*
* @b Examples
*
* Find a @p dlopen symbol address within the current task memory space
* @code
* addr = lorgnette_lookup(mach_task_self(), "dlopen");
* @endcode
* Find a @p glob_var0 symbol address inside a remote process
* @code
* addr = lorgnette_lookup(some_task, "glob_var0");
* @endcode
*/
mach_vm_address_t lorgnette_lookup(task_t target, const char *symbol_name);
/**
* @abstract
* Locate a symbol within a particular image inside an alien process.
*
* @param target
* The target process to inspect.
* @param symbol_name
* The name of the symbol to find. This parameter must not be NULL.
* @param image_name
* The name of the host image of the given symbol. This may be NULL.
* The image name should be either a full file path or just a file base name.
*
* @return
* An address of the given symbol within the given process, or 0 (zero) if this symbol
* could not be found [within the given image, if @p image_name is not NULL].
*
* @see lorgnette_lookup()
*/
mach_vm_address_t lorgnette_lookup_image(task_t target, const char *symbol_name, const char *image_name);