What's the point of...

Posts 1–9 of 9 · Page 1 of 1
What's the point of...
... this hackery?

Code:
void __cdecl PushToConsole( const char* szCommand )
{
DWORD *LTClient = ( DWORD* )( 0x3778BFB0 );
void* CONoff = ( void* )*( DWORD* )( *LTClient + 0x208 );
__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
The above code interprets integers as pointers which is never good.

The following does not depend on the size of a DWORD * and makes more sense programmatically. Also, it doesn't use inline asm so it will work on any compiler, not just MSVC.

Code:
blah blah the code I had wasn't quite right
Not saying everyone else is wrong, just that I think my way is more independent of any compiler/architecture.

Edit: Use this
Quote Originally Posted by markoj View Post
Code:
void PushToConsole(const char* szCommand)
{
    HMODULE hMod = GetModuleHandle("CShell.dll");
    if(hMod == NULL)
        return;
    int* ltClientAddr = (int*) 0x377E7810;
    
    typedef int (*ptc_t)(const char *);
    ptc_t ptc = *(ptc_t*) (*ltClientAddr + 0x208);
    ptc(Command);//edited this part so people cant c+p
}
1. It's how Gellin did it in his hack base for CA, and most "coders" on this forum have no idea what it does or how to change it.
2. It's illegal to add/subtract from a void*
3. Why didn't you just use
Code:
ptc_t ptc = *(ptc_t*) (*ltClientAddr + 0x208);
Actually neither of your ways worked, but my way did /

[php]void PushToConsole(const char* szCommand)
{
HMODULE hMod = GetModuleHandle("CShell.dll");
if(hMod == NULL)
return;
int* ltClientAddr = (int*) 0x377E7810;

typedef int (*ptc_t)(const char *);
ptc_t ptc = *(ptc_t*) (*ltClientAddr + 0x208);
ptc(Command);//edited this part so people cant c+p
}[/php]
Quote Originally Posted by mmbob View Post
2. It's illegal to add/subtract from a void*
3. Why didn't you just use
Code:
ptc_t ptc = *(ptc_t*) (*ltClientAddr + 0x208);
Bleh, I knew something was fishy about what I had.

Quote Originally Posted by Tekkn0logik
Not saying everyone else is wrong, just that I think my way is more independent of any compiler/architecture.
And, adding to a void pointer does the exact opposite of what I hoped to achieve, since afaik only gcc lets you do it :P

markoj is right, I shall shut up now
The above code interprets integers as pointers which is never good.
Thats wrong. DWORD is unsigned long/int, that means it goes from 0x00000000 to 0xFFFFFFFF and we know that an address on 32bit systems are 4 bytes long and the address would perfectly fit into a DWORD. I would use a void pointer, but in this case I would use DWORD pointer, cause you can access the value from the pointer with *, and that's why it's for.

But I'm with you with the ASM part. I don't know why people only want to use inline asm.
Quote Originally Posted by Gordon` View Post
Thats wrong. DWORD is unsigned long/int, that means it goes from 0x00000000 to 0xFFFFFFFF and we know that an address on 32bit systems are 4 bytes long and the address would perfectly fit into a DWORD. I would use a void pointer, but in this case I would use DWORD pointer, cause you can access the value from the pointer with *, and that's why it's for.

But I'm with you with the ASM part. I don't know why people only want to use inline asm.
Yeah, I kinda realized what I said about the DWORD * stuff was dumb. Whatever, my point still stands that there are better ways to do it than the inline ASM hackery and through this thread we have developed one. markoj's solution works perfectly and is good, solid code.
They are ignorant. I've posted how to do without inline asm, but no one wants to use it.
You just edited the LTC client to the update, the first code you posted is not up to date.
Quote Originally Posted by 5donotenter View Post
You just edited the LTC client to the update, the first code you posted is not up to date.
Did you read anything
Posts 1–9 of 9 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us