crazylin

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

关键代码

 1      SkinSharp.SkinH_Net skin = new SkinSharp.SkinH_Net();
 2         public frmMain()
 3         {
 4             InitializeComponent();
 5             skin.AttachEx(AppDomain.CurrentDomain.BaseDirectory + "compact.she", "");
 6 
 7 
 8             IntPtr bassAddr = IntPtr.Zero;
 9             foreach (ProcessModule pm in Process.GetCurrentProcess().Modules)
10             {
11                 if (pm.ModuleName.ToLower() == "skinh_net.dll")
12                 {
13                     bassAddr = pm.BaseAddress;
14                     break;
15                 }
16             }
17             byte[] writeData = new byte[] { 0x00 };
18             IntPtr hackAddr = new IntPtr(bassAddr.ToInt32() + 0x31c68);
19             uint lpflOldProtect = 0;
20             if (VirtualProtect(hackAddr, 0x1000, PAGE_EXECUTE_READWRITE, out lpflOldProtect))
21             {
22                 Marshal.Copy(writeData, 0, hackAddr, 1);
23                 VirtualProtect(hackAddr, 0x1000, lpflOldProtect, out lpflOldProtect);
24             }
25         }
26 
27 
28         const uint PAGE_EXECUTE_READWRITE = 0x40;
29         [DllImport("kernel32.dll")]
30         public static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize, uint flNewProtect, out uint lpflOldProtect);

下载Skin_Net.zip

 

posted on 2014-01-02 09:32  crazylin  阅读(346)  评论(0编辑  收藏  举报