Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 22:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



c++ ASM Problem

Discussion on c++ ASM Problem within the C/C++ forum part of the Coders Den category.

Closed Thread
 
Old   #1
 
PsychoXReaper's Avatar
 
elite*gold: 24
Join Date: Feb 2012
Posts: 1,173
Received Thanks: 3,113
c++ ASM Problem

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
PsychoXReaper is offline  
Old 07/26/2012, 00:17   #2
 
elite*gold: 31
Join Date: Oct 2011
Posts: 2,276
Received Thanks: 2,029
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!
__BuRn3R is offline  
Thanks
1 User
Old 07/26/2012, 00:37   #3
 
PsychoXReaper's Avatar
 
elite*gold: 24
Join Date: Feb 2012
Posts: 1,173
Received Thanks: 3,113
@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
PsychoXReaper is offline  
Old 07/26/2012, 15:17   #4
 
elite*gold: 0
Join Date: Jul 2010
Posts: 388
Received Thanks: 196
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
SmackJew is offline  
Old 07/26/2012, 16:04   #5


 
Ende!'s Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 6,378
Received Thanks: 7,996
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
Ende! is offline  
Thanks
1 User
Old 07/26/2012, 20:16   #6
 
PsychoXReaper's Avatar
 
elite*gold: 24
Join Date: Feb 2012
Posts: 1,173
Received Thanks: 3,113
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
PsychoXReaper is offline  
Old 07/26/2012, 23:17   #7
 
elite*gold: 0
Join Date: Jul 2010
Posts: 388
Received Thanks: 196
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.
SmackJew is offline  
Old 07/27/2012, 08:52   #8


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,902
Received Thanks: 25,407
Quote:
Too much Java.
shame on you
MrSm!th is offline  
Thanks
5 Users
Closed Thread


Similar Threads Similar Threads
[Problem]Habe ein Problem und zwar spinnt mein VPC etwas(ohne Grund)?!
07/28/2011 - Metin2 Private Server - 10 Replies
Also wie schon gesagt meins Server spinnt wodurch kiks usw. kommen :( ich lade euch die Screens in den Anhang, mit der Hoffnung, dass ihr mir helfen könnt :) wäre echt sehr nice :)



All times are GMT +1. The time now is 22:02.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.