Step 2:
-----------------
set path = %path%;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
set path = %path%;C:\Program Files\IDA\addons\Flair.v5.20\bin
-----------------
设置要调用的程序的路径,在你的机子上不一定如此
Step 3:
-----------------------------
for %i in (*.lib) do md %i.fdr
-----------------------------
For: 新建存放对象文件的文件夹
Step 4:
-----------------------------
cd v:\libc.lib.fdr
for /F "skip=3" %i in ('link.exe -lib /list ..\libc.lib') do link.exe -lib /extract:%i ..\libc.lib
cd v:\libcd.lib.fdr
for /F "skip=3" %i in ('link.exe -lib /list ..\libcd.lib') do link.exe -lib /extract:%i ..\libcd.lib
cd v:\libcmt.lib.fdr
for /F "skip=3" %i in ('link.exe -lib /list ..\libcmt.lib') do link.exe -lib /extract:%i ..\libcmt.lib
cd v:\libcmtd.lib.fdr
for /F "skip=3" %i in ('link.exe -lib /list ..\libcmtd.lib') do link.exe -lib /extract:%i ..\libcmtd.lib
Step 5:
--------------------------
for %i in (.\libc.lib.fdr\*.obj) do pcf.exe -g0 %i
for %i in (.\libcd.lib.fdr\*.obj) do pcf.exe -g0 %i
for %i in (.\libcmt.lib.fdr\*.obj) do pcf.exe -g0 %i
for %i in (.\libcmtd.lib.fdr\*.obj) do pcf.exe -g0 %i
-------------------------
pcf.exe -g0 .\libc.lib.fdr\*.obj
pcf.exe -g0 .\libcd.lib.fdr\*.obj
pcf.exe -g0 .\libcmt.lib.fdr\*.obj
pcf.exe -g0 .\libcmtd.lib.fdr\*.obj
-------------------------
For: 由.obj文件生成.pat文件。为了避免pcf.exe在执行的过程中处理非COFF文件时中断、出现提示信息“is not ar/coff file\npress enter to exit”,加上参数"-g0"。
Step 6:
-------------------------
sigmake -n"VC7 Static Lib (ST/MT & Rel/Dbg) By TnTTools" libc.lib.fdr\*.pat+libcd.lib.fdr\*.pat+libcmt.lib.fdr\*.pat+libcmtd.lib.fdr\*.pat vc7libc
See the documentation to learn how to resolve collisitions.
: modules/leaves: 9021136/3610, COLLISIONS: 2690
-------------------------
sigmake -n"VC7 Static Lib (ST/MT & Rel/Dbg) By TnTTools" libc.lib.fdr\*.pat+libcd.lib.fdr\*.pat+libcmt.lib.fdr\*.pat+libcmtd.lib.fdr\*.pat vc7libc
--------------------------
For: 转化成SIG文件vc7libc.sig,在这里我把四个静态库文件放在一起,当然你可以分开放。通过第一次运行sigmake,知道有冲突存在。手工编辑.EXE文件后再次运行sigmake,生成vc7libc.sig。见附件。
大家都是地球人,真的是想法一样。我原本也想写脚本,名字和你的一模一样,思路和你的基本一样。为什么没有写出来,因为for命令不支持%1的解析,下面这句解析有问题。
for /F "skip=3" %%i in ('link.exe -lib /list %1') do link.exe -lib /extract:%%i %1
lib2sig
命令行 lib2sig my.lib
生成my.sig
根目录下
放LINK.EXE pcf.exe sigmake.exe dumpsig.exe
大家也可以自己根据需要定义环境变量注释掉那几句复制这几个文件到子目录下
-------------------------------------
@echo off
md %1_objs
copy sigmake.exe %1_objs\sigmake.exe
copy pcf.exe %1_objs\pcf.exe
copy %1 %1_objs\%1
copy LINK.EXE %1_objs\LINK.EXE
copy dumpsig.exe %1_objs\dumpsig.exe
cd %1_objs
for /F %%i in ('link -lib /list %1') do link -lib /extract:%%i %1
for %%i in (*.obj) do pcf %%i
setlocal
set fn=%~n1
sigmake -n"%1" *.pat %fn%.sig
endlocal
if exist %1.exc for %%i in (%1.exc) do find /v ";" %%i > %1_tmp.exc
if exist %1.exc for %%i in (%1.exc) do > %1_tmp.exc more +2 "%%i"
copy %1_tmp.exc %1.exc
del %1_tmp.exc
setlocal
set fn=%~n1
sigmake -n"%1" *.pat %fn%.sig
copy %fn%.sig ..\%fn%.sig
endlocal
cd ..
del %1_objs /s /q
rd %1_objs
-------------------------------------