How to call functions in Advapi32.dll using ctypes

P

Podi

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/d...n-us/shutdown/base/initiatesystemshutdown.asp

Thanks,
P
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
 
S

Serge Orlov

Podi said:
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?

Most likely feature by design. What you see in documentation for C
library is not what your C code will actually use. For example when you
write errno in C (that looks like global variable access) it is
actually a call to __thread_safe_errno() function.

Have you tried calling InitiateSystemShutdownA mentioned in the
documentation?
 
P

Podi

Have you tried calling InitiateSystemShutdownA mentioned in the
documentation?

Thanks! This function exists. However,
advapi32.InitiateSystemShutdownA("", 'This is a test', 30, 1, 1)
returns 0 though. I will need to play with it a bit more...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top