Getting started with C++ SDK
IN PROGRESS
The IDA C++ SDK provides set of tools to interact with IDA Pro's disassembler, allowing you to navigate, analyze, and manipulate various elements such as functions, instructions, and data. This guide is designed to accelerate your learning curve with the IDA C++ SDK and kickstart your development journey, assuming you are already familiar with IDA Pro and its basic usage.
How This Guide is Structured
First, check Basics for core concepts and commonly used variables. Next, explore our Code Snippets to see examples of commonly used functions. Once you're comfortable with these, you can delve into more complex Examples that showcase advanced usage of the SDK.
C++ SDK Installation
You can download the latest C++ SDK Zip file from our Download Center in My Hex-Rays portal. The SDK package includes in the top-level directory a README file with instructions on how to install it on your local machine and additional README files in other directories for processor modules templates, loaders and so on.
Common Types and Constants
One of the most extensivly used type is ea_t, commonly used to represent an effective address (EA) within a binary.
Common header files and namespaces
The IDA C++ SDK is organized into header files containing various classes and functions. Below is a short desription of commonly used IDA SDK header files:
pro.h: This is the first header included in the IDA project. It defines the most common types, functions, and data. It also contains compiler- and platform-related definitions.
ida.hpp: In this file the 'inf' structure is defined: it keeps all parameters of the disassembled file.
Here are the most common namespaces to start with:
idc: This namespace provides access to IDC scripting functions via C++ SDK. It is often used for common tasks like setting comments or modifying bytes.
idati: This namespace is used for interacting with type information, such as function signatures and type definitions.
idaapi: This namespace contains core classes and functions for interacting with IDA's API, including functions for handling UI elements, plugins, and database access.
idamisc: This namespace includes utility functions for various tasks, such as working with the address space and disassembly.
Here are common functions and examples grouped by topics:
Part 1: Addresses and Names
Get the Current Address
Jump to the address
Get the Minimum and Maximum Address in IDB
List All Instruction Addresses
Get the Name Associated with a Given Address
Get the Address Associated with a Given Name
Part 2: Reading and Writing Data
Reading Bytes and Words
Writing Bytes and Words
Part 3: Comments
Add a Regular or Repeatable Comment
Get a Regular Comment
Part 4: Segments
Get a Segment Name
Iterate Through All Segments
Part 5: Functions
Create and Delete Function
Get the Name of the Function
Iterate Through All Functions
Part 6: Navigating Cross-References (Xrefs)
List Cross-References to an Address
List Cross-References from an Address
Set Background Color of a Function
Display a Custom Dialog
Complex Script Examples
If you’re comfortable with the basics, explore included in the SDK itself. These examples often leverage multiple modules to accomplish more sophisticated tasks.
Explore our tutorial on in IDA using C++.