NO

Author Topic: PeExpLib2Inc1 import library functions to inc-file for poasm  (Read 3654 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1628
PeExpLib2Inc1 import library functions to inc-file for poasm
« on: December 06, 2013, 11:31:24 am »
Small C program PeExpLib2Inc1.exe write function PROTO's from import library to inc-file.
PeExpLib2Inc1.zip
« Last Edit: December 06, 2013, 11:50:28 am by timovjl »
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 465
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #1 on: December 06, 2013, 07:21:15 pm »
Hi Timo,

I made a test with some lib files as input but so far no output. How exactly do you use it?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1628
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #2 on: December 06, 2013, 07:28:43 pm »
PeExpLib2Inc1.exe kernel32.lib > kernel32.inc
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 465
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #3 on: December 06, 2013, 08:16:06 pm »
Works:
PeExpLib2Inc1.exe \Masm32\lib\Kernel32.lib >Kernel32.inc

Fails:
PeExpLib2Inc1.exe \Masm32\lib\masm32.lib >masm32.inc

Why that?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1628
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #4 on: December 06, 2013, 08:20:06 pm »
Maybe masm32.lib isn't import library ?
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 465
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #5 on: December 06, 2013, 08:31:08 pm »
Right. Excuse my ignorance ;-)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1628
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #6 on: December 06, 2013, 08:34:37 pm »
PeLib2Inc.zip with FindFirstFile/FindNextFile mask.
Any better now ?
EDIT fix for silly error.
« Last Edit: December 07, 2013, 02:12:12 am by timovjl »
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 465
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #7 on: December 06, 2013, 11:54:26 pm »
Hmmm....

PeLib2Inc.exe \masm32\lib\user32.lib works fine
PeLib2Inc.exe \masm32\lib\kernel32.lib has "file open error" (and worked fine with version 1)

Edit: Works like a charm now :)
PeLib2Inc.zip with FindFirstFile/FindNextFile mask.
Any better now ?
EDIT fix for silly error.
« Last Edit: December 07, 2013, 05:53:39 pm by jj2007 »

Offline Vortex

  • Member
  • *
  • Posts: 501
    • http://www.vortex.masmcode.com
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #8 on: December 07, 2013, 05:37:36 pm »
Hi Jochen,

lib2inc can create an include file from a static library :

http://forum.pellesc.de/index.php?topic=701.0
Code it... That's all...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1628
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #9 on: December 07, 2013, 06:08:31 pm »
I recommend that too  ;D
« Last Edit: December 07, 2013, 08:35:03 pm by timovjl »
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 465
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #10 on: December 07, 2013, 06:53:37 pm »
lib2inc can create an include file from a static library

Hi Erol & Timo,

I have a n00bish question. I use inc files on a daily basis, and I always appreciated that there are gentlemen like Pelle or Hutch who write them. The question is really: how do they do that?
I know there are tools that convert a DLL into a static lib, and you can grab the number of dword paras from the name tables etc - but what about REAL4 or REAL8 or RECT PTR args? Do you parse a set of C header files to get these subtleties, do you grab it from MSDN online docu, ...? The DLLs certainly don't contain the definition of RECT or WNDCLASSEX, so some manual parsing must take place, but what are the best sources?

Offline Vortex

  • Member
  • *
  • Posts: 501
    • http://www.vortex.masmcode.com
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #11 on: December 07, 2013, 07:12:25 pm »
Hi Jochen,

Converting the equates and structure definitions from the SDK C\C++ header files is a difficult task. As you mentioned, some manual tweakings are unavoidable. Japheth,ToutEnMasm and Donkey created their own include file set. Creating include files for API function declarations is easier. You need to read the MS COFF import library specification to understand the structure of import libraries. Converting a statement like _MessageBoxA@16 to a sequence of PROTO and DWORD is easy. To be honest, my converter assumes everything as DWORDs.
Code it... That's all...

Offline Vortex

  • Member
  • *
  • Posts: 501
    • http://www.vortex.masmcode.com
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #12 on: December 07, 2013, 07:13:17 pm »
I recommend that too  ;D
If only Avast allows downloading that file.

Hi Timo,

Are you referring to my lib2inc tool?
Code it... That's all...

Offline Vortex

  • Member
  • *
  • Posts: 501
    • http://www.vortex.masmcode.com
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #13 on: December 07, 2013, 08:25:54 pm »
Timo,

As an assembly programmer, you should probably know that it's false-positive :

http://virusscan.jotti.org/en/scanresult/17924fd8de471ba282983f41deb6d84ca08e3b36/7768e871004cc7c04dbdb3acffe6ba75b14fc3be

https://www.virustotal.com/tr/file/0f4828389b2e1da84f025828b01834276072a6eba68fc0adccddb56f9275b0e6/analysis/1386439581/

Avast reports the exe as safe so you should be more careful while commenting another coder's work. Think twice before posting here. I hope you got it clearly.
Code it... That's all...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1628
Re: PeExpLib2Inc1 import library functions to inc-file for poasm
« Reply #14 on: December 07, 2013, 08:40:09 pm »
I just inform Avast's heuristics problem, that prevent downloading some file.
BTW: I'm not an assembly programmer.
« Last Edit: December 07, 2013, 09:09:07 pm by timovjl »
May the source be with you