Solved Small Assembly question

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

NTvalk

Hacker
Meme Tier VIP
Jul 6, 2013
499
3,108
8
Hello I have a question about the lea instruction and arrays, This works fine:
C++:
  char *msg = new char[6];
  msg = "hello";

    _asm{
		push        10h
		push        0
		mov         eax, [msg]
		push        eax
		push        0
		call        MessageBox
         }
}
But why do I get an "operand size conflict" error here?

C++:
  char msg2[] = "hey2";
	_asm{
		push        10h
		push        0
		mov         eax, [msg2]
		push        eax
		push        0
		call        MessageBox
	}
And why does it work with lea?

C++:
  char msg2[] = "hey2";
	_asm{
		push        10h
		push        0
		lea         eax, [msg2]  // <-
		push        eax
		push        0
		call        MessageBox
	}
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
mov will copy first 4 chars as a dword, and lea will load the address of beginning of the string
 
Status
Not open for further replies.
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods