【发布时间】:2013-03-12 14:28:12
【问题描述】:
我有以下脚本,将二进制文件作为 HEX 保存到变量中,并将其作为二进制文件转储到文件中,在 Linux 下一切正常,但在 Windows 下失败,我不知道为什么:
import os, os.path
from ctypes import *
import sys, binascii
current_dir = r".\\"
startup = "4d5a90000300000004000000ffff0000b800000000000000400000000000000000000000000000000000000000000000000000000000000000" # snipped, too big to have it here
def DumpStartupFile():
startupbin=binascii.unhexlify(startup)
o=open(current_dir+"\\startup.exe","w")
o.write(startupbin)
if os.path.isfile(current_dir+"\\startup.exe"):
True
else:
DumpStartupFile()
知道为什么它在 Windows 下会失败吗?
【问题讨论】:
标签: python windows python-2.7 binary hex