Adding comments to the remaining functions

This commit is contained in:
João
2024-07-26 22:06:40 -03:00
parent 5ec1126e0a
commit f3f07d1af1

View File

@@ -258,6 +258,14 @@ pub unsafe fn get_process_by_name(process_name: &str) -> Option<usize> {
None
}
/// Retrieves the syscall index for a given function name.
///
/// # Parameters
/// * `function_name` - The name of the function to retrieve the syscall index for.
///
/// # Returns
/// `Option<u16>` - The syscall index if found, or `None` if an error occurs or the function is not found.
///
pub unsafe fn get_syscall_index(function_name: &str) -> Option<u16> {
let mut section_handle = null_mut();
let ntdll = crate::utils::uni::str_to_unicode("\\KnownDlls\\ntdll.dll");
@@ -327,10 +335,13 @@ pub unsafe fn get_syscall_index(function_name: &str) -> Option<u16> {
return None
}
/// Finds the address of a specified Zw function.
///
/// # Parameters
/// - `name`: The name of the Zw function to find.
///
///
///
///
/// # Returns
/// - `Option<usize>`: The address of the Zw function if found, or `None` if an error occurs or the function is not found.
///
pub unsafe fn find_zw_function(name: &str) -> Option<usize> {
let ssn = match get_syscall_index(name) {
@@ -382,9 +393,17 @@ pub unsafe fn find_zw_function(name: &str) -> Option<usize> {
return None
}
///
/// Initializes the OBJECT_ATTRIBUTES structure.
///
/// # Parameters
/// * `object_name` - The name of the object (optional).
/// * `attributes` - The attributes of the object.
/// * `root_directory` - The root directory (optional).
/// * `security_descriptor` - The security descriptor (optional).
/// * `security_quality_of_service` - The security quality of service (optional).
///
/// # Returns
/// `OBJECT_ATTRIBUTES` - The initialized OBJECT_ATTRIBUTES structure
///
#[allow(non_snake_case)]
pub fn InitializeObjectAttributes(
@@ -404,10 +423,13 @@ pub fn InitializeObjectAttributes(
}
}
/// Reads the content of a file given its path.
///
///
///
///
/// # Arguments
/// * `path` - The path to the file.
///
/// # Returns
/// `Result<Vec<u8>, NTSTATUS>` - The content of the file as a vector of bytes if successful, or an NTSTATUS error code if an error occurs.
///
pub fn read_file(path: &String) -> Result<Vec<u8>, NTSTATUS> {
let mut path_nt = String::new();