flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > import dll in PE for ARM

Author
Thread Post new topic Reply to topic
flx



Joined: 27 Jan 2017
Posts: 4
flx 27 Jan 2017, 10:05
I am trying to write app (.exe) for WinCE on ARM which uses external dll.
How do I import dll in FASMARM for PE files?
I tried this
Code:
format PE

section '.code' code readable executable
<...>

section '.idata' import data readable
library coredll, 'coredll.dll'

import coredll,\
       MessageBoxW,'MessageBoxW'
    


and it says "illegal instruction" on "library coredll,'coredll.dll'".
Post 27 Jan 2017, 10:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 27 Jan 2017, 10:14
There are four example files for ARM PE in the fasmarm download. This is the second one and perhaps the one you are after:
Code:
; Example of building a WinCE executable using medium level macros

        include 'wince.inc'
        format  PE GUI
        entry   Start

section '.text' code readable executable

proc Start uses[lr]
        apscall MessageBoxW,0,addr Text,addr Caption,0
        ret
endp

Caption du      'ARM example MLI macros',0
Text    du      'Hello ArmCE world',0

section '.idata' import readable writeable

        library coredll,'COREDLL.DLL'
        include 'APICE\COREDLL.INC'    
Post 27 Jan 2017, 10:14
View user's profile Send private message Visit poster's website Reply with quote
flx



Joined: 27 Jan 2017
Posts: 4
flx 27 Jan 2017, 10:42
My fault not to look for example folder. Thank you, it works.
Post 27 Jan 2017, 10:42
View user's profile Send private message Reply with quote
flx



Joined: 27 Jan 2017
Posts: 4
flx 15 Feb 2017, 14:32
Ok, one more noob question. Now I need to export some functions from dll. How?
public and export macros don't work for WinCE on ARM (public does nothing, and export doesn't exist)
I also tried to construct export section manually, but I run into the issue that dd instruction always puts 0 after const, thus
dd 1,2 assembles to 0000001 00000000 00000002 00000000 instead of 00000001 00000002. How do I fix that?
Post 15 Feb 2017, 14:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 15 Feb 2017, 14:35
dd defines 64-bit values.
dw defines 32-bit values.
dh defines 16-bit values.
db defines 8-bit values.

BTW: public is not a macro. export is a macro.
Post 15 Feb 2017, 14:35
View user's profile Send private message Visit poster's website Reply with quote
flx



Joined: 27 Jan 2017
Posts: 4
flx 15 Feb 2017, 15:00
That's unexpected. Compared to ARM's dcb, dcw, dcd, dcq.
But thank you, I took export.inc from FASM for x86, replaced dd's in it for dw and dw for dh, and got working export macro.
Post 15 Feb 2017, 15:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20343
Location: In your JS exploiting you and your system
revolution 15 Feb 2017, 15:06
Section 7 of the docs.
Post 15 Feb 2017, 15:06
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.