flat assembler
Message board for the users of flat assembler.

Index > Windows > I need a little help with my code.

Author
Thread Post new topic Reply to topic
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick 11 Jan 2011, 02:51
Hello FASM Community,

Fist off, I just want to let you all know how much I love FASM. I've been tinkering with it and I enjoy how easy it is to use and how small my apps are Smile. I really didn't know how easy Assembler could be. So thank you for making such an awesome compiler. Now onto my problem, this is my code and I can't seem to figure out what is wrong with it:

Code:
format PE GUI
push    5
push    0
push    0
push    _website
push    0
push    0
call   [ShellExecute]
push    0
call   [ExitProcess]
_website db 'http://www.google.com',0
ShellExecute dd ?
ExitProcess dd ?    


Everything seems to be fine except that I am not calling "ShellExecute" & "ExitProcess" correctly. My problem is that I can't seem to figure out how to call it correctly. Can someone tell me what I am doing wrong?

Thank you for your time even if I can't figure it out yet Smile.
Post 11 Jan 2011, 02:51
View user's profile Send private message Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 11 Jan 2011, 03:34
Code:
format PE GUI
entry start
include 'win32a.inc'
section '.text' code readable executable
start:
        push    5
        push    0
        push    0
        push    _website
        push    0
        push    0
        call   [ShellExecute]
        push    0
        call   [ExitProcess]


 _website db 'http://www.google.com',0
 section '.idata' import data readable writeable
    library kernel,'kernel32.dll',\
          shell,'shell32.dll'

     import kernel,ExitProcess,'ExitProcess'
     import shell,ShellExecute,'ShellExecuteA'       


if you want to use window Function 'include win32a.inc' or 'include win32ax.inc'
Post 11 Jan 2011, 03:34
View user's profile Send private message Yahoo Messenger Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick 11 Jan 2011, 03:44
MinhHung,

Thank you so much for the quick reply. That does work and thank you, but I was hoping to be able to get this to work without any includes. That is what I am shooting for Smile. Thank you again though!
Post 11 Jan 2011, 03:44
View user's profile Send private message Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 11 Jan 2011, 03:59
Code:
format PE GUI
entry start

section '.text' code readable executable
start:
        push    5
        push    0
        push    0
        push    _website
        push    0
        push    0
        call   [ShellExecute]
        push    0
        call   [ExitProcess]


 _website db 'http://www.google.com',0

section '.idata' import data readable writeable

  dd 0,0,0,RVA kernel,RVA kernel_table
  dd 0,0,0,RVA shell,RVA shell_table
  dd 0,0,0,0,0

  kernel_table:
    ExitProcess dd RVA _ExitProcess
    dd 0
  shell_table:
    ShellExecute dd RVA _ShellExecute
    dd 0

  kernel db 'kernel32.dll',0
  shell  db 'shell32.DLL',0
  _ExitProcess dw 0
               db 'ExitProcess',0
  _ShellExecute dw 0
                db 'ShellExecuteA'     

if you don't want include anything
Post 11 Jan 2011, 03:59
View user's profile Send private message Yahoo Messenger Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick 11 Jan 2011, 04:07
MinhHung,

Oh WOW! Thank you so very very much! You are a true life saver! That works beautifuly! I can't thank you enough!! Very Happy

You are awesome!
Post 11 Jan 2011, 04:07
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 11 Jan 2011, 11:30
thanks minhung, it is an interresting snippet. Very Happy

what does it look like exactlly with invoke?

[edit]
found, it looks like this.

Code:
format PE GUI
entry start
include 'win32a.inc'
section '.text' code readable executable
start:
        invoke ShellExecute,0,0,website,0,0,5
        invoke ExitProcess,0

section '.data' data readable writeable
website db 'http://board.flatassembler.net',0

section '.idata' import data readable writeable
    library kernel,'kernel32.dll',\
          shell,'shell32.dll'

     import kernel,ExitProcess,'ExitProcess'
     import shell,ShellExecute,'ShellExecuteA'     


and for sure, it will be part of the book. bacause it is really good for educational purpose.

the proof is that i understand.

only problem is RVA, even if i read a lot baout RVA, i don't really understand what it means, and how it is behind.
Post 11 Jan 2011, 11:30
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.