flat assembler
Message board for the users of flat assembler.

Index > Windows > What's wrong with this code?

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 23 Aug 2005, 01:57
Code:
format PE GUI 4.0
entry MyEntry

include '%fasminc%\Win32a.inc'

section '.data' data readable writeable

gIst dd 0
gWnd dd 0
 
section '.code' code readable executable

MyEntry:
        invoke GetModuleHandle,eax
        mov [gIst],eax
        invoke DialogBoxParam,eax,1,0,DlgProc,0 
ExitApp:
        invoke ExitProcess,0

proc DlgProc,hWnd,uMsg,wParam,lParam
        ;enter  
        push edi esi ebx
        
        mov eax,[uMsg]
        cmp     eax,WM_COMMAND
        je      jCOMMAND
        cmp     eax,WM_INITDIALOG
        je      jINITDIALOG
        cmp     eax,WM_CLOSE
        je      jCLOSE
        xor eax,eax
        jmp finish

jINITDIALOG:
        mov eax,[hWnd]
        mov [gWnd],eax
        
        mov eax,1
        jmp finish
        
jCOMMAND:
        mov eax,[wParam]
        cmp     eax,1000
        je      a1000
        xor eax,eax
        jmp finish
        
a1000:
        invoke SendMessage,[hWnd],WM_CLOSE,0,0
        mov eax,1
        jmp finish
        
jCLOSE: 
        invoke EndDialog,[hWnd],0
        mov eax,1
        
finish:
        pop ebx esi edi
        ;return
endp

section '.idata' import data readable writeable

  library kernel, 'KERNEL32.DLL',\
          user,   'USER32.DLL'

  import  kernel,\
          GetModuleHandle,'GetModuleHandleA',\
          ExitProcess,    'ExitProcess'

  import  user,\
          DialogBoxParam, 'DialogBoxParamA',\
          EndDialog,      'EndDialog',\
          SendMessage,    'SendMessageA'

section '.rsrc' resource from 't.res' data readable
    


I got it from RadASM templates. It worked ok with older versions of fasm. Now it assembles, but when I execute the program I get memory error. What's wrong?

Thanks!
Post 23 Aug 2005, 01:57
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 23 Aug 2005, 10:28
Try increasing the memory - newer FASMs gain speed by behaving more radically thus using increased memory amounts.

Type on your keyboard:
Code:
Alt+O
C
65536
    

or alternatively choose Compiler Setup from Options menu
Post 23 Aug 2005, 10:28
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 23 Aug 2005, 14:49
It does nothing. The problem isn't with FASM IDE, cause I'm using Radasm.
Yesterday I got the memory problem when I run the program. Today I tried again and it does not show the read memory error, but now it simply will not show the dialog (I'm trying to assemble the dialog template that comes with RadASM, it worked before, but now with 1.64 it doesn't work anymore).
Any ideas?

Thanks!
Post 23 Aug 2005, 14:49
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 23 Aug 2005, 17:33
Wouldn't you have to have a ret right before endp? like this..
Code:
(some stuff here...)
proc DlgProc,hWnd,uMsg,wParam,lParam
(more stuff here...)
finish:
        pop ebx esi edi
        ;return
        ret
endp 
(more stuff)
    

_________________
This calls for... Ultra CRUNCHY Man!
Ta da!! *crunch*
Post 23 Aug 2005, 17:33
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 23 Aug 2005, 20:39
Strange 'cuz FASM should yell at you that it wants ret instead of return. It should make to memoryproblem. Try deleting the destination exe file and/or check and reset file/directory attributes.

I had a problem once when source file was (accidentally?) read-only and system/hidden so every time it asked me where to save the source Confused I reset attributes to most allowing ones and voila! Very Happy

I don't know how to set memory for assembler in RadASM because I know that you encounter less problems with compatible and supported programs etc. But hey - I'm using Windows too so what do you make of it Razz
Post 23 Aug 2005, 20:39
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Spidark



Joined: 11 May 2005
Posts: 39
Spidark 23 Aug 2005, 20:55
OzzY wrote:

I got it from RadASM templates. It worked ok with older versions of fasm. Now it assembles, but when I execute the program I get memory error. What's wrong?
Thanks!


Hallo Ozzy i,m using Radasm version 2.2.0.3
Using GoRC.Exe Version 0.89
FASM version 1.64
Windows 2000

The first time i tried to compile the program i got some strange kind of Mem error, but it never got passed the assembly.
After changing my settings the program ( YOURS ) compiles and startup without any errors.( yes the return was changed to ret )
Maybe i should give you my PROJECT OPTION SETTING:
CHECK YOUR ASSEMBLE SETTING ITS SAYS 5,O,FASM,2,5
Try this---> 5,O,$B\FASM,2,5

compile rc 4,O,$B\RC.EXE /v,1
assemble 5,O,$B\FASM,2,5
link 0,
run 0,0,,5
run w debug 0,0,"$E\OllyDbg",5
res to obj 0,O,$R\ollydbg\ollydbg,$.exe
asm module 0,O,$B\IMPORTS,$.asm

Hope this helps Wink
Post 23 Aug 2005, 20:55
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 24 Aug 2005, 00:41
I went to school and turned off the computer... now I tryed again without changing anything... and it worked! o.O
What a strange thing...
PS: only changed the return to ret... but it was changed before, but I forgot to change the code when I posted at first time...
Post 24 Aug 2005, 00:41
View user's profile Send private message Reply with quote
zemane



Joined: 02 Sep 2005
Posts: 5
Location: Brazil
zemane 02 Sep 2005, 22:20
Spidark wrote:

Hallo Ozzy i,m using Radasm version 2.2.0.3

Using GoRC.Exe Version 0.89
FASM version 1.64
Windows 2000


The first time i tried to compile the program i got some strange kind of Mem error, but it never got passed the assembly.
After changing my settings the program ( YOURS ) compiles and startup without any errors.( yes the return was changed to ret )
Maybe i should give you my PROJECT OPTION SETTING:
CHECK YOUR ASSEMBLE SETTING ITS SAYS 5,O,FASM,2,5
Try this---> 5,O,$B\FASM,2,5

compile rc 4,O,$B\RC.EXE /v,1
assemble 5,O,$B\FASM,2,5
link 0,
run 0,0,,5
run w debug 0,0,"$E\OllyDbg",5
res to obj 0,O,$R\ollydbg\ollydbg,$.exe
asm module 0,O,$B\IMPORTS,$.asm

Hope this helps Wink


Hi Spidark,

I'm new to assembly stuff in PC land, so I think you can help me.
I just got RadAsm 2.2.0.3c (08.31.2005) and FASM 1.64 and I'de like
to now if the defaults configurations are ok or I'll have to do some
customization... If so, can you help me with it?

Tanks,

Zemane

PS: As you can see I'm new to English to... Embarassed
Post 02 Sep 2005, 22:20
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 03 Sep 2005, 00:32
Hey Zemane!
Welcome! Very Happy
where are you from?
Post 03 Sep 2005, 00:32
View user's profile Send private message Reply with quote
zemane



Joined: 02 Sep 2005
Posts: 5
Location: Brazil
zemane 03 Sep 2005, 00:47
OzzY wrote:
Hey Zemane!
Welcome! Very Happy
where are you from?


Hi Ozzy,

I'm from Brasil...

PS: Am I wrong or you are from Brasil too!?
Post 03 Sep 2005, 00:47
View user's profile Send private message Reply with quote
Spidark



Joined: 11 May 2005
Posts: 39
Spidark 03 Sep 2005, 12:51
zemane wrote:

Hi Spidark,

I'm new to assembly stuff in PC land, so I think you can help me.
I just got RadAsm 2.2.0.3c (08.31.2005) and FASM 1.64 and I'de like
to now if the defaults configurations are ok or I'll have to do some
customization... If so, can you help me with it?

Tanks,

Zemane

PS: As you can see I'm new to English to... Embarassed

Sorry for the delay Zemane.
I hope i could help you.
I do have a big problem when it comes to READING the manual, so i end up doing things the hardway.
I like Radasm simply because i'm lazy , and don't have much LINUX ( console ) background experience where you work with Emacs Vi and Nano Embarassed.
I like to keep things simple.
So i have everything on drive c:\ (Radasm, fasm,nasm,masm32,OllyDbg,etc etc)
Once i got this working i just download the update an it keeps working for me
Laughing
The errors that RadAsm give's it simply because it does not know where your files are located.
It assumes that they are in c:\fasm, and it assumes that gorc.exe is in c:\fasm\bin.
It should not give you much problems however.
It's a personal flavor these settings
I wil give you my settings, and if it doesn't help let me know.
!!! backup your serttings before you use these. Wink


Description: Radasm settings and Doc
Download
Filename: ARCHIVES.rar
Filesize: 32.33 KB
Downloaded: 366 Time(s)

Post 03 Sep 2005, 12:51
View user's profile Send private message Reply with quote
zemane



Joined: 02 Sep 2005
Posts: 5
Location: Brazil
zemane 03 Sep 2005, 14:42
Got the file. Thanks!

I did it in a almost equal way. I installed RadAsm to 'd:\radasm' and
Fasm/GoRC to the '\fasm' sub-directory of 'd:\radasm', but I think this
isn't the better aproach.

Having each package in their own place seems better (for the case when
are going to play with more than one compiler)...

I'll give it a try...

Thanks again!

PS: Are you using it on Linux? Surprised
Post 03 Sep 2005, 14:42
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 03 Sep 2005, 14:47
Oh yeah! I'm from Brazil!! Very Happy
Bem vindo aew mano!
flw
Post 03 Sep 2005, 14:47
View user's profile Send private message Reply with quote
Spidark



Joined: 11 May 2005
Posts: 39
Spidark 03 Sep 2005, 14:59
zemane wrote:
Got the file. Thanks!
PS: Are you using it on Linux? Surprised

No i'm using Rad on Windows Laughing
Post 03 Sep 2005, 14:59
View user's profile Send private message Reply with quote
zemane



Joined: 02 Sep 2005
Posts: 5
Location: Brazil
zemane 03 Sep 2005, 15:12
Ok! Smile
Post 03 Sep 2005, 15:12
View user's profile Send private message Reply with quote
zemane



Joined: 02 Sep 2005
Posts: 5
Location: Brazil
zemane 05 Sep 2005, 12:43
OzzY wrote:
Oh yeah! I'm from Brazil!! Very Happy
Bem vindo aew mano!
flw


Great!

Sorry for the delay, I didn't read any messages last days...

Cheers.

PS: We can talk in Portuguese using pvt messges don't you aggree?
Post 05 Sep 2005, 12:43
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 05 Sep 2005, 15:28
Yes, we can. Very Happy
Post 05 Sep 2005, 15:28
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.