Skip to content

Commit

Permalink
fix: legacy cs2 get modules
Browse files Browse the repository at this point in the history
  • Loading branch information
WolverinDEV committed Oct 25, 2024
1 parent 67ca882 commit 354b1c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion driver/src/handler/cs_module.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
use alloc::{
boxed::Box,
string::ToString,
};

use valthrun_driver_shared::requests::{
ProcessFilter,
RequestCSModule,
RequestProcessModules,
ResponseProcessModules,
};

use super::handler_get_modules_internal;
use crate::handler::handler_get_modules;

pub fn handler_get_cs2_modules(
req: &RequestCSModule,
res: &mut ResponseProcessModules,
) -> anyhow::Result<()> {
let process_name = "cs2.exe";
handler_get_modules(
handler_get_modules_internal(
&RequestProcessModules {
filter: ProcessFilter::Name {
name: process_name.as_ptr(),
Expand All @@ -22,5 +28,6 @@ pub fn handler_get_cs2_modules(
module_buffer_length: req.module_buffer_length,
},
res,
true,
)
}
10 changes: 9 additions & 1 deletion driver/src/handler/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ use crate::util::kprocess;
pub fn handler_get_modules(
req: &RequestProcessModules,
res: &mut ResponseProcessModules,
) -> anyhow::Result<()> {
handler_get_modules_internal(req, res, false)
}

pub fn handler_get_modules_internal(
req: &RequestProcessModules,
res: &mut ResponseProcessModules,
kernel_filter: bool,
) -> anyhow::Result<()> {
let module_buffer = unsafe {
if !seh::probe_write(
Expand All @@ -38,7 +46,7 @@ pub fn handler_get_modules(
ProcessFilter::Id { id } => Process::by_id(id).map(|p| vec![p]).unwrap_or_default(),
ProcessFilter::Name { name, name_length } => {
let name = unsafe {
if !seh::probe_read(name as u64, name_length, 0x01) {
if !kernel_filter && !seh::probe_read(name as u64, name_length, 0x01) {
anyhow::bail!("{}", obfstr!("name buffer not readable"));
}

Expand Down

0 comments on commit 354b1c8

Please sign in to comment.