Here is V2.00 of my tool convinc eliminating the use of invoke statement. The tool converts MASM include files to this form :
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>
An example :
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include ..\..\kernel32.inc
include ..\..\user32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
MsgCaption db "Iczelion's tutorial no.2",0
MsgBoxText db "Win32 Assembly is Great!",0
.code
start:
MessageBox, NULL,ADDR MsgBoxText, ADDR MsgCaption, MB_OK
ExitProcess,NULL
END start
MASM include file converter V2.00
for function call without using the invoke statement
usage : convinc incfile.inc [optional]
Optional : -w UNICODE
: -s static libraries
http://vortex.masmcode.com/files/Convinc200.zip
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
Version 3
- Function declaration supporting indirect function call :
EXTERNDEF MessageBoxA@16:PROC
MessageBox EQU <invoke pr4 PTR MessageBoxA@16>
- Improved declaration for C functions :
prC TYPEDEF PROTO C :VARARG
_wsprintfA PROTO SYSCALL
wsprintf EQU <invoke prC PTR _wsprintfA>
http://vortex.masmcode.com/files/Convinc300.zip
Why not include the comma in the definition so this:
MessageBox, NULL,ADDR MsgBoxText, ADDR MsgCaption, MB_OK
becomes this:
MessageBox NULL,ADDR MsgBoxText, ADDR MsgCaption, MB_OK
OK, I can add a comma in the definition. My preferred style was definitions without commas.
Maybe an option then. Personally I'm not inclined to use this tool anyway since quite often I play dirty with the stack before calling :wink IMHO requiring a comma between the first two tokens breaks the idea of a command followed by parameters.
However, an option to not include the 'invoke' statement (effectively the same result as the L2EXTIA tool) would be very nice, since I really don't like the function table MASM generates :U
Cheers,
Zooba