Admin priv's are not requires, though make sure WoW/BNet are without admin rights.
If for personal use, Interception is a bit overkill and SendMessage works fine. If selling... I would still not use interception.. but that's just me :P
Here's a slimmed down version of what my game/keypress handler's like.
You can find what I use for generic type reading in my dumpers client class as well
Code:
internalclassClient{
private static IntPtr Handle;
private static Process _active;
private static List<Process> _procs;
internal static bool Search()
{
try
{
_procs = new List<Process>();
var cProcs = Process.GetProcessesByName("WowClassic");
if (cProcs.Length > 0)
_procs.AddRange(cProcs);
if (null == _procs || _procs.Count <= 0)
throw new Exception("Could not find any wow clients.");
return null != _procs && _procs.Count > 0;
}
catch (Exception) { return false; }
}
internal static bool Attach(int id)
{
try
{
_active = _procs[id];
Handle = Imports.OpenProcess(Imports.ALL_ACCESS, false, _active.Id);
return null != _active && Handle != IntPtr.Zero;
}
catch (Exception) { return false; }
}
internal static bool Close()
{
try
{
if (null == _active)
throw new Exception("Not attached to a process.");
var c = 1250;
_active.Kill();
while (!_active.HasExited)
{
Thread.Sleep(1);
if (c == 0) break;
c--;
}
if (!_active.HasExited)
throw new Exception("Process has not exited.");
return _active.HasExited;
}
catch (Exception) { return false; }
}
internal static bool Detach()
{
try
{
_procs = null;
_active = null;
return true;
}
catch (Exception) { return false; }
}
// For Key Sending.
// Stamp is another class that parses a unix timestam to ms, s or m.
internal static void PostFull(int[] _Key, int sleep = 20)
{
if (sleep < 20) return;
foreach (var key0 in _Key)
Imports.PostMessage(Window, Imports.WM_KEYDOWN, key0, 1);
var old = Stamp.Milliseconds;
long dif = 0;
while (dif < sleep)
dif = Stamp.Milliseconds - old;
foreach (var key1 in _Key)
Imports.PostMessage(Window, Imports.WM_KEYUP, key1, 1);
}
internal static void PostHalf(int Dir, int[] _Key)
{
foreach (var key in _Key)
Imports.PostMessage(Window, Dir == 0 ? Imports.WM_KEYUP : Dir == 1 ? Imports.WM_KEYDOWN : Imports.WM_KEYUP, key, 0);
}
}