flat assembler
Message board for the users of flat assembler.

Index > Windows > Local Variables

Author
Thread Post new topic Reply to topic
Force



Joined: 12 Jun 2012
Posts: 29
Force
Dword is ok. it works
but Byte (Hello Word message ) gives error in local defination inthis simple code
why ?


Code:
format PE GUI 4.0
include '\fasm\include\win32a.inc'
entry start

section '.data' data readable writeable



section '.code' code readable executable
start:

stdcall testing
invoke ExitProcess,NULL

proc testing

locals
  cnt dd ?
  msg db "Hello, World!",0
endl

mov [cnt],25


invoke MessageBox,NULL,msg,0,0

ret
endp

section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
          user32,'USER32.DLL'


include '\fasm\include\api\kernel32.inc'
include '\fasm\include\api\user32.inc'    
Post 13 Feb 2014, 19:01
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Another thing is to make sure you put a dummy value in your data section or just remove it. FASM will generate an invalid PE if you leave it out empty.
Post 13 Feb 2014, 19:19
View user's profile Send private message Reply with quote
Force



Joined: 12 Jun 2012
Posts: 29
Force
Code:
format PE GUI 4.0
include '\fasm\include\win32a.inc'
entry start

section '.data' data readable writeable

Buffer db 'Hello Word',0

section '.code' code readable executable
start:

stdcall testing
invoke ExitProcess,NULL

proc testing

locals
  cnt dd ?
  msg rd 50
endl

mov [cnt],25


invoke lstrcpy,msg,Buffer

ret
endp

section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
          user32,'USER32.DLL'


include '\fasm\include\api\kernel32.inc'
include '\fasm\include\api\user32.inc'    


error again
Post 13 Feb 2014, 19:58
View user's profile Send private message Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 143
Walter
lea eax,[msg]
invoke lstrcpy,eax,Buffer
Post 13 Feb 2014, 20:39
View user's profile Send private message Reply with quote
Force



Joined: 12 Jun 2012
Posts: 29
Force
Thank you Walter
it works now
Post 13 Feb 2014, 21:06
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.

Powered by rwasa.