Skip to main content

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

1

Access the Window

Open the Data Type Manager:
  • Window > Data Type Manager
  • Default: docked on left side
  • Shows tree view of all types
2

View Available Types

The tree displays:
  • Built-in types (always available)
  • Current program types
  • Open archive files
  • Categorized organization

Data Type Categories

Standard primitive types:
  • byte, word, dword, qword
  • char, short, int, long, long long
  • float, double
  • pointer (architecture-specific size)
  • string, unicode
  • undefined, undefined1, undefined2, etc.

Creating Data Types

Creating Structures

1

Create New Structure

Start a structure definition:
  • Right-click category > New > Structure
  • Or press Insert in Data Type Manager
  • Name the structure
2

Add Members

Build the structure:
  • Opens structure editor
  • Add fields one by one
  • Set member names and types
  • Specify field sizes
3

Configure Layout

Adjust structure properties:
  • Packing alignment
  • Explicit size
  • Bit fields
  • Nested structures
Use the Structure Editor to visualize memory layout and offsets as you build structures.

Creating Unions

1

Create Union

Define a union type:
  • Right-click category > New > Union
  • Name the union
2

Add Alternatives

Add union members:
  • Each member starts at offset 0
  • Different interpretations of same memory
  • Union size = largest member

Creating Enumerations

1

Create Enum

Define an enumeration:
  • Right-click category > New > Enum
  • Name the enumeration
2

Add Values

Define enum constants:
  • Add named values
  • Assign numeric values
  • Sequential or explicit values
3

Apply to Code

Use enums in code:
  • Apply to integer values
  • Create equates from enums
  • Improve code readability

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

1

Select Location

Position cursor on bytes to type:
  • Click on address in listing
  • Select range for arrays
2

Apply Type

Choose data type:
  • Press T for quick chooser
  • Drag from Data Type Manager
  • Right-click > Data > type name
3

Verify Layout

Check the result:
  • Type name shown in mnemonic
  • Structure members displayed
  • Operands reference members

In Functions

1

Function Parameters

Type function parameters:
  • Edit function signature
  • Choose parameter types
  • Name parameters
2

Return Types

Set return type:
  • Press T on function name
  • Right-click > Set Return Type
  • Choose from type manager
3

Local Variables

Type stack variables:
  • In decompiler, retype variables
  • Or edit in Function Editor
  • Types propagate through analysis
Applying correct types dramatically improves decompiler output by enabling proper type propagation.

Managing Archives

Opening Archives

1

Open Archive File

Load type archive:
  • File > Open File Archive
  • Browse to .gdt file
  • Archive appears in tree
2

Standard Archives

Access built-in archives:
  • File > Open File Archive > Standard Archive
  • Includes common libraries:
    • windows_vs12_32.gdt
    • generic_clib.gdt
    • Platform-specific types

Creating Archives

1

New Archive

Create type library:
  • File > New > File Archive
  • Name the archive file
  • Save as .gdt format
2

Populate Archive

Add types to archive:
  • Create types in archive
  • Copy from program
  • Import from other archives
3

Save Archive

Persist changes:
  • Archives auto-save by default
  • Manual save via right-click
  • Share across projects

Importing Types

1

Copy from Archive

Import into program:
  • Drag type from archive to program
  • Right-click > Copy
  • Dependencies auto-imported
2

Associate with Archive

Link to archive:
  • Types maintain source reference
  • Can sync with archive updates
  • Managed via source archive tracking

Editing Data Types

Structure Editor

Add fields to structure:
  • Click in editor and type
  • Drag types from manager
  • Press Insert to add row

Searching Data Types

Find types quickly:
1

Open Search

Access type search:
  • Click search icon in Data Type Manager
  • Press Ctrl + Shift + E
2

Search Options

Search by:
  • Name (wildcards supported)
  • Category
  • Contains types (structures with specific members)
3

Use Results

Work with found types:
  • Double-click to edit
  • Apply to code
  • View in tree

Advanced Features

Finding References

1

Find Usage

Locate type usage:
  • Right-click type > Find References to
  • Shows all locations using type
  • Results in table view
2

Structure Field References

Find field usage:
  • Right-click field > Find References to Field
  • Implemented by FindReferencesToStructureFieldAction
  • Shows all accesses to specific field

Data Type Conflicts

When importing conflicting types:
  • Replace: Overwrites existing type
  • Rename: Creates duplicate with new name
  • Use Existing: Keeps current type
Use conflict resolution carefully to avoid breaking existing type references in your program.

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

1

Create Categories

Organize types:
  • Right-click > New Category
  • Hierarchical organization
  • Name by purpose or source
2

Move Types

Reorganize:
  • Drag types between categories
  • Move entire categories
  • Maintain clear organization
3

Naming Conventions

Suggested organization:
  • /System/ - OS types
  • /Library/ - Standard library
  • /Custom/ - Project-specific
  • /Imported/ - From archives

Exporting Types

1

Export to Archive

Save types for reuse:
  • Select types to export
  • Right-click > Export > Archive File
  • Choose destination .gdt file
2

Export to C Header

Generate C declarations:
  • Select types
  • Right-click > Export > C Header
  • Creates .h file with definitions
Regularly export your custom types to archives for backup and sharing with team members.

Build docs developers (and LLMs) love