home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-05-04 | 1.1 KB | 44 lines |
- //
- // DebuggeeProcess.java
- //
- // (C) Copyright 1995 - 1999 Microsoft Corporation. All rights reserved.
- //
-
- import com.ms.win32.*;
- import java.io.IOException;
-
- public class DebuggeeProcess
- {
- protected int m_nMainThreadHandle;
- protected int m_nProcessID;
-
- public void CreateSuspendedProcess (String sCommandLine) throws IOException
- {
- STARTUPINFO si = new STARTUPINFO();
- PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
- if (Kernel32.CreateProcess(null, sCommandLine, null, null, false, winc.CREATE_SUSPENDED, 0, null, si, pi))
- {
- m_nMainThreadHandle = pi.hThread;
- m_nProcessID = pi.dwProcessId;
- }
- else
- {
- throw new IOException("CreateProcess");
- }
- }
-
- public int GetProcessID()
- {
- return(m_nProcessID);
- }
-
- public void ResumeProcess () throws IOException
- {
- if (Kernel32.ResumeThread(m_nMainThreadHandle) == (int)0xffffffff)
- throw new IOException("ResumeThread");
- Kernel32.CloseHandle(m_nMainThreadHandle);
- m_nMainThreadHandle = wini.INVALID_HANDLE_VALUE;
- }
- }
-
-