Skip to main content

Crate windows_erg

Crate windows_erg 

Source
Expand description

§windows-erg

Ergonomic, idiomatic Rust wrappers for Windows APIs.

This library provides safe, easy-to-use abstractions over Windows system APIs, built on top of the windows-rs crate. It handles the complexity of:

  • Automatic handle management (RAII)
  • Permission handling
  • Error conversion and context
  • Type safety

§Quick Start

use windows_erg::process::Process;

// List all running processes
for proc_info in Process::list()? {
    println!("{}: {}", proc_info.pid, proc_info.name);
}

§Raw File Example

use windows_erg::file;

// Requires administrator privileges in most environments.
file::raw_copy(
    r"C:\\Windows\\System32\\drivers\\etc\\hosts",
    r"C:\\Temp\\hosts.copy"
)?;

§Modules

  • process - Process management (list, info, kill, spawn)
  • desktop - Desktop windows and tray icon operations
  • registry - Registry operations
  • evt - Windows Event Log querying and reading
  • etw - Event Tracing for Windows (ETW)
  • [file] - Raw file operations
  • pipes - Windows named and anonymous pipe API (in progress)
  • service - Windows Service Control Manager operations

Re-exports§

pub use error::Error;
pub use error::Result;
pub use types::ProcessId;
pub use types::ThreadId;
pub use wait::Wait;

Modules§

desktop
Desktop window and tray icon operations.
error
Error types for the windows-erg crate.
etw
Real-time ETW event monitoring.
evt
Windows Event Log (evt) - Query and read events from Windows Event Logs.
file
Raw file operations.
mitigation
Process mitigation policies.
pipes
Windows pipe operations.
process
Process operations and management.
proxy
Windows proxy discovery and URL-specific proxy resolution.
registry
Windows Registry operations.
security
Security and permission primitives.
service
Windows Service Control Manager operations.
system
Host system inventory (native Windows API and registry).
types
Common types used across multiple modules.
utils
Shared utility helpers for UTF-16/Wide conversions and owned Win32 handle RAII. Shared utility helpers.
wait
Shared wait-object primitives for cancellation and coordination. Shared wait-object primitives used across modules.

Functions§

is_elevated
Check if the current process is running with elevated (administrator) privileges.
require_elevation
Ensure the current process has elevated privileges, returning an error if not.