flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Grom PE
Any help?
|
|||
![]() |
|
revolution
I don't see how they are simpler, but never mind, to answer your Q at the end:
Code: import_names equ null macro import name,[stuff]{ common import_part1 name,stuff import_part2 name,stuff import_names equ import_names,name } import blah1,blah1,... import blah2,blah2,... match x=,names{import_part3 names} Somehow I get the feeling that this is not what you want but it seems to be what you are asking for. Perhaps some clarification is needed? |
|||
![]() |
|
Grom PE
revolution, thanks, but it's not what I want, and line
Code: match x=,names{import_part3 names} Your import macro mixes part1 and part2, while I want them ordered. In general, I want macros that gives the same result as second piece of code in first post, but with clearer syntax: - call import_part1 for every DLL, with list of functions; - call import_part2 for every DLL, with list of functions; - call import_part3 with list of all DLLs |
|||
![]() |
|
revolution
Yeah, I expected it may not be what you wanted. But perhaps the macros I used for imports in my principles topic can give you some ideas.
BTW: a stupid omission in my code above, should be: Code: match x=,names,import_names{import_part3 names} |
|||
![]() |
|
Grom PE
All right, I wrote it! =)
Add the following code to the first post: Code: import_list equ import_libraries equ macro import library,[api] { common import_list equ import_list import_#library import_#library equ library,api import_libraries equ import_libraries,library } macro importend { match a, import_list \{ irps b, a \\{ match c, b \\\{ import_part1 c \\\} \\} irps b, a \\{ match c, b \\\{ import_part2 c \\\} \\} \} match =,a,import_libraries \{ import_part3 a \} } Now functions can be imported just with Code: import kernel32.dll, lstrlenW, GlobalUnlock, GlobalLock, GlobalAlloc, GetCommandLineW import user32.dll, SetClipboardData, OpenClipboard, EmptyClipboard, CloseClipboard importend The last question would be: is it possible to get rid of 'importend'? =) |
|||
![]() |
|
revolution
Grom PE wrote: All right, I wrote it! =) ![]() Grom PE wrote:
|
|||
![]() |
|
Grom PE
New version, first post updated.
Move this topic to Macroinstructions, please. Thanks. Edit: or this should stay in Windows subforum? I'm confused. |
|||
![]() |
|
LocoDelAssembly
Moved.
Would you mind commenting what are the advantage of using your macros over the standard ones in the first post? What are the optimizations you are talking about? I'm not saying that there is something wrong, just that your macros are lacking of a phrased explanation. |
|||
![]() |
|
Grom PE
It generates the smallest possible import directory, especially when placed in the end of section.
The trick is, when align is right, one byte from previous import name is used as byte for next import's hint. Oh, and there's a bug: it doesn't work with relocations, complains on line: Code: if $ mod 2=0 Any ideas what should I write there instead? In other words, how to do relocation-friendly align check? |
|||
![]() |
|
revolution
Grom PE wrote: In other words, how to do relocation-friendly align check? [edit] Oops, sorry you want a check, not a alignment. Ignore. Last edited by revolution on 24 Jan 2009, 16:01; edited 1 time in total |
|||
![]() |
|
LocoDelAssembly
Maybe "if rva $ mod 2 = 0"?
Thanks for the explanation, put it in the first post later if you can (or want, it is just a suggestion after all, not a commandment ![]() |
|||
![]() |
|
Grom PE
LocoDelAssembly, thanks, it works!
First post updated. |
|||
![]() |
|
asmfan
hmm, can it be compared to size of import by original fasm import macroses?
What's the difference? And what is "smallest"? Then what is opposite to smallest? Sample of unoptimal import by some macro/linker? |
|||
![]() |
|
Grom PE
asmfan, so many questions, but I'll answer to them =)
Quote: can it be compared to size of import by original fasm import macroses? Quote: What's the difference? Quote: And what is "smallest"? Quote: Then what is opposite to smallest? Quote: Sample of unoptimal import by some macro/linker? |
|||
![]() |
|
baldr
asmfan wrote: Then what is opposite to smallest? |
|||
![]() |
|
bitRAKE
Of course, the DLL extension is not needed, but I didn't know about saving the other byte.
I like the following syntax which results from overloading the DATA and END keywords: Code: data import,\ < kernel32, lstrlenW, GlobalUnlock, GlobalLock, GlobalAlloc, GetCommandLineW >,\ < user32, SetClipboardData, OpenClipboard, EmptyClipboard, CloseClipboard > end data |
|||
![]() |
|
asmfan
Grom PE yes, my fault for not digging into code =)
In best way we have 1byte per import function due to hint/closing zero right? And once again you're right - unique trick. baldr i don't use such linkers;) I guess i'ts either old Borland's products linkers or dumps of apps. Anyway it's darn bad written old (hope Borlad /if it exists)/ fixed this) HLL stuff. Quote:
I believe hint won't be 0 in some cases, low byte will be equal to last char of prev string of library#_str. If don't care about all hint zeroed then we get extra byte per each imported dll) |
|||
![]() |
|
kempis
How if we simply ignore alignment?
[code];;;;;; api dd rva api#_str-2 ;;;;; api#_str db `api,0[code] |
|||
![]() |
|
asmfan
Every entry must be aligned even 1st one as i said above. see pecoff_v8 for info.
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.