簡體   English   中英

檢查PE是32位還是64位

[英]Check if PE is 32 or 64 bit

我試圖弄清楚,如果它是32位或64位文件,則給出一個已上傳的EXE或DLL文件。 這是專門針對基於Windows的EXE / DLL文件。 有人有什么建議嗎?

我在使用python時嘗試使用python 2.7。 如果我對PE文件格式不熟悉,請檢查並確認解決方案是否有任何更改。 Python代碼是::

#Program to check PE file is 32 or 64 bit
import os
import win32file
import ctypes, hashlib

#Take File as input
resultPathFile = raw_input('Enter the path location of given file')
if os.path.isfile(resultPathFile) == True:
    print("File is present at this path"+"\n"+resultPathFile+"\n")
    #File check 32 or 64
    try:
        peFileCheck = win32file.GetBinaryType(resultPathFile)
        if peFileCheck == 6:
            print("The Given file is :"+"\t"+"64 bit x64")
        elif peFileCheck == 0:
            print("The Given file is :"+"\t"+"32 bit x86")
        else:
            print("other format file")
    except:
        print("Other file format")

else:
    print("File is absent at given Path")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM