windows-syscall

Crates.iowindows-syscall
lib.rswindows-syscall
version0.0.17
sourcesrc
created_at2024-04-10 08:21:05.362595
updated_at2024-04-17 12:43:04.681769
descriptionWindows inline syscalls for Rust
homepagehttps://github.com/oberrich/windows-syscall
repositoryhttps://github.com/oberrich/windows-syscall
max_upload_size
id1203253
size14,895
52 69 63 68 61 72 64 (oberrich)

documentation

README

windows-syscall: Windows syscalls for Rust

windows-syscall GitHub Actions windows-syscall on crates.io windows-syscall on docs.rs

The syscall! macro provides a type-safe way to invoke a Windows system service.

Available Features

Feature Description
windows-syscall-typesafe (default) The macro attempts calling the provided function in a dead branch, ensuring type-safety (enabled by default).
windows-syscall-use-linked The macro directly invokes the provided function instead of performing an inline syscall. This is only useful for testing/debugging and is equivalent to directly calling the function.

Example

#![feature(asm_const, maybe_uninit_uninit_array, maybe_uninit_array_assume_init)]
use phnt::ffi::{NTSTATUS, HANDLE, NtClose, NtTestAlert}; // = "0.0.25"
use windows_syscall::syscall;

fn main() {
   const INVALID_HANDLE: HANDLE = core::ptr::null_mut();

   assert!(syscall!(NtClose(INVALID_HANDLE)).is_err());
   assert!(syscall!(NtTestAlert()).is_ok());
}

Platform Support

Arch
x86_64 (64-bit) Yes
x86 (32-bit) ❌ No (on request)
AArch64 ❌ No (on request)

This crate only implements calls to ntoskrnl services, if you require win32k services or an additional architecture please create an issue and let me know!

crate version: 0.0.x aka work-in-progress.

Commit count: 51

cargo fmt