[Ironpython-users] Error while using setupapi.dll (windll) ctypes

Hemanth M B hemanth at broadcom.com
Mon Apr 27 13:26:27 CEST 2015


Hi All,

I am getting error when I execute the code below:

Code:

from ctypes import *
#from ctypes import create_string_buffer
from ctypes import WINFUNCTYPE
from ctypes.wintypes import HWND, DWORD, LPCSTR
pcc = windll.LoadLibrary(r"C:\Windows\System32\setupapi.dll")
prototype =WINFUNCTYPE(c_int, c_char, LPCSTR, HWND, DWORD)
paramflags = (1, "_ClassGuid", None), (1, "_Enumerator", None), (1, "_hwndParent", None), (1, "_Flags", 0)
setupapis = prototype(("SetupDiGetClassDevsA", pcc), paramflags)
print setupapis

Error:

C:\Users\Administrator\git\localrepo>"C:\Program Files (x86)\IronPython 2.7\ipy.exe" NX1_Setuptools\getdevclass.py
Traceback (most recent call last):
  File "NX1_Setuptools\getdevclass.py", line 9, in <module>
TypeError: expected int, got tuple

I got to know that it is expecting int data types but it got tuple.

Note:
I followed the documentation in https://ironpython-test.readthedocs.org/en/latest/library/ctypes.html ,section 15.18.2.4. Function prototypes

I am trying to install device drivers for network adapter, so I need HDEVINFO. Please help me resolve this.

Thanks and Regards,
Hemanth M B
@9010054054

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20150427/d4cac57b/attachment.html>


More information about the Ironpython-users mailing list