flat assembler
Message board for the users of flat assembler.

Index > Windows > How to use library with include 'win***x.inc'???

Author
Thread Post new topic Reply to topic
Estece



Joined: 08 Feb 2017
Posts: 10
Estece 08 Feb 2017, 01:10
Hi!
I used include 'win64ax.inc' to have .if , .code and the others simple macros and the easy way to include standard windows libraries.
For now macros included there are useless if i want add opengl or other non windows standard dll library. I know i can use only include 'win64a.inc' and type manually rest of missing code for opengl library to make it work. If somebody is starting to use fasm and read the fasm.pdf manual and read the windows programing chapter and use easy approach and then want to use non standard library they have to start over.
How i can use :
library opengl,'OPENGL32.DLL'

import opengl,\
.....
without editing 'win64ax.inc' file?
Post 08 Feb 2017, 01:10
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 08 Feb 2017, 01:15
AFAICT you can't add arbitrary libraries when using the standard .end macro.

You can write a custom .end macro of your own design. Then you don't have to edit any of the files that come in the fasm download.
Post 08 Feb 2017, 01:15
View user's profile Send private message Visit poster's website Reply with quote
Estece



Joined: 08 Feb 2017
Posts: 10
Estece 08 Feb 2017, 01:48
I know You are professional but understanding assembly is hard for starters.
Writing a macro is harder than using it. Your's answer approves that standard .end macro is useless for people who want use macros for easy approach. I know that i can write a custom macro.
For now i'm grasping x86_64 assembly , opengl api , windows x64 calling conversion and You want me to start understanding fasm macro preprocessor on top off that!?!
Do i have to always rewrite the .end macro when i add other library?
What this macro code do???

...
import_kernel32
import_user32
import_gdi32
import_advapi32
import_comctl32
import_comdlg32
import_shell32
import_wsock32

all_api
...
Post 08 Feb 2017, 01:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 08 Feb 2017, 02:43
If you need to import libraries not normally included with the usual .end macro then you will need to make your own set of imports.

This can be a macro, or can can simply be put into your code directly, the end result is the same.

The examples included in the fasm download show various ways of making import sections. Ranging form completely manually all the way up to using just the high level macros.

Note that the code you show above are also just macros defined in another file. The .end macro really just includes other macros. Which in turn might include other macros. And so on until you finally get to the real bytes.

It's turtles all the way down.
Post 08 Feb 2017, 02:43
View user's profile Send private message Visit poster's website Reply with quote
Estece



Joined: 08 Feb 2017
Posts: 10
Estece 08 Feb 2017, 04:32
Quote:
'AFAICT you can't add arbitrary libraries when using the standard .end macro.

Quote:
...make your own set of imports. This can be a macro, or can can simply be put into your code directly, the end result is the same.'


No , i can't do it without rewriting useless 'win***x*.inc' group of files.
If i put it directly then it doesn't work because library macro don't work.
Yours 2nd answer is bad because you said it already that i need to write own macro.
This is the same as 1st answer but expressed in other words.
Is there more useless macros that conflict with each other?!?
I'm looking for easy approach such as invoke macro or .if macro.
Various ways shown in examples don't resolve my problem here when i want to use standard .end macro without knowledge of it's internal workings and add non standard library.
Why i have to have knowledge of all the default macros, if the purpose of this .end macro is to simplify my coding experience as manual says or i'm missing something and there is example to use .end macro with non standard library???
Post 08 Feb 2017, 04:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20409
Location: In your JS exploiting you and your system
revolution 08 Feb 2017, 06:29
The unaltered .end macro won't include other libraries for you. And you can't add libraries one by one with the current default set of macros. So the only answer here it to modify something somewhere. And usually the thing you need to alter is a macro because that would be the easiest place to do it. There really isn't another answer.

There are many examples already on this board of people wanting to include the MSVCRT labrary (to access printf there) and you will see that they also have to make their own import section in some way. Perhaps you can search for some of those examples and see if one of those methods is going to work for you.
Post 08 Feb 2017, 06:29
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.