2007年04月03日 星期二 12:08
ÎÒÓÐÒ»¸öcдµÄdll exportÁËÒ»¸ö½âÂ뺯Êý
void DecodeStream£¨unsigned char * szBuffer, unsigned char *szKey, unsigned
long dwKeyLen£©;
Ïëͨ¹ýpythonÀ´µ÷ÓÃÕâ¸öº¯Êý,°´ÍøÉÏÒ»¸ö´«µÝc_doubleÊý×éµÄÀý×ÓдÁËÒ»¶Î´úÂë,ÀÏÊÇͨ¹ý²»ÁË:
FileKey = "1234567890ABCDEF"
hFileIn = open(DataFile, "rb")
BinaryContent = hFileIn.read()
BufLen = BinaryContent
szBuf = [c_byte]*BufLen
szBuf = struct.unpack('s'*BufLen, BinaryContent)
try:
DecodeBuf = cdll.LoadLibrary("Cipher.dll").DecodeStream
#cdecl way to call function
DecodeBuf .argtypes = [POINTER(c_byte), c_int, c_char_p, c_int]
res = DecodeBuf (szBuf, c_int(BufLen), c_char_p(FileKey), c_int(0x104))
if res == 1:
print szBuf
except WindowsError:
print "Fail to Load Cipher.dll\n"
print "Fail to Decode"
Èç¹û°´ÕâÑùд¾Í»áÌáʾ:
Traceback (most recent call last):
File "C:\123.py", line 51, in ?
res = DecodeBuf (szBuf, c_int(BufLen), c_char_p(FileKey), c_int(0x104))
ctypes.ArgumentError: argument 1: exceptions.TypeError: Don't know how to
convert parameter 1
Ó¦¸ÃÔõôÐ޸IJÅÐÐÄØ?
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070403/2a62b397/attachment.htm
Zeuux © 2025
京ICP备05028076号