Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to push an address using inline asm on Visual Studio 2013,

mov [asd], 0x80
push asd

instead of pushing the address, it pushes the value of asd

I have no idea how to overcome this any help is appreciated

What I have tried:

asd is the address, but when i go to the memory region with a hex viewer the push asd turns into push [asd]

I have no idea what to try next
Posted
Updated 1-Oct-18 22:24pm
v2

It's going to depend on the compiler, but for GCC it's:
C++
push $asd

See here, it might help: Using Inline Assembly in C/C++[^]
 
Share this answer
 
Comments
Member 14004556 2-Oct-18 4:12am    
I'm using visual c++
OriginalGriff 2-Oct-18 4:19am    
See here: https://msdn.microsoft.com/en-us/library/y8b57x4b.aspx
OriginalGriff 2-Oct-18 4:25am    
So you didn't bother to read the link, and see the code that does it at the bottom then?
Member 14004556 2-Oct-18 4:27am    
I just ended up reading it, thank u
OriginalGriff 2-Oct-18 4:43am    
You're welcome!
It depends on the used assembler. With MASM syntax which is used by Visual C/C++ you have to use the OFFSET keyword:
push OFFSET asd
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900