News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Create a Lib

Started by ragdog, August 18, 2012, 07:14:39 PM

Previous topic - Next topic

ragdog

Hi

My question is how i can create a Lib from a exe

I have a exe this have a export table for plugins how i can create a lib to writing a plugin?
Give for it a dump utiliti?

Greets,

Vortex

Hi ragdog,

You cannot create a library from an executable. I guess you want to create an EXE exporting functions. You could use this EXE like a DLL, right?

You need to search the old forum for some examples :

http://www.masmforum.com/board/index.php?topic=6331.0

ufo

I guess you're after the dynamic lib for the latest ollydbg.exe.

1) Open a Visual Studio Command Prompt
2) dumpbin /exports ollydbg.exe > ollydbg.def
3) Open ollydbg.def in a text editor
4) Delete everything except of the function names
5) Insert EXPORTS at the top
6) lib /def:ollydbg.def /OUT:ollydbg.lib

PS: http://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/

ragdog

Hi Ufo  :biggrin:

You here ?

No i have a other project what i need this lib.

You now i have translate the Ollydbg2 plugin in to Masm32
and have written a new plugin with many new function but now wait i
of the final version of Ollydbg. ;)

Thanks for your help und this nice link
It help  :t

Regards,


Farabi

I remind me to NTOSKernel.exe that had an export for the function it contains.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

hfheatherfox07

Quote from: ufo on August 19, 2012, 07:36:17 AM
I guess you're after the dynamic lib for the latest ollydbg.exe.

1) Open a Visual Studio Command Prompt
2) dumpbin /exports ollydbg.exe > ollydbg.def
3) Open ollydbg.def in a text editor
4) Delete everything except of the function names
5) Insert EXPORTS at the top
6) lib /def:ollydbg.def /OUT:ollydbg.lib

PS: http://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/


You can use the dumpbin in masm with a batch file :

@echo off
\masm32\bin\dumpbin.exe  /exports ollydbg.exe > ollydbg.def

Pause


But with :

@echo off
\masm32\bin\lib /def:ollydbg.def /OUT:ollydbg.lib


I always seem to get error:
LINK : warning LNK4068: /MACHINE not specified; defaulting to IX86
So My ollydbg.lib is 294 KB

I don't know  how you Got a lib that is only 88.2 KB ?

you can define a subsystem when you build a dll and a lib at the same time from dll.asm with no errors
Don't know how to define "/MACHINE"  with building lib from def only?
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

Vortex

Hi hfheatherfox07,

\masm32\bin\lib /def:ollydbg.def /OUT:ollydbg.lib /machine:IX86

hfheatherfox07

Quote from: Vortex on August 30, 2012, 05:26:52 AM
Hi hfheatherfox07,

\masm32\bin\lib /def:ollydbg.def /OUT:ollydbg.lib /machine:IX86

:t
Thank you That Did it ...

But Why am I still Getting a 294 KB ollydbg.lib
And the lib in the attachment is only 88.2 KB ?

Only for learning purposes ...I do not need a ollydbg.lib
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

Quote from: Vortex on August 30, 2012, 05:26:52 AM
Hi hfheatherfox07,

\masm32\bin\lib /def:ollydbg.def /OUT:ollydbg.lib /machine:IX86

Just for the sake Of learning .....

If I put that batch file and that def in a folder it works!

If I put This batch file and that def in a folder with : lib.exe,link.exe,mspdb50.dll

@echo off

lib.exe /def:ollydbg.def /OUT:ollydbg.lib

Pause
if exist ollydbg.exp del ollydbg.exp


It works!!!! but I get the error LINK : warning LNK4068: /MACHINE not specified; defaulting to IX86

How ever if I add "/machine:IX86"

So the batch file :
@echo off

lib.exe /def:ollydbg.def /OUT:ollydbg.lib /machine:IX86

Pause
if exist ollydbg.exp del ollydbg.exp


I Get this Error (And It Does not work):

LINK : fatal error LNK1117: syntax error in option "mac"

Why ? that is strange ?
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave

>lib /?

Microsoft (R) Library Manager Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

usage: LIB [options] [files]

   options:

      /CONVERT
      /DEBUGTYPE:CV
      /DEF[:filename]
      /EXPORT:symbol
      /EXTRACT:membername
      /INCLUDE:symbol
      /LIBPATH:dir
      /LIST[:filename]
      /MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
      /NAME:filename
      /NODEFAULTLIB[:library]
      /NOLOGO
      /OUT:filename
      /REMOVE:membername
      /SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]
      /VERBOSE


try placing the options before the files

dedndave

a couple more thoughts....

the lib program is a stub into the linker, so....
LINK /LIB
might work

and, i remember many of the older ms command line programs accept shortened versions of switch names
so, you might try....
LIB /MA:IX86
LIB /MAC:IX86
on some of the older ones, if the switch name was long enough to remove any ambiguities, it would work

hfheatherfox07

Actually non of that .....

If I had that folder on my desk top it works ,
but If I put i in another folder or yet even in a another
That gives me that error

So strange..... I will leave it at that
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.