Tuesday, September 20, 2011

dll2lib

Author:forgot
echo off
cls
set def=%~n1.def
set exp=%~n1.exp
echo dll2lib by forgot
if "%1"=="" (
  echo syntax: dll2lib dllfile
  goto exit
)
echo EXPORTS >%def%
for /f "usebackq skip=20 tokens=1,2,3,4,5*" %%i in (`dumpbin /nologo /exports %1`) do (
  if "%%l" == "(forwarded" (
    echo %%k >>%def%
  ) else (
    if not "%%l" == "" (
      if "%%m" == "" (
        echo %%l >>%def%
      )
    )
  )
)
lib /def:%def% /machine:ix86 /nologo
del %exp%
del %def%
:exit
pause

No comments:

Post a Comment