Author Topic: Strings in the stack  (Read 713 times)

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 2536
Strings in the stack
« on: November 01, 2020, 07:40:45 AM »
Hello,

Macro to pass strings to the stack :

Code: [Select]
.386
.model flat,stdcall
option casemap:none

ExitProcess PROTO :DWORD
MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
MessageBox  EQU <MessageBoxA>
MB_OK       EQU 0

include     StrToStackMacro.inc

includelib  \PellesC\lib\Win\kernel32.lib
includelib  \PellesC\lib\Win\user32.lib

.code

start:

    call    main
    invoke  ExitProcess,0

main PROC

; Dummy local variable
; initializing the stack frame

LOCAL x:DWORD

    mov     x,0
    mov     eax,@StrToStack(<This is a long test string in the stack.>)
    mov     ecx,@StrToStack(<Hello>)
    invoke  MessageBox,0,eax,ecx,MB_OK
    ret

main ENDP   

END start

jj2007

  • Member
  • *****
  • Posts: 11344
  • Assembler is fun ;-)
    • MasmBasic
Re: Strings in the stack
« Reply #1 on: November 01, 2020, 10:04:54 AM »

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 2536
Re: Strings in the stack
« Reply #2 on: November 03, 2020, 01:33:51 AM »
Hi Jochen,

That's right. Converting the Masm macros to Poasm is problematic in my case. The @CatStr macro is emitting the following error message :

Code: [Select]
POASM: fatal error: Internal error (').

jj2007

  • Member
  • *****
  • Posts: 11344
  • Assembler is fun ;-)
    • MasmBasic
Re: Strings in the stack
« Reply #3 on: January 07, 2021, 04:35:04 AM »
Why the hell does this thread attract the spammer brigade??

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 2536
Re: Strings in the stack
« Reply #4 on: January 07, 2021, 05:35:04 AM »
Hi Jochen,

The spam message is removed. Probably the bots are gaining more capabilities nowadays or they choose randomly a thread to spam.