├── .gitignore ├── IDAExecFunctions64.sln ├── IDAExecFunctions64 ├── IDAExecFunctions64.vcxproj ├── IDAExecFunctions64.vcxproj.filters ├── Main.cpp ├── ida_file.h └── ida_string.h └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /IDAExecFunctions64.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.12.35707.178 d17.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IDAExecFunctions64", "IDAExecFunctions64\IDAExecFunctions64.vcxproj", "{67CA0520-676A-436B-A249-67334661DEE8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {67CA0520-676A-436B-A249-67334661DEE8}.Debug|x64.ActiveCfg = Debug|x64 15 | {67CA0520-676A-436B-A249-67334661DEE8}.Debug|x64.Build.0 = Debug|x64 16 | {67CA0520-676A-436B-A249-67334661DEE8}.Release|x64.ActiveCfg = Release|x64 17 | {67CA0520-676A-436B-A249-67334661DEE8}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B29EF4C7-601F-4439-937B-EEC49B92F955} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /IDAExecFunctions64/IDAExecFunctions64.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 17.0 15 | Win32Proj 16 | {67ca0520-676a-436b-a249-67334661dee8} 17 | IDAExecFunctions64 18 | 10.0 19 | 20 | 21 | 22 | DynamicLibrary 23 | true 24 | v143 25 | Unicode 26 | 27 | 28 | DynamicLibrary 29 | false 30 | v143 31 | true 32 | Unicode 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | C:\idasdk90 48 | 49 | 50 | 51 | Level3 52 | true 53 | _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 54 | true 55 | $(IDASDKPath)\include;%(AdditionalIncludeDirectories) 56 | stdcpp17 57 | NotUsing 58 | 59 | 60 | Windows 61 | true 62 | $(IDASDKPath)\lib\x64_win_vc_64;%(AdditionalLibraryDirectories) 63 | ida.lib;%(AdditionalDependencies) 64 | 65 | 66 | 67 | 68 | 69 | Level3 70 | true 71 | true 72 | true 73 | NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 74 | true 75 | $(IDASDKPath)\include;%(AdditionalIncludeDirectories) 76 | stdcpp17 77 | true 78 | NotUsing 79 | 80 | 81 | Windows 82 | true 83 | true 84 | true 85 | $(IDASDKPath)\lib\x64_win_vc_64;%(AdditionalLibraryDirectories) 86 | ida.lib;%(AdditionalDependencies) 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /IDAExecFunctions64/IDAExecFunctions64.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /IDAExecFunctions64/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Makes ea_t an uint64 for high base address images 4 | #define __EA64__ 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "ida_file.h" 11 | #include "ida_string.h" 12 | 13 | class plugin_ctx_t : public plugmod_t 14 | { 15 | public: 16 | // Constructor 17 | plugin_ctx_t() 18 | { 19 | msg("IDAExecFunctions64: Plugin loaded.\n"); 20 | } 21 | 22 | // Destructor 23 | virtual ~plugin_ctx_t() 24 | { 25 | // msg("IDAExecFunctions64: Destructor called.\n"); 26 | } 27 | virtual bool idaapi run(size_t) override 28 | { 29 | ida_string result = ask_file(false, "*.idmap", "Load the file, or %s", "die!"); 30 | 31 | ida_file selected_file(result, ida_file::open_mode::binary_read_only); 32 | 33 | auto image_base = get_imagebase(); 34 | msg("IDAExecFunctions64: Image base is 0x%llX\n", image_base); 35 | 36 | msg("IDAExecFunctions64: Applying names...\n"); 37 | if (selected_file.is_open()) 38 | { 39 | while (selected_file.can_read_more()) 40 | { 41 | uint32 offset = selected_file.read(); 42 | uint16 name_len = selected_file.read(); 43 | 44 | ida_string name_string = selected_file.read_string(name_len); 45 | 46 | set_name(image_base + offset, name_string.c_str()); 47 | 48 | //msg("offset: 0x%X\n", offset); 49 | //msg("name_len: 0x%X\n", name_len); 50 | //msg("name_string: %s\n", name_string.c_str()); 51 | } 52 | } 53 | 54 | msg("IDAExecFunctions64: Done.\n"); 55 | 56 | return true; 57 | } 58 | }; 59 | 60 | 61 | //-------------------------------------------------------------------------- 62 | static plugmod_t* idaapi init(void) 63 | { 64 | return new plugin_ctx_t; 65 | } 66 | 67 | //-------------------------------------------------------------------------- 68 | plugin_t PLUGIN = 69 | { 70 | IDP_INTERFACE_VERSION, 71 | PLUGIN_UNL // Unload the plugin immediately after calling 'run' 72 | | PLUGIN_MULTI, // The plugin can work with multiple idbs in parallel 73 | init, // initialize 74 | nullptr, 75 | nullptr, 76 | nullptr, // long comment about the plugin 77 | nullptr, // multiline help about the plugin 78 | "IDAExecFunctionsImporter", // the preferred short name of the plugin 79 | "Ctrl-Alt-A", // the preferred hotkey to run the plugin 80 | }; 81 | -------------------------------------------------------------------------------- /IDAExecFunctions64/ida_file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #include "ida_string.h" 6 | 7 | class ida_file 8 | { 9 | public: 10 | enum class open_mode 11 | { 12 | none, 13 | read_only, 14 | binary_read_only, 15 | read_write, 16 | binary_read_write, 17 | }; 18 | 19 | private: 20 | FILE* file; 21 | open_mode mode; 22 | int pos; 23 | int size; 24 | 25 | public: 26 | ida_file() 27 | : file(nullptr) 28 | , mode(open_mode::none) 29 | , pos(0) 30 | , size(0) 31 | { 32 | } 33 | 34 | ida_file(const char* file_path, open_mode new_mode = open_mode::read_only) 35 | : file(nullptr) 36 | , mode(new_mode) 37 | , pos(0) 38 | , size(0) 39 | { 40 | if (!file_path) 41 | return; 42 | 43 | if (open_file(file_path, new_mode)) 44 | { 45 | qfseek(file, 0, SEEK_END); 46 | size = qftell(file); 47 | qfseek(file, 0, SEEK_SET); 48 | } 49 | } 50 | 51 | ~ida_file() 52 | { 53 | close_file(); 54 | } 55 | 56 | public: 57 | bool is_open() 58 | { 59 | return file && mode != open_mode::none; 60 | } 61 | 62 | bool can_write() 63 | { 64 | return is_open() && (mode >= open_mode::read_write); 65 | } 66 | 67 | bool open_file(const char* file_name, open_mode new_mode = open_mode::read_only) 68 | { 69 | if (is_open()) 70 | close_file(); 71 | 72 | mode = new_mode; 73 | 74 | switch (mode) 75 | { 76 | case open_mode::read_only: 77 | file = fopenRT(file_name); 78 | break; 79 | case open_mode::binary_read_only: 80 | file = fopenRB(file_name); 81 | break; 82 | case open_mode::read_write: 83 | file = fopenWT(file_name); 84 | break; 85 | case open_mode::binary_read_write: 86 | file = fopenWB(file_name); 87 | break; 88 | default: 89 | break; 90 | } 91 | 92 | return file != nullptr; 93 | } 94 | 95 | void close_file() 96 | { 97 | qfclose(file); 98 | file = nullptr; 99 | mode = open_mode::none; 100 | pos = 0; 101 | } 102 | 103 | public: 104 | template 105 | void read(T& out_value) 106 | { 107 | pos += sizeof(T); 108 | qfread(file, &out_value, sizeof(T)); 109 | } 110 | 111 | template 112 | T read() 113 | { 114 | T ret_value; 115 | pos += sizeof(T); 116 | 117 | qfread(file, &ret_value, sizeof(T)); 118 | 119 | return ret_value; 120 | } 121 | 122 | ida_string read_string(int length) 123 | { 124 | ida_string ret; 125 | pos += length; 126 | 127 | qfread(file, ret.buffer(length), length); 128 | 129 | return ret; 130 | } 131 | 132 | bool can_read_more() 133 | { 134 | return pos < size; 135 | } 136 | }; 137 | -------------------------------------------------------------------------------- /IDAExecFunctions64/ida_string.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | template 6 | class ida_string_base 7 | { 8 | private: 9 | static constexpr int char_size = sizeof(char_type); 10 | 11 | static constexpr uintptr_t use_allocated_buffer_mask = 0x8000000000000000; 12 | 13 | private: 14 | union 15 | { 16 | struct 17 | { 18 | char_type* buffer_start; 19 | char_type* buffer_end; 20 | }; 21 | 22 | unsigned char inline_buffer[0xF]; 23 | unsigned char inline_length_inverse : 4; 24 | unsigned char reserved : 3; 25 | unsigned char use_allocated_buffer : 1; 26 | }; 27 | 28 | public: 29 | ida_string_base() 30 | : buffer_start(nullptr) 31 | , buffer_end(nullptr) 32 | { 33 | mark_as_allocated(); 34 | } 35 | 36 | ida_string_base(const char_type* str, bool take_ownership = false) 37 | : buffer_start(nullptr) 38 | , buffer_end(nullptr) 39 | { 40 | if (!str) 41 | return; 42 | 43 | //int length = ida_string_base::strlen(str); 44 | int length = qstrlen(str); 45 | 46 | if (take_ownership) 47 | { 48 | takeover_outline_string(str, length); 49 | return; 50 | } 51 | 52 | if (is_length_suitable_for_inline(length)) 53 | { 54 | place_string_inline(str, length); 55 | return; 56 | } 57 | 58 | allocate_outline_string(str, length); 59 | } 60 | 61 | ida_string_base(ida_string_base&& other) 62 | : buffer_start(other.buffer_start) 63 | , buffer_end(other.buffer_end) 64 | { 65 | other.buffer_start = nullptr; 66 | other.buffer_end = nullptr; 67 | } 68 | 69 | ida_string_base(const ida_string_base& other) 70 | : buffer_start(nullptr) 71 | , buffer_end(nullptr) 72 | { 73 | if (other.is_inline_string()) 74 | { 75 | memcpy(*this, &other, sizeof(ida_string_base)); 76 | return; 77 | } 78 | 79 | allocate_outline_string(other, other.length()); 80 | } 81 | 82 | ~ida_string_base() 83 | { 84 | cleanup_self(); 85 | } 86 | 87 | public: 88 | ida_string_base& operator=(const char* string) 89 | { 90 | cleanup_self(); 91 | 92 | int length = qstrlen(string); 93 | 94 | if (is_length_suitable_for_inline(length)) 95 | { 96 | place_string_inline(string, length); 97 | return *this; 98 | } 99 | 100 | allocate_outline_string(string, length); 101 | 102 | return *this; 103 | } 104 | 105 | ida_string_base& operator=(ida_string_base&& other) 106 | { 107 | cleanup_self(); 108 | 109 | memcpy(this, &other, sizeof(ida_string_base)); 110 | memset(&other, 0, sizeof(ida_string_base)); 111 | 112 | return *this; 113 | } 114 | 115 | ida_string_base& operator=(const ida_string_base& other) 116 | { 117 | cleanup_self(); 118 | 119 | if (other.is_inline_string()) 120 | { 121 | memcpy(*this, &other, sizeof(ida_string_base)); 122 | return; 123 | } 124 | 125 | return *this; 126 | } 127 | 128 | private: 129 | void place_string_inline(const char_type* string, int len) 130 | { 131 | memset(this, 0, sizeof(ida_string_base)); 132 | inline_length_inverse = 0x10 - len; 133 | use_allocated_buffer = false; 134 | memcpy(inline_buffer, string, len * char_size); 135 | } 136 | 137 | void fit_outline_buffer(int len) 138 | { 139 | int length_with_null_terminator = len + 1; 140 | 141 | buffer_start = reinterpret_cast((is_empty() || is_inline_string()) ? qalloc(length_with_null_terminator) : qrealloc(buffer_start, length_with_null_terminator)); 142 | 143 | buffer_end = buffer_start + length_with_null_terminator; 144 | buffer_start[len] = 0; 145 | mark_as_allocated(); 146 | } 147 | 148 | void allocate_outline_string(const char_type* string, int len) 149 | { 150 | fit_outline_buffer(len); 151 | 152 | memcpy(buffer_start, string, len * char_size); 153 | } 154 | 155 | void takeover_outline_string(const char_type* string, int len) 156 | { 157 | int length_with_null_terminator = len + 1; 158 | 159 | buffer_start = const_cast(string); 160 | buffer_end = const_cast(string + length_with_null_terminator); 161 | mark_as_allocated(); 162 | } 163 | 164 | void cleanup_self() 165 | { 166 | if (is_inline_string()) 167 | return; 168 | 169 | qfree(buffer_start); 170 | memset(this, 0, sizeof(ida_string_base)); 171 | } 172 | 173 | private: 174 | static int strlen(const char_type* str) 175 | { 176 | int len = 0; 177 | while (str[len] != 0) 178 | len++; 179 | 180 | return len; 181 | } 182 | 183 | private: 184 | void mark_as_allocated() 185 | { 186 | buffer_end = reinterpret_cast(reinterpret_cast(buffer_end) | use_allocated_buffer_mask); 187 | } 188 | 189 | bool is_length_suitable_for_inline(int len) const 190 | { 191 | return (len * char_size) < 0x10; 192 | } 193 | 194 | bool is_inline_string() const 195 | { 196 | return !(reinterpret_cast(buffer_end) & use_allocated_buffer_mask); 197 | } 198 | 199 | int get_inline_length_bytes() const 200 | { 201 | return 0x10 - inline_length_inverse; 202 | } 203 | 204 | inline const char_type* get_buffer_start() const 205 | { 206 | return buffer_start; 207 | } 208 | 209 | inline const char_type* get_buffer_end() const 210 | { 211 | return reinterpret_cast(reinterpret_cast(buffer_end) & ~use_allocated_buffer_mask); 212 | } 213 | 214 | int length_bytes() const 215 | { 216 | if (is_inline_string()) 217 | return get_inline_length_bytes(); 218 | 219 | return reinterpret_cast(get_buffer_start()) - reinterpret_cast(get_buffer_end()); 220 | } 221 | 222 | public: 223 | inline bool operator==(const ida_string_base& other) const 224 | { 225 | return length() == other.length() && (qstrcmp(c_str(), other.c_str()) == 0); 226 | } 227 | 228 | inline bool operator!=(const ida_string_base& other) const 229 | { 230 | return length() != other.length() || (qstrcmp(c_str(), other.c_str()) != 0); 231 | } 232 | 233 | operator const char_type* () const 234 | { 235 | return c_str(); 236 | } 237 | 238 | public: 239 | int length() const 240 | { 241 | if (length_bytes() <= 0) 242 | return 0; 243 | 244 | return length_bytes() - 1; 245 | } 246 | 247 | bool is_empty() const 248 | { 249 | return length() == 0; 250 | } 251 | 252 | const char_type* c_str() const 253 | { 254 | if (is_inline_string()) 255 | return reinterpret_cast(inline_buffer); 256 | 257 | return buffer_start; 258 | } 259 | 260 | char* buffer(int required_buffer_size) 261 | { 262 | if (length() < required_buffer_size) 263 | fit_outline_buffer(required_buffer_size); 264 | 265 | return const_cast(c_str()); 266 | } 267 | }; 268 | 269 | using ida_string = ida_string_base; 270 | using ida_wstring = ida_string_base; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IDAExecFunctionsImporter 2 | 3 | ## This is an IDA-Plugin for v7.5 (see other branch) - v9.0 to import names from an `.idmap` file into the database. 4 | 5 | ### This plugin can be used with .idmap files generated by [Dumper-7](https://github.com/Encryqed/Dumper-7/). 6 | ----- 7 | ### Currently imported 8 | - Virtual Function Table names: eg. `UClass_VFT` 9 | - UFunction::ExecFunction names: eg. `APlayerController::execCanRestartPlayer` 10 | 11 | ### Build 12 | - Building this plugin requires the IDA C++ SDK 13 | - Add the SDKs `\include\` directors to the projects `Additional Include Directories` 14 | - Add the SDKs `\lib\x64_win_vc_64` director to the projects `Additional Library Directories` 15 | - Select your IDA installations' `\plugins\` folder as your `Output Directory` 16 | 17 | ----- 18 | 19 | ### Format expected by the plugin: 20 | ```c++ 21 | struct Identifier 22 | { 23 | uint32 Offset; // Relative to Imagebase 24 | uint16 NameLength; 25 | const char Name[NameLength]; // Not NULL-terminated 26 | }; 27 | ``` 28 | ----- 29 | Exec-Functions | VirtualFunctionTables 30 | :-------------------------:|:-------------------------: 31 | ![image](https://github.com/Fischsalat/IDAExecFunctionsImporter/assets/64608145/15b7c443-2742-40f5-8071-4238448b6269) | ![image](https://github.com/Fischsalat/IDAExecFunctionsImporter/assets/64608145/bfc1ab5b-c2df-4123-ac9d-208f77c2cc12) 32 | 33 | 34 | 35 | 36 | 37 | --------------------------------------------------------------------------------