Abstract ProcThreadAttributeList
into its own struct
This commit is contained in:
parent
d6f88291f3
commit
f371952cde
3 changed files with 297 additions and 154 deletions
|
@ -450,7 +450,7 @@ fn test_creation_flags() {
|
|||
fn test_proc_thread_attributes() {
|
||||
use crate::mem;
|
||||
use crate::os::windows::io::AsRawHandle;
|
||||
use crate::os::windows::process::CommandExt;
|
||||
use crate::os::windows::process::{CommandExt, ProcThreadAttributeList};
|
||||
use crate::sys::c::{BOOL, CloseHandle, HANDLE};
|
||||
use crate::sys::cvt;
|
||||
|
||||
|
@ -490,12 +490,14 @@ fn test_proc_thread_attributes() {
|
|||
|
||||
let mut child_cmd = Command::new("cmd");
|
||||
|
||||
unsafe {
|
||||
child_cmd
|
||||
.raw_attribute(PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, parent.0.as_raw_handle() as isize);
|
||||
}
|
||||
let parent_process_handle = parent.0.as_raw_handle();
|
||||
|
||||
let child = ProcessDropGuard(child_cmd.spawn().unwrap());
|
||||
let mut attribute_list = ProcThreadAttributeList::build()
|
||||
.attribute(PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, &parent_process_handle)
|
||||
.finish()
|
||||
.unwrap();
|
||||
|
||||
let child = ProcessDropGuard(child_cmd.spawn_with_attributes(&mut attribute_list).unwrap());
|
||||
|
||||
let h_snapshot = unsafe { CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue