This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Patching memory


Post New Thread Reply   
 
Thread Tools Display Modes
Alexander.3
Junior Member
Join Date: May 2009
Old 02-05-2013 , 11:58   Re: Patching memory
Reply With Quote #11

You can show is any example with patching memory for Metamod?

I looked at all the threads in this category. I think a complete and easy way to be useful to everyone.

Last edited by Alexander.3; 02-05-2013 at 11:59.
Alexander.3 is offline
Send a message via ICQ to Alexander.3 Send a message via Skype™ to Alexander.3
Alexander.3
Junior Member
Join Date: May 2009
Old 02-05-2013 , 18:58   Re: Patching memory
Reply With Quote #12

Hmm.. crashing server.
PHP Code:
#include "amxxmodule.h"

#define LODWORD(l) ((DWORD)((DWORDLONG)(l))) 

void *base;
void Message();


void FN_ClientCommand(edict_t *pEntity)
{
    const 
charcmd CMD_ARGV(0);

    if (
strcmp(cmd"test")  == 0) {
        
Message();
        
SERVER_PRINT("testcomplete");
        
RETURN_META(MRES_SUPERCEDE);
    }
    
RETURN_META(MRES_IGNORED);
}  

int DispatchSpawnedict_t *pEdict )
{
    
base GetModuleHandleA("mp.dll");
    return 
0;
}

void Message()
{
    
typedef void (*FN_SayMessage)(char *namechar *message);

    
FN_SayMessage SayMsgs = (FN_SayMessage)((DWORD)base 0x1623FC);
    
    
SayMsgs("NewNick""MegaMessage");


Last edited by Alexander.3; 02-05-2013 at 18:59.
Alexander.3 is offline
Send a message via ICQ to Alexander.3 Send a message via Skype™ to Alexander.3
Alexander.3
Junior Member
Join Date: May 2009
Old 02-07-2013 , 05:06   Re: Patching memory
Reply With Quote #13

Full instructions, I sent a message

1. Step ( Searching function )
1.1
For example, I find the function "print_center"
To begin, I started looking for any message that use in "print_center", I chose "World triggered \" Round_End \ "\ n"
CTRL + F looking sub_100CFCD0


1.2
Leafing slightly up and get the body functions ( sub_10093C70 )


1.3

Searching this function ( sub_10093C70 )

int __cdecl sub_10093C70(int a1, int a2);
a1 = Arg1
a2 = Arg2

2.0 ( Creating C++ code )
Obtain real offsets
sub_10093C70 = 093C70 = 0x093C70


Full code:
PHP Code:
#include "amxxmodule.h"

void *base;
void Message(char *Message);

void FN_ClientCommand(edict_t *pEntity) {
    const 
charcmd CMD_ARGV(0);

    if (
strcmp(cmd"test")  == 0) {
        
        
Message("Alexander.3 watching you");
    
        
RETURN_META(MRES_SUPERCEDE);
    }
    
RETURN_META(MRES_IGNORED);
}  

int DispatchSpawnedict_t *pEdict ) {
    
base GetModuleHandleA("mp.dll");
    return 
0;
}

void Message(char *Message) {
    
typedef void (*FN_Msg)(int v);
    
FN_Msg MessageCenter = (FN_Msg)((DWORD)base 0x093C70);
    
MessageCenter((int)Message);

Screenshot:


Arg2 not used.. I wonder why is it used?
Alexander.3 is offline
Send a message via ICQ to Alexander.3 Send a message via Skype™ to Alexander.3
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2013 , 06:35   Re: Patching memory
Reply With Quote #14

The function is : void EndRoundMessage( const char* sentence, int event );

event param is just to help to filter if message is for team, and what team.

Spoiler


What you do is just retrieving function address and calling it, how it's related to this thread which is patching things in memory?
__________________

Last edited by Arkshine; 02-07-2013 at 06:37.
Arkshine is offline
Alexander.3
Junior Member
Join Date: May 2009
Old 02-07-2013 , 08:17   Re: Patching memory
Reply With Quote #15

Arkshine
Thank for event list.
as is using in my function!?
Why sends message, even if you specify a 1337 event

Quote:
What you do is just retrieving function address and calling it, how it's related to this thread which is patching things in memory?
I would like it to ask you. As it is now to replace this piece of memory.
How could provide a "correct" patch that will work. For example block
Alexander.3 is offline
Send a message via ICQ to Alexander.3 Send a message via Skype™ to Alexander.3
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 02-07-2013 , 10:22   Re: Patching memory
Reply With Quote #16

If i understand this, you have hooked main function sub_10093C70 in which World triggered \" Round_End \ is called?
You haven't patched address sub_100CFCD0 (function call) to your new function?
Anyway great for sharing this with us
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Alexander.3
Junior Member
Join Date: May 2009
Old 02-07-2013 , 10:29   Re: Patching memory
Reply With Quote #17

OvidiuS
function sub_10093C70 - send message in "print center"
A good example:


Quote:
You haven't patched address sub_100CFCD0 (function call) to your new function?
Unfortunately I only got to send messages, and how to lock / replace ... I have no idea. =(
Alexander.3 is offline
Send a message via ICQ to Alexander.3 Send a message via Skype™ to Alexander.3
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2013 , 10:59   Re: Patching memory
Reply With Quote #18

Hook the function...
__________________
Arkshine is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 02-07-2013 , 16:42   Re: Patching memory
Reply With Quote #19

Thanks Alexander. I get it now
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-09-2013 , 17:23   Re: Patching memory
Reply With Quote #20

Arkshine if I have hooked my function, how to block it? By using memcpy? Can you give some examples
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Reply



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 -4. The time now is 16:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode