Help! Hooking string offset

ASDFGHJKLQWE

Solid & Active Platinian
Original poster
Jul 10, 2022
65
19
8
Nepal
Hello friends can anyone tell me how to hook or hexpatches this
// RVA: 0x25A6220 Offset: 0x25A6220 VA: 0x25A6220
public string get_BeyID() { }

I'm trying to use this switch "InputText_Enter Name" or any other switch suggestions for me friends
 
  • Like
Reactions: DR_eslam

DR_eslam

Awesome Active Platinian
May 20, 2022
110
24
18
21
Egypt
In LGL MENU
there EX. For hhoking strings


#but idont really know if Hooking this will change the value or it is just for button texture!
 

Tosilegit

Platinian
Feb 1, 2022
10
1
3
Perttilä
First you need a Monostring struct. You can just paste it in the main.cpp
C++:
typedef struct _monoString
{
    void *klass;
    void *monitor;
    int length;
    char chars[1];

    int getLength()
    {
        return length;
    }

    char *getChars()
    {
        return chars;
    }
} monoString;

monoString *CreateMonoString(const char *str)
{
    monoString *(*CreateString)(void *instance, const char *str) = (monoString * (*)(void *, const char *)) getRealOffset(0x1B92358); //offset here

    return CreateString(NULL, str);
}
You can get the CreateString offset from this function in class System.string:
1681410748974.png

if youre using lgl menu, then the getRealOffset() probably doesnt work, so you can just replace it with getAbsoluteAddress(targetLibName_here,offset_here)

Then you can hook like this:
C++:
monoString *(*old_get_BeyID)(void *instance);
monoString *get_BeyID(void *instance)
{
    if (instance != NULL)
    {
        return CreateMonoString("your text here");
    }

    return old_get_BeyID(instance);
}
 
  • Love
Reactions: ASDFGHJKLQWE

ASDFGHJKLQWE

Solid & Active Platinian
Original poster
Jul 10, 2022
65
19
8
Nepal
First you need a Monostring struct. You can just paste it in the main.cpp
C++:
typedef struct _monoString
{
    void *klass;
    void *monitor;
    int length;
    char chars[1];

    int getLength()
    {
        return length;
    }

    char *getChars()
    {
        return chars;
    }
} monoString;

monoString *CreateMonoString(const char *str)
{
    monoString *(*CreateString)(void *instance, const char *str) = (monoString * (*)(void *, const char *)) getRealOffset(0x1B92358); //offset here

    return CreateString(NULL, str);
}
You can get the CreateString offset from this function in class System.string: View attachment 506109
if youre using lgl menu, then the getRealOffset() probably doesnt work, so you can just replace it with getAbsoluteAddress(targetLibName_here,offset_here)

Then you can hook like this:
C++:
monoString *(*old_get_BeyID)(void *instance);
monoString *get_BeyID(void *instance)
{
    if (instance != NULL)
    {
        return CreateMonoString("your text here");
    }

    return old_get_BeyID(instance);
}
I'm getting error in getRealOffset