Xamarin.Windows.Injector 1.0.0

Prefix Reserved
This package has a SemVer 2.0.0 package version: 1.0.0+sha.f38b5f9-build.2634219.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Xamarin.Windows.Injector --version 1.0.0
                    
NuGet\Install-Package Xamarin.Windows.Injector -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xamarin.Windows.Injector" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xamarin.Windows.Injector" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Xamarin.Windows.Injector" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xamarin.Windows.Injector --version 1.0.0
                    
#r "nuget: Xamarin.Windows.Injector, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xamarin.Windows.Injector@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xamarin.Windows.Injector&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Xamarin.Windows.Injector&version=1.0.0
                    
Install as a Cake Tool

Allows injecting .NET code into a remote process on Windows

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 416 9/11/2019
1.0.0 795 4/30/2019

# Windows.Injector

Allows injecting .NET code into a remote process on Windows

Heavily based on [Cory Plott](http://www.cplotts.com/)'s [Snoop](https://github.com/cplotts/snoopwpf).

Usage:

* Install:

```
install-package Xamarin.Windows.Injector
```

The following properties are used to determine which version (`x86` or `x64`) of the `boostrap.dll`
assembly will be referenced: `PlatformTarget`, `Platform` and `RuntimeIdentifier`. If any of those
specify either `x86` or `x64`, the assembly will be automatically referenced. Note that you cannot
invoke the injector via its API from an `AnyCPU` library, since it has to be of a specific bitness.

The targets automatically include as content both the assembly as well as a helper `Injector.exe`
executable which you can use to inject into processes that have a different bitness than the calling one.

* Launch:

```
var targetProcess = System.Diagnostics.Process.GetProcessesByName("devenv.exe")[0];

Injector.Launch(
   // IntPtr of the main window handle of the process to inject
   targetProcess.MainWindowHandle,
   // The full path to the .NET assembly to load in the remote process
   Assembly.GetExecutingAssembly().Location,
   // Full type name of the public static class to invoke in the remote process
   "MyApp.Startup",
   // Name of the static method in that class to invoke in the remote process
   "Start");
```

Optionally, the injected method call can also receive parameters, in a `{method}:arg1:arg2:argN` format:

```
var targetProcess = System.Diagnostics.Process.GetProcessesByName("devenv.exe")[0];

Injector.Launch(
   // IntPtr of the main window handle of the process to inject
   targetProcess.MainWindowHandle,
   // The full path to the .NET assembly to load in the remote process
   Assembly.GetExecutingAssembly().Location,
   // Full type name of the public static class to invoke in the remote process
   "MyApp.Startup",
   // Name of the static method in that class to invoke in the remote process
   "Start:hello:42:true");
```

See [Program.cs](src/Sample/Program.cs) for complete example.

When referencing the package from an `AnyCPU` project, the `x86` and `x64` folders will be included as
content and copied to the project output path. This allows you to run the relevant `Injector.exe` for
that matches the target process bitness. This executable receives the same parameters as the `Launch`
method shown above.

> NOTE: parameter type conversion is supported and happens via the `TypeConverter` associated with the
parameter type.

       Built from https://github.com/xamarin/Windows.Injector/commit/f38b5f9