# A reversing problem at structure restore

**URL:** <https://community.hex-rays.com/t/a-reversing-problem-at-structure-restore/626>\
**Category:** IDA General\
**Created:** [December 22, 2025, 6:49am UTC](https://community.hex-rays.com/t/a-reversing-problem-at-structure-restore/626 "2025-12-22T06:49:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mas0n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/mas0n/32/32_2.png) [@Mas0n](https://community.hex-rays.com/u/Mas0n)\
**Post date:** [December 22, 2025, 6:49am UTC](https://community.hex-rays.com/t/a-reversing-problem-at-structure-restore/626/1 "2025-12-22T06:49:15Z")

</div>

Hi,

I have issue in my recently works

for example, I copy snippets, in this snippet, it’s calculate index firstly, and then add a fixed offset to set value.

```cpp
__int64__ fastcall RegisterCallbackHandler(
        unsigned int cmdCode,
        void (*handler)(void *context, ...),
        __int16 a3,
        void *context)
{
  __int16 v4; // w8
  __int64 v5; // x9

  if ( cmdCode <= 0xC7 )
  {
    v4 = 0;
    v5 = (__int64)&g_context + 0x1A * (unsigned__int16)cmdCode;
    *(_QWORD *)(v5 + 0x5D8) = handler;
    *(_WORD *)(v5 + 0x5E0) = a3;
    *(_QWORD *)(v5 + 0x5D0) = context;
  }
  else
  {
    return (unsigned int)0xE6F9;
  }
  return (unsigned int)v4;
}

```

I defined 2 structure:

```cpp
#pragma pack(push, 1)
struct CallbackEntry /*0x1A*/ {
    void *context;
    void (*handler)(void *, ...);
    __int16 a3;
    char padding[8];
};
#pragma pack(pop)

struct GlobalContext {
    char gap0[0x5D0];
    struct CallbackEntry callbacks[200];
};

```

and set g\_context type as GlobalContext,

but it’s seems not work for Hex-Ray decompiler, how can I solve this issue?

---

<div class="post-metadata">

**Author:** ![Milanek](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Milanek](https://community.hex-rays.com/u/Milanek)\
**Post date:** [December 22, 2025, 10:54am UTC](https://community.hex-rays.com/t/a-reversing-problem-at-structure-restore/626/2 "2025-12-22T10:54:30Z")

</div>

Try to set the global variable structure with DeclareStructVar (`Edit / Struct var`) in IDA-View.
