国产探花免费观看_亚洲丰满少妇自慰呻吟_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程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 雷州市| 佳木斯市| 双峰县| 修武县| 大厂| 富源县| 松滋市| 满洲里市| 宣汉县| 阜城县| 海原县| 崇礼县| 安康市| 苗栗市| 金沙县| 安远县| 忻州市| 盖州市| 永定县| 东兴市| 曲阳县| 江阴市| 临桂县| 鸡泽县| 香河县| 乌兰察布市| 宽甸| 谢通门县| 新乐市| 彩票| 铜山县| 台北县| 巩留县| 阿拉尔市| 栾川县| 游戏| 游戏| 阿合奇县| 汉源县| 渝中区| 静安区|