The MASM Forum

General => The Campus => Topic started by: bomz on February 12, 2013, 06:23:05 PM

Title: LIB2LIB
Post by: bomz on February 12, 2013, 06:23:05 PM
 :lol:

http://implib.sourceforge.net/index.html
http://implib.sourceforge.net/EN.HTM
make batch file
@echo off
color 0a
if "%~1"=="" exit /b
cd %~dp1
SetLocal EnableDelayedExpansion
\masm32\bin\dumpbin.exe /EXPORTS %~nx1 /out:%~n1.txt
echo include 'implib.inc'>%~n1.def
echo.>>%~n1.def
for /f "skip=9 delims=" %%i in (%~n1.txt) do (
if not !stop!==stop (
if "%%i"=="  Summary" (
set stop=stop
) else (
set string=%%i
set string=!string:~18!

set name=!string:~1!
for /f "delims=@" %%a in ('echo !name!') do set name=%%a

echo implib %~n1.dll, !string!, !name!>>%~n1.def
)
)
)
echo.>>%~n1.def
echo endlib>>%~n1.def
echo.
fasm %~n1.def %~nx1.lib
pause

it's makes from DDK_XP lib such files:
include 'implib.inc'

implib kernel32.dll, _ActivateActCtx@8, ActivateActCtx
implib kernel32.dll, _AddAtomA@4, AddAtomA
implib kernel32.dll, _AddAtomW@4, AddAtomW
.............................................
endlib

than FASM makes LIB from it. New LIB works but something wrong with mask signs through back converting.
What is wrong?
http://s018.radikal.ru/i514/1302/49/0b38119938a4.gif
Title: Re: LIB2LIB
Post by: japheth on February 12, 2013, 08:26:50 PM

Cool little "movie"! ( I particularly like the green color )


However, for finding errors it's probably way better to provide a simple, old-fashioned text that describes the cmdline parameters how fasm is launched - and, additionally, attach the input file that fasm is to assemble!
Title: Re: LIB2LIB
Post by: bomz on February 12, 2013, 08:33:07 PM
if I attach file hutch eat me without solt . all files download from first url and lib from microsoft site . how add them see screen
Title: Re: LIB2LIB
Post by: ragdog on February 12, 2013, 08:41:43 PM
Quoteif I attach file hutch eat me without solt


:badgrin: :badgrin:
Title: Re: LIB2LIB
Post by: japheth on February 12, 2013, 08:42:43 PM
Quote from: bomz on February 12, 2013, 08:33:07 PM
if I attach file hutch eat me without solt . all files download from first url and lib from microsoft site . how add them see screen

That's nonsense because there's no copyright violation. I'm not going to do thousand additional things just because of an ignorant person.
Title: Re: LIB2LIB
Post by: bomz on February 12, 2013, 08:51:45 PM
I ask two forums else, of course attach all files, but nobody answer me
Title: Re: LIB2LIB
Post by: dedndave on February 12, 2013, 09:14:46 PM
not sure what you mean by "wrong mask signs"

Quoteif I attach file hutch eat me without solt

i heard a similar phrase in the tv series "Justified"
Quotei am going to smile real big and eat a nice plate of shit, with no salt
:lol:
Title: Re: LIB2LIB
Post by: bomz on February 12, 2013, 09:32:12 PM
if begin convert "new" lib you don't get the same result as with DDK lib.
if open LIB in notepad the difference __imp__fname __imp___fname
Title: Re: LIB2LIB
Post by: bomz on February 12, 2013, 10:24:52 PM
LIB 2 INC (without FASTCALL!)
Quote@echo off
color 0a
rem --------------------------
rem ©™Alex_Piggy ru-board.com®
rem --------------------------
if "%~1"=="" exit /b
cd %~dp1
set fname=%~n1
SetLocal EnableDelayedExpansion
\masm32\bin\dumpbin.exe /EXPORTS %~nx1 /out:%fname%.txt
set string=%fname%
for /f "tokens=2* delims=:" %%i in ('find "" ":%string%\" 2^>^&1') do set upstring=%%j
set upstring=%upstring:~0,-1%
echo ; ---------------------------------------------------------------->%fname%.inc
echo ;      %fname%.inc>>%fname%.inc
echo ; ---------------------------------------------------------------->>%fname%.inc
echo.>>%fname%.inc
echo    IFNDEF %upstring%_INC>>%fname%.inc
echo    %upstring%_INC equ ^<1^>>>%fname%.inc
echo.>>%fname%.inc
for /f "skip=9 delims=" %%i in (%fname%.txt) do (
   if "%%i"=="  Summary" goto :break
      set "string=%%i"
      set string7=!string:~18,1!
      if not "!string7!"=="?" (
         set "string=!string:~19!"
         set "string5=!string:@=A@!"
         set "string6=!string:@=W@!"
( echo !string! | findstr "@" && (findstr /c:"!string5!" /c:"!string6!" %fname%.txt || call :stdcall) || (findstr /c:"!string!A" /c:"!string!W" %fname%.txt || call :decl))>nul
      )
)
:break
echo.>>%fname%.inc
echo    ELSE>>%fname%.inc
echo       echo ------------------------------------------->>%fname%.inc
echo       echo WARNING duplicate include file %fname%.inc>>%fname%.inc
echo       echo ------------------------------------------->>%fname%.inc
echo    ENDIF>>%fname%.inc
pause
del %fname%.txt
exit /b

:stdcall
SetLocal EnableDelayedExpansion
set string2=%string:*@=%
set string3=!string:@%string2%=!
if !string2!==0 (
   set string=!string:@%string2%= PROTO STDCALL!
) else (
   set string=!string:@%string2%= PROTO STDCALL !
)
:next
set /a string2=!string2!-4
if !string2!==0 (
   set string=!string!:DWORD&& goto :next
) else (
   if not !string2!==-4 set string=!string!:DWORD,&& goto :next
)
echo !string!>>%fname%.inc
set string4=!string3:~-1!
if !string4!==A (
(echo   !string3:~0,-1! equ ^<!string3!^>)>>%fname%.inc
)
exit /b

:decl
SetLocal EnableDelayedExpansion
set string4=!string:~-1!
set string3=!string!
set string=!string! PROTO C :VARARG
echo !string!>>%fname%.inc
if !string4!==A (
(echo   !string3:~0,-1! equ ^<!string3!^>)>>%fname%.inc
)
exit /b
Title: Re: LIB2LIB
Post by: hutch-- on February 12, 2013, 10:36:18 PM
Hmmmm,

The data at this uRL "http://implib.sourceforge.net/EN.HTM" is simply wrong. MASM32 has provided a working MSVCRT import library for years. The tools for creating it are in the directory "\masm32\tools\makecimp".

> That's nonsense because there's no copyright violation. I'm not going to do thousand additional things just because of an ignorant person.

Yet another profundity from a backyard GPL lawyer. Whats mine is mine, whats yours is mine, whats theirs is mine but don't touch anything thats mine.  :P
Title: Re: LIB2LIB
Post by: bomz on February 12, 2013, 10:41:25 PM
implib.inc is sourceforge.net
bin fasm free for copy and distribution with license file
kernel32.lib ???
who interested download all files
Title: Re: LIB2LIB
Post by: hutch-- on February 12, 2013, 10:47:22 PM
I would try and explain it but you won't even read anything when its translated into Russian.
Title: Re: LIB2LIB
Post by: bomz on February 12, 2013, 11:19:41 PM
google translator makes terrible translation, because English use fixed word order in sentence, as all Latin language group even Poland and
some respect Ukrainian, but Russian have not fixed word order in sentence, word order may change sense 100%

plus prepositions . I 1 hours find with google in all internet to find how say
Drug and Drop ON\INTO\TO batch file ???

get russian subtitles translate it with google and try to see movie
Title: Re: LIB2LIB
Post by: hutch-- on February 13, 2013, 03:21:16 AM
Russian is just anoth4er Indo-European language that is much closer to English than say Chinese or worse, Japanese. I have had no problems translating Russian with Google and while the word order is a little strange, its no harder to read that say Greek.
Title: Re: LIB2LIB
Post by: Vortex on February 13, 2013, 05:02:55 AM
Hi bomz,

Wouldn't it be better to rename your tool to something like dll2lib?
Title: Re: LIB2LIB
Post by: hfheatherfox07 on February 13, 2013, 05:34:58 AM
Quote from: Vortex on February 13, 2013, 05:02:55 AM
Hi bomz,

Wouldn't it be better to rename your tool to something like dll2lib?

A dll2lib tool would be nice vortex !
The only one that i know is a paid version http://www.binary-soft.com/dll2lib/dll2lib.htm and it wont make a lib for masm32 :(

I can never follow what bomz does :( The fasm forum some where
Title: Re: LIB2LIB
Post by: Vortex on February 13, 2013, 05:48:31 AM
Hi

With polib.exe, you can create import libraries from DLLs :

\masm32\bin\polib.exe /OUT:msvcrt.lib /MACHINE:x86 C:\WINDOWS\system32\msvcrt.dll

In the above example, polib does not create decorated symbols. ( no need of this feature as that dll exports C functions. )
Title: Re: LIB2LIB
Post by: hfheatherfox07 on February 13, 2013, 05:50:38 AM
Quote from: Vortex on February 13, 2013, 05:48:31 AM
Hi

With polib.exe, you can create import libraries from DLLs :

\masm32\bin\polib.exe /OUT:msvcrt.lib /MACHINE:x86 C:\WINDOWS\system32\msvcrt.dll

In the above example, polib does not create decorated symbols. ( no need of this feature as that dll exports C functions. )

I did not know That Thank you so much!!! :t
:biggrin:
So we can make the lib than lib2inc to make the inc as well
Title: Re: LIB2LIB
Post by: hfheatherfox07 on February 13, 2013, 06:01:20 AM
I get an error when trying to convert the lib to inc

Source files must be Microsoft Import Library(s)
Title: Re: LIB2LIB
Post by: bomz on February 13, 2013, 03:14:35 PM
This is not dll to lib, about dll to lib was in previous season.
This is about DDK lib to INC and DDK lib to LIB. I don't know method how export function names from dll with @4 - parametres

May be this may help.
http://www.binary-soft.com/dll2lib/dll2lib.htm - make strange lib's
http://www.yankeedownload.com/download/dll-to-static-lib-download-kbkln.html - this want microsoft studio
In TASM5 I find utilities dll2lib, this libs don't work with MASM. I don't know hwo it's author it's without any information so I can't put it hear according hutch rules
ps. Borland author
Title: Re: LIB2LIB
Post by: Vortex on February 14, 2013, 05:42:31 AM
Hi bomz,

Quote from: bomz on February 13, 2013, 03:14:35 PM
This is about DDK lib to INC and DDK lib to LIB. I don't know method how export function names from dll with @4 - parametres

You can't do that. You can extract the decorated symbols from import libraries.
Title: Re: LIB2LIB
Post by: hutch-- on February 14, 2013, 03:11:42 PM
Whoops, I may have removed one empty post too many.  :eusa_naughty:
Title: Re: LIB2LIB
Post by: bomz on February 17, 2013, 10:31:11 PM
don't be lazy check inc's, please

it was good idea to use "dog-nail log". I try it to 2003 xp vista windows7 - looks like working

hutch--
GNU GENERAL PUBLIC LICENSE (http://smiles.kolobok.us/light_skin/mosking.gif)
Title: Re: LIB2LIB
Post by: hutch-- on February 17, 2013, 11:14:25 PM
> GNU GENERAL PUBLIC LICENSE

Are you supposed to be telling me something with this ?
Title: Re: LIB2LIB
Post by: Vortex on February 18, 2013, 05:32:59 AM
Hi bomz,

Your attachment contains httpdisk. Does your tool download some extra files?
Title: Re: LIB2LIB
Post by: bomz on February 18, 2013, 09:18:31 AM
(http://smiles.kolobok.us/light_skin/yes3.gif)
yes. it's download 10 mb libs from microsoft site (w7 30 mb)
Title: Re: LIB2LIB
Post by: Vortex on February 19, 2013, 06:17:51 AM
Hi bomz,

Your tool downloads the import libraries from the Windows 7 RTM Driver Kit, right?
Title: Re: LIB2LIB
Post by: bomz on February 19, 2013, 11:45:43 AM
Windows Driver Kit (WDK)
Windows Driver Kit Version 7.1.0
http://www.microsoft.com/en-us/download/details.aspx?id=11800

for DateTime need
Quote---------- \MASM32\INCLUDE\OLEAUT32.INC
VariantTimeToSystemTime PROTO :REAL8,:PTR SYSTEMTIME
Title: Re: LIB2LIB
Post by: bomz on February 20, 2013, 04:58:34 AM
masm.2010.studio (http://rghost.ru/43923914)
open sfx archive with rar or 7zip. change zero size files for whole one (full bin dir any ver, include dir: windows.inc winextra.inc, disasm dir: dumppe.exe sr.exe) (http://smiles.kolobok.us/light_skin/this.gif). install, have fun

how make such thing:
in asm code like __NO_NOISE__ equ 1 determine variable for ex __WSYS__ equ wxp and compiller use path to libs and inc for xp?

QuoteIFDEF __WXP__
include \masm\include\wxp\kernel32.inc
ELSEIF.........
Title: Re: LIB2LIB
Post by: bomz on February 20, 2013, 04:35:40 PM
masm.studio.10 (http://rghost.ru/43932952)

Quote;__W2K__ equ 1
;__WXP__ equ 1
;__WNET__ equ 1
;__WLH__ equ 1
;__WIN7__ equ 1
; xp by default
.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib

.data
mestitle   db "MASM COOL",0
form      db "EAX: %010hu", 0

.data?
buffer      db 512 dup(?)

.code
start:
mov eax, -1
invoke wsprintf,ADDR buffer,ADDR form,eax
invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
invoke ExitProcess,0
end start
(http://smiles.kolobok.us/light_skin/dance4.gif)  ®people property (http://smiles.kolobok.us/light_skin/party.gif)