Re: Problem with calling function from dll

2012-12-13 Thread deepblu
sb = ctypes.create_string_buffer(20) i = ctypes.byref(ctypes.c_int(20)) w = b.GetComputerNameA(sb,i) w -> 1 sb.value -> nazwa komputera :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with calling function from dll

2012-12-13 Thread Duncan Booth
deep...@poczta.fm wrote: > I have problem with using function from dll. > > import ctypes > > b = ctypes.windll.LoadLibrary("kernel32") > > a = "" > > b.GetComputerNameA(a,20) > > > But I got exception: > > Traceback (most recent call last): > File "", line 1, in > b.GetComputerNameA

Re: Problem with calling function from dll

2012-12-13 Thread Ulrich Eckhardt
Am 13.12.2012 08:40, schrieb deep...@poczta.fm: I have problem with using function from dll. import ctypes b = ctypes.windll.LoadLibrary("kernel32") a = "" b.GetComputerNameA(a,20) GetComputerNameA takes a pointer to a writable char string. You give it a pointer to an immutable string. You

Problem with calling function from dll

2012-12-12 Thread deepblu
I have problem with using function from dll. import ctypes b = ctypes.windll.LoadLibrary("kernel32") a = "" b.GetComputerNameA(a,20) But I got exception: Traceback (most recent call last): File "", line 1, in b.GetComputerNameA(a,20) WindowsError: exception: access violation reading 0