int LuaOpenDumpFile(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->OpenDumpFile((PSTR)lua.checkintegerL(2))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
void kaguya_return_userdata_measure(nonius::chronometer& meter) { kaguya::State lua; lua.setErrorHandler(kaguya_panic_throw); lua["f"].setFunction(basic_return); auto code = repeated_code("b = f(i)"); meter.measure([&]() { lua(code.c_str()); }); }
int LuaFlushCallbacks(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->FlushCallbacks()); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaExitDispatch(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->ExitDispatch((IDebugClient *)Client)); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaSetKernelConnectionOptions(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->SetKernelConnectionOptions(lua.checkstringL(2))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaStartServer(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->StartServer(lua.checkstringL(3))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaWriteDumpFile(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->WriteDumpFile(lua.checkstringL(2), lua.checkintegerL(3))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaAttachKernel(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->AttachKernel((ULONG)lua.checkintegerL(2), lua.checkstringL(3))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaTerminateProcesses(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->TerminateProcesses()); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaSetOutputLinePrefix(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->SetOutputLinePrefix(lua.checkstringL(2))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaSetProcessOptions(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->SetProcessOptions(lua.checkintegerL(2))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaConnectSession(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->ConnectSession(lua.checkintegerL(2), lua.checkintegerL(3))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaSetOtherOutputMask(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->SetOtherOutputMask((IDebugClient *)Client, lua.checkintegerL(2))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaOutputRegisters(lua_State *L) { LuaAPI lua(L); DbgRegist *Reg = (DbgRegist *)lua.CheckUserPointer(1, str::utLuaDebugRegisters); RSLT(Reg->OutputRegisters(lua.checkintegerL(2), lua.checkintegerL(3))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaConnectProcessServer(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); ULONG64 srv; RSLT(Client->ConnectProcessServer(lua.checkstringL(2), &srv)); SOK() ? lua.Push(srv) : lua.Push(false); return 1; }
int isFileExist(lua_State* L) { OR::LUAStack lua(L); TString fn; lua>>fn; if(::IsFileExist(fn)) lua<<1; else lua<<0; return 1; }
int LuaGetProcessOptions(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); ULONG options; RSLT(Client->GetProcessOptions(&options)); SOK() ? lua.pushinteger(options) : lua.Push(false); return 1; }
int LuaGetOutputCallbacks(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); PDEBUG_EVENT_CALLBACKS pDEC; RSLT(Client->GetEventCallbacks(&pDEC)); SOK() ? lua.NewUserPointer(pDEC, str::utLuaEventCallback) : lua.Push(false); return 1; }
int LuaGetOtherOutputMask(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); ULONG mask; RSLT(Client->GetOtherOutputMask((IDebugClient *)Client, &mask)); SOK() ? lua.pushinteger(mask) : lua.Push(false); return 1; }
int LuaGetExitCode(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); ULONG ec; RSLT(Client->GetExitCode(&ec)); SOK() ? lua.pushinteger(ec) : lua.Push(false); return 1; }
int LuaSetInputCallbacks(lua_State *L) { LuaAPI lua(L); DbgClient *Client = (DbgClient *)lua.CheckUserPointer(1, str::utLuaDebugClient); RSLT(Client->SetInputCallbacks((IDebugInputCallbacks *) lua.CheckUserPointer(2, str::utLuaInputCallback))); SOK() ? lua.Push(true) : lua.Push(false); return 1; }
int LuaGetValue(lua_State *L) { LuaAPI lua(L); DbgRegist *Reg = (DbgRegist *)lua.CheckUserPointer(1, str::utLuaDebugRegisters); DEBUG_VALUE dv; RSLT(Reg->GetValue(lua.checkintegerL(2), &dv)); SOK() ? VALUE2Table(L, &dv) : lua.Push(false); return 1; }
int LuaGetNumberRegisters(lua_State *L) { LuaAPI lua(L); DbgRegist *Reg = (DbgRegist *)lua.CheckUserPointer(1, str::utLuaDebugRegisters); ULONG n; RSLT(Reg->GetNumberRegisters(&n)); SOK() ? lua.pushinteger(n) : lua.Push(false); return 1; }
int LuaGetStackOffset(lua_State *L) { LuaAPI lua(L); DbgRegist *Reg = (DbgRegist *)lua.CheckUserPointer(1, str::utLuaDebugRegisters); ULONG64 offset; RSLT(Reg->GetStackOffset(&offset)); SOK() ? lua.pushinteger(offset) : lua.Push(false); return 1; }
int LuaGetIndexByName(lua_State *L) { LuaAPI lua(L); DbgRegist *Reg = (DbgRegist *)lua.CheckUserPointer(1, str::utLuaDebugRegisters); ULONG i; RSLT(Reg->GetIndexByName(lua.checkstringL(2), &i)); SOK() ? lua.pushinteger(i) : lua.Push(false); return 1; }
void CScriptEngine::setup_auto_load() { luaL_newmetatable(lua(), "XRAY_AutoLoadMetaTable"); lua_pushstring(lua(), "__index"); lua_pushcfunction(lua(), auto_load); lua_settable(lua(), -3); lua_pushstring(lua(), "_G"); lua_gettable(lua(), LUA_GLOBALSINDEX); luaL_getmetatable(lua(), "XRAY_AutoLoadMetaTable"); lua_setmetatable(lua(), -2); //. ?????????? // lua_settop (lua(),-0); }
// matrix object を複製し、新たなmatrix object を生成する int CKLBLuaLibMatrix::luaCopyMatrix(lua_State * L) { CLuaState lua(L); MATRIX * pMat = getMatPointer(lua, 1); MATRIX * pNew = newMatrix(); for(int i = 0; i < 16; i++) pNew->m[i] = pMat->m[i]; lua.retPointer(pNew); return 1; }
int CKLBLuaLibFONT::luaFontRelease(lua_State * L) { CLuaState lua(L); int argc = lua.numArgs(); for(int i = 1; i <= argc; i++) { FONTOBJ * fontobj = (FONTOBJ *)lua.getPointer(i); remove_font(fontobj); lua.retNil(); } return argc; }
void kaguya_c_function_measure(nonius::chronometer& meter) { kaguya::State lua; lua.setErrorHandler(kaguya_panic_throw); lua["f"].setFunction(basic_call); auto code = repeated_code("f(i)"); meter.measure([&]() { if (!lua(code)) { lua_error(lua.state()); } }); }
// matrix object を破棄する int CKLBLuaLibMatrix::luaDeleteMatrix(lua_State * L) { CLuaState lua(L); int argc = lua.numArgs(); for(int i = 1; i <= argc; i++) { MATRIX * pMat = getMatPointer(lua, i); delMatrix(pMat); lua.retNil(); } return argc; }