flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Convenient import macros Goto page 1, 2 Next |
Author |
|
Grom PE 04 Jul 2008, 11:11
Any help?
|
|||
04 Jul 2008, 11:11 |
|
revolution 04 Jul 2008, 11:28
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? |
|||
04 Jul 2008, 11:28 |
|
Grom PE 04 Jul 2008, 12:10
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 |
|||
04 Jul 2008, 12:10 |
|
revolution 04 Jul 2008, 12:19
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} |
|||
04 Jul 2008, 12:19 |
|
Grom PE 04 Jul 2008, 14:42
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'? =) |
|||
04 Jul 2008, 14:42 |
|
revolution 04 Jul 2008, 14:46
Grom PE wrote: All right, I wrote it! =) Grom PE wrote:
|
|||
04 Jul 2008, 14:46 |
|
Grom PE 24 Jan 2009, 13:51
New version, first post updated.
Move this topic to Macroinstructions, please. Thanks. Edit: or this should stay in Windows subforum? I'm confused. |
|||
24 Jan 2009, 13:51 |
|
LocoDelAssembly 24 Jan 2009, 14:53
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. |
|||
24 Jan 2009, 14:53 |
|
Grom PE 24 Jan 2009, 15:48
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? |
|||
24 Jan 2009, 15:48 |
|
revolution 24 Jan 2009, 15:58
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 |
|||
24 Jan 2009, 15:58 |
|
LocoDelAssembly 24 Jan 2009, 15:58
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 ) |
|||
24 Jan 2009, 15:58 |
|
Grom PE 24 Jan 2009, 16:36
LocoDelAssembly, thanks, it works!
First post updated. |
|||
24 Jan 2009, 16:36 |
|
asmfan 24 Jan 2009, 18:28
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? |
|||
24 Jan 2009, 18:28 |
|
Grom PE 24 Jan 2009, 19:48
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? |
|||
24 Jan 2009, 19:48 |
|
baldr 24 Jan 2009, 22:05
asmfan wrote: Then what is opposite to smallest? |
|||
24 Jan 2009, 22:05 |
|
bitRAKE 25 Jan 2009, 04:17
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 |
|||
25 Jan 2009, 04:17 |
|
asmfan 25 Jan 2009, 07:39
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) |
|||
25 Jan 2009, 07:39 |
|
kempis 15 Feb 2009, 07:28
How if we simply ignore alignment?
[code];;;;;; api dd rva api#_str-2 ;;;;; api#_str db `api,0[code] |
|||
15 Feb 2009, 07:28 |
|
asmfan 15 Feb 2009, 09:33
Every entry must be aligned even 1st one as i said above. see pecoff_v8 for info.
|
|||
15 Feb 2009, 09:33 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.