0

I'm reversing a binary and I found this strange keyword I haven't seen before called 'code'. I looked up the C++ keywords and there doesn't seem to be one. Could anyone provide me with more information about this keyword?

      if (*(int *)(param_1 + 4) != 0) {
        (*(code *)(&PTR_thunk_FUN_005a7840_008dd8b8)[(int)param_2[4]])(*(int *)(param_1 + 4));
      }

In Assembly.

00491b95 85  c0           TEST       EAX ,EAX
00491b97 74  10           JZ         LAB_00491ba9
00491b99 8b  4e  10       MOV        ECX ,dword ptr [ESI  + 0x10 ]
00491b9c 8b  14  8d       MOV        EDX ,dword ptr [ECX *0x4  + -> thunk_FUN_005a7840 ] = 00401c30
         b8  d8  8d 
         00
00491ba3 50              PUSH       EAX
00491ba4 ff  d2           CALL       EDX
  • 1
    Not an answer, because I did no diligent research, but I assume that "code*" is supposed to mean "a function pointer of unspecified type", just like "void*" means "a data pointer of unspecified type". – Michael Karcher Jun 14 at 23:04
  • I see what you're getting at and it does seem like it, but I want more info on it. – DohnJoe Jun 15 at 0:07
  • (I'm not totally sure about this to post it as an answer). The decompiler concluded that there is a CALL to the address pointed to by your code. It doesn't know its prototype but it does know that this is called as a function. You can't normally CALL a void *, so code * is the way to show it. Consider it a cast to unknown-prototyped function. – Yotamz Jun 15 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.