News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

.code or .data section

Started by emre_tinaztepe, July 20, 2007, 11:27:46 PM

Previous topic - Next topic

emre_tinaztepe

Hi there,
I am struggling with something weird. I am trying to put my byte string in .code section and after using it with MessageBox api, it works but Windows XP gives and error,
as you know bla. bla. an exception occured, SEND it DONT SEND IT bla. bla.
  But if i put my byte string into .data section, it gives error...
  Code is like this :
.486
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.data


.code
_start:   
   push 0
   push offset mesaj
   push offset mesaj
   push NULL
   call MessageBox
   
    push 0
   push offset mesaj
   push offset mesaj
   push NULL
   call MessageBox
   
    mesaj db 'emre',0   


_end:
   push 0
   call ExitProcess
end _start

Does anyone have any idea?

mnemonic

There is a simple cure: put a
jmp _end
straight after the second
call MessageBox

I think you get the idea and can figure out yourself why your app got closed down by Windows, resulting in the mentioned error message.
If not, just ask. ;)

HTH
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

hutch--

The fault occurs because you are trying to execute data.


    mesaj db 'emre',0


Put it in the .DATA section and it will not be a problem.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php