News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Jwasm 64 FRAME problem with sprintf_s

Started by TouEnMasm, September 09, 2015, 04:28:56 PM

Previous topic - Next topic

TouEnMasm

Hello,
Jwasm 64 FRAME show a problem using sprintf_s with crt (Windows 10 VS 2015)
The stack size is bad when using the function.
Here the way to correct it

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE   
        ;-------------- build prologue ------------------------------------------------------------------
   WindProc PROC   hwnd:HWND,uMsg:UINT,wParam: WPARAM, lParam:LPARAM
      LOCAL retour:QWORD,child:HWND,Hfen:HWND
      sub rsp,78h  ;sub         rsp,38h with FRAME and prologue/epilogue
     
      mov hwnd,rcx
         mov uMsg,edx
      mov wParam,r8
      mov lParam,r9
       ;-------------- build epilogue ------------------------------------------------------------------
      add rsp,78h
      ret       

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef   

and "invoke sprintf_s,addr szbuffer,sizeof szbuffer,addr format,reel" can be used without problem

Complete source code here:
http://masm32.com/board/index.php?topic=4558.msg49075#msg49075

Fa is a musical note to play with CL

TouEnMasm

The only one soluce to avoid this is to modify the local variables as follow:

FullScreen PROC FRAME hwnd:HWND
LOCAL NEXTCALL[50h]:QWORD
Local mi:MONITORINFO
Local  retour:QWORD,dwStyle:DWORD,awidth:DWORD,aheight:DWORD,Hmonitor:HMONITOR

The local NEXTCALL is just here to increase the stack space for the next call and must be not used




Fa is a musical note to play with CL