c++ ASM Problem

07/25/2012 23:37 PsychoXReaper#1
hey guys i was trying to add my ASM into c++ it went good but when i add
Quote:
add [0x34532F73],ah
it give me an err while building
Quote:
error C2415: improper operand type
anyway here is my code

Code:
void func()
{
_asm
	{
push ebx
jns 0x01061F5F
popad 
jb 0x01061F69
push 0x0073746F
add [0x34532F73],ah
jmp func_ret_addy
	}
}
AnyIdea
07/26/2012 00:17 __BuRn3R#2
I can't Asm, but maybe it goes like this:
Code:
void func()
{
DWORD Adress = 0x34532F73;
_asm
	{
push ebx
jns 0x01061F5F
popad 
jb 0x01061F69
push 0x0073746F
add [Adress],ah
jmp func_ret_addy
	}
}
Greet's, BuRn3R!
07/26/2012 00:37 PsychoXReaper#3
@BuRn3R
thx for helping

now a new error XD
Quote:
error C2443: operand size conflict
i guess the err comes from the addy since if u change the addy all works fine
07/26/2012 15:17 SmackJew#4
Quote:
Originally Posted by Darsh2012 View Post
@BuRn3R
thx for helping

now a new error XD

i guess the err comes from the addy since if u change the addy all works fine
Code:
mov eax, 0x34532F73
add dword ptr [eax] ,ah
07/26/2012 16:04 Ende!#5
Quote:
Originally Posted by SmackJew View Post
Code:
mov eax, 0x34532F73
add dword ptr [eax] ,ah
Bad idea - ah is an 8-byte part of eax, so the size specifier has to be byte - your code would just lead to another size conflict. Also, the first instruction would overwrite the register's original value, so the value at 0x34532F73 were increased by 0x2F (what's obviously not OP's aim).

An additional register usage is not required, the following syntax is perfectly valid:
Code:
add byte ptr ds:[0x34532F73], ah
Edit:
My code implies that the target value at 0x34532F73 is of BYTE type. If that's not the case, you'll have to do something similar to this for a DWORD typed value:
Code:
movzx eax, ah
add dword ptr ds:[0x34532F73], eax
Or something like this for a word value:
Code:
movzx ax, ah
add word ptr ds:[0x34532F73], ax
07/26/2012 20:16 PsychoXReaper#6
Quote:
Originally Posted by Ende! View Post
Bad idea - ah is an 8-byte part of eax, so the size specifier has to be byte - your code would just lead to another size conflict. Also, the first instruction would overwrite the register's original value, so the value at 0x34532F73 were increased by 0x2F (what's obviously not OP's aim).

An additional register usage is not required, the following syntax is perfectly valid:
Code:
add byte ptr ds:[0x34532F73], ah
Edit:
My code implies that the target value at 0x34532F73 is of BYTE type. If that's not the case, you'll have to do something similar to this for a DWORD typed value:
Code:
movzx eax, ah
add dword ptr ds:[0x34532F73], eax
Or something like this for a word value:
Code:
movzx ax, ah
add word ptr ds:[0x34532F73], ax
thx Ende for ur help
Problem Solved #CloseRequest
07/26/2012 23:17 SmackJew#7
Quote:
Originally Posted by Ende! View Post
Bad idea - ah is an 8-byte part of eax, so the size specifier has to be byte - your code would just lead to another size conflict. Also, the first instruction would overwrite the register's original value, so the value at 0x34532F73 were increased by 0x2F (what's obviously not OP's aim).
You're right. I have barely typed or read a shred of ASM in years, I shouldn't be posting. Too much Java. :(
07/27/2012 08:52 MrSm!th#8
Quote:
Too much Java.
shame on you