Ctypes behave differenty on windows 2000 and windows XP

dudeja.rajat at gmail.com dudeja.rajat at gmail.com
Thu Oct 2 09:17:01 EDT 2008


Hi,

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

Please suggest why does it happen.


Thanks and regards,
Rajat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081002/bd4d7fff/attachment.html>


More information about the Python-list mailing list