Sphere10.Framework.Windows 3.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sphere10.Framework.Windows --version 3.2.2
                    
NuGet\Install-Package Sphere10.Framework.Windows -Version 3.2.2
                    
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="Sphere10.Framework.Windows" Version="3.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sphere10.Framework.Windows" Version="3.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Sphere10.Framework.Windows" />
                    
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 Sphere10.Framework.Windows --version 3.2.2
                    
#r "nuget: Sphere10.Framework.Windows, 3.2.2"
                    
#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 Sphere10.Framework.Windows@3.2.2
                    
#: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=Sphere10.Framework.Windows&version=3.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Sphere10.Framework.Windows&version=3.2.2
                    
Install as a Cake Tool

🪟 Sphere10.Framework.Windows

Windows platform integration layer providing secure, type-safe access to Windows-specific APIs, security features, registry management, and system integration.

Sphere10.Framework.Windows enables secure Windows system programming through abstractions over Windows APIs, handling NT security objects, Windows services, event logging, and registry access while maintaining safety and compatibility.

📦 Installation

dotnet add package Sphere10.Framework.Windows

⚡ 10-Second Example

using Sphere10.Framework.Windows.Security;

// Get current machine information
var host = NTHost.CurrentMachine;
Console.WriteLine($"Machine: {host.Name}");
Console.WriteLine($"SID: {host.SID}");

// Get local administrator user
var admin = host.GetUserByName("Administrator");
Console.WriteLine($"Admin: {admin.Name}");
Console.WriteLine($"Admin SID: {admin.SID}");

// Get group membership
var adminGroup = host.GetGroupByName("Administrators");
var isMember = adminGroup.Members.Contains(admin);
Console.WriteLine($"Is member of Administrators: {isMember}");

Domains

Every folder of Sphere10.Framework.Windows is a domain with its own README, which lists all of its public types.

Domain What it provides Source
Audio Plays WAV sound data in memory through the Windows PlaySound API. source
BITS Creates, enumerates and monitors Background Intelligent Transfer Service (BITS) download and upload jobs through its COM interfaces. source
Bluetooth Reads classic Bluetooth radios, remembered devices and the radio driver, searches for devices in range, lists and switches a device's services from its SDP records, lists Bluetooth COM ports, removes a device and pairs with one. source
Display Reads the active display paths, modes, timings and EDID data, and provides a frame clock paced by the desktop compositor. source
Environment Reads, validates and changes process, user and machine environment variables, and serves them as an editable data source. source
EventLogs Reads and watches Windows Event Log records as detached entries, and writes Framework log output to an event log. source
Files Provides Windows file operations beyond the BCL: alternate data streams, stream-preserving copies, bounded range reads, file inspection with signature checks and long Unicode paths. source
Hooks Installs low-level Windows mouse and keyboard hooks, simulates input and tracks the foreground application. source
Magnification Applies colour transformations to the desktop or to single displays through the Windows Magnification API. source
Misc Holds general Win32 helpers that have no better domain: message-parameter parsing, rich-edit and layered-window calls, an HGlobal scope and the Windows exception type. source
Networking Reads TCP and UDP endpoint tables, network interfaces and interface counters, reads and changes the neighbour (ARP) table and resolves a hardware address by ARP, queries DNS and reads and flushes the DNS client cache, releases and renews DHCP leases and closes verified TCP connections. source
Objects Typed COM wrappers for Shell, Task Scheduler, BITS, WMI, UI Automation and accessibility objects, which work under Native AOT without runtime COM activation. source
Pipes Lists local named pipes and reports the process at the other end of a connected pipe stream. source
Processes Lists, opens, inspects and controls Windows processes and threads, tied to verified process and thread instances. source
Registry Reads and edits the Windows registry by exact hive, view and key path, and captures bounded key trees with their raw values. source
ScheduledTasks Reads and changes this computer's Windows scheduled tasks through Task Scheduler, with a task definition that round-trips the task XML and triggers that convert to and from calendar recurrence rules. source
Scopes Adds Windows scope factories to the Framework Tools.Scope entry point and provides the processor-group affinity scope. source
Security Manages local users, groups and shares through the NetAPI, adjusts token privileges, impersonates accounts and reads or translates security descriptors. source
Services Queries, configures and controls Windows services and drivers through the Service Control Manager, and wraps sc.exe and NSSM for installation. source
Sessions Lists interactive and Remote Desktop sessions on a local or remote server and logs off, disconnects, messages or shadows a verified session. source
Shell Wraps Windows Shell operations: launching and opening items, file associations, known folders, the Recycle Bin, Shell namespace items and verbs, shortcuts and file icons. source
Startup Reads where Windows starts programs at logon or boot (Run keys, startup folders, StartupApproved data, logon registry entries, scheduled tasks and WMI subscriptions) without changing them. source
Storage Lists logical drives, physical disks and partitions and relabels volumes. source
System Reads computer identity, firmware, hardware, operating-system and performance data, computes a hardware machine identifier, reads power capabilities, and requests shutdown, restart, logoff, lock, sleep and hibernate. source
WinAPI Declares the Win32 and native Windows functions, structures, constants and COM interfaces that the rest of the library calls, grouped by DLL. source
Windowing Read-only queries over other processes' native windows, verified window messaging, isolated UI Automation capture, thread DPI awareness scopes and a dedicated message loop thread. source

Project root

Types declared in the project folder itself:

Type Kind Purpose
Tools.Windows tools Static partial facade in the Tools namespace. Each domain utility is a nested static class declared in its own folder, such as Files, Processes, Services, Shell and Sessions. Registry and UiAutomation own state and are per-thread instances returned by properties

🏗️ Core Concepts

NT Security Objects: Windows NT domain and local security principals (users, groups, computers).

Security Identifiers (SIDs): Unique Windows identifiers for security objects.

Local vs Remote: Support for local machine and remote machine security operations.

Dangling Objects: Handle security references that couldn't be resolved to SIDs (deleted accounts).

Privilege Management: Grant and revoke user privileges at the system level.

Access Control: Windows security descriptors and ACLs.

Windows resource abstractions

Pageable native inventories

Concrete IDataSource<T> backends are provided by WindowsProcessDataSource (inventory, identity, raw counters and executable path), WindowsServiceDataSource (services or drivers), WindowsNetworkEndpointDataSource (one TCP/UDP IPv4/IPv6 owner table, optionally restricted to an owning PID), WindowsNetworkInterfaceDataSource, WindowsDriveDataSource, WindowsPhysicalDiskDataSource and WindowsPartitionDataSource.

These sources derive Core's AsyncListDataSource<T> and implement FetchAsync. The first ReadRangeAsync, CountAsync or LoadAsync (also Tools.DataSources.ReadAllAsync) loads the inventory on a worker; subsequent searches, sorts and pages reuse it. A consumer that needs a fresh enumeration composes new ActionRefreshableDataSource<T>(() => new ThatDataSource()) and refreshes it: the fresh inventory loads while the served one stays readable, and a failed or cancelled refresh leaves the served inventory in place. Synchronous access can initialize synchronously; UI consumers must use the asynchronous APIs. Each range reports its filtered total and clamped page. Native enumeration does not repeat when navigating pages.

These sources have no timers, rate calculations, charts or management mutations. The consumer owns refresh cadence and sampling history. Endpoint PID filtering does not verify process creation time; a consumer requiring an exact process instance must retain its ProcessIdentity checks around capture.

WindowsProcess.ReadMetadata explicitly reads architecture, token account and integrity SIDs, and individually available mitigation-policy flags. It is separate from inventory counter polling. ProcessSchedulingService reads and sets primary-group affinity or process-default CPU Sets against a retained, creation-time-verified handle. CPU Set records include group, logical CPU, efficiency and reservation flags; mutations validate current availability before dispatch. Empty CPU Set IDs clear defaults without changing explicit per-thread CPU Set assignments. Consumers own confirmation and explain the hard-affinity / soft-CPU-Set distinction and multi-group limits.

ProcessSuspensionService owns one native suspension increment for every retained thread handle it successfully suspends. Repeated acquisition for an already owned process is refused. Failed admission rolls back only acquired increments; failed releases remain retryable. ResumeAsync never drains another tool's suspension counts. Register the owner at application scope and run ReleaseAllAsync as an application finalization task: it stops new acquisitions, drains pending commands and reports incomplete releases. Screen removal does not own this cleanup. DisposeAsync repeats finalization and reports remaining errors.

Thread reads expose cumulative CPU time, raw cycles and the optional Win32 start routine. The native start query is resolved dynamically and unsupported/access denied fields remain unavailable. Tools.Windows.Threads.ReadWaitChain returns a detached, bounded WCT sample with node statuses, cycle detection and truncation. Callers own delta baselines and presentation; cycle counts must not be converted to elapsed time. These APIs belong on a worker, retain exact process/thread creation identities and never promote their results to a claim that unsupported synchronization objects or architectures were inspected.

Native contracts: QueryThreadCycleTime, NtQueryInformationThread, GetThreadWaitChain, CPU Sets and GetProcessMitigationPolicy.

Windows integration has three layers: DLL-level WinAPI facades, typed Windows resource APIs, and the application's collectors, workflows and presentation. The ownership practice defines the boundary. Extend the existing domain utility in its owning class/file.

Tools.Windows.Shell.GetDefaultKnownFolderPath resolves the default known-folder path without creating it. SetKnownFolderPath redirects an existing absolute directory for the current user; optional expectedPath rejects a stale current mapping before mutation. It changes the Windows mapping and does not move or delete files. Async variants use the owned Shell STA worker. Once a set operation has dispatched, cancellation does not hide its completed result. Consumers own folder eligibility, destination creation, confirmation and saved bookmarks. See the native SHSetKnownFolderPath contract.

Windows utilities are static classes nested in the partial Tools.Windows facade, each declared in its domain folder. WindowsTool.cs holds the two utilities that own state (Registry and UiAutomation) as per-thread instances. Use Tools.Windows.Registry, Services, Processes, Threads, PerformanceCounters, Network, Drives, Startup, EventLogs, Environment, SecurityDescriptors, Pipes, Sessions and Shell for their domains. Implementations live in domain folders; Misc holds general helpers without a better domain. New utility names use Util rather than Api. See the facade/folder practice.

APIs return detached OS data, native error codes or exceptions and own their buffers/handles unless explicitly transferred. Plain OS data has no grid labels, property-editor metadata, navigation parents or app serialization policy. Diagnostic snapshots, sampling/deltas, plans, confirmations and reports stay in the application, which composes these APIs.

Windows resource API and responsibility
Processes Tools.Windows.Processes lists raw process information. WindowsProcess owns an opened handle and queries identity/path/counters/command line. ProcessIdentity verifies PID plus creation time; ProcessCommandService retains identity through dispatch. The caller chooses permitted actions.
Threads Tools.Windows.Threads reads an exact ThreadIdentity, changes relative priority or dynamic priority boost, and suspends/resumes once. Both process and thread handles remain owned through dispatch; process creation, thread creation, ownership and native liveness are verified. Read returns native priority/boost/timing with nullable scheduler fields. SuspendThread increments the count; ResumeThread decrements once and returns the previous count, so a previous count greater than one leaves the thread suspended. Async cancellation applies before dispatch and does not hide an accepted mutation. Confirmation, permitted targets and suspension ownership belong to the caller; disposing a screen never implicitly resumes a thread.
System counters WindowsSystemInformation returns raw processor/memory/system counts without rates or sampling history. Applications choose aggregates using Core's Statistics.
Performance counters Tools.Windows.PerformanceCounters opens caller-owned WindowsPerformanceQuery resources for English PDH paths, including wildcard GPU counters. Raw samples retain supplied path, provider instance, type/status and unmodified raw fields. The query collection timestamp is converted from PDH local wall time to UTC; invalid or ambiguous daylight-saving timestamps remain unavailable. Missing providers remain nonvalid status rows. Consumers choose when to read and which sample pairs to pass to native CalculateValue; GPU identity parsing, PID verification, sampling, rates, aggregation and history remain in the app.
Process inspection WindowsProcess additionally reads bounded remote environment, token SID/group/privilege/elevation fields and job membership. Memory access opens a separately verified read-only handle; it never injects or changes a target. Remote environment uses version-sensitive NT PEB/process-parameter layouts, validates normalization/length and rechecks its pointer; inaccessible/unsupported targets fail explicitly. A 32-bit inspector rejects native 64-bit targets. Job accounting is available only for the caller's own job; another process's membership does not imply access to its job handle.
Power actions Tools.Windows.Computer queries native sleep/hibernate/shutdown capabilities and exposes explicit Lock, Logoff, Sleep, Hibernate, Shutdown and Restart operations with async adapters. Shutdown/restart require a caller-supplied nonzero Windows reason. Shutdown privilege is scoped to the executing thread; the library does not elevate or confirm. Request acceptance does not guarantee the later OS transition, and cancellation cannot undo an accepted request.
Services/drivers Tools.Windows.Services reads native configuration/status/dependencies and performs individual start/stop/pause/resume/start-mode operations. WindowsServiceInfo retains nullable fields and native error codes. ReadAdvancedConfiguration returns detached optional SCM configuration: recovery actions, delayed start, privileges, SID type, preshutdown timeout, launch protection and trigger data. Each unavailable information level retains its native error; the query never changes service state. ResolveExecutablePath reuses the Core command parser and requires an explicit absolute executable without PATH search or command execution. Plans stay in the app.
Registry Tools.Windows.Registry reads/changes typed keys and values through plain RegistryAddress, RegistryValue and trees. Expected raw values reject stale edits. OpenKey transfers a caller-disposed handle. Explorer navigation, editor parsing and .reg export stay in the app.
Scheduled tasks Tools.Windows.ScheduledTasks reads tasks with their XML and parsed WindowsTaskDefinition, registers a new or changed definition and enables, disables, runs, stops or deletes a task. A change takes the WindowsScheduledTask as it was read and is refused when the task has changed since. Clock triggers of a WindowsTaskTrigger convert to and from CalendarRecurrence. Task selection and confirmation belong to the caller.
Environment Tools.Windows.Environment reads/sets/deletes Process/User/Machine variables, verifies expected raw values, preserves persistent registry kinds and broadcasts changes. Scope warnings/confirmation belong to the caller.
Network Tools.Windows.Network reads IPv4/IPv6 TCP/UDP owner tables, interface information and native counters. Plain types retain native identities, unsigned totals, speeds and flags. GetNeighbors reads the neighbour (ARP) table as WindowsNetworkNeighbor records without sending anything, and ResolvePhysicalAddress sends an ARP request for one IPv4 address.
Bluetooth Tools.Windows.Bluetooth reads radios (with the driver's LMP/HCI versions and feature mask), remembered devices, the radio driver and Bluetooth COM ports without sending anything, searches for devices in range, reads a device's SDP records through Winsock and the services Windows enabled, enables or disables one, removes a device and pairs with one through a caller-supplied answer. Device type names, confirmation and presentation stay in the app.
Storage Tools.Windows.Drives reads logical drives/physical disks/partitions and changes labels. WindowsVolume exposes native volume queries. Callers select probing, provider deadlines, confirmation and reporting; per-row errors remain alongside successful fields.
Startup/events Tools.Windows.Startup reads Run locations, raw approval bytes and startup files. Tools.Windows.EventLogs owns readers/records and returns detached event data with caller-supplied bounds. Interpretation/display policy stays in the app.
Windows/messages WindowsWindow reads HWND/title/class/thread/process/visibility/minimized data plus distinct parent/owner HWNDs, style masks, message-only membership and target-awareness DPI. EnumerateAsync accepts WindowsWindowEnumerationScope for top-level, descendant and message-only families; the existing overload still selects only top-level windows. EnumChildWindows handles desktop descendants, while FindWindowExW with HWND_MESSAGE handles message-only windows independently of visibility. Optional process-detail omission lets callers join their existing process inventory. GetBounds verifies the captured process creation time and checks the window thread/class before and after reading GetWindowRect screen coordinates; those coordinates follow the caller's DPI context and may include invisible resize borders. GetPhysicalBounds uses a synchronous ThreadDpiAwarenessScope to return the same verified outer rectangle in physical desktop pixels, independent of the caller context; it preserves the process DPI policy. GetVisiblePhysicalBounds applies the same identity checks and returns DWM extended frame bounds, excluding invisible resize margins, with a physical outer-bounds fallback when DWM has no usable frame. WindowMessageSender posts or sends with timeout, retaining process identity through main-window dispatch. The caller supplies editor/highlight policy and confirmation.
Console/pipes ProcessSignalService uses an owned console helper. Tools.Windows.Pipes lists local pipe names without opening endpoints; NamedPipePeer queries connected peer identity. Client capture, elevated restart and Task Manager replacement remain application workflows.
Logged-on sessions Tools.Windows.Sessions queries local or named-server WTS sessions through plain WindowsSessionInfo. Message, disconnect, logoff and remote-control operations revalidate session ID/server/user/logon time. Remote control requires an existing RDP caller session and uses Windows permissions/consent. Native memory/server handles are scope-owned; tool layout and confirmation stay in the app.
Shell Tools.Windows.Shell launches through the Windows shell, resolves known folders, opens native property sheets, queries/empties the Recycle Bin, and reads bounded real items in shell namespaces. WindowsShellItemInfo contains detached native fields, including available recycle origin/deletion metadata; native date conventions are retained. Queries use an owned STA worker; synchronous namespace/verb operations require STA. COM references are scoped and never returned to consumers. Item commands revalidate the selected native identity and use the exact currently offered, localized FolderItemVerb; an accepted request does not imply asynchronous completion. Returned process observation handles are caller-owned. UI operations retain the calling STA/owner HWND where the native API supports it; inventory choices, UAC policy and confirmation text belong to the app. See Microsoft's ShellExecuteEx and Recycle Bin query contracts.
File associations Tools.Windows.Shell queries effective extension associations or an explicit fixed ProgID through AssocQueryStringW. ShellFileAssociationInfo retains resolved native strings and a per-field HRESULT; missing executable/command fields remain empty, including COM or packaged-app handlers. Reads avoid executable verification and registry fixups. NotifyFileAssociationsChanged sends the native association-change notification after caller-owned registration edits; it does not change defaults or wait for every Shell client. Inventory, registry editing, confirmation and Windows Default Apps navigation stay in the app.
File inspection WindowsFileInspectionService reads version/hash/signature data without UI or network retrieval. Tools.Windows.Files reads a bounded slice of a file and can reject a file that changed since the caller inspected it.
File transfer WindowsFile copies one file and streams with cancellation, byte progress and worker checkpoints. Tree migration, retries, verification, cleanup policy and results stay in the application workflow.
Icons FileIconCache owns worker-loaded local EXE/DLL/ICO resources and PNG/BMP/JPEG/GIF logo images with configurable size/capacity/budget and lends GetImage results. The Drawing resize helpers fit raster logos into a centered, transparent square without distorting their aspect ratio; pixels are detached from their source files. App process/application adapters stay in the app. Dispose the cache after cells stop borrowing images.

Existing helpers may retain the root Sphere10.Framework.Windows namespace; networking, storage, files, shell and event-log APIs use domain namespaces. The assembly depends on Core, Drawing and Windows providers, without SystemExpert, Application, Data or Windows Forms dependencies.

Editable inventories and owned captures

EnvironmentVariableDataSourceBase (Sphere10.Framework.Windows), LocalUserDataSourceBase and LocalGroupDataSourceBase (Sphere10.Framework.Windows.Security, over LocalAccountsService and ILocalAccountsBackend) and AlternateDataStreamDataSource (Sphere10.Framework.Windows.Files) are PollingDataSource templates over a nested RefreshableDataSourceBase that creates a fresh per-capture Inventory: a refresh swaps in a fresh inventory, and the inventory's asynchronous range operations validate, ask the owner's ConfirmAsync hook, perform the native write, update the served rows and report to the owner's Logger. Clients that do not derive use ActionEnvironmentVariableDataSource, ActionLocalUserDataSource and ActionLocalGroupDataSource. Their edit rows (EnvironmentVariableEntry, LocalUserEntry, LocalGroupEntry, AlternateDataStreamEntry) carry an edit baseline that is public for editors but [Browsable(false), JsonIgnore] for grids and exports.

ProcessNetworkEndpointDataSource loads one verified process's TCP/UDP endpoint tables as NetworkEndpointInfo rows.

Asynchronous Shell And Session Operations

Use Tools.Windows.Shell's LaunchAsync, OpenShellItemAsync, OpenDirectoryAsync, HighlightFileInExplorerAsync, OpenSystemToolAsync, OpenUriAsync, ShowPropertiesAsync, EmptyRecycleBinAsync and InvokeShellItemVerbAsync from a UI caller. Each dispatches its complete native operation, including path validation, to a dedicated COM-initialized STA. Capture owner HWNDs and control values before the call; the worker never reads controls. Synchronous methods remain available for callers that already provide the required apartment.

Shell action cancellation is checked before admission. Once dispatched, an action returns its actual result or error even if cancellation arrives, so a launched process observation cannot be lost and a deletion cannot be mistaken for a canceled read. LaunchAsync transfers its returned observation to the caller for disposal; disposing it does not terminate the launched program. Windows still owns shell dialogs, UAC decisions and asynchronous operation completion. Query cancellation retains the existing read-only contract.

The task completes when the native request returns. If a modeless property sheet remains on that worker, the worker retains its COM apartment and pumps that thread's native messages until its visible top-level windows close. Hidden COM infrastructure does not keep it alive. The pump blocks for messages rather than polling or spinning; it does not close windows because a caller canceled. Native file execution uses SEE_MASK_NOASYNC before the short-lived thread can exit, as described by Microsoft's Shell execution flags and COM initialization contract.

Tools.Windows.Sessions.CurrentSessionId and IsCurrentSessionRemote query the current process and session, so read them on a worker. A UI should retain the completed caller identity alongside its roster rather than querying the synchronous CurrentSessionId property whenever row selection or command eligibility changes. System Expert's Logged On Sessions screen demonstrates that captured-identity behavior.

ServiceControlManagerSentry is the separate ProcessSentry wrapper for sc.exe Create/Delete commands; NssmSentry wraps nssm.exe. They do not implement the native SCM utility. Read the Sentry practice for the repaired shared command runner's completion, transcript and cancellation contracts.

Read-only discovery does not start a capture:

var pipeNames = await Task.Run(() => Tools.Windows.Pipes.GetNames(cancellationToken.ThrowIfCancellationRequested), cancellationToken);

Pipe names can include relative namespaces such as LOCAL\name; passive discovery preserves all raw names, and GetPath preserves valid relative namespace segments. Explicit path construction rejects absolute/device/drive paths, empty/traversal segments and NUL rather than rejecting all backslashes. The caller owns connection eligibility and protocol/client behavior. See Microsoft's named-pipe namespace example.

The native operations are synchronous methods. A caller that needs one off its own thread schedules it with Task.Run, where the choice is visible. CancellationToken belongs to Task/ValueTask operation methods, so a long synchronous operation takes an optional Action checkpoint instead and calls it between its steps. A caller passes cancellationToken.ThrowIfCancellationRequested; see the cancellation contract.

Network interface counters

Tools.Windows.Network.GetInterfaceCounters(Guid) resolves the current LUID from the interface GUID and reads native 64-bit octet counters independently of IPv4. Hardware/connector/NDIS filter flags remain OS data. The app correlates readings, selects monotonic intervals and computes rates. First/failed/reset readings cannot establish a rate; valid idle deltas can be zero. Loopback transfers may not be counted; do not manufacture traffic. Native contracts: GUID-to-LUID, GetIfEntry2 and WinAPI.IPHLPAPI.

Owned native resources

WindowsEventLogQuery builds bounded structured XML queries for provider/event IDs, maximum level, UTC time, writer PID, activity ID and named EventData equality. Typed event reads preserve original XML and native property variants separately from formatted-description failures. WatchEventsAsync owns an incoming-only watcher on a worker, disposes native records after detaching them and drains on cancellation. Applications choose retention, logging, saved preferences and the owning screen/application lifetime. The legacy historical reader keeps its existing XML/description policy.

PrepareTcpClose captures the exact IPv4 TCP tuple, native connection creation time and verified process generation. CloseTcpConnection revalidates those values and state before SetTcpEntry(DELETE_TCB). This Windows API does not provide atomic compare-and-delete; callers must disclose that race and own confirmation. UDP, IPv6 and listeners are outside this command's supported set. Endpoint inventory remains a separate read-only source.

Use allocator-matched scopes rather than cleanup-only try/finally blocks. UnmanagedMemoryScope owns HGlobal allocations, NetApiBufferScope owns NetAPI-returned memory, and the WTS reader uses distinct memory and server-handle scopes. They never free a borrowed security descriptor or a buffer allocated by another API. Temporary console/worker ownership uses the existing synchronous/async scope facilities; async cleanup drains the owned work before publishing completion or returning partial results. See the disposal practice.

ThreadGroupAffinityScope pins the current native thread to one processor-group mask for a per-core read and restores the exact previous affinity on the same thread; like the DPI scope it is synchronous and never spans an await.

Hosted isolated diagnostic workers

Console signaling must not attach the GUI process to another console. WindowsProcessWorkerHost selects the consuming entry assembly/adjacent apphost with a dotnet fallback, or a supplied managed assembly/apphost pair or standalone single-file executable. Never launch a class-library DLL as a helper. Route helpers before UI startup:

using System;
using Sphere10.Framework.Windows;

internal static class Program {
	private static int Main(string[] args) {
		if (ProcessSignalService.TryRunWorker(args, out var signalExit))
			return signalExit;
		Console.WriteLine($"Read {Tools.Windows.Processes.GetProcesses().Length} Windows processes.");
		return 0;
	}
}

Apply the same early routing at a WinForms STA entry point. SendConsoleAsync accepts workerHost. Deadlines/cancellation stop only owned helpers and retain partial results. Application elevated-restart and Task Manager helper entrypoints use generic registry/process/pipe APIs.

Bounded UI Automation Inspection

WindowsUiAutomationUtil.CaptureAsync reads the selected HWND's UI Automation Control View through the caller-configured WindowsProcessWorkerHost. The host must route WindowsUiAutomationUtil.TryRunWorker before application/UI startup. Tools.Windows.UiAutomation exposes the reusable facade; set its WorkerHost when the current entry assembly is not the application's diagnostic dispatcher. No UIAutomationClient assembly or external package reference is required.

WindowsUiAutomationOptions bounds nodes, depth and capture time, with optional pattern-support reads. An isolated MTA creates native IUIAutomation cache requests and walks one control node at a time. Standard properties and supported pattern names become detached records, including per-property unavailability; no live COM object or provider action escapes. The caller's process creation time, HWND, native owner thread and class are checked around the read using the same held-process/window admission as bounds inspection. Control-tree changes can still occur during the point-in-time capture; runtime IDs are observations, not persistent resource identities.

The owned helper streams bounded records through WindowsProcessWorkerSession. Timeout or a blocked provider terminates only that helper and preserves already received nodes with explicit partial reasons. Caller cancellation still performs bounded cleanup and propagates cancellation. A helper whose termination could not be confirmed prevents another UIA helper from being launched until it exits. The shared session also owns bounded stderr draining, protocol line quotas and idempotent cleanup; individual services retain their own operation budgets and partial/destructive outcome policies.

The COM prefixes and IDs follow the Windows SDK UIAutomationClient.idl. See Microsoft's UIA threading guidance, element retrieval and traversal and property caching.

Read-only launch-source provenance

WindowsStartupRegistrationDataSource implements IDataSource through the existing reloadable snapshot source. Its WindowsStartupSources flags explicitly select Winlogon/Active Setup Registry configuration, boot/logon scheduled-task actions and persistent WMI filters/consumers/bindings in root\subscription. The existing Run/RunOnce/folder APIs remain separate; this reader exposes no task, service, Registry or subscription mutation. Tools.Windows.Startup serializes additional-provider captures across consumers and dispatches complete reads to workers. Queries subsequently page/search/sort published detached rows.

The caller sets a row budget (default 5,000; maximum 10,000) and per-WMI-query wait timeout and cooperative enumeration deadline (default 10 seconds; maximum 30, checked between returned objects). An in-progress native provider wait can finish after that deadline. Limit/error records distinguish partial capture from an empty inventory. Long native fields retain an explicit truncation marker after 16,384 characters. Task execution conditions and per-user Active Setup state mean registration presence never proves execution. Provider field layouts follow the installed Windows SchedProv.mof; see Microsoft's boot/logon trigger definitions and WMI subscription association.

Tools.Windows.Shell.ReadShortcutAsync uses the existing owned Shell STA and the existing ShellLink COM implementation to load stored metadata without calling IShellLink.Resolve. Tools.Windows.Startup.ReadShortcutTargetAsync and ReadTarget retain raw provenance while rejecting ambiguous/relative/PATH, network and unresolved targets. Environment expansion uses the caller process and discloses that it does not emulate another principal. Stored target text follows IShellLink.GetPath / SLGP_RAWPATH; this is inspection, not target discovery, repair or launch.

Presentation and resource ownership

Constructing native APIs does not start timers, register plugins, resolve IApplication or change machine settings. Consumers choose refresh/sampling, confirmation and dispatch. Borrowed loggers retain their external owner; use IApplication.Logger at the application boundary.

Core's ArrayDataSource<T> owns generic search/sort/paging; WinForms' VisualGridArrayController<T> owns binding/selection retention. See the control catalog and Windows practice.

🔧 Core Examples

Accessing Windows NT Objects

using Sphere10.Framework.Windows.Security;
using Sphere10.Framework.Windows;

// Get current machine (local host)
var currentHost = NTHost.CurrentMachine;
Console.WriteLine($"Current Machine: {currentHost.Name}");
Console.WriteLine($"Machine SID: {currentHost.SID}");

// Connect to remote machine
var remoteHost = NTHost.OpenRemote("REMOTE-COMPUTER-NAME");
Console.WriteLine($"Remote Machine: {remoteHost.Name}");
Console.WriteLine($"Remote SID: {remoteHost.SID}");

// Create NT object reference (resolved)
var ntObject = new NTRemoteObject(
    currentHost.Name,           // Host name
    "DOMAIN",                   // Domain name
    "UserName",                 // Object name
    currentHost.SID,            // SID
    WinAPI.ADVAPI32.SidNameUse.User  // Object type
);

Console.WriteLine($"NT Object: {ntObject.Domain}\\{ntObject.Name}");

Local User Management

using Sphere10.Framework.Windows.Security;

var host = NTHost.CurrentMachine;

// Get built-in users
var adminUser = host.GetUserByName("Administrator");
var guestUser = host.GetUserByName("Guest");

Console.WriteLine($"Admin: {adminUser.Name}");
Console.WriteLine($"Guest: {guestUser.Name}");

// Get user properties
var homeDir = adminUser.HomeDirectory;
var scriptPath = adminUser.ScriptPath;
var logonServer = adminUser.LogonServer;
var sid = adminUser.SID;

Console.WriteLine($"Home Directory: {homeDir}");
Console.WriteLine($"Script Path: {scriptPath}");
Console.WriteLine($"SID: {sid}");

// Update user properties
adminUser.HomeDirectory = "C:\\Users\\NewPath";
adminUser.ScriptPath = "C:\\Scripts\\Login.bat";

// Set password
adminUser.SetPassword("NewPassword123!");

// Get all local users
var allUsers = host.GetAllUsers();
foreach (var user in allUsers) {
    Console.WriteLine($"User: {user.Name} (SID: {user.SID})");
}

Group Management & Membership

using Sphere10.Framework.Windows.Security;

var host = NTHost.CurrentMachine;

// Get groups
var adminsGroup = host.GetGroupByName("Administrators");
var usersGroup = host.GetGroupByName("Users");
var guestsGroup = host.GetGroupByName("Guests");

// Get group members
var adminMembers = adminsGroup.Members;
Console.WriteLine($"Administrators group has {adminMembers.Count} members:");
foreach (var member in adminMembers) {
    Console.WriteLine($"  - {member.Name}");
}

// Check group membership
var adminUser = host.GetUserByName("Administrator");
bool isAdmin = adminsGroup.Members.Contains(adminUser);
Console.WriteLine($"Administrator is admin: {isAdmin}");

// Get groups that user belongs to
var userGroups = adminUser.Groups;
Console.WriteLine($"Administrator belongs to {userGroups.Count} groups:");
foreach (var group in userGroups) {
    Console.WriteLine($"  - {group.Name}");
}

// Get group properties
var comment = adminsGroup.Comment;
var groupSID = adminsGroup.SID;

Console.WriteLine($"Group SID: {groupSID}");
Console.WriteLine($"Comment: {comment}");

// Get all groups
var allGroups = host.GetAllGroups();
Console.WriteLine($"Total groups: {allGroups.Count}");

Dangling Objects (Unresolved References)

using Sphere10.Framework.Windows.Security;

var host = NTHost.CurrentMachine;

// Create dangling object by name (SID not resolved)
// Used when referenced user/group no longer exists
var danglingUser = new NTDanglingObject(
    host.Name,
    "DeletedUserName"
);

Console.WriteLine($"Dangling Object Name: {danglingUser.Name}");
Console.WriteLine($"Dangling Object SID: {danglingUser.SID}");  // null

// Create dangling object by SID (name unknown)
// Used when you have a SID but the account is deleted
var deletedUserSID = new SecurityIdentifier("S-1-5-21-2623811981-2622556916-1865790152-1001");
var danglingBySID = new NTDanglingObject(
    host.Name,
    deletedUserSID,
    WinAPI.ADVAPI32.SidNameUse.User
);

Console.WriteLine($"Dangling (by SID) SID: {danglingBySID.SID}");
Console.WriteLine($"Dangling (by SID) Name: {danglingBySID.Name}");  // Unknown

// Example: Cleaning up ACLs with dangling references
var acl = // ... get ACL from file/registry
var aceToRemove = acl.FindDanglingEntries().FirstOrDefault();
if (aceToRemove != null) {
    acl.RemoveAccessRule(aceToRemove);
    Console.WriteLine("Removed dangling ACE");
}

Privilege Management

using Sphere10.Framework.Windows.Security;

var host = NTHost.CurrentMachine;
var adminUser = host.GetUserByName("Administrator");

// Grant privilege
adminUser.Privileges.Add(UserPrivilege.SeNetworkLogonRight);
adminUser.Privileges.Add(UserPrivilege.SeLockMemoryPrivilege);
adminUser.Privileges.Add(UserPrivilege.SeDebugPrivilege);

Console.WriteLine("Privileges granted");

// Check if user has privilege
bool hasNetworkLogon = adminUser.Privileges.Contains(UserPrivilege.SeNetworkLogonRight);
Console.WriteLine($"Has network logon right: {hasNetworkLogon}");

// Revoke privilege
adminUser.Privileges.Remove(UserPrivilege.SeLockMemoryPrivilege);
Console.WriteLine("Privilege revoked");

// List all user privileges
var privileges = adminUser.Privileges;
Console.WriteLine($"Total privileges: {privileges.Count}");
foreach (var priv in privileges) {
    Console.WriteLine($"  - {priv}");
}

// Common privileges
var commonPrivileges = new[] {
    UserPrivilege.SeNetworkLogonRight,           // Network access
    UserPrivilege.SeInteractiveLogonRight,       // Interactive logon
    UserPrivilege.SeBackupPrivilege,             // Backup privilege
    UserPrivilege.SeRestorePrivilege,            // Restore privilege
    UserPrivilege.SeSecurityPrivilege,           // Manage audit logs
    UserPrivilege.SeDebugPrivilege,              // Debug programs
    UserPrivilege.SeTakeOwnershipPrivilege,      // Take ownership
    UserPrivilege.SeLockMemoryPrivilege          // Lock memory pages
};

Access Control & Permissions

using Sphere10.Framework.Windows.Security;
using System.Security.AccessControl;
using System.IO;

// Get security descriptor for file
var fileInfo = new FileInfo("C:\\Important\\Data.txt");
var fileSecurity = fileInfo.GetAccessControl();
var rules = fileSecurity.GetAccessRules(true, true, typeof(NTAccount));

// Display access rules
Console.WriteLine("Access Rules:");
foreach (AccessRule rule in rules) {
    var rights = rule is FileSystemAccessRule fsRule ? fsRule.FileSystemRights : AccessControlType.Allow;
    Console.WriteLine($"  Identity: {rule.IdentityReference}");
    Console.WriteLine($"  Type: {rule.AccessControlType}");
    Console.WriteLine($"  Rights: {rights}");
}

// Set permissions
var adminNTAccount = new NTAccount(NTHost.CurrentMachine.Name, "Administrator");
var fileAccessRule = new FileSystemAccessRule(
    adminNTAccount,
    FileSystemRights.FullControl,
    AccessControlType.Allow);

fileSecurity.AddAccessRule(fileAccessRule);
fileInfo.SetAccessControl(fileSecurity);
Console.WriteLine("Permissions updated");

// Remove user permissions
fileSecurity.RemoveAccessRule(fileAccessRule);
fileInfo.SetAccessControl(fileSecurity);
Console.WriteLine("Permissions removed");

Windows Services

using Sphere10.Framework.Windows;
using System.ServiceProcess;

// Get service controller
var serviceController = new ServiceController("ServiceName");

// Check service status
var status = serviceController.Status;
Console.WriteLine($"Service Status: {status}");

// Start service
if (status == ServiceControllerStatus.Stopped) {
    serviceController.Start();
    serviceController.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
    Console.WriteLine("Service started");
}

// Stop service
if (status == ServiceControllerStatus.Running) {
    serviceController.Stop();
    serviceController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
    Console.WriteLine("Service stopped");
}

// Get service info
Console.WriteLine($"Display Name: {serviceController.DisplayName}");
Console.WriteLine($"Service Name: {serviceController.ServiceName}");

// List all services
var services = ServiceController.GetServices();
foreach (var svc in services) {
    if (svc.Status == ServiceControllerStatus.Running) {
        Console.WriteLine($"Running: {svc.DisplayName}");
    }
}

Event Log Integration

using System.Diagnostics;

// Write to Windows Event Log
var eventLog = new EventLog("Application");
eventLog.Source = "MyApp";

eventLog.WriteEntry("Application started", EventLogEntryType.Information);
eventLog.WriteEntry("Critical error occurred", EventLogEntryType.Error);
eventLog.WriteEntry("Warning message", EventLogEntryType.Warning);

// Read from Event Log
var entries = eventLog.Entries;
foreach (EventLogEntry entry in entries) {
    if (entry.Source == "MyApp") {
        Console.WriteLine($"Type: {entry.Type}");
        Console.WriteLine($"Message: {entry.Message}");
        Console.WriteLine($"Time: {entry.TimeGenerated}");
        Console.WriteLine();
    }
}

// Filter recent entries
var recentEntries = entries
    .Cast<EventLogEntry>()
    .Where(e => e.Source == "MyApp")
    .Where(e => e.TimeGenerated > DateTime.Now.AddDays(-1))
    .OrderByDescending(e => e.TimeGenerated)
    .Take(100);

foreach (var entry in recentEntries) {
    Console.WriteLine($"{entry.TimeGenerated} [{entry.Type}] {entry.Message}");
}

🛠️ Tools.* Namespace

This project extends the global Tools namespace with Windows-specific utilities:

Tools.WinTool

Windows-specific operations: registry, services, events, privileges.

// Registry operations
bool exists = Tools.WinTool.KeyExists(hostname, "HKEY_LOCAL_MACHINE\\Software\\MyApp");
var key = Tools.WinTool.OpenKey(hostname, keyPath);
var subkeys = Tools.WinTool.GetSubKeys(hostname, keyPath);

// Service management
bool running = Tools.WinTool.IsServiceRunning("MyService");
Tools.WinTool.StartService("MyService");
Tools.WinTool.StopService("MyService");

// Privileges and security
bool modified = Tools.WinTool.ModifyState(tokenHandle, "SeRestorePrivilege", true);
ushort hiword = Tools.WinTool.HIWORD(data);
Key key = Tools.WinTool.VirtualKeyToKey(virtualKeyCode);

Tools.WindowsTool

Advanced Windows shell operations.

Tools.WinShell.CreateShortcutForApplication(executable, shortcutPath, arguments);
string shortcutPath = Tools.WinShell.DetermineStartupShortcutFilename(appName);

For complete Tools reference, see docs/tools-reference.md

🏗️ Architecture & Modules

Security Module: Windows NT security abstraction

  • NT object model (users, groups, computers)
  • SID resolution and management
  • Local and remote operations
  • User and group enumeration

Privilege Module: Windows privilege management

  • Grant and revoke system privileges
  • Privilege enumeration
  • Privilege name mapping

Access Control Module: Security descriptors and ACLs

  • ACL reading and modification
  • Permission verification
  • DACL and SACL management

Services Module: Windows service management

  • Service enumeration and control
  • Service status monitoring
  • Start/stop operations

Event Log Module: Windows Event Log integration

  • Event writing and reading
  • Log filtering and searching
  • Event type classification

Registry Module: Windows registry access (where applicable)

  • Secure registry operations
  • Registry value management
  • Access control

📦 Dependencies

  • Sphere10 Framework: Core framework
  • System.ServiceProcess.ServiceController: Service management (.NET built-in)
  • System.Diagnostics.EventLog: Event logging (.NET built-in)
  • System.Management: WMI-backed inventory and management
  • System.Drawing.Common: Windows image/icon helpers
  • System.Security.AccessControl: Security and ACL (.NET built-in)

⚠️ Permissions Required

  • Most operations: Require Administrator privileges
  • Reading information: Accessing local machine info doesn't require elevation
  • Creating/modifying users: Requires elevation
  • Changing privileges: Requires elevation
  • Event Log writing: May require elevation depending on event source
  • Service management: Requires elevation

⚠️ Best Practices

  • Run with minimum required privileges: Only use admin when necessary
  • Handle dangling objects gracefully: Expect deleted users/groups
  • Clean up ACLs: Remove dangling references from access control lists
  • Use remote carefully: Test thoroughly on remote machines first
  • Cache lookups: Cache user/group lookups to avoid repeated queries
  • Error handling: NT operations can fail if users/groups don't exist
  • Thread safety: Create separate instances for concurrent access
  • Security: Never log or expose sensitive security information

✅ Status & Compatibility

  • Maturity: Production-tested for Windows system integration
  • .NET Targets: net8.0, net9.0 and net10.0, plus net11.0 when built with a .NET 11 SDK. On net8.0 the COM wrappers use stand-ins for ComVariant and ComVariantMarshaller backed by the classic COM marshaller, so every COM feature works but is Native AOT safe only on net9.0 and later
  • Platform: Windows only (uses Windows-specific APIs)
  • Privileges: Most operations require administrative elevation

⚖️ License

Distributed under the MIT License.

See the LICENSE file for full details. More information: MIT License

👤 Author

Herman Schoenfeld - Software Engineer

Native interop and utility ownership

WinAPI nested types identify DLLs: KERNEL32 owns process/file/console/system declarations, PSAPI process-memory/performance, IPHLPAPI endpoint/interface/neighbour tables, NTDLL native handles, RSTRTMGR Restart Manager, USER32 window/message/environment broadcasts, and ADVAPI32 registry/service/token calls. Extend the DLL facade rather than creating domain-named extern containers.

Typed domain APIs sit above the bindings. Apps own collectors, sampling/rates, view models, display metadata and plans. Core's Statistics(0) is the reusable accumulator; the caller selects metrics, units and lifetime. Follow the Windows facade practice.

Global hotkey bindings

WinAPI.USER32 supplies RegisterHotKey, UnregisterHotKey, WM_HOTKEY, the modifier flags and the message-only window parent. Register and release a shortcut on its owning window thread, and use MOD_NOREPEAT when one notification per press is required. WinForms consumers can use the owned GlobalHotKey component instead of maintaining native window registration themselves. Product settings and toggle behavior remain in the consuming application.

Magnification and overlay layering

WinAPI.MAGNIFICATION declares the Windows Magnification API: initialization, the WC_MAGNIFIER control, window source/transform/filter lists, per-window and full-screen color effects. MagnificationSession owns the one process-level MagInitialize/MagUninitialize lifetime and applies the full-screen color effect (SetFullscreenColorEffect, ResetFullscreenColorEffect); disposal uninitializes, which also removes the effect. MagnifierWindow hosts a magnifier control in a passive, topmost, click-through layered popup that re-renders Bounds (physical pixels) through a GDI+ ColorMatrix at 1:1, optionally clipped to SourceBounds, with ExcludedWindows left out of the capture. Windows captures a frame each time the source is set, so callers Refresh() once per display frame; re-assigning an unchanged ExcludedWindows list costs nothing. Use both on the UI thread that created the session, and keep the session alive longer than its windows.

The full-screen effect is the only zero-latency transformation Windows offers, and it covers the whole desktop. Magnifier windows lag by up to one refresh, so drive them with DisplayFrameClock rather than a WinForms timer, whose 15.6 ms granularity and fixed intervals fall behind the screen. The clock raises Frame on its synchronization context at the compositor's refresh rate (RefreshRate, re-read every second), or no faster than MinimumInterval. A frame stays pending until its handler returns, so a slow handler lowers the rate without queueing a backlog or starving input. Stop the clock while nothing needs re-rendering.

using var session = new MagnificationSession();
var window = new MagnifierWindow(session, screenBounds, "Inverter") { ColorEffect = negative };
window.Show();
using var clock = new DisplayFrameClock();
clock.Frame += window.Refresh;
clock.Start();

WindowsWindowLayering answers z-order questions: GetPassiveOverlaysAbove(referenceWindows) returns the visible layered, click-through windows (pointer sprites, annotation overlays) that sit above every reference window, walking from the top of the z-order and stopping at the first reference. A capture surface excludes those so they render once, live, while an overlay the surface already covers stays captured rather than disappearing. Placing a window in the topmost band puts it above the overlays that were over it, so a caller that places its surface again reads those overlays first and passes them to RestoreAbove(overlays, referenceWindows) afterwards, which puts them back in their order without activating anything; GetTopmostPassiveOverlays() lists the overlays a first surface lands above. A renderer that places capture windows again on each request does both, so an overlay such as a reading guide stays above them.

Composing these into per-display colour effects, with fades, window exceptions and preserved media, is application policy. Lumina's colour-effect renderer does it on top of the session, the magnifier windows, the frame clock and the overlay layering.

Cached WAV feedback

IWaveSoundPlayer and WaveSoundPlayer in Audio/ provide synchronous WAV playback with a bounded cache of loaded samples (six entries, 4 MiB retained and 1 MiB per WAV by default; constructor overrides are available). Play(key, streamFactory) owns and closes a newly opened stream, reuses samples for the same key, and completes when playback ends. Stop() can interrupt playback from another thread; disposal stops playback and releases the cache. Call blocking playback from an owned background worker, then stop and join that worker during shutdown.

Applications choose sample keys, resources, user preferences and preview policy. The player does not simulate input, create UI, retry sounds or play a warm-up sound. Windows audio-device behavior after a long idle remains device dependent.

Reusable file, account and SID operations

Tools.Windows.Files exposes named $DATA streams through WindowsFile. Enumeration excludes the unnamed primary contents; opening a stream returns an owned FileStream. Creation requires an existing primary file; empty names and stream/path separators are rejected. Delete removes the exact named stream. Use bounded reads for unknown streams and dispose every returned stream. Apps own encoding, editing, stale checks and confirmation.

Tools.Windows.Computer exposes detached computer, system-product, BIOS, baseboard, processor and operating-system resources, physical RAM modules and arrays, enclosures, video controllers, monitor EDID identities, present Plug and Play devices and printer connections. These queries return raw Windows resource records without presentation metadata. Memory-array maximum capacity is converted from WMI kilobytes to bytes; configured module clock is the provider's MHz value. Video-controller ReportedMemoryBytes retains the limited 32-bit WMI AdapterRAM field and must not be treated as authoritative modern GPU memory capacity. Queries release WMI objects before returning typed data. Queries run in the calling thread, so call them on a worker. They call their checkpoint between resources. Provider fields may be unavailable. Apps choose report grouping, labels, caching and copy/export behavior.

Underlying provider contracts: physical memory, memory arrays, enclosures, video controllers, Plug and Play entities, monitor identities and printers.

Tools.Windows.Network.GetInterfaces[Async] also retains detached physical address bytes and reported link speed. Hardware-read errors are separate from IP-address-read errors, so one unavailable part does not erase the other.

WindowsFile.Copy / CopyAsync transfer one file and streams with overwrite selection, cancellation, byte progress and worker checkpoints. Cancelled copies discard partial destination data; callback failures are rethrown after returning from native code. Local/UNC paths are supported. This API does not impose a migration layout or delete a tree.

Windows.Security supplies account/group/share resource methods, paged native enumeration, descriptor reads/writes, raw SID lookup and effective-token scopes. Tools.Windows.SecurityDescriptors translates exact owner/group/ACE identities simultaneously, preserving unrelated sections. Account enumerators consume every page and release owning buffers; callers do not retain interior pointers.

The File Server Migrator plugin composes these primitives. File-tree options/results, retry/verification policy, cleaning/overlap checks, missing-account import/default passwords, share recreation, SID walkers, progress reporting, pause/cancel and confirmation belong to that application workflow.

Native declarations, message constants, and layouts live in WinAPI in this package. Use Tools.Windows.Win32 for native message structures, cursor handles, rich-edit formatting, tab captions, and layered-window rendering. The Windows package has no dependency on Windows Forms; controls supply their native handles to these helpers.

SoundPlayerEx now lives in Sphere10.Framework.Windows. WinAPI.USER32 owns ICONINFO, MINMAXINFO, icon/cursor functions, and window-message constants. WinAPI.RICHEDIT owns rich-edit constants and the Unicode CHARFORMAT/FORMATRANGE layouts; WinAPI.COMCTL32 owns TCITEM and tab-message constants. CreateCursorHandle returns a native handle owned by the caller; release it with WinAPI.USER32.DestroyCursor when no longer used.

The assembly declares its Windows platform requirement. Bitmap/GDI helpers additionally declare windows6.1, matching their System.Drawing.Common dependencies. Keyboard and mouse hooks now raise their existing Disposed event once during explicit disposal; finalization releases the native hook without raising managed disposal events. SoundPlayerEx.LoadStream reads from the current position to the end, supports nonseekable streams and short reads, and leaves the input stream open.

Process liveness

WindowsProcess.HasExited uses the native process handle's signaled state with a zero-time wait. GetProcessTimes supplies creation and CPU times; its exit-time output is undefined for a live process and is not used as a liveness predicate. WindowsProcess.Open requests query plus synchronization access. If Windows allows only querying, identity/path/counters remain available while HasExited explicitly reports the missing synchronization permission. Identity capture and verified commands require a live handle; they never infer a successful check from access denial. Window and file-handle ownership checks reuse the same native liveness rule.

Active Monitor And Display Paths

Tools.Windows.Display.GetDisplays(checkpoint) performs CCD, GDI, registry and optional WMI metadata reads, so call it on a worker, and returns WindowsDisplayInfo[]. It is a read-only snapshot of active paths, with exact adapter LUID/target IDs and device paths, current/preferred timings, color state, driver metadata, source modes and validated cached EDID metadata. Older systems or unsupported driver queries leave optional fields null and preserve per-query availability details. HDR support, user enablement and active mode use the optional advanced-color v2 request; the older advanced-color flags are not reinterpreted as HDR state.

When only names are needed, Tools.Windows.Display.GetDisplayNames(checkpoint) reads the display configuration alone and returns the monitor name Windows Settings shows for each active desktop source, keyed by its GDI device name (\\.\DISPLAY1, as Screen.DeviceName reports it, compared ignoring case). Sources whose monitor reports no name are omitted; a cloned source takes its first named monitor.

WindowsDisplayDataSource implements IDataSource<WindowsDisplayInfo> through AsyncListDataSource<T>. Its first read collects once; sorting, filtering and page reads reuse that inventory, and an ActionRefreshableDataSource over the factory serves a fresh one on refresh. Sync native readers assert that they are not on the main thread. Query buffers retry boundedly when a hotplug races sizing, without publishing a failed query.

WindowsMonitorEdid.Parse validates the EDID 1.x base header and checksum before decoding size/gamma. Missing extension blocks and per-block checksum failures are reported; raw bytes remain available. The native reader reads the registry cache and flags EDID overrides separately. It does not read DDC live, apply overrides, change display settings or write monitor registers.

Native contracts: QueryDisplayConfig, display target names, video signals, and Windows EDID overrides.

Process Inspection

Explicit module details, token restrictions and mitigation policies are described in Process Inspection.

Mouse Hook Compatibility

IMouseHook exposes the Scroll event already implemented by BaseMouseHook. Consumers implementing IMouseHook directly must provide that event; subclasses of BaseMouseHook inherit its implementation.

Asynchronous WindowsMouseHook observations preserve native arrival order and carry MouseMoveEvent.MonotonicTimestampMilliseconds captured before dispatch. The existing wall-clock Time remains the processing time. Stop, restart and uninstall discard queued observations from earlier activations; an already running callback can finish. Native critical callbacks retain synchronous dispatch so their subscribers can decide whether input is suppressed. HooksTool.IsAnyMouseButtonDown() reads physical button state independently of the caller's message queue, including the two extended mouse buttons.

File Discovery

Tools.Windows.Files.CreateInspectionService() returns a fresh on-demand file-inspection service; Tools.Windows.Files.Inspect(path, checkpoint) remains the existing direct route. Bounded file range reads remain on the same Files utility.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
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 Sphere10.Framework.Windows:

Package Downloads
Sphere10.Framework.Windows.Forms

Windows Forms UI framework and component library for building desktop applications with Sphere10 Framework. Provides reusable WinForms controls, dialogs, layout/helpers, and common UI utilities intended to integrate cleanly with the framework's application and data layers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.4-ci.197.47634432842.1 0 12/6/2026
3.2.4-ci.196.47500116417.1 63 12/5/2026
3.2.3 70 12/5/2026
3.2.2 158 12/1/2026
3.2.2-ci.194.47495410207.1 62 12/5/2026
3.2.2-ci.193.47493568597.1 65 12/5/2026
3.2.2-ci.192.46917925497.1 85 12/2/2026
3.2.2-ci.190.46632449858.1 101 12/1/2026
3.2.1 133 12/1/2026
3.2.1-ci.188.46577495467.1 85 12/1/2026
3.2.1-ci.187.46570985646.1 84 12/1/2026
3.2.0-ci.186.45519021075.1 107 11/25/2026
3.2.0-ci.185.45437957423.1 104 11/24/2026
3.2.0-ci.184.45433825651.1 105 11/24/2026
3.2.0-ci.179.45429051159.1 104 11/24/2026
3.2.0-ci.176.45423889482.1 102 11/24/2026
3.2.0-ci.175.45417619940.1 102 11/24/2026
3.2.0-ci.174.45412668816.1 103 11/24/2026
3.2.0-ci.173.45375449609.1 108 11/24/2026
3.2.0-ci.171.45374063975.1 98 11/24/2026
Loading failed