├── IdaVSHelp.py ├── LICENSE └── README.md /IdaVSHelp.py: -------------------------------------------------------------------------------- 1 | __author__ = "Andrea Fioraldi" 2 | __copyright__ = "Copyright 2017, Andrea Fioraldi" 3 | __license__ = "MIT" 4 | __email__ = "andreafioraldi@gmail.com" 5 | 6 | import idaapi 7 | import subprocess 8 | import os 9 | 10 | MENU_PATH = 'Edit/Other' 11 | class IdaVSHelpPlugin(idaapi.plugin_t): 12 | flags = idaapi.PLUGIN_KEEP 13 | comment = "" 14 | 15 | help = "IdaVSHelp: Visual Studio Help for IDA Pro" 16 | wanted_name = "IDA Visual Studio Help" 17 | wanted_hotkey = "Alt-R" 18 | 19 | hlpviewer_path = "" 20 | catalog_name = "" 21 | 22 | def init(self): 23 | self.grabInfo() 24 | r = idaapi.add_menu_item(MENU_PATH, 'Open Microsoft Help Viewer', '', 1, self.openHelp, tuple()) 25 | if r is None: 26 | idaapi.msg("IdaVSHelp: add menu failed!\n") 27 | idaapi.msg("IdaVSHelp: initialized\n") 28 | return idaapi.PLUGIN_KEEP 29 | 30 | def run(self, arg): 31 | self.query() 32 | 33 | def term(self): 34 | idaapi.msg("IdaVSHelp: terminated\n") 35 | 36 | def grabInfo(self): 37 | prog_dir = os.environ["ProgramFiles"] 38 | data_dir = os.environ["ProgramData"] 39 | 40 | # check if Help Viewer directory exists 41 | hlp_basedir = os.path.join(prog_dir, "Microsoft Help Viewer") 42 | if not os.path.isdir(hlp_basedir): 43 | raise Exception("Microsoft Help Viewer not installed") 44 | 45 | # get the lastest version of Help Viewer installed 46 | maxver = 0.0 47 | for elem in os.listdir(hlp_basedir): 48 | p = os.path.join(hlp_basedir, elem) 49 | if os.path.isdir(p): 50 | if elem[0] == 'v': 51 | try: 52 | ver = float(elem[1:]) 53 | except: 54 | continue 55 | maxver = max(ver, maxver) 56 | 57 | if maxver == 0.0: 58 | raise Exception("Microsoft Help Viewer not installed") 59 | 60 | self.hlpviewer_path = os.path.join(hlp_basedir, 'v' + str(maxver), "HlpViewer.exe") 61 | 62 | # get HelpLibrary directory 63 | helplib_dir = os.path.join(data_dir, "Microsoft", "HelpLibrary") 64 | if int(maxver) > 1: 65 | helplib_dir = helplib_dir + str(int(maxver)) 66 | 67 | if not os.path.isdir(hlp_basedir): 68 | raise Exception("Microsoft Help Library not in ProgramData directory") 69 | 70 | catalogs_dir = os.path.join(helplib_dir, "Catalogs") 71 | 72 | # get Visual Studio catalog 73 | maxver = 0 74 | for elem in os.listdir(catalogs_dir): 75 | p = os.path.join(catalogs_dir, elem) 76 | if os.path.isdir(p): 77 | try: 78 | if elem[:12] == "VisualStudio": 79 | ver = int(elem[12:]) 80 | maxver = max(ver, maxver) 81 | except: 82 | continue 83 | 84 | if maxver == 0: 85 | raise Exception("Visual Studio catalog is not present, try to run Help Viewer from Visual Studio to create it") 86 | 87 | self.catalog_name = "VisualStudio" + str(maxver) 88 | 89 | def openHelp(self): 90 | args = [self.hlpviewer_path, 91 | '/catalogName', 92 | self.catalog_name, 93 | '/locale', 94 | 'en-US', 95 | ] 96 | subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 97 | 98 | def query(self): 99 | func = idaapi.get_highlighted_identifier() 100 | args = [self.hlpviewer_path, 101 | '/catalogName', 102 | self.catalog_name, 103 | '/helpQuery', 104 | 'method=f1&query=' + func, 105 | '/locale', 106 | 'en-US', 107 | ] 108 | subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 109 | 110 | 111 | def PLUGIN_ENTRY(): 112 | return IdaVSHelpPlugin() 113 | 114 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Andrea Fioraldi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IdaVSHelp 2 | IDAPython plugin to integrate Visual Studio Help Viewer in IDA Pro >= 6.8. 3 | 4 | ### Usage 5 | Select a Windows API function name in IDA and then press `Alt-R` to open the Help Viewer page about the selected function. 6 | 7 | ### Dependencies 8 | + IDAPython >= 2.7 9 | + Visual Studio (2015 recommended) 10 | 11 | I tested the plugin only with Visual Studio 2015 and Help Viewer 2.2. 12 | 13 | ### Installation 14 | Copy `IdaVSHelp.py` to `[IDA PATH]\plugins\`. 15 | 16 | 17 | --------------------------------------------------------------------------------