Author Topic: Jwasm 64 FRAME problem with sprintf_s  (Read 5974 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1764
    • EditMasm
Jwasm 64 FRAME problem with sprintf_s
« on: September 09, 2015, 04:28:56 PM »
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

Afiferza

  • Regular Member
  • *
  • Posts: 2
Re: Jwasm 64 FRAME problem with sprintf_s
« Reply #1 on: November 23, 2015, 06:46:36 PM »
The embodiment of what is being sought is fit.

TouEnMasm

  • Member
  • *****
  • Posts: 1764
    • EditMasm
Re: Jwasm 64 FRAME problem with sprintf_s
« Reply #2 on: November 23, 2015, 07:29:56 PM »
The only one soluce to avoid this is to modify the local variables as follow:
Code: [Select]
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

jj2007

  • Member
  • *****
  • Posts: 13873
  • Assembly is fun ;-)
    • MasmBasic
Re: Jwasm 64 FRAME problem with sprintf_s
« Reply #3 on: November 23, 2015, 08:38:53 PM »
Hey, 'Afiferza', tell your coder that you are a lousy bot :badgrin: