flat assembler
Message board for the users of flat assembler.

Index > Main > proc by macro

Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 06 Aug 2020, 13:26
Hi
What is wrong on it?
Code:
macro proc [param] { 
        common proc param }
.....
proc    DlgProc         uses rbx rsi rdi,hWnd,wMsg,wParam,lParam
.....
endp
    

proc DlgProc uses rbx rsi rdi,hWnd,wMsg,wParam,lParam
D:\TOOLS\Fasm\INCLUDE/MyMacros.INC [14] proc [2]:
common proc param
D:\TOOLS\Fasm\INCLUDE/macro/proc64.inc [308] proc [2]:
\{ define@proc name,<params \} }
D:\TOOLS\Fasm\INCLUDE/macro/proc64.inc [308] match [0]:
\{ define@proc name,<params \} }
D:\TOOLS\Fasm\INCLUDE/macro/proc64.inc [338] define@proc [1]:
if used name
processed: if used wMsg
error: missing end directive.

Error(s) occured.
Post 06 Aug 2020, 13:26
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 06 Aug 2020, 19:20
Looks like ..... is the source of trouble.
Post 06 Aug 2020, 19:20
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 06 Aug 2020, 19:38
Works fine without that simple macro. Proc itself is very intricate already.
Post 06 Aug 2020, 19:38
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 06 Aug 2020, 22:40
Overclick: Post something minimal we can compile without having to guess what you have done.
Post 06 Aug 2020, 22:40
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 07 Aug 2020, 04:08
Oh sorry, it happens inside an other macro only.
Code:
macro set_it {
        macro proc [param] \{ 
            common proc param \}
}
set_it
    

Does it make any difference?
Post 07 Aug 2020, 04:08
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 07 Aug 2020, 04:22
Overclick wrote:
Oh sorry, it happens inside an other macro only.
Code:
macro set_it {
        macro proc [param] \{ 
            common proc param \}
}
set_it
    

Does it make any difference?
Compiles fine for me
Code:
1 passes, 0 bytes.    
Post 07 Aug 2020, 04:22
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 07 Aug 2020, 04:32
Try this
Code:
format PE64 GUI 5.0
include 'WIN64ax.INC'
macro set_it {
        macro proc [param] \{ 
            common proc param \}
}
set_it
MYDIALOG = 1000
section '.rsrc' resource from 'Test.res' data readable 

section '.idata' import data readable writeable
        library kernel32,'KERNEL32.DLL',\
        user32,'USER32.DLL',\
        gdi32,'GDI32.DLL',\
        advapi32,'ADVAPI32.DLL',\
        comctl32,'COMCTL32.DLL',\
        comdlg32,'COMDLG32.DLL',\
        shell32,'SHELL32.DLL',\
        wsock32,'WSOCK32.DLL'   
        import_kernel32
        import_user32
        import_gdi32
        import_advapi32
        import_comctl32
        import_comdlg32
        import_shell32
        import_wsock32  
        all_api
section '.text' code readable executable
entry $
        sub             rsp,8
        invoke  GetModuleHandle,0       
        invoke  DialogBoxParam,rax,MYDIALOG,NULL,DlgProc,NULL   
proc    DlgProc         uses rbx rsi rdi,hWnd,wMsg,wParam,lParam
        mov             [hWnd],rcx
        mov             [wMsg],rdx
        mov             [wParam],r8
        mov             [lParam],r9
ret
endp    
Post 07 Aug 2020, 04:32
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 07 Aug 2020, 04:42
The common needs to be escaped or it is processed at the wrong level.
Code:
macro set_it {
        macro proc [param] \{
            \common proc param \}
}
set_it    
Post 07 Aug 2020, 04:42
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 07 Aug 2020, 04:47
It works, thanks man
Post 07 Aug 2020, 04:47
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20460
Location: In your JS exploiting you and your system
revolution 07 Aug 2020, 04:49
Same for local, forward and reverse.
Post 07 Aug 2020, 04:49
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.