Defines | |
#define | DR_MAX_OPTIONS_LENGTH 512 |
Enumerations | |
enum | dr_operation_mode_t { DR_MODE_NONE = 0, DR_MODE_CODE_MANIPULATION = 1 } |
enum | dr_config_status_t { DR_SUCCESS, DR_PROC_REG_EXISTS, DR_PROC_REG_INVALID, DR_PRIORITY_INVALID, DR_ID_CONFLICTING, DR_ID_INVALID, DR_FAILURE, DR_NUDGE_PID_NOT_INJECTED, DR_NUDGE_TIMEOUT } |
enum | dr_platform_t { DR_PLATFORM_DEFAULT, DR_PLATFORM_32BIT, DR_PLATFORM_64BIT } |
Functions | |
dr_config_status_t | dr_register_process (const char *process_name, process_id_t pid, bool global, const char *dr_root_dir, dr_operation_mode_t dr_mode, bool debug, dr_platform_t dr_platform, const char *dr_options) |
dr_config_status_t | dr_unregister_process (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform) |
dr_config_status_t | dr_register_syswide (dr_platform_t dr_platform, const char *dr_root_dir) |
dr_config_status_t | dr_unregister_syswide (dr_platform_t dr_platform, const char *dr_root_dir) |
bool | dr_syswide_is_on (dr_platform_t dr_platform, const char *dr_root_dir) |
bool | dr_process_is_registered (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform, char *dr_root_dir, dr_operation_mode_t *dr_mode, bool *debug, char *dr_options) |
dr_registered_process_iterator_t * | dr_registered_process_iterator_start (dr_platform_t dr_platform, bool global) |
bool | dr_registered_process_iterator_hasnext (dr_registered_process_iterator_t *iter) |
bool | dr_registered_process_iterator_next (dr_registered_process_iterator_t *iter, char *process_name, char *dr_root_dir, dr_operation_mode_t *dr_mode, bool *debug, char *dr_options) |
void | dr_registered_process_iterator_stop (dr_registered_process_iterator_t *iter) |
dr_config_status_t | dr_register_client (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform, client_id_t client_id, size_t client_pri, const char *client_path, const char *client_options) |
dr_config_status_t | dr_unregister_client (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform, client_id_t client_id) |
size_t | dr_num_registered_clients (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform) |
dr_config_status_t | dr_get_client_info (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform, client_id_t client_id, size_t *client_pri, char *client_path, char *client_options) |
dr_client_iterator_t * | dr_client_iterator_start (const char *process_name, process_id_t pid, bool global, dr_platform_t dr_platform) |
bool | dr_client_iterator_hasnext (dr_client_iterator_t *iter) |
void | dr_client_iterator_next (dr_client_iterator_t *iter, client_id_t *client_id, size_t *client_pri, char *client_path, char *client_options) |
void | dr_client_iterator_stop (dr_client_iterator_t *iter) |
dr_config_status_t | dr_nudge_process (const char *process_name, client_id_t client_id, uint64 arg, uint timeout_ms, int *nudge_count) |
dr_config_status_t | dr_nudge_pid (process_id_t process_id, client_id_t client_id, uint64 arg, uint timeout_ms) |
dr_config_status_t | dr_nudge_all (client_id_t client_id, uint64 arg, uint timeout_ms, int *nudge_count) |
#define DR_MAX_OPTIONS_LENGTH 512 |
Maximum length of a registered process's options string
enum dr_config_status_t |
Return status codes for process registration, unregistration and nudging.
enum dr_operation_mode_t |
enum dr_platform_t |
bool dr_client_iterator_hasnext | ( | dr_client_iterator_t * | iter | ) |
[in] | iter | A client iterator created with dr_client_iterator_start() |
void dr_client_iterator_next | ( | dr_client_iterator_t * | iter, | |
client_id_t * | client_id, | |||
size_t * | client_pri, | |||
char * | client_path, | |||
char * | client_options | |||
) |
Return information about a client.
[in] | iter | A client iterator created with dr_client_iterator_start() |
[out] | client_id | The unique client ID provided at client registration. |
[out] | client_pri | The client's priority. |
[out] | client_path | The client's path provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length MAX_PATH. |
[out] | client_options | The client options provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length DR_MAX_OPTIONS_LENGTH. |
dr_client_iterator_t* dr_client_iterator_start | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform | |||
) |
Creates and starts an iterator for iterating over all clients registered for the given process.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the one-time configuration for that pid will be queried. If pid == 0, the general configuration for process_name will be queried. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to check. |
void dr_client_iterator_stop | ( | dr_client_iterator_t * | iter | ) |
Stops and frees a client iterator.
[in] | iter | A client iterator created with dr_client_iterator_start() |
dr_config_status_t dr_get_client_info | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform, | |||
client_id_t | client_id, | |||
size_t * | client_pri, | |||
char * | client_path, | |||
char * | client_options | |||
) |
Retrieve client registration information for a particular process for the current user.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the one-time configuration for that pid will be queried. If pid == 0, the general configuration for process_name will be queried. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to unset. |
[in] | client_id | The unique client ID provided at client registration. |
[out] | client_pri | The client's priority. |
[out] | client_path | The client's path provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length MAX_PATH. |
[out] | client_options | The client options provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length DR_MAX_OPTIONS_LENGTH. |
dr_config_status_t dr_nudge_all | ( | client_id_t | client_id, | |
uint64 | arg, | |||
uint | timeout_ms, | |||
int * | nudge_count | |||
) |
Provides a mechanism for an external entity on the guest OS to communicate with a client. Requires administrative privileges. A process 'nudge' causes a client event handler to be invoked (use dr_register_nudge_event() to register the handler function). A nudge is ignored if the process is not running under DynamoRIO, the specified client is not loaded, or if the client does not provide a handler. Nudges are attempted to all processes running on the system.
[in] | client_id | The unique client ID provided at client registration. |
[in] | arg | An argument passed to the client's nudge handler. |
[in] | timeout_ms | The number of milliseconds to wait for each nudge to complete before continuing. If INFINITE is supplied then the wait is unbounded. If 0 is supplied the no wait is performed. If a wait times out DR_NUDGE_TIMEOUT will be returned. |
[out] | nudge_count | Returns the number of processes nudged. Client can supply NULL if this value is not needed. |
dr_config_status_t dr_nudge_pid | ( | process_id_t | process_id, | |
client_id_t | client_id, | |||
uint64 | arg, | |||
uint | timeout_ms | |||
) |
Provides a mechanism for an external entity on the guest OS to communicate with a client. Requires administrative privileges. A process 'nudge' causes a client event handler to be invoked (use dr_register_nudge_event() to register the handler function). A nudge is ignored if the process is not running under DynamoRIO, the specified client is not loaded, or if the client does not provide a handler.
[in] | process_id | The system id of the process to nudge (see dr_get_process_id()) |
[in] | client_id | The unique client ID provided at client registration. |
[in] | arg | An argument passed to the client's nudge handler. |
[in] | timeout_ms | The number of milliseconds to wait for the nudge to complete before returning. If INFINITE is supplied then the wait is unbounded. If 0 is supplied the no wait is performed. If the wait times out DR_NUDGE_TIMEOUT will be returned. |
dr_config_status_t dr_nudge_process | ( | const char * | process_name, | |
client_id_t | client_id, | |||
uint64 | arg, | |||
uint | timeout_ms, | |||
int * | nudge_count | |||
) |
Provides a mechanism for an external entity on the guest OS to communicate with a client. Requires administrative privileges. A process 'nudge' causes a client event handler to be invoked (use dr_register_nudge_event() to register the handler function). A nudge is ignored if the process is not running under DynamoRIO, the specified client is not loaded, or if the client does not provide a handler.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable. |
[in] | client_id | The unique client ID provided at client registration. |
[in] | arg | An argument passed to the client's nudge handler. |
[in] | timeout_ms | The number of milliseconds to wait for each nudge to complete before continuing. If INFINITE is supplied then the wait is unbounded. If 0 is supplied the no wait is performed. If a wait times out DR_NUDGE_TIMEOUT will be returned. |
[out] | nudge_count | Returns the number of processes nudged. Client can supply NULL if this value is not needed. |
A process nudge is a one way asynchronous communication from an external entity to a client. It does not allow a client to return information back to the nudge originator. To communicate from a client to another process, use the channels specified in Communication.
size_t dr_num_registered_clients | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform | |||
) |
Retrieve the number of clients registered for a particular process for the current user.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the one-time configuration for that pid will be queried. If pid == 0, the general configuration for process_name will be queried. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to unset. |
bool dr_process_is_registered | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform, | |||
char * | dr_root_dir, | |||
dr_operation_mode_t * | dr_mode, | |||
bool * | debug, | |||
char * | dr_options | |||
) |
Check if a process is registered to run under DynamoRIO. To obtain client information, use dr_get_client_info().
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the one-time configuration for that pid will be queried. If pid == 0, the general configuration for process_name will be queried. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to check. |
[out] | dr_root_dir | If the process is registered, the root DynamoRIO directory provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length MAX_PATH. |
[out] | dr_mode | If the process is registered, the mode provided at registration. Callers can pass NULL if this value is not needed. |
[out] | debug | If the process is registered, the debug flag provided at registration. Callers can pass NULL if this value is not needed. |
[out] | dr_options | If the process is registered, the extra DynamoRIO parameters provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length DR_MAX_OPTIONS_LENGTH. |
dr_config_status_t dr_register_client | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform, | |||
client_id_t | client_id, | |||
size_t | client_pri, | |||
const char * | client_path, | |||
const char * | client_options | |||
) |
Register a client for a particular process. Note that the process must first be registered via dr_register_process() before calling this routine.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the one-time configuration for that pid will be modified. If pid == 0, the general configuration for process_name will be modified. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to unset. |
[in] | client_id | A client_id_t uniquely identifying the client. DynamoRIO provides the client ID as a parameter to dr_init(). Clients use this ID to retrieve client-specific path and option information. Outside entities also identify the target of a nudge via this ID. |
[in] | client_pri | The client number, or priority. Client registration includes a value indicating the priority of a client relative to other clients. In multi-client settings, a client's priority influences event callback ordering. That is, higher priority clients can register their callbacks first; DynamoRIO then calls these routines last. Client priorities range consecutively from 0 to N-1, where N is the number of registered clients. Specify priority 0 to register a client with highest priority. |
[in] | client_path | A NULL-terminated string specifying the full path to a valid client library. The string length cannot exceed MAX_PATH. The client path may not include any semicolons. |
[in] | client_options | A NULL-terminated string specifying options that are available to the client via dr_get_options(). The string length cannot exceed DR_MAX_OPTIONS_LENGTH. The client options may not include any semicolons. |
dr_config_status_t dr_register_process | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
const char * | dr_root_dir, | |||
dr_operation_mode_t | dr_mode, | |||
bool | debug, | |||
dr_platform_t | dr_platform, | |||
const char * | dr_options | |||
) |
Register a process to run under DynamoRIO. Note that this routine only sets the base options to run a process under DynamoRIO. To register one or more clients, call dr_register_client() subsequently.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, a one-time configuration is created just for it. If pid == 0, a general configuration is created for all future instances of process_name. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_root_dir | A NULL-terminated string specifying the full path to a valid DynamoRIO root directory. The string length cannot exceed MAX_PATH. |
[in] | dr_mode | Specifies the mode under which DynamoRIO should operate. See dr_operation_mode_t. |
[in] | debug | If true, a DynamoRIO debug build will be used; otherwise, a release build will be used. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to set. |
[in] | dr_options | A NULL-terminated string controlling DynamoRIO's behavior. Most users should not need to specify options. The total string length cannot exceed DR_MAX_OPTIONS_LENGTH. |
dr_config_status_t dr_register_syswide | ( | dr_platform_t | dr_platform, | |
const char * | dr_root_dir | |||
) |
Sets up systemwide injection so that registered applications will run under DynamoRIO however they are launched (i.e., they do not need to be explicitly invoked with the drrun or drinject tools). This requires administrative privileges and affects all users (though configurations remain private to each user). On Windows NT, a reboot is required for this to take effect.
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those to use. |
[in] | dr_root_dir | The root DynamoRIO directory (used to locate drpreinject.dll). |
bool dr_registered_process_iterator_hasnext | ( | dr_registered_process_iterator_t * | iter | ) |
[in] | iter | A registered process iterator created with dr_registered_process_iterator_start() |
bool dr_registered_process_iterator_next | ( | dr_registered_process_iterator_t * | iter, | |
char * | process_name, | |||
char * | dr_root_dir, | |||
dr_operation_mode_t * | dr_mode, | |||
bool * | debug, | |||
char * | dr_options | |||
) |
Return information about a registered process
[in] | iter | A registered process iterator created with dr_registered_process_iterator_start(). |
[out] | process_name | The name of the registered process. Callers can pass NULL if this value is not needed. Otherwise the parameter must be a caller-allocated array of length MAX_PATH. |
[out] | dr_root_dir | The root DynamoRIO directory provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length MAX_PATH. |
[out] | dr_mode | If the process is registered, the mode provided at registration. Callers can pass NULL if this value is not needed. |
[out] | debug | If the process is registered, the debug flag provided at registration. Callers can pass NULL if this value is not needed. |
[out] | dr_options | If the process is registered, the extra DynamoRIO parameters provided at registration. Callers can pass NULL if this value is not needed. Otherwise, the parameter must be a caller-allocated array of length DR_MAX_OPTIONS_LENGTH. |
dr_registered_process_iterator_t* dr_registered_process_iterator_start | ( | dr_platform_t | dr_platform, | |
bool | global | |||
) |
Creates and starts an iterator for iterating over all processes registered for the given platform and given global or local parameter.
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to check. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
void dr_registered_process_iterator_stop | ( | dr_registered_process_iterator_t * | iter | ) |
Stops and frees a registered process iterator.
[in] | iter | A registered process iterator created with dr_registered_process_iterator_start() |
bool dr_syswide_is_on | ( | dr_platform_t | dr_platform, | |
const char * | dr_root_dir | |||
) |
Returns whether systemwide injection is enabled.
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those to use. |
[in] | dr_root_dir | The root DynamoRIO directory (used to locate drpreinject.dll). |
dr_config_status_t dr_unregister_client | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform, | |||
client_id_t | client_id | |||
) |
Unregister a client for a particular process.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the one-time configuration for that pid will be modified. If pid == 0, the general configuration for process_name will be modified. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to unset. |
[in] | client_id | The unique client ID provided at client registration. |
dr_config_status_t dr_unregister_process | ( | const char * | process_name, | |
process_id_t | pid, | |||
bool | global, | |||
dr_platform_t | dr_platform | |||
) |
Unregister a process from running under DynamoRIO.
[in] | process_name | A NULL-terminated string specifying the name of the target process. The string should identify the base name of the process, not the full path of the executable (e.g., calc.exe). |
[in] | pid | A process id of a target process, typically just created and suspended via dr_inject_process_exit(). If pid != 0, the existing one-time configuration is removed. If pid == 0, the general configuration for process_name is removed. |
[in] | global | Whether global config files, stored in a dir pointed at by the DYNAMORIO_HOME registry key, should be used, or local config files private to the current user. Administrative privileges may be needed if global is true. Note that DynamoRIO gives local config files precedence when both exist. The caller must separately create the global directory. |
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those configurations to unset. |
dr_config_status_t dr_unregister_syswide | ( | dr_platform_t | dr_platform, | |
const char * | dr_root_dir | |||
) |
Disables systemwide injection. Registered applications will not run under DynamoRIO unless explicitly launched with the drrun or drinject tools (or a custom tool that uses the drinjectlib library). On Windows NT, a reboot is required for this to take effect.
[in] | dr_platform | Configurations are kept separate on 64-bit Windows for 32-bit (WOW64) processes and 64-bit processes. This parameter allows selecting which of those to use. |
[in] | dr_root_dir | The root DynamoRIO directory (used to locate drpreinject.dll). |