As the title,
Orpheu code and the signature:
Code:
#include <amxmodx>
#include <orpheu>
#define PLUGIN_NAME "NewPlugin"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "LittleKu-Lv"
public plugin_precache()
{
OrpheuRegisterHook(OrpheuGetFunction("SetProgressBarTime", "CBasePlayer"), "OnSetProgressBarTime");
}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
}
public OrpheuHookReturn:OnSetProgressBarTime(id, iTime)
{
return OrpheuSupercede;
}
Code:
{
"name" : "SetProgressBarTime",
"class" : "CBasePlayer",
"library" : "mod",
"arguments" :
[
{
"type" : "int"
}
],
"identifiers":
[
{
"os" : "windows",
"mod" : "cstrike",
"value" : [0x51,0x53,0x55,0x56,0x57,0x8B,"*","*","*",0x33,"*",0x3B,"*",0x8B,"*",0x74],
},
{
"os" : "linux",
"mod" : "cstrike",
"value" : "_ZN11CBasePlayer18SetProgressBarTimeEi"
}
]
}
chooker code:
Code:
#include "amxxmodule.h"
#include "chooker.h"
CHooker HookerClass;
CHooker* Hooker = &HookerClass;
#ifdef _WIN32
#define DUMMY_VAL 0
typedef int DUMMY;
typedef void ( __fastcall *FuncSetProgressBarTime ) ( void*, DUMMY, int );
void __fastcall FuncSetProgressBarTime_Hook( void* pvPlayer, DUMMY, int iTime );
#else
typedef void ( *FuncSetProgressBarTime ) ( void*, int );
void FuncSetProgressBarTime_Hook( void* pvPlayer, int iTime );
#endif
CFunc* FuncSetProgressBarTimeHook = NULL;
FuncSetProgressBarTime FuncSetProgressBarTimeOrig = NULL;
#ifdef _WIN32
void __fastcall FuncSetProgressBarTime_Hook( void* pvPlayer, DUMMY, int iTime )
#else
void FuncSetProgressBarTime_Hook( void* pvPlayer, int iTime )
#endif
{
if( FuncSetProgressBarTimeHook->Restore() )
{
FuncSetProgressBarTimeOrig( pvPlayer, DUMMY_VAL, iTime );
FuncSetProgressBarTimeHook->Patch();
}
printf("\n\t\tSet Progress Bar Time .iTime is %i\n", iTime);
}
void OnMetaAttach()
{
#ifdef _WIN32
FuncSetProgressBarTimeOrig = Hooker->MemorySearch< FuncSetProgressBarTime >( "0x51,0x53,0x55,0x56,0x57,0x8B,*,*,*,0x33,*,0x3B,*,0x8B,*,0x74", ( void* )MDLL_Spawn, FALSE );
#else
FuncSetProgressBarTimeOrig = Hooker->MemorySearch< FuncSetProgressBarTime>( "_ZN11CBasePlayer18SetProgressBarTimeEi", ( void* )MDLL_Spawn, TRUE );
#endif
FuncSetProgressBarTimeHook = Hooker->CreateHook( ( void* )FuncSetProgressBarTimeOrig, ( void* )FuncSetProgressBarTime_Hook, TRUE );
printf( "\n %s v%s - by %s.\n -\n", MODULE_NAME, MODULE_VERSION, MODULE_AUTHOR );
if( !FuncSetProgressBarTimeOrig )
printf( " Signature/symbol could not be found.\n\n" );
else if( !FuncSetProgressBarTimeHook )
printf( " Hook creation failed.\n\n" );
else
printf( " Loaded with success.\n\n" );
}
and the problem is chooker can find the function, but the Orpheu log a error message .
anything did I wrong ?
__________________