Skip to content

Commit

Permalink
Process: fix imports of frida namespaced glib functions
Browse files Browse the repository at this point in the history
  • Loading branch information
s1341 committed Feb 2, 2025
1 parent 34464d5 commit 4fc4605
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions frida-gum/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@ use {
use alloc::{string::String, string::ToString, vec::Vec};

Check failure on line 19 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

unused import: `string::ToString`

Check failure on line 19 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

unused import: `string::ToString`

Check failure on line 19 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

unused import: `string::ToString`

Check failure on line 19 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

unused import: `string::ToString`
use cstr_core::CString;

#[cfg(target_os = "linux")]
extern "C" {
pub fn _frida_g_get_home_dir() -> *const c_char;
pub fn _frida_g_get_current_dir() -> *const c_char;
pub fn _frida_g_get_tmp_dir() -> *const c_char;
}

#[cfg(not(target_os = "linux"))]
extern "C" {
pub fn _g_get_home_dir() -> *const c_char;
pub fn _g_get_current_dir() -> *const c_char;
pub fn _g_get_tmp_dir() -> *const c_char;
}


#[derive(Clone, FromPrimitive, Debug)]
#[repr(u32)]
pub enum CodeSigningPolicy {
Expand Down Expand Up @@ -121,27 +130,42 @@ impl<'a> Process<'a> {
/// Returns a string specifying the filesystem path to the current working directory
pub fn current_dir(&self) -> String {
unsafe {
#[cfg(target_os = "linux")]
CStr::from_ptr(_frida_g_get_current_dir())
.to_string_lossy()
.to_string()

Check failure on line 136 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

expected `;`, found `#`

Check failure on line 136 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

expected `;`, found `#`

Check failure on line 136 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

expected `;`, found `#`

Check failure on line 136 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

expected `;`, found `#`
#[cfg(not(target_os = "linux"))]
CStr::from_ptr(_g_get_current_dir())
.to_string_lossy()
.to_string()
}
}

/// Returns a string specifying the filesystem path to the directory to use for temporary files
pub fn tmp_dir(&self) -> String {
unsafe {
#[cfg(target_os = "linux")]
CStr::from_ptr(_frida_g_get_tmp_dir())
.to_string_lossy()
.to_string()

Check failure on line 150 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

expected `;`, found `#`

Check failure on line 150 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

expected `;`, found `#`

Check failure on line 150 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

expected `;`, found `#`

Check failure on line 150 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

expected `;`, found `#`
#[cfg(not(target_os = "linux"))]
CStr::from_ptr(_g_get_tmp_dir())
.to_string_lossy()
.to_string()
}
}

/// Returns a string specifying the filesystem path to the current user’s home directory
pub fn home_dir(&self) -> String {
unsafe {
#[cfg(target_os = "linux")]
CStr::from_ptr(_frida_g_get_home_dir())
.to_string_lossy()
.to_string()

Check failure on line 164 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

expected `;`, found `#`

Check failure on line 164 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

expected `;`, found `#`

Check failure on line 164 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check no_std

expected `;`, found `#`

Check failure on line 164 in frida-gum/src/process.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

expected `;`, found `#`
#[cfg(not(target_os = "linux"))]
CStr::from_ptr(_g_get_home_dir())
.to_string_lossy()
.to_string()
}
}

Expand Down

0 comments on commit 4fc4605

Please sign in to comment.