flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > i have problem with call this macro twice with same argument

Author
Thread Post new topic Reply to topic
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
i try to make library, import, invoke with relocation for windows 3.x application, to make windows 3.x from scrath but i have problem with this macro:
Code:
macro invoke name
{
db 0x9a
label name#.offset
dw name#.value
dw 0
}

macro import name, [label,string]
{
local size
forward
label#.value1 =label#-ImportNameTable
label#:
        db size
        db string
        size = $- label#-1
        label#.library = name#.library
}

macro Relocation1 name;, importdll,importnum
{
db 03
db 02
dw name#.offset
dw name#.library;importdll
dw name#.value1;importnum
name#.value = 0xFFFF ; just to make sure we don't forget to relocation
}

macro library [name, string]
{

common
ModuleReferenceTable:
forward
        dw name#.value
        name#.library = ($-ModuleReferenceTable)/2
common
NumModuleEntry = ($-ModuleReferenceTable)/2
ImportNameTable:

db 0

forward
local sizea
name#.value =name#-ImportNameTable
name#:
        db sizea
        db string
        sizea =$-name# -1
}
;=================================== code

library user,'USER'
import user, initapp,'INITAPP', initappa, 'ada'

invoke initapp
invoke  initappa
invoke initapp ; this the error occure
rb 100
Relocation1 initapp
Relocation1 initappa
Relocation1 initapp
    

when i try to make invoke the same procedure Fasm give this message:
"symbol already defined"
can anybody help me to solve this problem?

Regard
Senolc_eht

_________________
sorry if i always asking.....
Post 10 Jun 2006, 11:05
View user's profile Send private message Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17620
Location: In your JS exploiting you and your system
revolution
"label.offset" is defined twice, once for each "invoke" issued.
Code:
macro invoke name 
{ 
db 0x9a 
label name#.offset  ;<-- name definition occurs here every "invoke"
dw name#.value 
dw 0 
}     
Post 10 Jun 2006, 13:39
View user's profile Send private message Visit poster's website Reply with quote
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
i figure out that problem after i write this thread, so i make this ugly solution
Code:
macro callz name,id
{
db 0x9a
Reloc#id#.offset:
dw Reloc#id#.value
dw 0
Reloc#id#.library = name#.library
Reloc#id#.ordinal = name#.ordinal
}
    


and for the relocation i add this code
Code:
 rept 16 n
      {
      db 03
      db 01
      dw Reloc#n#.offset
      dw Reloc#n#.library;importdll
      dw Reloc#n#.ordinal;importnum
      Reloc#n#.value = 0xFFFF
      }
    

is there any sugestion to make this code simpler, and is there any way to use rept directive inside the macro

thanks for the help

_________________
sorry if i always asking.....
Post 18 Jun 2006, 11:57
View user's profile Send private message Yahoo Messenger 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.