The Coder's Corner

A Forum for free software.

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Found a bug?
PostPosted: 08 Sep 2011, 04:46 
Offline
Member

Joined: 06 Jan 2011, 05:43
Posts: 7
Problem: STD before invoke inside .IF .ENDIF causes crash (win7 ultimate 32bit, latest easy code 1.06, masm32v10)

Behavior: setting the direction flag then a call or invoke to SetDlgItemText will crash the program.

Reproducing: looks like a blank project with a STD followed by an invoke SetDlgItemText will not crash it..but putting it inside a .IF .ENDIF statement does crash it..

Notes: Moving the CLD *after* the invoke SetDlgItemText does not fix crash...it crashes at SetDlgItemText

Minimal code needed:
Visual style form with one Edit1 or static1 plus a button
Code:
.Const

.Data?

.Data
blah DB "Oh look...Im gonna crash!", 0
.Code

Window1Procedure Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
   .If uMsg == WM_CREATE

   .ElseIf uMsg == WM_COMMAND
      ;LoWord wParam
      ;.If Ax == IDC_BASEDIT_BUTTON2
         ;HiWord wParam
            Mov Eax, wParam
            Shr Eax, 16
         ;.If Ax == BN_CLICKED
            Std
                                          Cld ;REMOVE ME TO CRASH!!!
            Invoke SetDlgItemText, hWnd, IDC_WINDOW1_STATIC1, Addr blah
         ;.EndIf
      ;.EndIf
   .ElseIf uMsg == WM_CLOSE
      Invoke IsModal, hWnd
      .If Eax
         Invoke EndModal, hWnd, IDCANCEL
         Mov Eax, TRUE ;Return TRUE
         Ret
      .EndIf
   .EndIf
   Xor Eax, Eax   ;Return FALSE
   Ret
Window1Procedure EndP


Top
 Profile  
 
 Post subject: Re: Found a bug?
PostPosted: 09 Sep 2011, 01:38 
Offline
Member

Joined: 06 Jan 2011, 05:43
Posts: 7
Found out it's not a compiler issue, ide issue but a microsoft issue. Microsoft DLL calls expect direction flag to be clear

http://www.asmcommunity.net/board/index ... ic=30657.0


Top
 Profile  
 
 Post subject: Re: Found a bug?
PostPosted: 09 Sep 2011, 22:10 
Offline
Moderator

Joined: 10 Apr 2010, 10:45
Posts: 19
Hi gs611,

Thanks for using Easy Code and also thanks for the direction flag info.

Regards,

Ramon


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group