public static DSInterface Attach(Process process)
        {
            DSInterface result = null;
            IntPtr      handle = OpenProcess(PROCESS_ALL_ACCESS, false, (uint)process.Id);

            if (handle != IntPtr.Zero)
            {
                result = new DSInterface(new SafeProcessHandle(handle, true));
            }
            return(result);
        }
Exemple #2
0
        public DSProcess(Process candidate)
        {
            process = candidate;
            ID      = process.Id;
            Version = "Unknown";
            Valid   = false;

            dsInterface = DSInterface.Attach(process);
            if (dsInterface != null)
            {
                uint versionValue = dsInterface.ReadUInt32(DSOffsets.CheckVersion);
                if (DSOffsets.Versions.ContainsKey(versionValue))
                {
                    Version = DSOffsets.Versions[versionValue].Name;
                    offsets = DSOffsets.Versions[versionValue].Offsets;
                    Valid   = offsets != null;
                }
            }
        }