Ejemplo n.º 1
0
        public bool Open(IntPtr WindowHandle)
        {
            if (WindowHandle == IntPtr.Zero)
            {
                return(false);
            }

            return(this.Open(SProcess.GetProcessFromWindow(WindowHandle)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the main thread of a given process.
        /// </summary>
        /// <param name="hWindowHandle">The window handle of the process whose main thread will be returned.</param>
        /// <returns>Returns the main thread on success, null on failure.</returns>
        public static ProcessThread GetMainThread(IntPtr hWindowHandle)
        {
            if (hWindowHandle == IntPtr.Zero)
            {
                return(null);
            }

            return(GetMainThread(SProcess.GetProcessFromWindow(hWindowHandle)));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the main thread ID of a given process.
        /// </summary>
        /// <param name="hWindowHandle">The window handle of the process whose main thread ID will be returned.</param>
        /// <returns>Returns non-zero on success, zero on failure.</returns>
        public static int GetMainThreadId(IntPtr hWindowHandle)
        {
            if (hWindowHandle == IntPtr.Zero)
            {
                return(0);
            }

            return(GetMainThreadId(SProcess.GetProcessFromWindow(hWindowHandle)));
        }
Ejemplo n.º 4
0
        public bool Open(int ProcessId)
        {
            if (ProcessId == 0)
            {
                return(false);
            }

            if (ProcessId == m_ProcessId)
            {
                return(true);
            }

            if (m_bProcessOpen)
            {
                this.CloseProcess();
            }

            if (SetDebugPrivileges)
            {
                System.Diagnostics.Process.EnterDebugMode();
            }

            m_bProcessOpen = (m_hProcess = SProcess.OpenProcess(ProcessId)) != IntPtr.Zero;

            if (m_bProcessOpen)
            {
                m_ProcessId = ProcessId;
                m_hWnd      = SWindow.FindWindowByProcessId(ProcessId);

                m_Modules    = Process.GetProcessById(m_ProcessId).Modules;
                m_MainModule = m_Modules[0];

                if (Asm == null)
                {
                    Asm = new ManagedFasm(m_hProcess);
                }
                else
                {
                    Asm.SetProcessHandle(m_hProcess);
                }
            }

            return(m_bProcessOpen);
        }
Ejemplo n.º 5
0
 public NixLite(IntPtr WindowHandle) : this(SProcess.GetProcessFromWindow(WindowHandle))
 {
 }