Exemplo n.º 1
0
        public void UninjectProc(int pid)
        {
            List <IntPtr> handlelist;
            var           found = m_InjectedHandles.TryGetValue(pid, out handlelist);

            if (!found)
            {
                throw new Exception("Tried to uninject a non-injected process");
            }

            Logger.Server.DebugLine($"Uninject PID: {pid}");

            foreach (var handle in handlelist)
            {
                Logger.Server.DebugLine($"\tUninject: {handle}");
                Inject32.UninjectPid(pid, handle);
            }

            Logger.Server.DebugLine("Uninjection successful");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Inject into process specified by pid
        /// </summary>
        /// <param name="pid"></param>
        public IntPtr InjectProc(int pid, string dllname)
        {
            Logger.Server.DebugLine($"PID: {pid}");

            // Find client dll path
            string dllPath = GetInjectionLib(dllname);

            Logger.Server.DebugLine($"DLL Path: {dllPath}");

            var res = Inject32.InjectPid(pid, dllPath);

            Logger.Server.DebugLine("Injection successful");

            if (!m_InjectedHandles.ContainsKey(pid))
            {
                m_InjectedHandles[pid] = new List <IntPtr>();
            }

            m_InjectedHandles[pid].Add(res);

            return(res);
        }