Data Type Manager Overview
The Data Type Manager provides a centralized system for managing data types across programs and archives.Implemented by
DataTypeManagerPlugin, it manages built-in types, program-specific types, and archived type libraries.Opening Data Type Manager
Access the Window
Open the Data Type Manager:
Window>Data Type Manager- Default: docked on left side
- Shows tree view of all types
Data Type Categories
- Built-in Types
- Program Types
- Archive Types
Standard primitive types:
byte,word,dword,qwordchar,short,int,long,long longfloat,doublepointer(architecture-specific size)string,unicodeundefined,undefined1,undefined2, etc.
Creating Data Types
Creating Structures
Create New Structure
Start a structure definition:
- Right-click category >
New>Structure - Or press
Insertin Data Type Manager - Name the structure
Add Members
Build the structure:
- Opens structure editor
- Add fields one by one
- Set member names and types
- Specify field sizes
Creating Unions
Creating Enumerations
Add Values
Define enum constants:
- Add named values
- Assign numeric values
- Sequential or explicit values
Creating Typedefs
Create type aliases:- Right-click type >
Create Typedef - Give meaningful name
- Use for clarity (e.g.,
HANDLE,SIZE_T)
Applying Data Types
In the Listing
Select Location
Position cursor on bytes to type:
- Click on address in listing
- Select range for arrays
Apply Type
Choose data type:
- Press
Tfor quick chooser - Drag from Data Type Manager
- Right-click >
Data> type name
In Functions
Function Parameters
Type function parameters:
- Edit function signature
- Choose parameter types
- Name parameters
Return Types
Set return type:
- Press
Ton function name - Right-click >
Set Return Type - Choose from type manager
Applying correct types dramatically improves decompiler output by enabling proper type propagation.
Managing Archives
Opening Archives
Open Archive File
Load type archive:
File>Open File Archive- Browse to
.gdtfile - Archive appears in tree
Creating Archives
New Archive
Create type library:
File>New>File Archive- Name the archive file
- Save as
.gdtformat
Populate Archive
Add types to archive:
- Create types in archive
- Copy from program
- Import from other archives
Importing Types
Copy from Archive
Import into program:
- Drag type from archive to program
- Right-click >
Copy - Dependencies auto-imported
Editing Data Types
Structure Editor
- Add Members
- Reorder Members
- Edit Properties
- Set Packing
Add fields to structure:
- Click in editor and type
- Drag types from manager
- Press
Insertto add row
Searching Data Types
Find types quickly:Search Options
Search by:
- Name (wildcards supported)
- Category
- Contains types (structures with specific members)
Advanced Features
Finding References
Find Usage
Locate type usage:
- Right-click type >
Find References to - Shows all locations using type
- Results in table view
Data Type Conflicts
When importing conflicting types:- Replace: Overwrites existing type
- Rename: Creates duplicate with new name
- Use Existing: Keeps current type
Source Archive Tracking
Ghidra tracks type origins:- Links types to source archives
- Detects archive updates
- Allows type synchronization
- Managed via
UpdateSourceArchiveNamesAction
Data Type Organization
Category Management
Create Categories
Organize types:
- Right-click >
New Category - Hierarchical organization
- Name by purpose or source
Move Types
Reorganize:
- Drag types between categories
- Move entire categories
- Maintain clear organization
