You will have to memory read each time to read the health obviously, however the pointer to that location will stay the same until you zone (eg Zeplin/instance). I have not noticed it change in any other circumstances.
For quick reads I have direct pointers to the x/y/z locs in mem.
--
To gain the right privileges I use wow!sharp's method. I'm using C# but it is using pinvoke.
Code:
internal void EnableDebuggerPrivileges()
{
int token = 0;
TOKEN_PRIVILEGES tp = new TOKEN_PRIVILEGES();
tp.PrivilegeCount = 1;
tp.Luid = 0;
tp.Attributes = SE_PRIVILEGE_ENABLED;
// We just assume this works
if( OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token) == 0)
throw( new Exception( "OpenProcessToken failed"));
if( LookupPrivilegeValue( null, "SeDebugPrivilege", ref tp.Luid) == 0)
throw( new Exception( "LookupPrivilegeValue failed"));
if( AdjustTokenPrivileges( token, 0, ref tp, Marshal.SizeOf(tp), 0, 0) == 0)
throw( new Exception( "AdjustTokenPrivileges failed"));
}
[StructLayout(LayoutKind.Sequential, Pack=1)]
private struct TOKEN_PRIVILEGES
{
public int PrivilegeCount;
public long Luid;
public int Attributes;
}
--
With CE try changing the exe name. This is what I've done with tsearch and it has not been a problem so far. I also use Process Guard which stops one process from reading another process.
If you want to take it a little further with CE you can make a few changes to the source and compile it yourself (credit to Greyman for this info).