|
|
@ -29,8 +29,11 @@ namespace MediaBrowser.ServerApplication.Native
|
|
|
|
static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId);
|
|
|
|
static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId);
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
static extern uint SuspendThread(IntPtr hThread);
|
|
|
|
static extern uint SuspendThread(IntPtr hThread);
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
static extern int ResumeThread(IntPtr hThread);
|
|
|
|
static extern int ResumeThread(IntPtr hThread);
|
|
|
|
|
|
|
|
[DllImport("kernel32.dll")]
|
|
|
|
|
|
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
|
|
|
|
|
|
public static extern bool CloseHandle(IntPtr hObject);
|
|
|
|
|
|
|
|
|
|
|
|
public static void Suspend(this Process process)
|
|
|
|
public static void Suspend(this Process process)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -41,7 +44,8 @@ namespace MediaBrowser.ServerApplication.Native
|
|
|
|
{
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SuspendThread(pOpenThread);
|
|
|
|
SuspendThread(pOpenThread);
|
|
|
|
|
|
|
|
CloseHandle(pOpenThread);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void Resume(this Process process)
|
|
|
|
public static void Resume(this Process process)
|
|
|
@ -52,8 +56,9 @@ namespace MediaBrowser.ServerApplication.Native
|
|
|
|
if (pOpenThread == IntPtr.Zero)
|
|
|
|
if (pOpenThread == IntPtr.Zero)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ResumeThread(pOpenThread);
|
|
|
|
ResumeThread(pOpenThread);
|
|
|
|
|
|
|
|
CloseHandle(pOpenThread);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static void Print(this Process process)
|
|
|
|
public static void Print(this Process process)
|
|
|
|