Code Monkey home page Code Monkey logo

windows-syscall's Introduction

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};
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.

windows-syscall's People

Contributors

oberrich avatar

Stargazers

Andrew avatar  avatar

Watchers

 avatar  avatar

Forkers

fengjixuchui

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.