public static void SendConfig(IntPtr wnd)
        {
            var str = string.Format(
                "{0}{1}{2}{3}",
                (Config.Instance.Settings.GameSettings[0].SelectedValue == "True") ? "1" : "0",
                (Config.Instance.Settings.GameSettings[3].SelectedValue == "True") ? "1" : "0",
                (Config.Instance.Settings.GameSettings[1].SelectedValue == "True") ? "1" : "0",
                (Config.Instance.Settings.GameSettings[2].SelectedValue == "True") ? "2" : "0");

            var lParam = new COPYDATASTRUCT {
                cbData = 2, dwData = str.Length * 2 + 2, lpData = str
            };

            Win32Imports.SendMessage(wnd, 74U, IntPtr.Zero, ref lParam);
        }
Example #2
0
        private static List <IntPtr> FindWindows(string title)
        {
            var windows = new List <IntPtr>();

            Win32Imports.EnumWindows(delegate(IntPtr wnd, IntPtr param)
            {
                if (GetWindowText(wnd).Contains(title))
                {
                    windows.Add(wnd);
                }
                return(true);
            }, IntPtr.Zero);

            return(windows);
        }
        public static void ResolveImports()
        {
            var hModule = Win32Imports.LoadLibrary(Directories.BootstrapFilePath);

            if (!(hModule != IntPtr.Zero))
            {
                return;
            }

            var procAddress = Win32Imports.GetProcAddress(hModule, "ModifyIAT");

            if (!(procAddress != IntPtr.Zero))
            {
                return;
            }

            ModifyIAT = Marshal.GetDelegateForFunctionPointer(procAddress, typeof(ModifyIATDelegate)) as ModifyIATDelegate;
        }
Example #4
0
        private static void ResolveInjectDLL()
        {
            try
            {
                mmf = MemoryMappedFile.CreateOrOpen("Local\\LeagueSharpBootstrap", 260 * 2,
                                                    MemoryMappedFileAccess.ReadWrite);

                var sharedMem = new SharedMemoryLayout(PathRandomizer.LeagueSharpSandBoxDllPath, PathRandomizer.LeagueSharpBootstrapDllPath,
                                                       Config.Instance.Username, Config.Instance.Password);

                using (var writer = mmf.CreateViewAccessor())
                {
                    var len = Marshal.SizeOf(typeof(SharedMemoryLayout));
                    var arr = new byte[len];
                    var ptr = Marshal.AllocHGlobal(len);
                    Marshal.StructureToPtr(sharedMem, ptr, true);
                    Marshal.Copy(ptr, arr, 0, len);
                    Marshal.FreeHGlobal(ptr);
                    writer.WriteArray(0, arr, 0, arr.Length);
                }

                var hModule = Win32Imports.LoadLibrary(PathRandomizer.LeagueSharpBootstrapDllPath);
                if (!(hModule != IntPtr.Zero))
                {
                    return;
                }

                var procAddress = Win32Imports.GetProcAddress(hModule, "InjectModule");
                if (!(procAddress != IntPtr.Zero))
                {
                    return;
                }

                injectDLL = Marshal.GetDelegateForFunctionPointer(procAddress, typeof(InjectDLLDelegate)) as InjectDLLDelegate;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }