How to call functions in Advapi32.dll using ctypes

Podi podi.ex at gmail.com
Fri Apr 7 19:58:38 EDT 2006


I have ctypes version 0.9.6 and Python 2.4.2 running on Windows XP
Professional.

When I tried to use some functions in the Advapi32.dll, some functions
are available and some are not. Is this a bug or feature by design?

In the example below, I am trying to examine the
'InitiateSystemShutdown' function which is from Advapi32.dll as
advertised by Microsoft
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/initiatesystemshutdown.asp

Thanks,
P

>>> import ctypes
>>> advapi32 = ctypes.oledll.LoadLibrary('Advapi32.dll')
>>> advapi32.InitiateSystemShutdown
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\lib\site-packages\ctypes\__init__.py", line 395, in
__getattr__
    func = self._OlecallFuncPtr(name, self)
AttributeError: function 'InitiateSystemShutdown' not found
>>>




More information about the Python-list mailing list