Here a sample way to create lib file for ollydbg ...
==============Copy Contents ====================
""" Usage
Copies those files from VC first:
DUMPBIN.EXE
LIB.EXE
LINK.EXE
MSPDB60.DLL(your symbol version)
Use following command to get the lib file for debug
python dlltolib.py xxx.dll
"""
import sys, os, re
if len(sys.argv) < 2:
print "** Plz spcecifies a dll file"
sys.exit()
cwdpath = os.getcwd()
os.chdir(cwdpath)
dllfile = sys.argv.pop()
deffile = dllfile[0:-3] + 'def'
print '** Will create %s, %s after done, del manually' % (dllfile, deffile)
#dumpbin.exe /exports /out:g:\tool\ws2_32.def ws2_32.dll
dumpcom = r'dumpbin.exe '
param = r'/exports /out:%s %s' % (deffile, dllfile)
print '** Begin to dump dll to def'
print dumpcom + param
os.system(dumpcom + param)
print '** Dump dll file to def file Done'
opendef = file(deffile, 'r')
startsign = re.compile(r'^\s*ordinal\s+hint\s+RVA\s+name', re.IGNORECASE)
endsign = re.compile(r'^\s*Summary\s*$', re.IGNORECASE)
fromflag = True # flag for checking whether has found function table
tempfunc = []
# read the fucntion from orignal def
exportfunc = opendef.readlines()
for line in exportfunc:
if fromflag:
if startsign.search(line):
fromflag = False
else:
if endsign.search(line):
break
tempfunc.append(line.replace('\n', ''))
exportfunc = tempfunc[1:-1]
opendef.close()
# then produce to what I want to define def file
writefile = file(deffile, 'w')
heard = 'LIBRARY "%s"\n\n' % dllfile
section = 'EXPORTS\n'
# exportfunc[1] = ' 22 73 00010BDE shutdown'
funcs = []
funcs.append(heard)
funcs.append(section)
for line in exportfunc:
func = line.split()
funcs.append('\t' + func[-1] + ' @' + func[0] + '\n')