Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef VOID*(__cdecl* rinsert)(DWORD RLS, int idx);
- rinsert r_l_insert = (rinsert)(unprotect(ASLR(0x800110)));
- typedef const char*(__cdecl* getupval)(DWORD RLS, int funcindex, int n);
- getupval r_l_getupvalue = (getupval)(unprotect(ASLR(0x800060)));
- typedef const char*(__cdecl* setupval)(DWORD RLS, int funcindex, int n);
- setupval r_l_setupvalue = (setupval)(unprotect(ASLR(0x801D50)));
- //typedef void*(__cdecl* rgetfenv)(DWORD RLS, int idx);
- //rgetfenv r_l_getfenv = (rgetfenv)(unprotect(ASLR(0x7FFA80)));
- int Debug_GetRegistry(lua_State* LS) {
- r_l_pushvalue(RLS, LUA_REGISTRYINDEX);
- return 1;
- }
- static int r_l_unpack(lua_State *L) {
- int i, e, n;
- luaL_checktype(L, 1, LUA_TTABLE);
- i = luaL_optint(L, 2, 1);
- e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
- if (i > e) return 0; /* empty range */
- n = e - i + 1; /* number of elements */
- if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
- return luaL_error(L, "too many results to unpack");
- r_l_rawgeti(RLS, 1, i); /* push arg[i] (avoiding overflow problems) */
- while (i++ < e) /* push arg[i + 1...e] */
- r_l_rawgeti(RLS, 1, i);
- return n;
- }
- int Debug_GetMetaTable(lua_State* LS) {
- if (lua_gettop(LS) == 0) {
- luaL_error(LS, "'debug.getrawmetatable' needs 1 argument.");
- return 0;
- }
- if (r_l_getmetatable(RLS, -1) == 0) {
- r_l_pushnil(RLS);
- return 0;
- }
- return 1;
- }
- int Debug_SetMetaTable(lua_State* LS) {
- if (lua_gettop(LS) == 0) {
- luaL_error(LS, "'debug.setmetatable' needs at least 1 argument.");
- return 0;
- }
- r_l_pushboolean(RLS, r_l_setmetatable(RLS, 1));
- return 1;
- }
- static int auxupvalue(lua_State *L, int get) {
- const char *name;
- int n = luaL_checkint(L, 2);
- luaL_checktype(L, 1, LUA_TFUNCTION);
- if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */
- name = get ? r_l_getupvalue(RLS, 1, n) : r_l_setupvalue(RLS, 1, n);
- if (name == NULL) return 0;
- r_l_pushstring(RLS, name);
- r_l_insert(RLS, -(get + 1));
- return get + 1;
- }
- static int db_setupvalue(lua_State *L) {
- luaL_checkany(L, 3);
- return auxupvalue(L, 0);
- }
- static int db_getupvalue(lua_State *L) {
- return auxupvalue(L, 1);
- }
- int rgetfenvremake(lua_State* LS) {
- r_l_getfenv(RLS, lua_tonumber(LS, -1));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement