Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 14:34

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

Advertisement



About custom packets, PLS Help me, Thaks!

Discussion on About custom packets, PLS Help me, Thaks! within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2012
Posts: 53
Received Thanks: 6
Talking About custom packets, PLS Help me, Thaks!

hi every one:

PHP Code:
void CNetProcessIn::OnB983(CMsgStreamBuffer &msg) {

    
DEBUG_PRINT_CALL()

    
std::n_string recvMsg;
    
msg >> recvMsg;
    
msg.FlushRemaining();

    
char *cstr = new char[recvMsg.length() + 1];
    
strcpy(cstrrecvMsg.c_str());

    
g_vRank.clear();
    
char *tmp strtok(cstr"#");
    while (
tmp != NULL)
    {
        
g_vRank.push_back(tmp);
        
tmp strtok(NULL"#");
    }

    
delete [] cstr;

    if (!
g_vRank.empty())
    {
        
CIFConvert cc;
        
g_Charname->SetText(cc.AnsiToUnicode(g_vRank[0].c_str()));
    }

    
reinterpret_cast<void (__thiscall *)(CNetProcessIn *, CMsgStreamBuffer &)>(0x0084CAB0)(thismsg);

The code does what I need, but the sro_client.exe will be crash once in a while. It happens every 3~5 times when i received 0xB983.


I know the problem is at

PHP Code:
reinterpret_cast<void (__thiscall *)(CNetProcessIn *, CMsgStreamBuffer &)>(0x0084CAB0)(thismsg); 

but, i do not know how to get a stable(safe)address,

I can not understand F0 or HB's guide.

I want to know which address I should hook up to and if someone can share that address with me, Thank you very much,

I do not know ASM, last, sorry for my english.:D
halloway520 is offline  
Old 10/21/2020, 21:47   #2
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
The answer is simple: Don't call 0x0084CAB0 in the end. You don't need it.

Explanation:
That function looks like it belongs to the CNetProcessIn implementation I added to SRO_DevKit. B983 is not a standard msgid, therefore I guess it's a custom one.
CNetProcessIn will call your handler function if a message with that Id is received. Your handler has to read all bytes from the message, otherwise the game will think there was an error.

The redirection in the end is only required when a function is hooked. You redirect some function to your own function and call the original function in the end to close the loop.
Since your handler function is entirely your own creation and has no equivalent in the game, you don't need to call any original function in the end (since you don't have one). You can just leave the function without that. It'll work fine.
florian0 is offline  
Thanks
2 Users
Old 10/22/2020, 04:00   #3
 
elite*gold: 0
Join Date: Dec 2012
Posts: 53
Received Thanks: 6
Thumbs up

Quote:
Originally Posted by florian0 View Post
The answer is simple: Don't call 0x0084CAB0 in the end. You don't need it.

Explanation:
That function looks like it belongs to the CNetProcessIn implementation I added to SRO_DevKit. B983 is not a standard msgid, therefore I guess it's a custom one.
CNetProcessIn will call your handler function if a message with that Id is received. Your handler has to read all bytes from the message, otherwise the game will think there was an error.

The redirection in the end is only required when a function is hooked. You redirect some function to your own function and call the original function in the end to close the loop.
Since your handler function is entirely your own creation and has no equivalent in the game, you don't need to call any original function in the end (since you don't have one). You can just leave the function without that. It'll work fine.

You solved my confusion, The program is working perfectly.

Again, thank you for your great contribution. Thank epvp.

fix.
halloway520 is offline  
Thanks
1 User
Old 10/24/2020, 04:30   #4

 
devdash's Avatar
 
elite*gold: 14
Join Date: Feb 2016
Posts: 1,607
Received Thanks: 445
It's sad when i see things looks shiny but i do not understand it still.
Will i be able to understand what are you guys talking about if i start learning C#?
i started already but i still can't understand anything, maybe on a higher level of C#?

i really wish someday i can understand what are you guys talking about here, because i feel i am not even in the trace race.

give me hints, so i can join the trace <3
devdash is offline  
Old 10/24/2020, 06:21   #5
 
elite*gold: 0
Join Date: Apr 2020
Posts: 79
Received Thanks: 42
Quote:
Originally Posted by alydandy View Post
It's sad when i see things looks shiny but i do not understand it still.
Will i be able to understand what are you guys talking about if i start learning C#?
i started already but i still can't understand anything, maybe on a higher level of C#?

i really wish someday i can understand what are you guys talking about here, because i feel i am not even in the trace race.

give me hints, so i can join the trace <3
ahaha, i felt like you're describing me.
irockalone is offline  
Old 10/24/2020, 08:37   #6
 
JellyBitz's Avatar
 
elite*gold: 0
Join Date: Sep 2018
Posts: 419
Received Thanks: 943
Starts with basic knowledge.
is a good start, never is too late.
JellyBitz is offline  
Reply


Similar Threads Similar Threads
Packets packets packets...
10/06/2012 - CO2 Private Server - 13 Replies
I have been struggling to understand what is a Packet how could i create one with the data i want then send it to my server So please any one tell if as example i want to send some info from my client to my server, then handle them from the server how could i do that : i have my socket server, also i don't wanna copy and paste codes i want to UNDERSTAND. My PacketReader.cs
Vipmt2 help for Thaks pls! pls! pls!
05/26/2009 - Metin2 Private Server - 3 Replies
Könnte einer von euch mir diesen capacha entziffern bitte bitte ich schaff es nicht hier:http://img43.imageshack.us/img43/8940/beztytu ubhu.png



All times are GMT +1. The time now is 14:35.


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.