Home Forum MultiPlayer Game Hacks & Cheats CrossFire Hacks & Cheats CrossFire Hack Coding / Programming / Source Code ASM doubt Posts 1–13 of 13 · Page 1 of 1
ASM doubt
Hey, I've been playing arround in assembly, and, doing some
experiments, I've come across an issue. How do I pass
and integer to an pointer in ASM?
I've tried:
Code:
MOV [pPlayerClient + 4 * i], -56
MOV DWORD PTR [pPlayerClient + 4 * i], -56
MOV DWORD PTR SS:[pPlayerClient + 4 * i], -56
and so on...
Thanks for any help.
dude what damn english is it ?, i did not understand what do you mean.
integer to pointer ?.
Code:
int addr = 0xABCDEF;
mov eax, [ addr ]
mov ecx, [ eax ]
; mov [ ecx ], some_shit
Code:
#define MAX_INDEX 25
xor esi, esi
_label:
mov [ pPlayerClient + esi * 4 ], FFFFFFAAh
inc esi
cmp esi, MAX_INDEX
jnz _label
???
Originally Posted by
luizimloko
dude what damn english is it ?, i did not understand what do you mean.
integer to pointer ?.
Code:
int addr = 0xABCDEF;
mov eax, [ addr ]
mov ecx, [ eax ]
; mov [ ecx ], some_shit
Code:
#define MAX_INDEX 25
xor esi, esi
_label:
mov [ pPlayerClient + esi * 4 ], FFFFFFAAh
inc esi
cmp esi, MAX_INDEX
jnz _label
???
I was trying to make the walk through walls function in ASM.
What I wanted to do is:
Code:
*(int*)(pPlayerClient + 4 * i) = -56;
MOV doesn't work to do this.
I saw your SuperKill source and tried like that too, but didn't work either.
Indirect access to memory require usage of registers.
try the following:
Code:
MOV EAX, pPlayerClient
MOV ESI, i
MOV DWORD PTR [EAX+ESI*4], -56
Originally Posted by
giniyat101
Indirect access to memory require usage of registers.
try the following:
Code:
MOV EAX, pPlayerClient
MOV ESI, i
MOV DWORD PTR [EAX+ESI*4], -56
That's what I was reading about, but modifying the register (ESI, it has values pre-defined)
won't cause any errors? Should I make a backup?
Originally Posted by
vaisefud3
That's what I was reading about, but modifying the register (ESI, it has values pre-defined)
won't cause any errors? Should I make a backup?
If you really care about these registers' old values, you can always push them on the stack and restore them later
Code:
PUSH EAX
PUSH ESI
; stuff
POP ESI
POP EAX
Originally Posted by
giniyat101
Indirect access to memory require usage of registers.
try the following:
Code:
MOV EAX, pPlayerClient
MOV ESI, i
MOV DWORD PTR [EAX+ESI*4], -56
Reduced FPS to 1 and had no effect at all.
@vaisefud3
now i understood what do you want, this way is more clean.
PS: if you want turn off this feature, you need save the org value (56) into the stack and restore posteriorly, or restore manually.
Code:
#define ADDR_LTCLIENTSHELL 0x0115B4D4
__declspec( noinline ) void WTWAssembly( void )
{
char *strCShell = ( char * ) "CShell.dll";
float fWTWValue = -56.0f;
__asm
{
push strCShell
call [ GetModuleHandleA ]
mov eax, [ eax + ADDR_LTCLIENTSHELL ]
mov ecx, [ eax + 70h ]
test ecx, ecx
jz _return
fld [ fWTWValue ]
fstp [ ecx + 580h ]
fld [ fWTWValue ]
fstp [ ecx + 584h ]
fld [ fWTWValue ]
fstp [ ecx + 588h ]
_return:
xor eax, eax
}
}
Originally Posted by
luizimloko
@vaisefud3
now i understood what do you want, this way is more clean.
PS: if you want turn off this feature, you need save the org value (56) into the stack and restore posteriorly, or restore manually.
Code:
#define ADDR_LTCLIENTSHELL 0x0115B4D4
__declspec( noinline ) void WTWAssembly( void )
{
char *strCShell = ( char * ) "CShell.dll";
float fWTWValue = -56.0f;
__asm
{
push strCShell
call [ GetModuleHandleA ]
mov eax, [ eax + ADDR_LTCLIENTSHELL ]
mov ecx, [ eax + 70h ]
test ecx, ecx
jz _return
fld [ fWTWValue ]
fstp [ ecx + 580h ]
fld [ fWTWValue ]
fstp [ ecx + 584h ]
fld [ fWTWValue ]
fstp [ ecx + 588h ]
_return:
xor eax, eax
}
}
Thank you! Just one more question, why the "h" after the offsets?
Originally Posted by
vaisefud3
Thank you! Just one more question, why the "h" after the offsets?
Use 'h' to hex value.
'd' to dec value...
@
Wyo question answered, please close. Thank You All!
@
luizimloko , your source crashes the game.
Originally Posted by
vaisefud3
@
Wyo question answered, please close. Thank You All!
@
luizimloko , your source crashes the game.
if you want use exactly like the SKill source, you should modify the original code for this:
Code:
#define ADDR_LTCLIENTSHELL 0x0115B4D4
__declspec( naked ) DWORD WINAPI WTWAssembly( void * )
{
static char *strCShell = ( char * ) "CShell.dll";
static float fWTWValue = -56.0f;
__asm
{
_loop:
push strCShell
call [ GetModuleHandleA ]
test eax, eax
jz _return
mov eax, [ eax + ADDR_LTCLIENTSHELL ]
test eax, eax
jz _return
mov ecx, [ eax + 70h ]
test ecx, ecx
jz _return
fld [ fWTWValue ]
fstp [ ecx + 580h ]
fld [ fWTWValue ]
fstp [ ecx + 584h ]
fld [ fWTWValue ]
fstp [ ecx + 588h ]
_return:
push 6Ah
call [ Sleep ]
jmp _loop
}
}
BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved )
{
if( dwReason == DLL_PROCESS_ATTACH )
CreateThread( 0, 0, &WTWAssembly, 0, 0, 0 );
return 1;
}
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.