Esatto.Win32.Common 1.0.0

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

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

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 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 107 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