OpenSource

02/24/2012 00:18 bloodx#1
I just started this Thread for all to post Source Codes/Snippes/Packets what ever.

Looks like some more People now know how to work with the Public Sources.

Here a little "Base"
02/24/2012 00:27 hoseta#2
good release thanks, public source's are always good book for learning :]
02/24/2012 01:43 bloodx#3
IngameChat Hook
thx to NOOR/Syron
PHP Code:
void __stdcall MyChatBox(charrw)
{
    if (
strcmp(rw,"/Test") == 0)
    {
        
//do your stuff..
    
}
}
DWORD MyChatBack;
void __declspecnaked MyChatHook()
{
    
__asm
    
{
            
add        esp,4
            mov     eax
esp
            push    eax
            call    MyChatBox
            jmp MyChatBack
;
    }
}
BYTE pChatBoxHook[] = {0x83,0xC4,0x04,0x85,0xC0,0x74,0x02,0xEB,0x26,0x8B,0x55,0xF8,0x52,0x68,0x00,0x00,0x00,0x00,0x6A,0x11,0xE80x000x00,0x00,0x00};
    
charChatBoxHook "xxxxxxxxxxxxxx????xxx????";

    
MyChatBack=CFunction::dwFindPattern(0x00400000,0x00700000,pChatBoxHook,ChatBoxHook);
    
CFunction::Intercept(INST_JMP,MyChatBack,reinterpret_cast<DWORD>(MyChatHook),9);
    
MyChatBack += 0x09
02/24/2012 10:34 pamz12#4
@above
the right thing i needed thanks alot :)

ty to NOOR too
02/24/2012 16:19 Roronoa Z.#5
da hat wohl jmd ne vorliebe für reinterpret_cast gefunden ;D
02/24/2012 16:22 bloodx#6
wozu C-Casts benutzten :P
02/24/2012 17:13 RunzelEier#7
geht schneller und macht das gleiche :P
02/25/2012 18:16 hoseta#8
could some1 help me with recv npc ID ?,
which recv packet i need to use?, have no idea, and i didint try to work with send yet.
02/25/2012 18:24 Kealy#9
Quote:
Originally Posted by bloodx View Post
((*reinterpret_cast<DWORD*>(0x004921F4 + 1)) + (0x004921F4 + 1) + 4)
Quote:
Originally Posted by bloodx View Post
#include <everything.h>
Quote:
Quote:
Originally Posted by Roronoa Z. View Post
da hat wohl jmd ne vorliebe für reinterpret_cast gefunden ;D
Quote:
Originally Posted by bloodx View Post
wozu C-Casts benutzten :P
Quote:
Originally Posted by bloodx View Post
if (strcmp(rw,"/Test") == 0)
wozu std::string benutzen ?
Quote:
Originally Posted by bloodx View Post
DWORD MyChatBack;
void __declspec( naked ) MyChatHook()
{
__asm
{
add esp,4
mov eax, esp
push eax
call MyChatBox
jmp MyChatBack;
}
}
[Only registered and activated users can see links. Click Here To Register...]

Lolwut.
Besides the horrible reinterpret_casts, and the pattern search, this looks so fucking much like ZeroTen's ugly source.
02/25/2012 19:01 bloodx#10
Quote:
Originally Posted by Kealy View Post

Lolwut.
Besides the horrible reinterpret_casts, and the pattern search, this looks so fucking much like ZeroTen's ugly source.
Yeah I diddn't checked the includes already had know there are useless one's. c&p from a other Project I had left here.

thx for tip with std::string ;) I will change it for sure.


uhm nah it's not ZeroTen's source.
02/25/2012 19:57 MoepMeep#11
Quote:
Originally Posted by hoseta View Post
could some1 help me with recv npc ID ?,
which recv packet i need to use?, have no idea, and i didint try to work with send yet.
should be 0x34.
02/25/2012 20:21 Kealy#12
Quote:
Originally Posted by bloodx View Post
Yeah I diddn't checked the includes already had know there are useless one's. c&p from a other Project I had left here.

thx for tip with std::string ;) I will change it for sure.


uhm nah it's not ZeroTen's source.
Baah, 'k.
Now I look like the bad guy <:

So, if you want to gear up on efficiency a bit, you should read some [Only registered and activated users can see links. Click Here To Register...], and see how you can use it.
It's there to be used.

Also, like RunzelEier already said, using reinterpret_cast will do exactly the same as C-style cast, it just makes the code more confusing overall, if you overuse it.
And in the end, type-casting doesn't exist in ASM (unless you change from signed/unsigned or change the container width).

You should also learn some [Only registered and activated users can see links. Click Here To Register...], to have a clear understanding of calling conventions and what they imply, the stack and how it reacts upon push/pop, et cetera.
Detouring functions using direct JMP's toward declspec(naked) functions is just a bad design. (that's how ZeroTen does it)
You shouldn't do that unless it's absolutely necessary.
It is always better to reserve a few bytes ahead, and push the necessary variables on the stack, and then call your hook, this way, you can create your own local variables, and use whichever calling convention you like, without having to worry where to jump back.
And it will look a lot better. (because yes, people should care about style)

Detouring class functions should be linked toward __fastcall hooks, and those hooks should NOT be in a class, not even static. It is better to leave them in a namespace, to keep things ordered.
The reason I'm saying this, is because forcing calling conventions on member functions will confuse the compiler, and cause undefined behaviour. (like moving edx into ecx in a __fastcall member function).

Declaring class instances using extern and using static member functions are also a bad design.
The "extern" keyword might be the "approved" way to declare globals, but that's not something you should rely on.
Classes are meant to be used for object-oriented programming, not to be used as a wrapper.
Therefore, static members should only be used within a class if you use a singleton patterning.

So, that's pretty much it =]
02/25/2012 20:30 ilQr#13
hi it is
02/25/2012 21:08 hoseta#14
Quote:
Originally Posted by MoepMeep View Post
should be 0x34.
@MoepMeep, big thanks getting id work fine.

but is there a way to get correct name of npc?

[Only registered and activated users can see links. Click Here To Register...]
02/25/2012 22:14 Kealy#15
Read it from message.dat ?