国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python實現計算資源圖標crc值的方法

2020-02-23 06:03:22
字體:
來源:轉載
供稿:網友

本文實例講述了python實現計算資源圖標crc值的方法,分享給大家供大家參考。具體方法如下:

實現該功能的關鍵在于解析資源信息,找到icon的數據,然后計算這些數據的crc

具體實現代碼如下:

  def _get_iconcrc(self, file_path):     """     Generates the crc32 hash of the icon of the file.     @return: str, the str value of the file's icon     """     iconData = ""      mype = pefile.PE(file_path)     if hasattr(mype, "DIRECTORY_ENTRY_RESOURCE"):       resIcons = filter(lambda x: x.id==pefile.RESOURCE_TYPE['RT_ICON'], mype.DIRECTORY_ENTRY_RESOURCE.entries)       if len(resIcons)>0:         resIcons = resIcons[0]         if hasattr(resIcons, "directory"):           for resId in resIcons.directory.entries:             if hasattr(resId, 'directory'):               for resLang in resId.directory.entries:                 iconData += mype.get_data(resLang.data.struct.OffsetToData, resLang.data.struct.Size)          if not iconData:       print "not iconData"       return None     else:       return self._crc32(iconData) 

希望本文所述對大家的Python程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 车致| 濉溪县| 贡觉县| 宜宾县| 视频| 通辽市| 兰西县| 镇安县| 葵青区| 湟中县| 新河县| 滕州市| 香港 | 醴陵市| 南雄市| 吴旗县| 昭苏县| 织金县| 安化县| 孟州市| 沂水县| 古交市| 汉沽区| 百色市| 金乡县| 云和县| 吴忠市| 通州市| 伊宁市| 历史| 白城市| 临江市| 密山市| 巴南区| 德钦县| 梅州市| 通化县| 拜泉县| 疏勒县| 镶黄旗| 峨眉山市|