flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Convenient import macros Goto page Previous 1, 2 |
Author |
|
Grom PE 16 Feb 2009, 00:18
bitRAKE, very nice, thanks!
|
|||
16 Feb 2009, 00:18 |
|
bitRAKE 16 Feb 2009, 02:11
I'm wonder if there is a way to take it further - more encapsulated, more featureful? Have yet to test any of this - just brain storming:
First, make all labels local to import - in order that no possible name collisions could occur. Code: forward local library#_import,library#_str irp name,api { local name#_str } Finally, support for 64-bit. Detecting long mode with a virtual block and change DD to DQ (equ/restore) seems easy enough for 64-bit support. Edit: almost forgot - support for by ordinal import. I don't know - never use it. |
|||
16 Feb 2009, 02:11 |
|
kempis 17 Feb 2009, 13:31
Suggestion for bitRAKE's idea:
Code: import kernel32.dll,<\ ExitProcess,\ ; normal import GetModuleHandle:AW,\ ; support for unicode and ansi version _my_tick_func:"GetTickCount",\ ; different import func name _unknown:33> ; ordinal import |
|||
17 Feb 2009, 13:31 |
|
bitRAKE 06 Jul 2009, 04:26
I had a problem implementing the 64-bit version of this macro: windows don't like the NOP instructions used by FASM for ALIGN when the import data is in a code section. Don't ask how long this took to discover. This problem might also happen in 32-bit, so I post the new adaptation.
Code: macro import [lib,api] { common local part0,part1,first macro part0 lib0,[api0] \{ \common lib0\#_STR db \`lib0 \forward rb 2 - RVA $ AND 1 label api0\#_STR at $-2 db \`api0 \common db 0 \} first = 7 macro part1 lib1,[api1] \{ \common rb (8 - RVA $ AND 7) AND first first = 15 label lib1\#_TAB \forward api1 dq RVA api1\#_STR \} forward part0 lib,api forward part1 lib,api common data import forward dd 0,0,0,RVA lib#_STR,RVA lib#_TAB common rd 5 end data } Edit: or, maybe it was some other problem. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
06 Jul 2009, 04:26 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.