如何从dll函数获取参数到python

时间:2015-07-29 15:32:20

标签: python c ctypes ida

我有一个包含此功能的DLL文件

signed int __stdcall EncodeInit(unsigned int a1, int a2, int a3, int a4)
{
  signed int result; // eax@1

  result = 55;
  *(_DWORD *)a2 = (signed __int64)((double)a1 / 1.37 - 25.0 - 23.0 - 2.0 - 6.0);
  return result;
}

我试图从Python调用这个函数:

import ctypes
from ctypes import cdll

# Load DLL into memory.

hllDll = cdll.LoadLibrary("E:\\sap mobile\\Bin32\\dbencod11.dll")
a1 = ctypes.c_int32(1)
print hllDll.EncodeInit(11, a1, 31, 4)

但是我收到了一个错误:

WindowsError: exception: access violation writing 0x00000001

因为a1是不变的。我该如何解决这个问题?

0 个答案:

没有答案