For the complete documentation index, see llms.txt. This page is also available as Markdown.

Structures & Arrays

Description of structures and arrays

Structures

HyperDbg supports defining and using structures within scripts, similar to C structs.

Defining and Initializing a Struct

Structures are defined using the struct keyword, and instances can be initialized with brace-enclosed values.

? {
  struct Point {
      int x;
      int y;
  };

  struct Point local = {0n31, 0n32};
  printf("%d %d\n", local.x, local.y);
}

The above example prints:

31 32

Accessing and Modifying Struct Members

Struct members are accessed using the dot (.) operator. They can be read and modified like regular variables.

The above example prints:

Pointers to Structs (Arrow Operator)

You can take the address of a struct instance using & and access its members via a pointer using the arrow (->) operator.

The above example prints:

Nested Structs

As shown in the pointer example above, structs can be nested (a struct may contain another struct as a member field). Both dot (.) and arrow (->) operators can be chained to reach deeply nested members (e.g., arrow_nested_pointer->nested.value).

Arrays

HyperDbg also supports arrays within scripts.

Initializing Array

The following statements are used for initializing arrays.

Array Assignment

The following example shows how to assign constant values to an array.

You can also assign variables to an array.

Reading Array Elements

There are two ways you can read each array item: first, by using its index, or by dereferencing it directly from memory.

By using its index:

By directly reading it from memory:

Multidimensional Array

Multidimensional arrays are defined as follows.

or another example with more dimensions:

Last updated