示例#1
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            // Free the attribute list
            if (StartupInfo.lpAttributeList != IntPtr.Zero)
            {
                ProcessApi.DeleteProcThreadAttributeList(StartupInfo.lpAttributeList);
                Marshal.FreeHGlobal(StartupInfo.lpAttributeList);
            }

            // Close process and thread handles
            if (ProcessInfo.hProcess != IntPtr.Zero)
            {
                ConsoleApi.CloseHandle(ProcessInfo.hProcess);
            }
            if (ProcessInfo.hThread != IntPtr.Zero)
            {
                ConsoleApi.CloseHandle(ProcessInfo.hThread);
            }

            disposed = true;
        }