Does this code shows the methods from a dll?
from ctypes import *
x = cdll.LoadLibrary("olari.dll")
dir(x)
if not, how can we see the .dll methods in python?
Does this code shows the methods from a dll?
from ctypes import *
x = cdll.LoadLibrary("olari.dll")
dir(x)
if not, how can we see the .dll methods in python?
No, it doesn't. But It can cache when you call, and will show in dir
after that.
You could take a look this SO Thread, even in Win32, seems like need to parse PE Header. I think python need to do similar way.
UPDATE:
I found pefile read/write module written in python, there you can find exported entries.
for entry in pe.DIRECTORY_ENTRY_IMPORT:
print entry.dll
for imp in entry.imports:
print '\t', hex(imp.address), imp.name
Output
comdlg32.dll
0x10012A0L PageSetupDlgW
0x10012A4L FindTextW
0x10012A8L PrintDlgExW
[snip]
SHELL32.dll
0x1001154L DragFinish
0x1001158L DragQueryFileW
imp.name
will be the one you are looking for. You could use that name in ctypes like
>>> ctypes.windll.comdlg32.PageSetupDlgW
<_FuncPtr object at 0x00A97210>
>>> ctypes.windll.comdlg32.FindTextW
<_FuncPtr object at 0x00A97288>
...