Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Runtime.InteropServices;
- using RGiesecke.DllExport;
- namespace InASM
- {
- internal static class UnmanagedExports
- {
- [DllExport("DLLMain", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
- static void DLLMain()
- {
- //multiclient-test inline ASM
- int[] addr = { 0x0040CD4A, 0x0040CD5C, 0x0040CD61 };
- IntPtr baseaddr = advanced.GetModuleBaseAddress("KERNELBASE.dll");
- IntPtr module = advanced.GetProcAddress(baseaddr, "CreateMutexA");
- MessageBox(0, "Program will write inline ASM\nPress OK to continue.", "Info", 0);
- /*
- * Writing inline ASM into memory...
- * */
- try
- {
- //6 - bytes
- ASM.Nop();//1
- ASM.Nop();//2
- ASM.Nop();//3
- ASM.Nop();//4
- ASM.Nop();//5
- ASM.Nop();//6
- ASM.RunAsm(addr[0]);
- //2 - bytes
- ASM.Mov_EAX(0xB7);
- ASM.RunAsm(addr[1]);
- //1 - byte
- ASM.JMP();
- ASM.RunAsm(addr[2]);
- //3 - bytes
- ASM.RetB(0x0C);
- ASM.RunAsm((int)module);
- }
- catch (Exception Exc){
- MessageBox(0, "An Exception occured!\n" + Exc.Message, "Error", 0);
- Environment.Exit(7331);
- }
- MessageBox(0, "OK", "Info", 0);
- }
- [DllImport("user32", CharSet = CharSet.Auto)]
- static extern int MessageBox(int hwnd, String text, String caption, int options);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement