Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion win32/dll/kernel32/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{KernelObject, get_state, peb_mut};
use memory::Extensions;
use std::{rc::Rc, sync::Arc};
use win32_system::{Event, System, memory::Memory};
use win32_winapi::{HANDLE, Str16};
use win32_winapi::{ERROR, HANDLE, Str16};

#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub struct HTHREADT;
Expand Down Expand Up @@ -178,6 +178,11 @@ pub fn TlsSetValue(sys: &mut dyn System, dwTlsIndex: u32, lpTlsValue: u32) -> bo
#[win32_derive::dllexport]
pub fn TlsGetValue(sys: &mut dyn System, dwTlsIndex: u32) -> u32 {
let teb = teb_mut(sys);
if dwTlsIndex as usize >= teb.TlsSlots.len() {
log::warn!("TlsGetValue of unknown slot {dwTlsIndex}");
sys.set_last_error(ERROR::INVALID_PARAMETER);
return 0;
}
teb.TlsSlots[dwTlsIndex as usize]
}

Expand Down
Loading