Source Simple cclosure hooking (Roblox)

Tiahh

Solid & Active Platinian
**THIS CODE IS A SIMPLE HOOK FUNCTION AND SHOULD NOT BE USED FOR PASTE**
I admit it this code is pretty ugly but i did it in a few hours quite easy (This code is for Roblox)​
C++:
#define sizeCclosure(n) (offsetof(Closure, c.upvalue) + sizeof(TValue) * (n)) //thanks Roblox for the definition is always nice to reverse you!
std::uint32_t hookfunction(std::uintptr_t rL) {
        if (lua_type(rL, 1) != lua::types::LUA_TFUNCTION || lua_type(rL, 2) != lua::types::LUA_TFUNCTION) return error(rL, "Error, both of the arguments must be functions!");
        auto firstClosure = *reinterpret_cast<uintptr_t*>(rl_topointer(rL, 1)); //get the first function (Function that we want to be replaced)
        auto secondClosure = *reinterpret_cast<uintptr_t*>(rl_topointer(rL, 2)); //get the second function (Function that we use for replace the first function)
        auto firstClosureNups = *reinterpret_cast<std::uint8_t *>(firstClosure + closure_nups_off); //gets the first closure nups (you can find the cclosure_nups in luaf_newcclosure lol, easy to reverse)
        auto secondClosureNups = *reinterpret_cast<std::uint8_t *>(secondClosure + closure_nups_off); //gets the second closure nups (you can find the cclosure_nups in luaf_newcclosure lol, easy to reverse)
        void* newClosure = reinterpret_cast<void*>(malloc(sizeCclosure(firstClosureNups))); //allocate memory (this is the function that we will return from the hookfunction).
        std::memcpy(newClosure, (void*)firstClosure, sizeCclosure(firstClosureNups)); //copy the firstClosure bytes and insert them in newClosure
        std::memcpy(firstClosure, secondClosure, sizeCclosure(firstClosureNups));//replace the firstClosure with the secondClosure (basically the hook part is this one lol)
        /* Push the newClosure and make the hookfunction returns it */
        TValue* top = *reinterpret_cast<TValue**>(rL + top);
        top->value.p = reinterpret_cast<void*>(newClosure);
        top->tt = lua::types::LUA_TFUNCTION;
        *reinterpret_cast<uintptr_t*>(rL + top) += 16; //Increase the top obv.
        return 1;
    }


Hope you enjoyed this thread and hope it was useful for you.​
 
Last edited:
Hey bro, would this impl work? I don't have a way to test it rn so yh

C++:
signed int identifyexecutor()
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
 
Identityexecutor should have the Lua state as the first parameter.
Nevermind just realized what you meant after drinking some coffee and clearing my mind.

So basically should it go something like this?

C++:
signed int identifyexecutor(std::uintptr_t ls)
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
 
Nevermind just realized what you meant after drinking some coffee and clearing my mind.

So basically should it go something like this?

C++:
signed int identifyexecutor(std::uintptr_t ls)
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
yes then push the cclosure with lua_pushcclosure
 
1650184802900.png

Tiahh: **THIS CODE IS A SIMPLE HOOK FUNCTION AND SHOULD NOT BE USED FOR PASTE**
Tiahh: Proceeds to paste code that he didn't make.
 
It's actually the same but modified and added TValue support.
He grabbed it from an exploit dev called amoy who used to work for his exploit.

Go ask Kiko ( whozkiko#0001 ) if you want

You can also look closely and look at the highlighted parts to see how darn similar it is lmao.
 
No, the code is actually pretty much the same. Clearly you don't have much experience in programming. That's something I've noticed with all these platin modders. No one here knows what they're actually doing.
Sure it works the same, isnt written exactly the exact same way, people act like there will never be duplicate lines of code
 
its not the same code kiko is a incompetent developer, this code supports nups. Sincerely the code provided by amoy is trash.
 
its not the same code kiko is a incompetent developer, this code supports nups. Sincerely the code provided by amoy is trash.

Without Kiko, Arceus X wouldn't even be a thing. You later kicked him because you saw he was starting to get tired of your shit. Literally almost every person that has joined your team has now left because of you being an asshole. Secondly, you just pay people to develop the executor, you don't do anything yourself on it.
 
Without Kiko, Arceus X wouldn't even be a thing. You later kicked him because you saw he was starting to get tired of your shit. Literally almost every person that has joined your team has now left because of you being an asshole. Secondly, you just pay people to develop the executor, you don't do anything yourself on it.
Sorry, but kiko did nothing on Arceus X with or without him, nothing would have changed.
 
Sorry, but kiko did nothing on Arceus X with or without him, nothing would have changed.
Your right, kiko didn't bring something cool functions when he is on Arceus X and the update was getting delayed by him.

Sorry, but kiko did nothing on Arceus X with or without him, nothing would have changed.
And also everyone skid mod menu source and people is just fucking retard

View attachment 403039
Tiahh: **THIS CODE IS A SIMPLE HOOK FUNCTION AND SHOULD NOT BE USED FOR PASTE**
Tiahh: Proceeds to paste code that he didn't make.
Reminder: everyone use mod menu templates
 
Back
Top Bottom