En Thu, 02 Oct 2008 10:17:01 -0300, <[EMAIL PROTECTED]> escribió:
Im facing a strange problem with ctypes module on windows 2000. I did not
face this problem with the windows Xp.
The problem is this code and specifically "c_long" which behave
differently
on win2000 and winxp
from ctypes import *
h = windll.LoadLibrary("C:\\Windows\\System32\\myDll.dll")
print h
ver = getattr(h, "myDll_GetVersion")
versionArr = c_long * 4
version = versionArr(0, 0, 0, 0)
print ver(version)
dllVersionStr = "v%d.%d.%d.%d" % tuple(version)
print dllVersionStr
The same code appears to work on windows xp with dllVersionStr printing
as
v1.3.5.0
But on wIindows 2000 it prints v0.0.0.0
For myDll_GetVersion you should define its arguments and return type using
.argtypes and .restype - else ctypes assumes "int"
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list