{"id":17817130,"url":"https://github.com/emesare/binja-msvc","last_synced_at":"2025-03-18T03:31:28.678Z","repository":{"id":151071117,"uuid":"622079374","full_name":"emesare/binja-msvc","owner":"emesare","description":"Parses and symbolizes MSVC RTTI information in Binary Ninja.","archived":true,"fork":false,"pushed_at":"2024-11-19T16:24:14.000Z","size":974,"stargazers_count":27,"open_issues_count":12,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T15:53:39.679Z","etag":null,"topics":["binary-ninja","binja","msvc","rtti"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emesare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-01T04:02:54.000Z","updated_at":"2025-01-15T04:34:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f8690c4-c8fd-4506-97ec-8cbdfcf12e35","html_url":"https://github.com/emesare/binja-msvc","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emesare%2Fbinja-msvc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emesare%2Fbinja-msvc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emesare%2Fbinja-msvc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emesare%2Fbinja-msvc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emesare","download_url":"https://codeload.github.com/emesare/binja-msvc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244150574,"owners_count":20406611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-ninja","binja","msvc","rtti"],"created_at":"2024-10-27T16:40:51.852Z","updated_at":"2025-03-18T03:31:28.672Z","avatar_url":"https://github.com/emesare.png","language":"C++","readme":"_As of Binary Ninja 4.2 this code is shipped by default, you can browse that code [here](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/msvc_rtti)_\n\n# MSVC RTTI\n\nParses and symbolizes MSVC RTTI information in [Binary Ninja].\n\n## Example Virtual Function Table Listing\n\nArguably the most import function of symbolizing RTTI information is the virtual function tables. The listing below is the symbolized view of `simple.cpp` (found in test\\bins).\n\n```cpp\nvoid* data_140010320 = ParentA::`RTTI Complete Object Locator\nstruct ParentA::VTable ParentA::`vftable = \n{\n    void* (* const vFunc_0)(void* arg1, int32_t arg2) = ParentB::vFunc_0\n    int64_t (* const vFunc_1)() __pure = ParentA::vFunc_1\n    int64_t (* const vFunc_2)() __pure = ParentA::vFunc_2\n}\nvoid* data_140010340 = ParentB::`RTTI Complete Object Locator\nstruct ParentB::VTable ParentB::`vftable = \n{\n    void* (* const vFunc_0)(void* arg1, int32_t arg2) = ParentB::vFunc_0\n    int64_t (* const vFunc_1)() __pure = ParentB::vFunc_1\n}\nvoid* data_140010358 = SomeClass::`RTTI Complete Object Locator\nstruct SomeClass::VTable SomeClass::`vftable = \n{\n    void* (* const vFunc_0)(void* arg1, int32_t arg2) = SomeClass::vFunc_0\n    int64_t (* const vFunc_1)() __pure = ParentA::vFunc_1\n    int64_t (* const vFunc_2)() __pure = ParentA::vFunc_2\n    int64_t (* const vFunc_3)() __pure = SomeClass::vFunc_3\n}\nvoid* data_140010380 = SomeClass::`RTTI Complete Object Locator{for `ParentB}\nstruct ParentB::VTable SomeClass::`vftable{for `ParentB} = \n{\n    void* (* const vFunc_0)(void* arg1, int32_t arg2) = SomeClass::vFunc_0\n    int64_t (* const vFunc_1)() __pure = ParentB::vFunc_1\n}\n```\n\n## Example Constructor Listing\n\nBased off the information collected from the RTTI scan, we can deduce constructors and create types and symbolize their structures. Using the [type inheritence](https://binary.ninja/2023/05/03/3.4-finally-freed.html#inherited-types) in [Binary Ninja] we can make these types easily composable. The listing below shows the fully symbolized constructor function for `Bird` in `overrides.cpp` (found in test\\bins), as well as the accompanying auto created type.\n\n```cpp\nclass __base(Animal, 0) __base(Flying, 0) Bird\n{\n    struct `Bird::VTable`* vtable;\n    char const* field_8;\n    struct `Flying::VTable`* vtable_Flying;\n    int32_t field_18;\n    __padding char _1C[4];\n    int32_t field_20;\n};\n\nclass Bird* Bird::Bird(class Bird* this, int32_t arg2)\n{\n    Animal::Animal(this);\n    Flying::Flying(\u0026this-\u003evtable_Flying);\n    this-\u003evtable = \u0026Bird::`vftable';\n    this-\u003evtable_Flying = \u0026Bird::`vftable'{for `Flying};\n    this-\u003efield_8 = \"A bird\";\n    this-\u003efield_18 = 0x58;\n    this-\u003efield_20 = arg2;\n    return this;\n}\n```\n\n## Example Virtual Function Listing\n\nUsing the newly created constructor object type in [Example Constructor Listing](#example-constructor-listing) we can apply it to all virtual functions as the first parameter. The listing below shows a fully symbolized virtual function for `Bird` in `overrides.cpp` (found in test\\bins).\n\n```cpp\nuint64_t Bird::vFunc_0(class Bird* this)\n{\n    int32_t var_18 = 0;\n    uint64_t field_20;\n    while (true)\n    {\n        field_20 = ((uint64_t)this-\u003efield_20);\n        if (var_18 \u003e= field_20)\n        {\n            break;\n        }\n        fputs(\"Tweet!\");\n        var_18 = (var_18 + 1);\n    }\n    return field_20;\n}\n\n```\n\n[Binary Ninja]: https://binary.ninja\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femesare%2Fbinja-msvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femesare%2Fbinja-msvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femesare%2Fbinja-msvc/lists"}