Esatto.Win32.Common 3.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package Esatto.Win32.Common --version 3.0.6                
NuGet\Install-Package Esatto.Win32.Common -Version 3.0.6                
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="Esatto.Win32.Common" Version="3.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Esatto.Win32.Common --version 3.0.6                
#r "nuget: Esatto.Win32.Common, 3.0.6"                
#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.
// Install Esatto.Win32.Common as a Cake Addin
#addin nuget:?package=Esatto.Win32.Common&version=3.0.6

// Install Esatto.Win32.Common as a Cake Tool
#tool nuget:?package=Esatto.Win32.Common&version=3.0.6                

Esatto Win32 Common

  • Process and Job objects
    • Create Job
    • Create process in other session
    • Privilege manipulation
  • Printers
    • Creating RAW Print Jobs
    • Installing and administering Port Monitors
    • Installing Printer Drivers
  • Installing and administering NT Services
  • Windows Security access
    • Computer and user names (FQDN, UPN, etc...) without LDAP
    • Standard windows Username/Password prompt
    • Standard windows Certificate prompt
    • Mapping a network drive with or without a drive letter
    • Setting a file's Mark-of-the-web

Create Job

Ensures that even if you crash or things go wrong, child processes will not be left around.

using (var job = new Job())
{
	var child = Process.Start(/* blah */);
	// small opportunity between Process.Start and job.AddProcess.  Use 
	// CREATE_SUSPENDED to avoid the bug
	job.AddProcess(child);
	throw new InvalidOperationException("Example");
}
// since Job.Dispose was called, the child process was terminated by the OS

Create process in other session

While running as a user with rights to SE_TCB_NAME (typically SYSTEM), you can create a process in a different user's session with CreateProcessForSession.

var otherUserSession = /* Get another user's session ID */;
ProcessInterop.CreateProcessForSession(otherUserSession, "calc.exe", "");

Privilege manipulation

To run a piece of code with privileges

var privs = new[] 
{
	Privilege.TrustedComputingBase, 
	Privilege.AssignPrimaryToken,
	Privilege.IncreaseQuota
};
Privilege.RunWithPrivileges(() => 
{
	Console.WriteLine("I got the power!");
}, privs);

Write RAW Print job

To send RAW data to a windows print queue, as frequently required for thermal label printers.

using (var windowsJob = new GdiPrintJob("Zebra TLP384", GdiPrintJobDataType.Raw, "Example Job Name", null))
{
	var exampleLabelData = new MemoryStream(Encoding.ASCII.GetBytes(@"^XA
^LT120
^FX Top section
^CFB,25
^FO50,173^FDFROM:^FS
^FO200,173^FDTest sender^FS
^FO200,228^FD10 MOUNTAIN PKWY^FS
^FO200,283^FDTN, COLLIERVILLE, 38017^FS
^FO50,343^GB706,1,3^FS
^XZ"));
    windowsJob.WritePage(exampleLabelData);
}
Product Compatible and additional computed target framework versions.
.NET net7.0-windows7.0 is compatible.  net8.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

    • No dependencies.
  • net7.0-windows7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Esatto.Win32.Common:

Package Downloads
Itp.WpfScanners

Keyboard-like incorporation of barcode scanners into WPF applications. Support for Serial and HID barcode scanners.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.17 108 7/14/2024
3.0.6 265 11/12/2023
3.0.3 142 11/4/2023
3.0.2 144 10/31/2023
3.0.1 221 7/4/2023
3.0.0 196 4/29/2023
1.0.1 289 4/20/2023
1.0.0 200 4/20/2023