Skip to main content

close_handle

Function close_handle 

Source
pub fn close_handle(handle: HANDLE) -> bool
Expand description

Closes a HANDLE object.

It will return either a boolean value or an Err with a descriptive error message. If the function fails the bool value returned will be false.

§Examples

let pid = 792u32;
let handle = dyncvoke_core::open_process(0x0040, 0, pid); //PROCESS_DUP_HANDLE access right.

if !handle.is_null()
{
    let r = dyncvoke_core::close_handle(handle);
    if r
    {
        println!("Handle to process with id {} closed.", pid);
    }
}