public static ForeignProcess Get(IntPtr hWnd) { int processId; GetWindowThreadProcessId(hWnd, out processId); if (processId == 0) { throw new Win32Exception(); } var moniker = IpcConstants.GetRotMonikerName(processId); var hook = GetHookedProcess(hWnd, moniker); return(new ForeignProcess(hook, Process.GetProcessById(processId))); }
internal static HookedProcess GetInstance() { lock (SyncCreateInstance) { if (Instance != null) { return(Instance); } Instance = new HookedProcess(); RotRegistration = new RotRegistration(IpcConstants.GetRotMonikerName(Process.GetCurrentProcess().Id), Instance); return(Instance); } }