JobObjectWrapper Beta 1

Rating: No reviews yet
Downloads: 1822
Released: Aug 28, 2007
Updated: Aug 30, 2007 by sashag
Dev status: -not yet defined by owner-

Recommended Download

Source Code JobObjectWrapper Sources
source code, 90K, uploaded Aug 28, 2007 - 862 downloads

Other Available Downloads

Application JobManagement.dll
application, 136K, uploaded Aug 28, 2007 - 314 downloads
Application InJobProcessCreator.exe
application, 9K, uploaded Aug 28, 2007 - 162 downloads
Documentation JobManagement.xml
documentation, 39K, uploaded Aug 28, 2007 - 153 downloads
Application EndOfJobMemory.exe
application, 16K, uploaded Aug 28, 2007 - 109 downloads
Source Code Example Source
source code, 2K, uploaded Aug 28, 2007 - 222 downloads

Release Notes

JobObjectWrapper Beta 1

This is the Beta 1 release of the JobObjectWrapper project. The Beta 1 is feature complete. It is not fully tested. Beta testers are welcome.

To use the Job Object Wrapper, download the JobManagement.dll and InJobProcessCreator.exe files. Both have to be in the running directory of your application. You will need the Visual C++ 2005 SP1 runtime library installed on your machine.

The source code can be found in the JobObjectWrapper Sources archive. Open it with VS 2005, or upgrade the solution to VS 2008.

On VIsta, If you start Visual Studio from Windows Explorer, it put it under a Job. To be able to run the examples from Visual Studio, you must run it from command line (the executable for the Visual Studio IDE is devenv.exe).

To see if your process is part of a job, you can use Process Explorer. Processes running within a job will be highlighted in brown by default.

Project Description
A job object allows a group of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of and assign limits to the processes associated with them. Operations performed on the job object affect all processes associated with the job object.
JobObjectWrapper is a .NET abstraction over the Win32 Job Object. With this library you can create job objects, create and assign a process to the job, control process and job limits, and register for the various process- and job-related notification events.

Usage Example:

using System;
using JobManagement;
using System.Diagnostics;

namespace ConsoleApplicationTestJob
{
class Program
{
static void Main(string[] args)
{
JobObject jo = new JobObject();
jo.Events.OnExitProcess += new jobEventHandler<ExitProcessEventArgs>(OnExitProcess);
jo.Limits.ActiveProcessLimit = 4;
jo.Limits.Affinity = new IntPtr(1);

ProcessStartInfo si = new ProcessStartInfo("whoami", "/all");
si.RedirectStandardOutput = true;
si.UseShellExecute = false;
si.CreateNoWindow = true;

Process p = jo.CreateProcessSecured(si);
while (!p.StandardOutput.EndOfStream)
{
Console.WriteLine(p.StandardOutput.ReadLine());
}

foreach (System.Diagnostics.Process process in jo.ConstructAssignedProcessList())
{
Console.WriteLine(process.ProcessName + " " + process.Id);
}
Console.ReadKey();
jo.TerminateAllProcesses(42);
}

static void OnExitProcess(object sender, ExitProcessEventArgs args)
{
Console.WriteLine("Process {0} has exited", args.TheProcess == null ? args.TheProcessId.ToString() : args.TheProcess.ProcessName);
}
}
}

Reviews for this release

No reviews yet for this release.