Announcement

Collapse
No announcement yet.

Hooking USERMSG (also for sXe-Injected)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hooking USERMSG (also for sXe-Injected)

    This code can be used to hook and list all USERMSG, included the ones of sXe-Injected. Also you can hook them. But is better to hook the relevant sXe-Injected usermsg's related to checks results on the clientside, using another way of hooking.

    Credits: GD, Karman

    Code:
    DWORD msgOrg = 0;

    Code:
     typedef struct _UserMgsList{
    
    DWORD unknown1,unknown2;
    CHAR msgname[16];
    struct _UserMgsList *next;
    DWORD address;
    }UserMgsList,*PUserMgsList;

    Code:
     DWORD GetUserMsgHook(PCHAR name){
    
    PBYTE address=(PBYTE)msgOrg;
    PUserMgsList uml=*(PUserMgsList*)(*(PDWORD)(((address+=0x1A)+*(PDWORD)(address+1)+5)+0x0D));
    
    int x = 0;
    while(uml){
    if(x==200) break;
    
    if(!strncmp(uml->msgname,name,16))
    {
    return uml->address;
    }
    else
    {
    }
    
    uml=uml->next;
    
    x++;
    }
    return 0;
    }


    Code:
     void GetUserMsgHookX(){
    
    PBYTE address=(PBYTE)msgOrg;
    PUserMgsList uml=*(PUserMgsList*)(*(PDWORD)(((address+=0x1A)+*(PDWORD)(address+1)+5)+0x0D));
    
    int x = 0;
    while(uml){
    if(x==200) break;
    
    uml=uml->next;
    
    x++;
    }
    }

    Code:
     static pfnUserMsgHook TeamInfoOrg= NULL;


    Code:
     static int TeamInfo(const char* pszName, int iSize, void* pbuf){
    
    // YOUR CODE HERE
    
    return (*TeamInfoOrg)(pszName, iSize, pbuf);
    }



    Code:
     void SetupMsgHooks()
    {
    msgOrg = (DWORD)gEngfuncs.pfnHookUserMsg;// original
    
    //
    // now you can hook pfnHookUserMsg or use the xEngine version of it (function emulation)
    
    static bool bApplied = false;
    if (bApplied == false)
    {
    bApplied = true;
    TeamInfoOrg=(pfnUserMsgHook) GetUserMsgHook("TeamInfo\0");
    if(TeamInfoOrg)gEngfuncs.pfnHookUserMsg("TeamInfo\0", TeamInfo);
    }
    }

    Code:
     void UNHOOKMSG()
    {
    if(TeamInfoOrg)gEngfuncs.pfnHookUserMsg("TeamInfo\0", (int (*)(const char*, int, void*))TeamInfoOrg);
    }


    Example of listing all USERMSG


    MSG: Health - 0x20700DA0
    MSG: Money - 0x20700DD0
    MSG: Battery - 0x20700D70
    MSG: SayText - 0x20700280
    MSG: ScoreInfo - 0x20700BB0
    MSG: DeathMsg - 0x20700AC0
    MSG: SetFOV - 0x20700A50
    MSG: WeaponList - 0x20700A20
    MSG: CurWeapon - 0x20700950
    MSG: TeamInfo - 0x207005C0
    MSG: ResetHUD - 0x20700580
    MSG: ReqState - 0x196AA60
    MSG: VoiceMask - 0x196AA40
    MSG: ShowMenu - 0x19577B0
    MSG: Scenario - 0x19616E0
    MSG: TaskTime - 0x194B290
    MSG: BarTime2 - 0x194A160
    MSG: BarTime - 0x194A100
    MSG: RoundTime - 0x1949CD0
    MSG: BlinkAcct - 0x1940FD0
    MSG: Money - 0x1940F40
    MSG: StatusIcon - 0x1961FC0
    MSG: TextMsg - 0x19663C0
    MSG: SecAmmoIcon - 0x1941600
    MSG: SecAmmoVal - 0x1941570
    MSG: DeathMsg - 0x1943340
    MSG: StatusValue - 0x19624B0
    MSG: StatusText - 0x1962440
    MSG: GameTitle - 0x192E470
    MSG: HudTextArgs - 0x192E450
    MSG: HudTextPro - 0x192E3F0
    MSG: HudText - 0x192E390
    MSG: FlashBat - 0x1945490
    MSG: Flashlight - 0x19454D0
    MSG: ArmorType - 0x1941F00
    MSG: Battery - 0x1941EA0
    MSG: Train - 0x19669D0
    MSG: Geiger - 0x1948880
    MSG: SendAudio - 0x19606C0
    MSG: SayText - 0x19606A0
    MSG: ReceiveW - 0x1948D60
    MSG: ClCorpse - 0x1948D40
    MSG: ScoreAttrib - 0x1948C60
    MSG: Radar - 0x1948CD0
    MSG: Damage - 0x1948BD0
    MSG: Health - 0x1948B80
    MSG: Crosshair - 0x193E250
    MSG: AmmoX - 0x193E120
    MSG: HideWeapon - 0x193E1F0
    MSG: ItemPickup - 0x193E210
    MSG: WeapPickup - 0x193E1B0
    MSG: AmmoPickup - 0x193E160
    MSG: WeaponList - 0x193E100
    MSG: CurWeapon - 0x193E0E0
    MSG: NVGToggle - 0x1957D30
    MSG: ItemStatus - 0x193BBD0
    MSG: BotProgress - 0x194C2F0
    MSG: SpecHealth2 - 0x194BC80
    MSG: BuyClose - 0x194BE50
    MSG: TutorClose - 0x194BFC0
    MSG: TutorState - 0x194BF90
    MSG: TutorLine - 0x194BF60
    MSG: TutorText - 0x194BF30
    MSG: VGUIMenu - 0x194BF00
    MSG: ForceCam - 0x194C1D0
    MSG: AllowSpec - 0x194C1A0
    MSG: Spectator - 0x194C170
    MSG: Location - 0x194C140
    MSG: TeamInfo - 0x194C110
    MSG: TeamScore - 0x194C0E0
    MSG: ScoreInfo - 0x194C0B0
    MSG: ServerName - 0x194C080
    MSG: RandomPC - 0x194C050
    MSG: BuildSt - 0x194C020
    MSG: MOTD - 0x194BFF0
    MSG: Detpack - 0x194BED0
    MSG: Feign - 0x194BEA0
    MSG: TeamNames - 0x194BE70
    MSG: ShowTimer - 0x194BAD0
    MSG: Fog - 0x194BBC0
    MSG: Brass - 0x194BD30
    MSG: BotVoice - 0x194C2B0
    MSG: ShadowIdx - 0x194C2D0
    MSG: CZCareerHUD - 0x194C200
    MSG: HostageK - 0x194BB60
    MSG: HostagePos - 0x194BB30
    MSG: ADStop - 0x194BB00
    MSG: BombPickup - 0x194BAA0
    MSG: BombDrop - 0x194BA70
    MSG: ReloadSound - 0x194BD10
    MSG: Concuss - 0x194BCD0
    MSG: SpecHealth - 0x194BC30
    MSG: HLTV - 0x194BC10
    MSG: SetFOV - 0x194BBF0
    MSG: ViewMode - 0x194BA40
    MSG: InitHUD - 0x194BB90
    MSG: GameMode - 0x194BCF0
    MSG: ResetHUD - 0x194BA20
    MSG: Logo - 0x194B9F0
    MSG: sXe-AD - 0x1001C3F0
    MSG: sXe-SSInfo - 0x1001C2F0
    MSG: sXe-SSSendD - 0x1001B260
    MSG: sXe-SSSend - 0x1001BCC0
    MSG: sXe-SSD - 0x1001B120
    MSG: sXe-SS - 0x1001BC90
    MSG: sXe-ping - 0x10003180
    MSG: sXe-CHN - 0x10004920
    MSG: ScreenFade - 0x1DC9B70
    MSG: ScreenShake - 0x1DC9AC0
Working...
X