We all know that reversing STL code is no fun. To make it easier, I usually create some of the strucutres so I can reference the created STL structures in another custom structure.
For example, msvc - std::string structure:
00000000 std::string struc ; (sizeof=0x1C)
00000000 alloc dd ? ; void *
00000004 Buffer db 16 dup(?) ; string(C)
00000014 Length dd ? ; int
00000018 LengthMax dd ? ; int
0000001C std::string ends
or std::vector:
00000000 std::vector struc ; (sizeof=0x10)
00000000 alloc dd ? ; void *
00000004 NumberOfItems dd ? ; int
00000008 MaxSize dd ? ; int
0000000C Data dd ? ;
00000010 std::vector ends
Doing this and then in decompilation using these structures, makes the code much more readable.
I sometimes find it difficult figuring out other structures, i.e. std::queue
, looking in the implementation I can see its container type is actually a typedef to std::deque
, which has the content of std::_Compressed_pair
.
Is there a way to recreate these STL types, with proper naming as I did for vector and string, so I can reference to them in other structures in order to a have cleaner decompilation? What would a std::queue
structure look like?
Thanks a lot in advance.
_Compressed_pair
. Note that neitherstd::string
norstd::vector
have avTable
field -- you should delete them from both structure declarations. Anyway, I have a specific answer to the substance of your question, but I will eventually write a blog entry about it rather than go into it now.