Ondrej Sevecek said:
Hello,
is there some program (I need one from either Windows, SupportTools or
ResourceKit) which would be able to call ANY of Win32 DLL functions? Use of
RUNDLL32 is not allowed as Win32 .DLL do not provide this functionality
(they havent the required entry point function).
Ondra.
If you are willing to use a 3rd party Script Interpreter,
IMO, the best one to get at the Win32API is ActivePyton 2.2,
or higher. see
http://www.activestate.com/Products/ActivePython/
This product is tailor made to quickly edit script and solve
problems in Windows. The learning curve is not as steep as
Perl, while the functionality hammers the WSH (VBScript & JScript).
Here's a trivial Python script to enum the License Hive in the
Registry:
#!/usr/bin/python
'''
keywords: registry enum license typelib
description: scriptlet to enum a subkey collection
date: 11/8/02 3:03PM
'''
import os, sys
import win32api as wi
import win32con as wc
import string as st
#exercise to enumerate a subkey collection
# try this for the Licenses key, then the TypeLib key
kName = "Licenses"
kName = "TypeLib"
# get a handle
pyk = wi.RegOpenKey( wc.HKEY_CLASSES_ROOT, kName)
# get key info, num1 has the key count
( num1, vals, works) = wi.RegQueryInfoKey( pyk )
print num1, vals, works
nt = 0
guid = wi.RegEnumKey( pyk, nt )
nt = nt + 1
#
done = 0
for nt in range(num1):
guid = wi.RegEnumKey( pyk, nt)
svers = ''
if kName == "TypeLib":
'''
for TypeLibs we need to step down to the version key and
read the help string (default value)
'''
pyj=wi.RegOpenKey(wc.HKEY_CLASSES_ROOT,os.path.join(kName,guid))
(num2, val2, work2) = wi.RegQueryInfoKey(pyj)
if num2 > 0:
# we are ingnoring multi versions, like Ado (2.1, 2.5, 2.7, etc)
svers = wi.RegEnumKey( pyj, 0)
valkey = wi.RegQueryValue( pyj, svers)
else:
valkey = wi.RegQueryValue( pyk, guid)
print guid, svers, valkey
nt = nt + 1
pyk.Close()
sys.exit()
# end code
hagd,
msp