Git Product home page Git Product logo

warden's Introduction

Warden.NET

What Is It?

Warden.NET is a simple to use library for managing processes and their states.

Why?

With Rainway we're tasked with launching thousands of different applications from various third parties. To ensure launching games was a smooth process for the user, we needed a reliable way to keep track of game states.

The System.Diagnostics.Process class, while useful, does not have a concept for parent applications; In contrast, Windows itself tracks parents; however, it does not track grandparents, and processes can quickly become orphaned. Process.EnableRaisingEvents while useful, does not support monitoring URI-based launches' lifetime, processes with higher privileges than the calling application, or processes different sessions.

That is why we built Warden.NET.

Getting Started

As of Warden.NET 6.0.0 the calling application is no longer required to be running as Administrator. Some processes may be inaccessible however without those privileges.

Installing

Via Nuget

Install-Package Warden.NET

Enable Process Tracking

To initialize Warden to track processes you launch through it you must first call SystemProcessMonitor.Start(new MonitorOptions()); in the entry point of your application.

If you wish you can optionally subscribe to receive events when all untracked processes have started and stopped execution.

SystemProcessMonitor.OnProcessStarted += (sender, info) => Console.WriteLine(info);
SystemProcessMonitor.OnProcessStopped += (sender, info) => Console.WriteLine(info);

Launching a Process

The WardenProcess class allows you to start processes on the current machine in various context. It supports:

  • Using the operating system shell to start the process.
  • Creating a process as the current interactive user.
  • Launching a Microsoft Store / Universal Windows Platform app.

All of these methods support exit events and process family tree tracking. For more information please review the in-line documentation.

Impersonation

Warden supplies a built-in class, WardenImpersonator, that helps processes created by WardenProcess.StartAsUser execute code as the interactive user.

Notes

If you'd like to contribute we'll be happy to accept pull request. You can find a full example application in the repository.

warden's People

Contributors

battleguard avatar calebnelton avatar yretenai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

warden's Issues

Launcher ignores commands on environment path

The line below sets the default behavior for process paths as accepting only full paths.

internal static Regex ProgramPath = new Regex(@"([A-Z]:\\[^/:\*\?<>\|]+\.((exe)))|(\\{2}[^/:\*\?<>\|]+\.((exe)))", RegexOptions.IgnoreCase);

That makes the line below to give exception because "notepad" is called from environment path adn does not include full path.

var wardenTest = await WardenProcess.Start("notepad", string.Empty, null);

Until the ProgramPath Regex is modified, the README and WardenExample project can be changed accordingly.

how to handle timer based events

Hello, can you share some guidance, on monitoring process, killing thread/process if its runaway or hung (beyond 10 mins for e.g.)

Also, its asking for admin privileges , any chance we can give it a role to run under as an option

Also, a windows GUI Sample with a list view would be nice.

thanks

Access Denied

Hi.,
While executing the WardenExample project in VS 2017 15.3 i'm getting "Access denied" error. And, here is exception details,
Warden.Core.Exceptions.WardenException occurred
HResult=0x80131500
Message=Access denied
Source=Warden
StackTrace:
at Warden.Core.WardenManager.Initialize(Boolean killTressOnExit) in E:\Projects\Gits\warden\Warden\Core\WardenManager.cs:line 45
at WardenExample.Program.d__1.MoveNext() in E:\Projects\Gits\warden\WardenExample\Program.cs:line 30
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at WardenExample.Program.Main(String[] args) in E:\Projects\Gits\warden\WardenExample\Program.cs:line 25

Inner Exception 1:
ManagementException: Access denied

net461 target

hello please add a net461 target framework, thanks.

Further Examples

Are there any further examples available anywhere? The given example app is not especially useful. Many thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.