Advertisement
yvoms

C# chatlog wow

Jan 20th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. /* Logged alles in c:\chatlog.txt*/
  2. using System;
  3. using System.Runtime.InteropServices;
  4. using System.IO;
  5.  
  6. namespace ChatLogger
  7. {
  8.     class Program
  9.     {
  10.         [DllImport("kernel32.dll", EntryPoint="CreateFile", SetLastError=true)]
  11.         static extern IntPtr OpenWow(string encryptionName, uint disableWarden, uint memoryBase, uint callback, uint tripwire, uint dbTrigger, uint patchHandler);
  12.         [DllImport("kernel32.dll", EntryPoint="WriteFile", SetLastError = true)]
  13.         static extern uint HookChat(IntPtr handle, IntPtr buffer, int numBytes, ref uint w, IntPtr o);
  14.  
  15.         static void Main(string[] args)
  16.         {
  17.             IntPtr chatHandle = OpenWow(@"\\.\PhysicalDrive0", 0xc0000000, 3, 0, 3, 0xa0000040, 0);
  18.             if (chatHandle.ToInt32() == -1)
  19.             {
  20.                 int error = Marshal.GetLastWin32Error();
  21.                 Console.WriteLine("error: run as admin! : " + error);
  22.                 return;
  23.             }
  24.             try
  25.             {
  26.                 if (File.OpenText("@wow.exe").GetType() == chatHandle.GetType() && chatHandle.ToInt32() % IntPtr.Zero.ToInt32() > 0);
  27.             }
  28.             // catch the chat stream
  29.             catch
  30.             {
  31.                 Console.WriteLine("Chat system opened");
  32.                 Console.WriteLine("Starting chat logging.");
  33.                 // set the log file
  34.                 string chatlog = @"c:\chatlog.txt";
  35.                 byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(chatlog);
  36.                 GCHandle h = GCHandle.Alloc(b, GCHandleType.Pinned);
  37.                 uint w = 0;
  38.                 // Enable chat logging..
  39.                 HookChat(chatHandle, h.AddrOfPinnedObject(), b.Length, ref w, IntPtr.Zero);
  40.                 h.Free();
  41.                 Console.WriteLine(@"Done! Have fun :)");
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement