gratz
gratz
I never had time to actual try hooking functions yesterday, but it's nice that you got it working Ian. Good job!Originally Posted by Ian
Also I do believe it is possible to make the Booter in C#. You will probably just have to hardcode a bit of it to make it load mscoree.dll and the functions you need and then use it the same way packet.dll works.
Edit: I did a few tests and got a printfps hook working. Which after a few minutes crashed. But I'll look into it a little bit more later on.
How could you possibly start the CLR using managed code? It has to be natively bootstrapped.
Well sure it has to be native code that boots it up, but what I'm thinking of is to allocate memory inside the client and manually input the needed code from a managed program and then use CreateRemoteThread to execute it.
The same way packet.dll works but most of it probably has to be hardcoded here.
Inject code that uses LoadLibrary on mscoree.dll, so you can use GetProcAddress to get the address of the needed functions and execute them.
It would sure be faster just to use an extra dll made in C++ but this way it is technically possbile to use C# all the way.
Ah gotcha. Yeah, I think it is much cleaner to have the extra dll; you can include it as a resource if necessary to keep a one-binary distribution.
Code caves are funner, though.
I may try it out not sure, been lazy
Have any luck with PrintFPS? I tried hooking print name, but it crashed:
[code=c#]
void PrintName(int nSurface, int nX, int nY, int nFont, int nRed, int nGreen, int nBlue, string lpText, int nAlign)
{
PrintText(nSurface, nX, nY, nFont, nRed, nGreen, nBlue, lpText, nAlign);
}
[/code]
Well I haven't had time to test it out anymore so I'm still stuck with my halfworking and unstable code.
Would be great if there was some way to make naked functions in C# but I don't think there is any.
#Edit
I've now completed and stabilized my printfps hook, it now prints out "Hello World!" under fps. Check first post for source code.
Great Job Stiju!
I have a question about it - I tried to implement Drag & Drop to ListView and got an exception
I triedCode:************** Exception Text ************** System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) --- End of inner exception stack trace --- at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) at System.Windows.Forms.Control.OnHandleCreated(EventArgs e) at System.Windows.Forms.ListView.OnHandleCreated(EventArgs e) at System.Windows.Forms.Control.WmCreate(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ListView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- LiteBot Assembly Version: 0.1.0.0 Win32 Version: 0.1.0.0 CodeBase: file:///C:/Users/Muttley/documents/visual%20studio%202010/Projects/LiteBot/Release/LiteBot.dll ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- ComponentFactory.Krypton.Toolkit Assembly Version: 4.3.0.0 Win32 Version: 4.3.0.0 CodeBase: file:///C:/Windows/assembly/GAC_MSIL/ComponentFactory.Krypton.Toolkit/4.3.0.0__a87e673e9ecb6e8e/ComponentFactory.Krypton.Toolkit.dll ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
but it didn't work. How to make it work?Code:[STAThread] public static int EntryPoint(string pwzArgument) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Main()); return 0; }