AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   any difference between the Orpheu and chooker ? (https://forums.alliedmods.net/showthread.php?t=217700)

K.K.Lv 06-06-2013 09:08

any difference between the Orpheu and chooker ?
 
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 ?

Arkshine 06-06-2013 10:34

Re: any difference between the Orpheu and chooker ?
 
And we have to guess what error you're talking about ?

K.K.Lv 06-06-2013 11:01

Re: any difference between the Orpheu and chooker ?
 
Sorry for my bad,
Orpheu log error message is :
Code:

[ORPHEU] Function "CBasePlayer::SetProgressBarTime" not found
L 06/06/2013 - 20:39:26: [AMXX] Run time error 10 (plugin "test.amxx") (native "OrpheuGetFunction") - debug not enabled!
L 06/06/2013 - 20:39:26: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/06/2013 - 20:42:58: Start of error session.


Arkshine 06-06-2013 12:20

Re: any difference between the Orpheu and chooker ?
 
Paste or attach the orpheu log file generated when you hit "orpheu config". It should say the file is not formatted properly.

Actually, looking at your copy-paste, in "..0x74]," the "," should be removed.

Always checking the output of the config parsing.

K.K.Lv 06-06-2013 13:26

Re: any difference between the Orpheu and chooker ?
 
the problem still exist !
Code:

                Parsing folder "CBasePlayer" started
                        Parsing file "SetProgressBarTime" started
                                Argument type "int" validated
                                Searching for signature "[0x51][0x53][0x55][0x56][0x57](...)" ... NOT FOUND
                        Parsing file "SetProgressBarTime" ended


Arkshine 06-06-2013 14:42

Re: any difference between the Orpheu and chooker ?
 
Code:

[0x51,0x53,0x55,0x56,0x57,0x8B,"*","*","*",0x33,"*",0x3B]
or
Code:

"0x51,0x53,0x55,0x56,0x57,0x8B,*,*,*,0x33,*,0x3B"

K.K.Lv 06-06-2013 21:37

Re: any difference between the Orpheu and chooker ?
 
problem has been solved.
not the signature.I just made ​​a stupid mistake.
all of the cod above are find !


All times are GMT -4. The time now is 16:23.

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