[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: system32 directory

Gabriel Genellina

3/6/2008 10:02:00 PM

En Thu, 06 Mar 2008 19:15:17 -0200, Robert Dailey <rcdailey@gmail.com>
escribi�:

> On Thu, Mar 6, 2008 at 2:42 AM, Tim Golden <mail@timgolden.me.uk> wrote:
>>
>> >>> import win32api
>> >>> win32api.GetSystemDirectory ()
>> 'C:\\WINDOWS\\system32'
>
> I was aiming to figure out if the standard modules shipped with Python
> could
> do this already before I started using 3rd party libraries. Thanks.

Use ctypes then:

py> from ctypes import *
py> windll.kernel32.GetSystemDirectoryA
<_FuncPtr object at 0x00A0F918>
py> GetSystemDirectory = windll.kernel32.GetSystemDirectoryA
py> buffer = create_string_buffer(260)
py> GetSystemDirectory(buffer, sizeof(buffer))
19
py> buffer.value
'C:\\WINDOWS\\system32'

--
Gabriel Genellina