def __read_props(self):
def _loword(dword):
return dword & 0x0000ffff
def _hiword(dword):
return dword >> 16
self.__props = {}
try:
pe = pefile.PE(self.__path)
except pefile.PEFormatError as e:
raise ValueError(e.value)
else:
ms = pe.VS_FIXEDFILEINFO.ProductVersionMS
ls = pe.VS_FIXEDFILEINFO.ProductVersionLS
self.__props['fixed_version'] = '.'.join(map(str, (_hiword(ms), _loword(ms), _hiword(ls), _loword(ls))))
for file_info in pe.FileInfo:
if file_info.Key == b'StringFileInfo':
for st in file_info.StringTable:
for entry in st.entries.items():
self.__props[entry[0].decode('latin_1')] = entry[1].decode('latin_1')
# noinspection PyAbstractClass
评论列表
文章目录