I think I posted a test version around here a while ago, and it's included in the KMDkit by four-f. The tool has pretty bad code, and needs more or less a rewrite. Especially the linked-list code is currently extremely dirty. I guess I should start work on the tool again, it could be useful to some people - especially since it handles both ANSI and UNICODE, and the output includes can trigger the default equates (whether you want MessageBox to alias to MessageBoxA or MessageBoxW). Furthermore it handles other calling conventions than stdcall (depending on symbol decoration), etc.
Posted on 2004-03-20 05:34:49 by f0dder
Glad it worked Vortex. Here is some more stuff:



EXTERNDEF _imp__ExitProcess@4:PROC
RExitProcess equ <invoke p2 PTR> ;<--No target function

EXTERNDEF szCatStr@8:PROC
RszCatStr equ <invoke pr2 PTR> ;<--No target function

EXTERNDEF StdOut@4:PROC
RStdOut equ <invoke pr1 PTR> ;<--No target function
.
.
.data
__imp__ExitProcess@4 dd _imp__ExitProcess@4 ;<--Pointer Table
_szCatStr dd szCatStr@8 ;
_StdOut dd StdOut@4 ;

msg1 db 'Hello ',0
db 11 dup(0)
msg2 db 'my friend!',0

.code
start:

lea eax,_szCatStr
RszCatStr[eax],ADDR msg1,ADDR msg2 <--Use with reg

lea eax,_StdOut
RStdOut[eax],ADDR msg1 <--Use with reg

lea eax,__imp__ExitProcess@4
RExitProcess[eax],0 <--Use with reg
END start

This code is not tested.

Now the function name is only for checking if the proper number of parameters are used.

Because there is no target function:

ExitProcess,0 will not work.

So if you want to use both styles, you will need a different name(heance the 'R' afixed to the funtion names in the above example.

Now if you really want to get crazy you can do this:

RExitProcess equ <invoke p2 PTR > <--a default reg.

RExitProcess,0

And even more crazy:

RExitProcess equ <invoke p2 PTR >

RExitProcess,0

Gives you:

call dword ptr

I think my insanity must stop for now.
Posted on 2004-03-20 08:48:33 by ThoughtCriminal
with such tool how to do something like this:



invoke LoadIcon, lparam, ID_MAINICO
push eax
invoke SendMessage, handle, WM_SETICON, ICON_BIG, eax
call DestroyIcon



btw, I thought that using your tool was going to eliminate the jmp table, but it is still there :notsure:
Posted on 2004-06-21 08:57:11 by maCo
Man these macros here would make my life so much easier
Posted on 2004-06-21 09:06:34 by x86asm
oh ok, i have change it vortex's code.



template1 db 'externdef _imp__%s@%u:proc',13,10
db '%s equ <dword ptr _imp__%s@%d>',13,10,13,10,0

-----

push handle
pop _hmain
xcall LoadIcon, lparam, ID_MAINICO
push eax
xcall SendMessage, handle, WM_SETICON, ICON_BIG, eax
xcall DestroyIcon


thanks for the convinc again :alright:
Posted on 2004-06-21 10:45:39 by maCo
check out EliASM's macros -
http://www.anticracking.sk/EliCZ/
Posted on 2004-06-22 17:17:16 by Drocon
Here is V2.00 of my tool convinc. Now, without the usage of special macros simulating invoke, the function declarations are simplified:

EXTERNDEF _imp__AddAtomA@4:PTR pr1
AddAtom EQU <invoke _imp__AddAtomA@4>

EXTERNDEF _imp__AllocConsole@0:PTR pr0
AllocConsole EQU <invoke _imp__AllocConsole@0>


Convinc supports also include files for static libraries, an example from the converted masm32.inc :

EXTERNDEF GetCL@8:PROC
GetCL EQU <invoke pr2 PTR GetCL@8>

EXTERNDEF Alloc@4:PROC
Alloc EQU <invoke pr1 PTR Alloc@4>


MASM include file converter V2.00
for function call without using the invoke statement

usage : convinc incfile.inc
Optional : -w UNICODE
        : -s static libraries


http://vortex.masmcode.com/files/Convinc200.zip
Posted on 2005-10-16 11:58:15 by Vortex
Version 2.1
- Fixed bug with function prototypes taking parameters other than DWORD
- Fixed bug with C functions from static libraries

prC TYPEDEF PROTO C :VARARG
EXTERNDEF szMultiCat:PTR prC
_szMultiCat EQU <invoke prC PTR szMultiCat>


You need to put a leading underscore to all C functions from static libraries.

http://vortex.masmcode.com/files/Convinc210.zip
Posted on 2005-11-04 06:05:34 by Vortex