Skip to content

Commit 64bcddb

Browse files
committed
FIX #2
1 parent 0835a43 commit 64bcddb

File tree

4 files changed

+146
-140
lines changed

4 files changed

+146
-140
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222

2323
1. 安装IDA的时候,要勾选IDAPython
2424

25-
1. 用IDAPython的pip,安装pywin32
26-
27-
默认情况下,使用命令:`C:\python27-x64\Scripts\pip.exe install pywin32`
25+
1. 安装pywin32`pip install pywin32`
2826

2927
1. 将bin目录三个文件复制到插件目录
3028

31-
默认情况下,在这个目录:`C:\Program Files\IDA 7.0\plugins`
29+
默认情况下,在这个目录:`C:\Program Files\IDA 7.6\plugins`
3230

3331
1. 删除或备份插件目录原始的`comhelper.dll``comhelper64.dll`文件
3432

3533
## 更新记录
3634

35+
1. 2022-9-30
36+
37+
1. 支持IDA7.6,支持Python3
38+
3739
1. 2020-4-8
3840

3941
1. 重新编译去除运行库依赖,解决丢失MSVCR90.dll等问题

bin/comhelper.py

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
2-
import sys
3-
import locale
42
import subprocess
53
import pythoncom
64
import idaapi
75
import idautils
86
import idc
7+
import ida_nalt
98

109
invokekinds = {
1110
pythoncom.INVOKE_FUNC: "func",
@@ -68,7 +67,7 @@
6867
p_initialized = False
6968

7069

71-
class ComHelperResultChooser(idaapi.Choose2):
70+
class ComHelperResultChooser(idaapi.Choose):
7271
def __init__(self,
7372
title,
7473
items,
@@ -77,13 +76,13 @@ def __init__(self,
7776
height=None,
7877
embedded=False,
7978
modal=False):
80-
idaapi.Choose2.__init__(
79+
idaapi.Choose.__init__(
8180
self,
8281
title, [
83-
["Address", idaapi.Choose2.CHCOL_HEX | 10],
84-
["Function", idaapi.Choose2.CHCOL_PLAIN | 25],
85-
["Parent", idaapi.Choose2.CHCOL_PLAIN | 25],
86-
["Desc", idaapi.Choose2.CHCOL_PLAIN | 40],
82+
["Address", idaapi.CHCOL_HEX | 10],
83+
["Function", idaapi.CHCOL_PLAIN | 25],
84+
["Parent", idaapi.CHCOL_PLAIN | 25],
85+
["Desc", idaapi.CHCOL_PLAIN | 40],
8786
],
8887
flags=flags,
8988
width=width,
@@ -98,7 +97,7 @@ def OnClose(self):
9897

9998
def OnSelectLine(self, n):
10099
self.selcount += 1
101-
idc.Jump(self.items[n][0])
100+
idc.jumpto(self.items[n][0])
102101

103102
def OnGetLine(self, n):
104103
res = self.items[n]
@@ -113,9 +112,9 @@ def show(self):
113112
return self.Show() >= 0
114113

115114

116-
#--------------------------------------------------------------------------
115+
# --------------------------------------------------------------------------
117116
# Plugin
118-
#--------------------------------------------------------------------------
117+
# --------------------------------------------------------------------------
119118
class Comhelper_Plugin_t(idaapi.plugin_t):
120119
comment = "Comhelper plugin for IDA Pro"
121120
help = "Comhelper"
@@ -147,15 +146,14 @@ def get_com_vas(self, dllpath, clsid, iid, count):
147146
toolpath = os.path.join(BASE_DIR, toolname)
148147
try:
149148
ret = subprocess.check_output(
150-
[toolpath, dllpath, clsid, iid, count], shell=True)
151-
except subprocess.CalledProcessError, e:
149+
[toolpath, dllpath, clsid, iid, count], shell=True).decode('ascii')
150+
except subprocess.CalledProcessError as e:
152151
return [
153152
'LoadDll fail', 'GetProc fail', 'GetClass fail',
154153
'CreateInstance fail'
155-
][e.returncode - 1] + ' for clsid:{} iid:{}'.format(clsid,iid)
154+
][e.returncode - 1] + ' for clsid:{} iid:{}'.format(clsid, iid)
156155
vas = []
157156
imagebase = ida_nalt.get_imagebase()
158-
159157
for rvahex in ret.split('\n'):
160158
rvahex = rvahex.strip()
161159
if rvahex:
@@ -169,7 +167,7 @@ def search(self):
169167
'DllUnregisterServer', 'DllEntryPoint', 'DllGetClassObject',
170168
'DllCanUnloadNow', 'DllRegisterServer'
171169
])
172-
dllpath = ida_nalt.get_input_file_path().decode('utf-8')
170+
dllpath = ida_nalt.get_input_file_path()
173171
if not comexports.issubset(exports):
174172
print('{} is not COM! exports mismatching'.format(dllpath))
175173
return
@@ -178,7 +176,6 @@ def search(self):
178176
except:
179177
print('{} is not COM! LoadTypeLib fail'.format(dllpath))
180178
return
181-
classes = {}
182179
values = []
183180
for i in range(tlb.GetTypeInfoCount()):
184181
if tlb.GetTypeInfoType(i) == pythoncom.TKIND_COCLASS:
@@ -191,8 +188,8 @@ def search(self):
191188
name = tlb.GetDocumentation(i)[0]
192189
iid = str(attr.iid)
193190
vas = self.get_com_vas(
194-
dllpath.encode(locale.getdefaultlocale()[1]), clsid,
195-
iid, str(attr.cFuncs))
191+
dllpath, clsid, iid, str(attr.cFuncs)
192+
)
196193
if isinstance(vas, str):
197194
print(vas)
198195
else:

comfinder/comfinder.vcxproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@
2323
<ProjectGuid>{54F62D4B-EB14-4B38-8211-A880FD39040C}</ProjectGuid>
2424
<Keyword>Win32Proj</Keyword>
2525
<RootNamespace>comfinder</RootNamespace>
26-
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
2727
</PropertyGroup>
2828
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
3030
<ConfigurationType>Application</ConfigurationType>
3131
<UseDebugLibraries>true</UseDebugLibraries>
32-
<PlatformToolset>v141</PlatformToolset>
32+
<PlatformToolset>v142</PlatformToolset>
3333
<CharacterSet>MultiByte</CharacterSet>
3434
</PropertyGroup>
3535
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
3636
<ConfigurationType>Application</ConfigurationType>
3737
<UseDebugLibraries>false</UseDebugLibraries>
38-
<PlatformToolset>v141</PlatformToolset>
38+
<PlatformToolset>v142</PlatformToolset>
3939
<WholeProgramOptimization>true</WholeProgramOptimization>
4040
<CharacterSet>Unicode</CharacterSet>
4141
</PropertyGroup>
4242
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
4343
<ConfigurationType>Application</ConfigurationType>
4444
<UseDebugLibraries>true</UseDebugLibraries>
45-
<PlatformToolset>v141</PlatformToolset>
45+
<PlatformToolset>v142</PlatformToolset>
4646
<CharacterSet>Unicode</CharacterSet>
4747
</PropertyGroup>
4848
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4949
<ConfigurationType>Application</ConfigurationType>
5050
<UseDebugLibraries>false</UseDebugLibraries>
51-
<PlatformToolset>v141</PlatformToolset>
51+
<PlatformToolset>v142</PlatformToolset>
5252
<WholeProgramOptimization>true</WholeProgramOptimization>
5353
<CharacterSet>Unicode</CharacterSet>
5454
</PropertyGroup>

0 commit comments

Comments
 (0)