Skip to content

Commit e30adab

Browse files
authored
small changes and explanation
1 parent fa2bd44 commit e30adab

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Process/createprocess.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/*
2-
This is an Rust code for starting an process and print out some values like the PID, TID and Handles for the subsequent processes/threads. This was given as homework by Crow/ .
3-
4-
Crow's Homework : https://www.crow.rip/crows-nest/mal/dev/getting-started#homework
5-
6-
*/
7-
8-
// Rust Code
9-
101
extern crate winapi;
112

123
#[allow(unused_imports)]
@@ -17,7 +8,7 @@ use winapi::{
178
um::{
189
processthreadsapi::{PROCESS_INFORMATION,STARTUPINFOW,{CreateProcessW,GetProcessId,GetThreadId}},
1910
winbase::INFINITE,
20-
handleapi::CloseHandle,
11+
// handleapi::CloseHandle,
2112
synchapi::WaitForSingleObject,
2213
errhandlingapi::GetLastError,
2314
}};
@@ -71,7 +62,10 @@ fn main(){
7162
WaitForSingleObject(process_info.hProcess, INFINITE);
7263
println!("(+) Finish Exiting...");
7364

74-
CloseHandle(process_info.hThread);
75-
CloseHandle(process_info.hProcess);
65+
// In Rust we dont need to free up its allocated memory because when going out of scops rust automatically cleans up the memory due to its ownership and resource management system.
66+
// If you need so you can clean by yourself !...
67+
68+
// CloseHandle(process_info.hThread);
69+
// CloseHandle(process_info.hProcess);
7670
}
7771
}

0 commit comments

Comments
 (0)