flat assembler
Message board for the users of flat assembler.

Index > Main > [solved] In 64 bits pushd not work.

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
Fasmw 1.73 in 32 bit work:
Code:
pushd 'some text '
pop [txt]
pushd Value
pop [CurVal]
    


But in 64 bits fasm error pushd

And in 64 bits error if push eax or push esi.
I must do push raxd or push rsid ?
Post 22 Aug 2020, 12:07
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
pushd isn't valid. You can't push 32-bit values in 64-bit mode.
Code:
pushd 'some text '
processed: pushd 'some text '
error: illegal instruction.    
There is a macro pushd. Are you using that?
Post 22 Aug 2020, 12:09
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
Yes. From include\WIN32AX.inc
Post 22 Aug 2020, 13:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
WIN32AX.inc is for 32-bit code. It isn't compatible with 64-bit code.

You can't push 32-bit values in 64-bit mode.
Post 22 Aug 2020, 13:06
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
How emulate pushd in 64 bits ?
Or write macro ?
Post 22 Aug 2020, 13:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Code:
lea rsp,[rsp-4]
mov [rsp],eax    
Post 22 Aug 2020, 13:28
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
And what in eax ?

And how in 64 bits work invoke ?
invoke MessageBox,0,'Some text',0,0

I look in IDA Pro 64 bit
Code:
.code:0000000000401014                 mov     rcx, 0          ; hWnd
.code:000000000040101B                 jmp     short loc_401023
.code:000000000040101B ; ---------------------------------------------------------------------------
.code:000000000040101D ; CHAR Text[]
.code:000000000040101D Text            db 'float',0            ; DATA XREF: start:loc_401023↓o
.code:0000000000401023 ; ---------------------------------------------------------------------------
.code:0000000000401023
.code:0000000000401023 loc_401023:                             ; CODE XREF: start+F↑j
.code:0000000000401023                 lea     rdx, Text       ; "float"
.code:000000000040102A                 mov     r8, 0           ; lpCaption
.code:0000000000401031                 mov     r9, 0           ; uType
.code:0000000000401038                 call    cs:MessageBoxA
    
Post 22 Aug 2020, 13:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
You can push 64-bit values in 64-bit mode. So all the invoke parameters are 64-bits in size.
Code:
use64
push 0   ; 64-bit push
push rax ; 64-bit push
push eax ; invalid, not possible in 64-bit mode    


Last edited by revolution on 22 Aug 2020, 13:46; edited 1 time in total
Post 22 Aug 2020, 13:45
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 209
Overclick
It's your text in eax, 4 bytes )) No reason to do like that even partly.
You can push qword registers or if length undefined use something like lea rsi,[rsp] and load until zero.
Post 22 Aug 2020, 13:45
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
Ok.
I want try this:
Code:
jmp .3
   .2: db "Patrik1",0
.3: mov dword [eax],.2
     add eax,64
jmp .3
   .2: db "Patrik2",0
.3: mov dword [eax],.2
     add eax,64
    

Fasm get error .3 alredy exist.
Post 22 Aug 2020, 13:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Use a new label name. Or use @f, @b, and @@
Post 22 Aug 2020, 13:55
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 209
Overclick
Quote:
And how in 64 bits work invoke ?

It is not in the stack It just leaving space in code before call for db value and loads its address for function.
You can do that any time. Just don't try to write on it in segmented mode.
Code:
.code
jmp @F
txt db 'abc',0
@@:
    
Post 22 Aug 2020, 13:56
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
I understood you.
Not good for me.
I use @ symbol.

I do that in my Fasm++:
Code:
jmp .class%
   .%classb: db "@",0
.class%:
   mov dword [@.c],.%classb
    

This get on % 0 than 1 than 2. On symbol @ put some text name.
jmp .class0
.0classb: db "Bill",0
.class0:
jmp .class1
.1classb: db "Tom",0
.class1:

PS: this fine for 32 bits and 64 bits.
Post 22 Aug 2020, 14:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Code:
   mov dword [@.c],.%classb
processed: mov dword[@.c],.%classb
error: undefined symbol '@.c'.    
You have to define the label @.c somewhere.
Post 22 Aug 2020, 14:12
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
Quote:

You have to define the label @.c somewhere.

No. I use mov dword[@.c] in my ^cls
Post 22 Aug 2020, 14:14
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
How replace @ to $ in this case ?
jmp @F
txt db 'abc',0
@@:
Post 22 Aug 2020, 14:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Roman: We don't know what you are doing. We have trouble reading your mind.

Give a minimal code sample showing your problem.
Post 22 Aug 2020, 14:16
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 828
Roman
Quote:

jmp @F
txt db 'abc',0
@@:

My problem this does not fit for me.
Because i use token @.

It's a pity that fasm can't use another token not a @ for label @@:


Last edited by Roman on 22 Aug 2020, 14:21; edited 1 time in total
Post 22 Aug 2020, 14:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Then don't use @. Wink

Therein lies the problem of trying to bend things out of shape. Smile
Post 22 Aug 2020, 14:21
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3055
Location: vpcmipstrm
bitRAKE
Code:
        call @F
        db 'love it when a plan comes together',0
@@:     pop rax ; do something with constant string address    
...is the typical way.
Post 22 Aug 2020, 14:28
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.