GustavoHMA 15 Report post Posted June 24, 2016 Can anyone help me make the LuaSQL.dll posted by @Xeon work? Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted June 24, 2016 do you need help compiling, injecting, or calling? 1 Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted June 24, 2016 (edited) 7 hours ago, KONG said: do you need help compiling, injecting, or calling? To call the function within the lua and injection. Edited June 24, 2016 by GustavoHMA Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted June 25, 2016 There are multiple ways of injecting a DLL. There is the Codecave method which uses LoadLibrary&GetProcAddress, but you can use programs like: CFF Explorer to eliminate the need to use those methods. These tools requires a "dllexport" method, so in dllmain.cpp the function: __declspec(dllexport) void __cdecl ExportedFunction() {} is present so these tools can inject DLL. And to use the functions via LUA, I will ask @Wrexor to upload his documentation for using the interface because I dont have it. Kudos to Miha for the picture hehe EDIT: I just found this: maybe it'll work I havent tried. but it must be something like this SQL_CONNECT = 'connect' SQL_QUERY = 'query' SQL_FETCH = 'fetch' SQL_HOST = '127.0.0.1,3707' SQL_UID = 'sa' SQL_PWD = 'Y87dc#$98' local connect, handle = LuaSQL(SQL_CONNECT, SQL_HOST, SQL_UID, SQL_PWD) if(connect == 1) then print('Connection Established') local SqlText = "select * from accountserver.dbo.account_login where name = 'admin'" local query, stmt = LuaSQL(SQL_QUERY, handle, SqlText) if(query == 1) then print('Query success, fetching...') local row = LuaSQL(SQL_FETCH, handle, stmt) for i,v in pairs(row) do print(i..'=>'..v) end else print('Query Failed => '..query) end else print('Connection Failed') end QueryAsyn(SQL_HOST, SQL_UID, SQL_PWD, 'UPDATE TradeDB.dbo.AccountInfo SET money = 99 WHERE accName = \'admin\'') 1 Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted June 25, 2016 The following error appears: attempt to call global `LuaSql' (a nil value) Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted June 25, 2016 version of gameserver ? Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted June 25, 2016 Gameserver 1.36 Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted June 25, 2016 Maybe function pointers mismatch offsets. To verify this, make sure you see: "DLL Loaded!" at the top of GS console. If visible, Need to go back to debugger to collect offsets. If not visible, DLL not injected/hooked. Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted June 25, 2016 In the console shows the message: "DLL Loaded!" I will look at OllyDbg. Thanks in advance. Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted March 8, 2022 That rebuilt with OFT need to be on or not? BTW, i always get thet SQL is nill also and I dont understand your advance discussion here Quote Share this post Link to post Share on other sites