flat assembler
Message board for the users of flat assembler.
Index
> Windows > include 'win32axp.inc' + library |
Author |
|
Jin X 22 Jul 2017, 15:42
Really nobody knows???
|
|||
22 Jul 2017, 15:42 |
|
ProMiNick 22 Jul 2017, 18:13
format of ypur import section:
Code: section '.idata' import data readable writeable dd 0,0,0,RVA kernel_name,RVA kernel_table dd 0,0,0,RVA user_name,RVA user_table dd 0,0,0,RVA winmm_name,RVA winmm_table dd 0,0,0,0,0 kernel_table: ExitProcess dd RVA _ExitProcess dd 0 user_table: MessageBoxA dd RVA _MessageBoxA dd 0 winmm_table: mciSendString dd RVA _mciSendString dd 0 kernel_name db 'KERNEL32.DLL',0 user_name db 'USER32.DLL',0 winmm_name db 'WINMM.DLL',0 _ExitProcess dw 0 db 'ExitProcess',0 _MessageBoxA dw 0 db 'MessageBoxA',0 __mciSendString dw 0 db '_mciSendStringA',0 0 if you russion-speaking look in internet for "issledovanieprogramm2004.djvu" - nice source about PE internals. or/and see fasm/fasmg macros that realize different aspects of PE formatting. |
|||
22 Jul 2017, 18:13 |
|
Jin X 23 Jul 2017, 12:03
It's invention of bicycles and crutches (костылей)...
I thought that fasm has something for such cases... |
|||
23 Jul 2017, 12:03 |
|
Furs 23 Jul 2017, 12:29
It does have, it's called the macro you don't want to use.
You can also write your own macro. |
|||
23 Jul 2017, 12:29 |
|
Jin X 24 Jul 2017, 11:59
What macro don't I want to use?
I didn't write that I don't want to use something... I mean that library macro will cause an error if 'win32axp.inc' file is included. |
|||
24 Jul 2017, 11:59 |
|
Tomasz Grysztar 24 Jul 2017, 13:02
It is the ".end" macro that creates the non-configurable import section. If you need to customize it, you have to either alter the ".end" macro or not use it:
Code: format PE GUI 4.0 include 'win32axp.inc' .code start: invoke MessageBoxA,0,'Do you need additional place for the beer?','Desktop configuration',MB_ICONQUESTION+MB_YESNO .if eax=IDYES invoke mciSendString,'open cdaudio',0,0,0 invoke mciSendString,'set cdaudio door open',0,0,0 invoke mciSendString,'close cdaudio',0,0,0 .endif invoke ExitProcess,0 entry start section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL',\ winmm,'WINMM.DLL' import kernel32,\ ExitProcess,'ExitProcess' import user32,\ MessageBoxA,'MessageBoxA' import winmm,\ mciSendString,'mciSendStringA' |
|||
24 Jul 2017, 13:02 |
|
Jin X 24 Jul 2017, 13:57
Tomasz, it's almost the same as BEER.ASM in examples.
My idea is: 1. to use macros such .if, .code and strings in invoke 2. to don't use import macro for each WinAPI function It's sad if it's impossible to do that... I need to build this library/import comstruction just to include 1 WinAPI function. Imagine the program that uses 100 WinAPI function defined in INCLUDE/API/... and 1 not defined. It's would be good to be able to use library and import (with the same libname) macro more than once. Or additional macros like .library and .import that defines some constants that used in .end when calling library macros (and import in INCLUDE/API/...) The final code could be: Code: format PE GUI 4.0 include 'win32axp.inc' .code start: invoke MessageBoxA,0,'Do you need additional place for the beer?','Desktop configuration',MB_ICONQUESTION+MB_YESNO .if eax=IDYES invoke mciSendString,'open cdaudio',0,0,0 invoke mciSendString,'set cdaudio door open',0,0,0 invoke mciSendString,'close cdaudio',0,0,0 .endif invoke ExitProcess,0 .library wimnn,'WINMM.DLL' .import winmm,mciSendString,'mciSendStringA' .end start |
|||
24 Jul 2017, 13:57 |
|
Tomasz Grysztar 24 Jul 2017, 15:04
That's a good example of what an alteration of ".end" macro could accomplish. I cannot promise I would extend the macro myself, as I have mostly moved to fasmg with my "macro work". I could suggest working on it in the community-developed package but as far as I know these projects are no longer active.
|
|||
24 Jul 2017, 15:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.