What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Lua dll

king

Member
Joined
Jan 15, 2010
Messages
463
Reaction score
1
What Dll's are being used for the LUA functions and what would be the:
using ______________;
I have searched for 2 days but yet to find something working or a straight answer.
Also if possible anexample of the Lua.DoString();
 
Last edited:
What Dll's are being used for the LUA functions and what would be the:
using ______________;
I have searched for 2 days but yet to find something working or a straight answer.
Also if possible anexample of the Lua.DoString();

If you're using Visual studio add reference to Honorbuddy.exe.

using Styx;

example code
Code:
Lua.Dostring("DoEmote(\"dance\")";
if you're looking for a return from a LUa function then use use either
List<string> LuaGetReturnValue(string lua, string scriptName); for multiple returns. scriptname can be any random lua file name that you make up.

Code:
[URL="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Collections.Generic.List%3C%3E"]List[/URL]<[URL="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.String"]string[/URL]> <string>retVals = Lua.LuaGetReturnValue("GetLFGMode()","highvoltz.lua");
or you can try
static T GetReturnVal<T>(string lua, uint retVal); for single returns., I've never tried this one though.

I assume retval is the index to item in the return list that you want to have this function return.

<int><int><int>
</int></int></int></string>
 
Last edited:
if you wanted to get a value from lua, you would want to do something like this. this is the code i used in tombstone (my dk CC) to return currently active runes.
Code:
 private void RunesCheck()
        {
            

            List<string> rune1 = Lua.LuaGetReturnValue("return GetRuneCount(1)", "hawker.lua");
            List<string> rune2 = Lua.LuaGetReturnValue("return GetRuneCount(1)", "hawker.lua");
            List<string> rune3 = Lua.LuaGetReturnValue("return GetRuneCount(1)", "hawker.lua");
            List<string> rune4 = Lua.LuaGetReturnValue("return GetRuneCount(1)", "hawker.lua");
            List<string> rune5 = Lua.LuaGetReturnValue("return GetRuneCount(1)", "hawker.lua");
            List<string> rune6 = Lua.LuaGetReturnValue("return GetRuneCount(1)", "hawker.lua");
            if (rune1[0] == "1")
            {
                BloodRunesList.Add(1);
                
            }
            else
            {
                BloodRunesList.Remove(1);
             
            }
            if (rune2[0] == "1")
            {
                BloodRunesList.Add(1);
             
            }
            else
            {
                BloodRunesList.Remove(1);
               
            }
            if (rune3[0] == "1")
            {
                FrostRunesList.Add(1);
            }
            else
            {
                FrostRunesList.Remove(1);

            }
            if (rune4[0] == "1")
            {
                FrostRunesList.Add(1);
            }
            else
            {
                FrostRunesList.Remove(1);

            }
            if (rune5[0] == "1")
            {

                UndeadRunesList.Add(1);
            }
            else
            {
                UndeadRunesList.Remove(1);

            }
            if (rune6[0] == "1")
            {
                UndeadRunesList.Add(1);
            }
            else
            {
                UndeadRunesList.Remove(1);

            }
        }
 
Cool Thank you so much, I am trying to use the LUA in a new program not attached to HB so do I need a special .dll and a different using _______; Thanks again for the help so far.
 
You cant, the logic behind hooking wow wont be ran just by reference.

Try writing your own. Its not that hard with some research.
Take a look at the mmowned forums they seem to have a good idea of what there doing there memory editing section is also really good.

Infact i think there is even a complete source code for doing exactly what you want on there.
 
Thanks they were both big helps but when using highvoltz link I am getting a error


System.BadImageFormatException was unhandled
Message="Could not load file or assembly 'aHook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Source="WoWReloger"
FileName="aHook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
FusionLog="=== Pre-bind state information ===\r\nLOG: User = Dtagg-Laptop\\Dtagg\r\nLOG: DisplayName = aHook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\n (Fully-specified)\r\nLOG: Appbase = file:///C:/Users/Dtagg/Documents/Visual Studio 2008/Projects/WoWReloger/WoWReloger/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : WoWReloger, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\config\\machine.config.\r\nLOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).\r\nLOG: Attempting download of new URL file:///C:/Users/Dtagg/Documents/Visual Studio 2008/Projects/WoWReloger/WoWReloger/bin/Debug/aHook.DLL.\r\nERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.\r\n"
StackTrace:
at WindowsFormsApplication1.Form1.btnStart_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at WindowsFormsApplication1.Program.Main() in C:\Users\Dtagg\Documents\Visual Studio 2008\Projects\WoWReloger\WoWReloger\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

The example code:
Hook EndScene = new Hook(aProcess.GetProcessIdByName("Wow"));

UInt32 pDevicePtr = EndScene.BlackMagic.ReadUInt(0x00C5DF88);
pDevicePtr = EndScene.BlackMagic.ReadUInt(pDevicePtr + 0x397C);

UInt32 EndSceneAddr = EndScene.BlackMagic.ReadUInt(pDevicePtr);
EndSceneAddr = EndScene.BlackMagic.ReadUInt(EndSceneAddr + 0xA8);

txtFill.Text = EndScene.Hook_Install(EndSceneAddr).ToString();


// Command to send using LUA
string Command = "print(\"EndScene hooked!\");";

// Allocate memory for command
uint DoString_space = EndScene.BlackMagic.AllocateMemory(Encoding.UTF8.GetBytes(Command).Length + 1);

// Write command in the allocated memory
EndScene.BlackMagic.WriteBytes(DoString_space, Encoding.UTF8.GetBytes(Command));

// Write the asm stuff for Lua_DoString
EndScene.Hook_AsmAddLine("mov eax, " + DoString_space);
EndScene.Hook_AsmAddLine("push 0");
EndScene.Hook_AsmAddLine("push eax");
EndScene.Hook_AsmAddLine("push eax");
EndScene.Hook_AsmAddLine("mov eax, 0x00819210"); // Lua_DoString
EndScene.Hook_AsmAddLine("call eax");
EndScene.Hook_AsmAddLine("add esp, 0xC");
EndScene.Hook_AsmAddLine("retn");

// Inject the shit
EndScene.Hook_AsmInject();

// Free memory allocated for command
EndScene.BlackMagic.FreeMemory(DoString_space);

// Uninstall the hook
EndScene.Hook_Remove();


It throws the error as soon as the method starts, It doesn't even get to any of the code lines.
 
If you dont know what you are doing with injection, DONT DO IT!

King: What are you trying to achieve?
 
I just want to attach my program to a WoW at the login screen, and through LUA log into a character. Really frustrating
 
Back
Top