0

Im a noob when it comes to using reverse engineering tooling.

I am doing a reversing challenge (pwn adventure 3 CTF) and I am exporting the various types from IDA. The thing is, the header files are always full of errors when I add them to the project in visual studio. Using these headers would be much convenient since I have access to them, its just frustrating that i cannot get the syntax work. I have tried exporting the whole DLL I am debugging as a header (it includes a pdb so all these are supposed to be included). I have even tried including all of the std headers (I know its a bad practice, just wanted to try whether that fixes it.)

Is there something I am missing that I am supposed to do in order to have the exported headers be syntactically correct so I can use them in my development project?

Maybe the pros can guide me to the correct direction with this. Cheers in advance.

An example for the header exported by IDA for the ClientWorld looks the following,:

/*
   This file has been generated by IDA.
   It contains local type definitions from
   the type library 'GameLogic'
*/

#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long

struct IPlayer;
struct ILocalPlayer;
struct std::_Tree_node<std::pair<unsigned int const ,ActorRef<IActor> >,void *>;
struct std::_Tree_node<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *>,void *>;
struct std::_Tree_node<ActorRef<IActor>,void *>;
struct std::_Tree_node<ActorRef<IPlayer>,void *>;
struct WorldVtbl;

/* 155 */
struct __cppobj std::_Container_base0
{
};

/* 545 */
struct __cppobj std::_Tree_val<std::_Tree_simple_types<ActorRef<IPlayer> > > : std::_Container_base0
{
  std::_Tree_node<ActorRef<IPlayer>,void *> *_Myhead;
  unsigned int _Mysize;
};

/* 549 */
struct __cppobj std::_Tree_alloc<0,std::_Tree_base_types<ActorRef<IPlayer>,std::allocator<ActorRef<IPlayer> > > > : std::_Tree_val<std::_Tree_simple_types<ActorRef<IPlayer> > >
{
};

/* 550 */
struct __cppobj std::_Tree_buy<ActorRef<IPlayer>,std::allocator<ActorRef<IPlayer> > > : std::_Tree_alloc<0,std::_Tree_base_types<ActorRef<IPlayer>,std::allocator<ActorRef<IPlayer> > > >
{
};

/* 551 */
struct __cppobj std::_Tree_comp<0,std::_Tset_traits<ActorRef<IPlayer>,std::less<ActorRef<IPlayer> >,std::allocator<ActorRef<IPlayer> >,0> > : std::_Tree_buy<ActorRef<IPlayer>,std::allocator<ActorRef<IPlayer> > >
{
};

/* 565 */
struct __cppobj std::_Tree<std::_Tset_traits<ActorRef<IPlayer>,std::less<ActorRef<IPlayer> >,std::allocator<ActorRef<IPlayer> >,0> > : std::_Tree_comp<0,std::_Tset_traits<ActorRef<IPlayer>,std::less<ActorRef<IPlayer> >,std::allocator<ActorRef<IPlayer> >,0> >
{
};

/* 687 */
struct __cppobj std::set<ActorRef<IPlayer>,std::less<ActorRef<IPlayer> >,std::allocator<ActorRef<IPlayer> > > : std::_Tree<std::_Tset_traits<ActorRef<IPlayer>,std::less<ActorRef<IPlayer> >,std::allocator<ActorRef<IPlayer> >,0> >
{
};

/* 322 */
struct __cppobj std::_Tree_val<std::_Tree_simple_types<ActorRef<IActor> > > : std::_Container_base0
{
  std::_Tree_node<ActorRef<IActor>,void *> *_Myhead;
  unsigned int _Mysize;
};

/* 323 */
struct __cppobj std::_Tree_alloc<0,std::_Tree_base_types<ActorRef<IActor>,std::allocator<ActorRef<IActor> > > > : std::_Tree_val<std::_Tree_simple_types<ActorRef<IActor> > >
{
};

/* 328 */
struct __cppobj std::_Tree_buy<ActorRef<IActor>,std::allocator<ActorRef<IActor> > > : std::_Tree_alloc<0,std::_Tree_base_types<ActorRef<IActor>,std::allocator<ActorRef<IActor> > > >
{
};

/* 542 */
struct __cppobj std::_Tree_comp<0,std::_Tset_traits<ActorRef<IActor>,std::less<ActorRef<IActor> >,std::allocator<ActorRef<IActor> >,0> > : std::_Tree_buy<ActorRef<IActor>,std::allocator<ActorRef<IActor> > >
{
};

/* 554 */
struct __cppobj std::_Tree<std::_Tset_traits<ActorRef<IActor>,std::less<ActorRef<IActor> >,std::allocator<ActorRef<IActor> >,0> > : std::_Tree_comp<0,std::_Tset_traits<ActorRef<IActor>,std::less<ActorRef<IActor> >,std::allocator<ActorRef<IActor> >,0> >
{
};

/* 664 */
struct __cppobj std::set<ActorRef<IActor>,std::less<ActorRef<IActor> >,std::allocator<ActorRef<IActor> > > : std::_Tree<std::_Tset_traits<ActorRef<IActor>,std::less<ActorRef<IActor> >,std::allocator<ActorRef<IActor> >,0> >
{
};

/* 304 */
struct __cppobj std::_Tree_val<std::_Tree_simple_types<std::pair<unsigned int const ,ActorRef<IActor> > > > : std::_Container_base0
{
  std::_Tree_node<std::pair<unsigned int const ,ActorRef<IActor> >,void *> *_Myhead;
  unsigned int _Mysize;
};

/* 305 */
struct __cppobj std::_Tree_alloc<0,std::_Tree_base_types<std::pair<unsigned int const ,ActorRef<IActor> >,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > > > > : std::_Tree_val<std::_Tree_simple_types<std::pair<unsigned int const ,ActorRef<IActor> > > >
{
};

/* 330 */
struct __cppobj std::_Tree_buy<std::pair<unsigned int const ,ActorRef<IActor> >,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > > > : std::_Tree_alloc<0,std::_Tree_base_types<std::pair<unsigned int const ,ActorRef<IActor> >,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > > > >
{
};

/* 331 */
struct __cppobj std::_Tree_comp<0,std::_Tmap_traits<unsigned int,ActorRef<IActor>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > >,0> > : std::_Tree_buy<std::pair<unsigned int const ,ActorRef<IActor> >,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > > >
{
};

/* 334 */
struct __cppobj std::_Tree<std::_Tmap_traits<unsigned int,ActorRef<IActor>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > >,0> > : std::_Tree_comp<0,std::_Tmap_traits<unsigned int,ActorRef<IActor>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > >,0> >
{
};

/* 597 */
struct __cppobj std::map<unsigned int,ActorRef<IActor>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > > > : std::_Tree<std::_Tmap_traits<unsigned int,ActorRef<IActor>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > >,0> >
{
};

/* 285 */
struct __cppobj std::_Tree_val<std::_Tree_simple_types<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > > : std::_Container_base0
{
  std::_Tree_node<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *>,void *> *_Myhead;
  unsigned int _Mysize;
};

/* 286 */
struct __cppobj std::_Tree_alloc<0,std::_Tree_base_types<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > > > : std::_Tree_val<std::_Tree_simple_types<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > >
{
};

/* 393 */
struct __cppobj std::_Tree_buy<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > > : std::_Tree_alloc<0,std::_Tree_base_types<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > > >
{
};

/* 490 */
struct __cppobj std::_Tree_comp<0,std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,AIZone *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> >,0> > : std::_Tree_buy<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > >
{
};

/* 513 */
struct __cppobj std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,AIZone *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> >,0> > : std::_Tree_comp<0,std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,AIZone *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> >,0> >
{
};

/* 564 */
struct __cppobj std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,AIZone *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > > : std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,AIZone *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> >,0> >
{
};

/* 706 */
struct World
{
  WorldVtbl *vfptr;
  std::set<ActorRef<IPlayer>,std::less<ActorRef<IPlayer> >,std::allocator<ActorRef<IPlayer> > > m_players;
  std::set<ActorRef<IActor>,std::less<ActorRef<IActor> >,std::allocator<ActorRef<IActor> > > m_actors;
  std::map<unsigned int,ActorRef<IActor>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,ActorRef<IActor> > > > m_actorsById;
  ILocalPlayer *m_localPlayer;
  unsigned int m_nextId;
  std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,AIZone *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,AIZone *> > > m_aiZones;
};

/* 259 */
struct ActorRef<IPlayer>
{
  IPlayer *m_object;
};

/* 1618 */
struct __cppobj ClientWorld : World
{
  ActorRef<IPlayer> m_activePlayer;
  float m_timeUntilNextNetTick;
};
  • 1
    What errors are in that header? – usr2564301 Jun 25 at 22:15
  • First error is: specializing class "std::_Treenode<std::pair<const unsigned int, <error-type>>, void*>" requires 'template<>' syntax – geo10 Jun 26 at 11:48
1

First, you need to include the std libs you need

#include <xtree>
#include <set>
#include <map>
#include <functional>

Second you need to remove "struct" before all the variable declarations that aren't structs

and third you should delete everything from this header you don't need, it's 90% garbage

remove all instances of "__cppobj"

You also need to define ActorRef, World & WorldVtbl.

I was able to remove 99% of errors by doing these things:

#include <xtree>
#include <set>
#include <map>
#include <functional>

#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long

struct IPlayer
{

};

struct ILocalPlayer
{

};

struct IActor
{

};

template <class T>
class ActorRef
{
public:
    IPlayer* m_object;
};

struct AIZone
{
    
};

struct WorldVtbl
{

};

#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long

struct IPlayer;
struct ILocalPlayer;

struct std::_Tree_val<std::_Tree_simple_types<ActorRef<IPlayer> > > : std::_Container_base0
{
    std::_Tree_node<ActorRef<IPlayer>, void*>* _Myhead;
    unsigned int _Mysize;
};

struct std::_Tree_val<std::_Tree_simple_types<ActorRef<IActor> > > : std::_Container_base0
{
    std::_Tree_node<ActorRef<IActor>, void*>* _Myhead;
    unsigned int _Mysize;
};

struct std::_Tree_val<std::_Tree_simple_types<std::pair<unsigned int const, ActorRef<IActor> > > > : std::_Container_base0
{
    std::_Tree_node<std::pair<unsigned int const, ActorRef<IActor> >, void*>* _Myhead;
    unsigned int _Mysize;
};

struct std::_Tree_val<std::_Tree_simple_types<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AIZone*> > > : std::_Container_base0
{
    std::_Tree_node<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AIZone*>, void*>* _Myhead;
    unsigned int _Mysize;
};

struct World
{
    WorldVtbl* vfptr;
    std::set<ActorRef<IPlayer>, std::less<ActorRef<IPlayer> >, std::allocator<ActorRef<IPlayer> > > m_players;
    std::set<ActorRef<IActor>, std::less<ActorRef<IActor> >, std::allocator<ActorRef<IActor> > > m_actors;
    std::map<unsigned int, ActorRef<IActor>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ActorRef<IActor> > > > m_actorsById;
    ILocalPlayer* m_localPlayer;
    unsigned int m_nextId;
    std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, AIZone*, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AIZone*> > > m_aiZones;
};

struct ClientWorld : World
{
    ActorRef<IPlayer> m_activePlayer;
    float m_timeUntilNextNetTick;
};

My opinion is using a tool like ReClass.NET is much easier for reversing structures and exporting header files, you should give it a try and see if it fits your needs.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.