Git Product home page Git Product logo

external's People

Contributors

casualx avatar kitcatier avatar leagueraini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

external's Issues

IntPtr<T> not implementing Pod?

I started converting my code to the most recent version of external and not gonna lie the switch to ur intptr crate is nothing but pain and suffering so far, my current issue is that in my case IntPtr<usize> does not seem to implement Pod

error[E0277]: the trait bound `external::prelude::IntPtr<usize>: dataview::Pod` is not satisfied
  --> src\main.rs:83:24
   |
83 |         self.read_as::<IntPtr<usize>>(idx, proc).and_then(|ptr| ptr.cast::<T>().read(proc))
   |                        ^^^^^^^^^^^^^ the trait `dataview::Pod` is not implemented for `external::prelude::IntPtr<usize>`
   |
   = help: the following other types implement trait `dataview::Pod`:
             isize
             i8
             i16
             i32
             i64
             i128
             usize
             u8
           and 15 others

into_inner not working propery for HANDLEs

So i came across a weird issue, my goal was to suspend/resume threads and since external doesnt have suspend/resume implemented on Thread i used the winapi crate and called SuspendThread and ResumeThread myself, issue is that into_inner() always gives me a wrong handle, here is some example code

fn suspend_process(proc_id: ProcessId) -> Result<()> {
    let threads = EnumThreads::create().context("Failed to collect running threads")?;
    let threads = threads.filter(|thread| thread.process_id() == proc_id);

    threads.for_each(|thread_entry| {
        if let Ok(thread) =
            Thread::attach(thread_entry.thread_id(), ThreadRights::new().suspend_resume())
        {
            unsafe { SuspendThread(thread.into_inner()) };
        }
    });

    Ok(())
}

fn resume_process(proc_id: ProcessId) -> Result<()> {
    let threads = EnumThreads::create().context("Failed to collect running threads")?;
    let threads = threads.filter(|thread| thread.process_id() == proc_id);

    threads.for_each(|thread_entry| {
        if let Ok(thread) =
            Thread::attach(thread_entry.thread_id(), ThreadRights::new().suspend_resume())
        {
            let handle = thread.into_inner();
            loop {
                if matches!(unsafe { ResumeThread(handle) }, 0 | 0xFFFFFFFF) {
                    break;
                }
            }
        }
    });

    Ok(())
}

when implemented on Thread directly tho using self.0 everything works perfectly fine

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.