コード例 #1
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void CB_SkillsMarkers_CheckedChanged(object sender, EventArgs e)
        {
            if (War.HWnd != IntPtr.Zero)
            {
                byte[] modelByte = WjeWar.Properties.Resources.heroflamelord;
                string modelName = "heroflamelord.mdx";

                if (CB_SkillsMarkers.Checked)
                {
                    bool isSetup = FileManage.SetupModel(modelByte, War.Path, modelName);
                    if (isSetup)
                    {
                        SetRegEditData("Allow Local Files", "00000001");
                    }
                    else
                    {
                        MessageBox.Show("安装失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    FileManage.deleteFile(War.Path + "\\" + modelName);
                }
            }
        }
コード例 #2
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void CB_ShowFuzzy_CheckedChanged(object sender, EventArgs e)
        {
            if (War.HWnd != IntPtr.Zero)
            {
                byte[][] modelByte = { WjeWar.Properties.Resources.FrostGlowBall64, WjeWar.Properties.Resources.Sword_1H_Miev_D_01, WjeWar.Properties.Resources.HeroWarden, WjeWar.Properties.Resources.yuelun };
                string   modelPath = "Units\\nightelf\\HeroWarden";
                string[] modelName = { "FrostGlowBall64.blp", "Sword_1H_Miev_D_01.blp", "HeroWarden.mdx", "yuelun.mdx" };
                string   path      = War.Path + "\\" + modelPath;

                if (CB_ShowFuzzy.Checked)
                {
                    bool isSetup = false;
                    for (int i = 0; i < modelName.Length; i++)
                    {
                        isSetup = FileManage.SetupModel(modelByte[i], path, modelName[i]);
                    }

                    if (isSetup)
                    {
                        SetRegEditData("Allow Local Files", "00000001");
                    }
                    else
                    {
                        MessageBox.Show("安装失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    FileManage.deleteFile(path + "\\" + modelName[0]);
                    FileManage.deleteFile(path + "\\" + modelName[1]);
                    FileManage.deleteFile(path + "\\" + modelName[2]);
                    FileManage.deleteFile(path + "\\" + modelName[3]);
                }
            }
        }
コード例 #3
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void CB_RowerRange_CheckedChanged(object sender, EventArgs e)
        {
            if (War.HWnd != IntPtr.Zero)
            {
                byte[][] modelByte = { WjeWar.Properties.Resources.AncientProtector, WjeWar.Properties.Resources.ziggurat };
                string[] modelPath = { "Buildings\\nightelf\\AncientProtector", "Buildings\\Undead\\ziggurat" };
                string[] modelName = { "AncientProtector.mdx", "ziggurat.mdx" };

                if (CB_RowerRange.Checked)
                {
                    string path    = War.Path + "\\" + modelPath[0];
                    bool   isSetup = FileManage.SetupModel(modelByte[0], path, modelName[0]);

                    path    = War.Path + "\\" + modelPath[1];
                    isSetup = FileManage.SetupModel(modelByte[1], path, modelName[1]);
                }
                else
                {
                    FileManage.deleteFile(War.Path + "\\" + modelPath[0] + "\\" + modelName [0]);
                    FileManage.deleteFile(War.Path + "\\" + modelPath[1] + "\\" + modelName[1]);
                }
            }
        }
コード例 #4
0
ファイル: DllInject.cs プロジェクト: wuethan/wjewar
        public static bool inject(byte[] fileByte, string proName, string path, string dllname)
        {
            const UInt32 INFINITE = 0xFFFFFFFF;
            const Int32  PAGE_EXECUTE_READWRITE = 0x40;
            const Int32  MEM_COMMIT             = 0x1000;
            const Int32  MEM_RESERVE            = 0x2000;
            Int32        AllocBaseAddress;

            string dllPath = path + "\\" + dllname;

            if (!System.IO.File.Exists(dllPath))
            {
                FileManage.FileCreate(fileByte, path, dllname);
            }

            Process[] process = Process.GetProcessesByName(proName);
            IntPtr    hWnd    = process[0].Handle;

            int umstrcnt = Encoding.Default.GetByteCount(dllPath);

            AllocBaseAddress = VirtualAllocEx(hWnd, 0, umstrcnt, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);

            IntPtr AddrWM = Marshal.StringToHGlobalAnsi(dllPath);

            int  readSize;
            bool isWrite = WriteMemory.WriteProcessMemory(hWnd, AllocBaseAddress, (int)AddrWM, umstrcnt, out readSize);

            Marshal.FreeHGlobal(AddrWM);

            int loadaddr = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");

            IntPtr ThreadHwnd = (IntPtr)CreateRemoteThread(hWnd, 0, 0, loadaddr, AllocBaseAddress, 0, 0);

            WaitForSingleObject(ThreadHwnd, INFINITE);

            return(true);
        }