flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Projects and Ideas > win32ax.inc powerful macro basic to advance guide

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 4805
win32ax.inc powerful macro basic to advance guide
well, like title, am thinking of a list of source code samples that shows directly how to "use" those powerful macros in this thread, hopefully it would be a one-stop resource for everybody.
Post 02 Aug 2011, 22:47
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 4805
how win32ax.inc looks like

Code:

include '%fasminc%\win32ax.inc'

TITLE_TO_FIND equ 'Untitled - Notepad'

proc start
      invoke  PostMessage, <invoke FindWindowNULLTITLE_TO_FIND>, WM_CLOSE00
      invoke  ExitProcess0
endp

.end start



based on post 132212 by LocoDelAssembly,
Post 02 Aug 2011, 22:48
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 4805
how to add extra library .dll under win32ax.inc
thanks to LocoDelAssembly, revolution & edfed.

Code:

format PE console 4.0
include '%fasminc%\WIN32AX.INC'

.code
start:
        cinvoke printfhello
        invoke  ExitProcess,0

.data
hello db "hello world!"

section '.idata' import data readable writeable
library kernel32'kernel32.dll',\
                msvcrt'msvcrt.dll'

include '%fasminc%\API\kernel32.inc'
import msvcrtprintf'printf' 




Last edited by sleepsleep on 03 Aug 2011, 18:36; edited 4 times in total
Post 02 Aug 2011, 23:29
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 4805
.if
.endif
example
Post 02 Aug 2011, 23:30
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4641
Location: Argentina
The "won't work" example the problem you have is that the ".end" macro already built the import table, so "library" and "import" macros won't work.
Post 03 Aug 2011, 14:47
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 4805
i change it to be like this,
assembled but crashed.

Code:

include '%fasminc%\WIN32AX.INC'

.code
start:
  cinvoke printfhello
       invoke  ExitProcess,0

.data
hello db "hello world!"

library  msvcrt'msvcrt.dll', \
          kernel32'kernel32.dll'
import msvcrtprintf'printf'
include '%fasminc%\API\kernel32.inc'




this display what intended

Code:

format PE console 4.0
include '%fasminc%\WIN32AX.INC'

.code
start:
      cinvoke printfhello
       invoke  ExitProcess,0

.data
hello db "hello world!"

section '.idata' import data readable writeable
library     kernel32'kernel32.dll',\
               msvcrt'msvcrt.dll'

include '%fasminc%\API\kernel32.inc'
import msvcrtprintf'printf'




but does this mean, when user start using etc DLLs, they must code their idata section on their own?
Post 03 Aug 2011, 16:53
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 12019
Location: Page 7, paragraph 4, second sentence, fourth word, third letter.
The current import and library macros cannot be extended. If you want to add more imports then currently you must code a custom section.

I did write some macros for this some time ago. libraryonce and some others. Perhaps the search will find them?
Post 03 Aug 2011, 16:57
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2013, Tomasz Grysztar.