Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY! > Extenders

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 19.02.2008, 21:53   #1
roxaz
Guest
 
Posts: n/a
Default [Tutorial]Finding things in server exe (for newbies)

I remember myself when i barely knew asm and i was always asking how do ppl find a place to hook in exe. It is so big and confusing.. So i decided i must share knowledge to our apprentice programmers.


So lets start:

1. get l2server.exe and disassemble it in IDA. No explanations for that, even an idiot would manage to do this.

2. get list of l2server functions. lots of them were posted around in this forum (so you will need to use your searching skills ofcourse)

3. you also need basic understanding of programming, assembler(x64) and brain. dont worry if you are not too good with asm, you shold know basic instructions and what they do and registers.


now when we got all we need lets think what we would like to find. why dont we find a place where *user holds his *socket? So where do we start looking? we obviously need pointer to user. lets go to functions list and seach for user pased as an argument to function, or better, function that belongs to user class (when we call method of an object in assembler we get passed object itself to that method in rcx register). Look what i found in the functions list:

Code:

Code:
007FE950  User::Set(CUserSocket*)
so we have method that sets socket to our user. lets go in IDA to see it at 0x007FE950. We see some variables declared, some registers stored in stack and finaly first interaction with our user and socket:

Code:

Code:
.text:00000000007FE97B                 mov     rdi, rdx        ; socket
.text:00000000007FE97E                 mov     rsi, rcx        ; user
remember, in rcx register was passed user itself. btw you should know that x64 uses __fastcall calling convention. this means that 4 first arguments are passed in registers (rcx, rdx, r8, r9) and remaining on stack. So back to the topic - as you see our user now is rsi, socket is rdi (so are rcx and rdx, but they are overwritten later). Click with mouse on rdi, IDA will mark all rdi's in function (you should be turned on graph view in right mouse button menu). scroll down the function and see where rdi is used. and what do we see:

Code:

Code:
.text:00000000007FE9F1                 mov     [rsi+2670h], rdi
rdi is moved somewhere to memory place of rsi+2670h (h in the end of number indicates that number is hexadecimal). So we move pointer of socket (we know it is a pointer from functions list, see declaration of function) to a memory place user+2670h. This is where your socket is stored. Now in your extender whenever you have pointer to user you will be able to get socket from that user Wink

Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Дата оценена по относительному времени в снимке (4 Weeks Ago); точное время не сохранилось. Открыть источник.
 
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:18.