flat assembler
Message board for the users of flat assembler.

Index > Windows > Compiling error

Author
Thread Post new topic Reply to topic
greeneyehawk13



Joined: 12 Dec 2008
Posts: 9
greeneyehawk13
Okay, this is my first time using flat assembler. I create a file with code in it that I know has no errors in it. When I click compile, I get an "Error: File Not Found" Can you please help me out, thanks.
Post 12 Dec 2008, 06:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17484
Location: In your JS exploiting you and your system
revolution
Please post your code. It is very hard to help you without code to refer to.

Do you have any "include" statements in the source? Perhaps your source tries to include other files?
Post 12 Dec 2008, 06:24
View user's profile Send private message Visit poster's website Reply with quote
greeneyehawk13



Joined: 12 Dec 2008
Posts: 9
greeneyehawk13
oh, I took code from an example just so I could get used to compiling things with flat assembler. Here it is (oh, if this helps, I have windows vista):

; example of simplified Win32 programming using complex macro features

include 'win32ax.inc'

.code

start:
invoke MessageBox,HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK
invoke ExitProcess,0

.end start
Post 12 Dec 2008, 06:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17484
Location: In your JS exploiting you and your system
revolution
You need to set your "include=" environment variable. It is described in the manual. Just set the path to where you have put fasm. e.g. "include=c:\mystuff\fasm\include"
Post 12 Dec 2008, 07:17
View user's profile Send private message Visit poster's website Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:54; edited 1 time in total
Post 12 Dec 2008, 11:21
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17484
Location: In your JS exploiting you and your system
revolution
asmcoder wrote:
first of all, dont use exit process. on stack you have return address to ExitThread, eax pass return code.
This is bad advice. One should never rely on undocumented behaviour.
asmcoder wrote:
Second, try to use orginal function names. Not MessageBox, but MessageBoxA/MessageBoxW. Thats very important, you will have problems in future.
It is not necessary to put the A/W suffix. And by not putting it it allows more flexibility if one chooses to use the same code in a Unicode or ASCII scenario.
asmcoder wrote:
Code:
include 'win32ax.inc'     

this is a relative path to file. fasm will default search it in his directory.
change it to ./includes/win32ax.inc or smth like this.
And again, this is bad advice. This reduces flexibility. Using fixed paths in source does not allow for compatibility with other sources.
Post 12 Dec 2008, 13:34
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
first of all, dont use exit process. on stack you have return address to ExitThread, eax pass return code.

Why not? Use ExitProcess if it is more convient for you than returning from the entry point function.

Quote:
this is a relative path to file. fasm will default search it in his directory. change it to ./includes/win32ax.inc or smth like this.

Actually, intended solution is to set up environment variable "INCLUDE" (i think, not sure) to point to INCLUDES directory in FASM directory. Whenever FASM searches for file, it looks to directory pointed by "INCLUDE" env var.
Post 12 Dec 2008, 13:56
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
asmcoder,

ret is not enough, because ExitThread() is not. See below.

revolution & vid,

ret was useful some time ago (SP1?); now WMI injects some thread (MessageBox() is enough to activate this behaviour, may be it's some user32/gdi32 statistics?) which will not die after your ExitThread(), so the process will remain alive.

ExitProcess() will do the trick. Wink

_________________
"Don't belong. Never join. Think for yourself. Peace." – Victor Stone.
Post 12 Dec 2008, 17:01
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
baldr, do you mean ANY executable that calls MessageBox()?

The following code under a WinXP (SP3, 32-bit) ends and the process disappears from the task manager's process list:
Code:
include 'win32axp.inc'

.code
start:
      invoke  MessageBox, 0, "testing", "testing", 0
      ret

.end start    


It is a bad idea to use RET anyway of course and these are the results of the scenario that baldr comments:
Code:
include 'win32axp.inc'

.code
start:
      invoke  CreateThread, NULL, 0, threadProc, NULL, 0, dummy
      ret ; invoke  ExitProcess, 0

threadProc:
      invoke  Sleep, 60000 ; Process die after 1 minute
      invoke  ExitThread, 0

.data
  dummy dd ?

.end start       


A DLL hook could create a thread so it is important to not assume the inexistence of threads other than those created by you. If I remember right GDIplus creates a thread so OS-provided DLLs are on the list of possible threads creators too.
Post 12 Dec 2008, 17:32
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
LocoDelAssembly,

I'll try to reproduce that, I have backups.

I'd discovered that while experimenting with macros and simple WndProc. Compiled, run, tried to compile again… no access… found it still running some evil thread started from WmipXXX() ;-(

Did I said that I hate anything that does something on my behalf and doesn't clean up after itself? Wink

_________________
"Don't belong. Never join. Think for yourself. Peace." – Victor Stone.
Post 12 Dec 2008, 18:03
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:54; edited 1 time in total
Post 12 Dec 2008, 19:58
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:

ExitProcess is good when you want to brutaly terminate program

All the run-time libraries must be in a mistake then, even those provided by Microsoft. Microsoft must have written the documentation wrong too. What an idiots, I will tell them they must contact you so they can learn something.

Quote:

if a thread dont wana die by itself, its a bug. Unless you created it.

And how could it know you want to end the process?
Post 12 Dec 2008, 20:17
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder
[content deleted]
Post 12 Dec 2008, 21:25
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.