Enumerating STRING-TABLE in dll

Nikolai Kirsebom nikolai.kirsebom at siemens.no
Wed Jan 30 04:21:45 EST 2002


On Wed, 30 Jan 2002 01:19:03 GMT, "Neil Hodgson"
<nhodgson at bigpond.net.au> wrote:

>   You need to get a hmodule for the DLL, then use
>win32api.EnumResourceNames, and win32api.LoadResource. IIRC strings are
>blocked into groups of upto 16 strings in each resource rather than with one
>resource per string.
>
>   Neil
>
Thanks,
But could you please explain what / how the 'group of 16' is handled.


import win32api
import win32con

m = win32api.LoadLibrary("kernel32.dll")
k = win32api.EnumResouceNames(m, win32con.RT_STRING)
print k
[1,2,65,.....]
v = win32api.LoadResource(m, win32con.RT_STRING, 1)
print v
'\x10\x00L....'

Even if 3 is not a member of 'k', it is possible to write
print win32api.LoadString(m, 3)
>>> u'Baltic'

Could you please explain more.  Is it the content of 'v' I use to find
the actual string-table strings (ID + String value) ?


Thanks.






More information about the Python-list mailing list