[python-win32] Calling random Windows function? [SEC=PERSONAL]

Andrew MacIntyre Andrew.MacIntyre at acma.gov.au
Fri Oct 23 04:46:34 CEST 2009


Aahz wrote:
> I'm just getting into Windows programming for the first time, 
> and I need
> to list all open files.  Windows has a convenient function for that
> (NtQuerySystemInformation), but I can't figure out how I am 
> supposed to
> call it.  I bought of copy of the Win32 book and I can't find anything
> about accessing random API calls;
> ctypes.windll.kernel32.NtQuerySystemInformation gives an 
> AttributeError.
> 
> Where should I be looking to figure this out?

A search turned up the following page:
http://msdn.microsoft.com/en-us/library/ms724509%28VS.85%29.aspx

The remarks section indicates that the function is in ntdll.dll rather 
than kernel32.dll, which would explain the attribute error for the 
ctypes case.

When using ctypes, the MSDN reference pages are frequently the best 
available source of Windows API references, if you haven't got the 
platform SDK installed.

As I understand, while PyWin32 wraps a lot of API functions it doesn't 
wrap everything; if it's not wrapped, ctypes is your only option.

-------------------------> "These thoughts are mine alone!" <---------
Andrew MacIntyre           National Licensing and Allocations Branch
tel:   +61 2 6219 5356     Inputs to Industry Division
fax:   +61 2 6253 3277     Australian Communications & Media Authority
email: andrew.macintyre at acma.gov.au            http://www.acma.gov.au/ 

If you have received this email in error, please notify the sender immediately and erase all copies of the email and any attachments to it. The information contained in this email and any attachments may be private, confidential and legally privileged or the subject of copyright. If you are not the addressee it may be illegal to review, disclose, use, forward, or distribute this email and/or its contents.
 
Unless otherwise specified, the information in the email and any attachments is intended as a guide only and should not be relied upon as legal or technical advice or regarded as a substitute for legal or technical advice in individual cases. Opinions contained in this email or any of its attachments do not necessarily reflect the opinions of ACMA.


More information about the python-win32 mailing list