1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use crate::*;
use super::Wrap;

/// TLS Directory.
impl<'a, Pe32: pe32::Pe<'a>, Pe64: pe64::Pe<'a>> Wrap<pe32::tls::Tls<'a, Pe32>, pe64::tls::Tls<'a, Pe64>> {
	/// Gets the PE instance.
	#[inline]
	pub fn pe(&self) -> Wrap<Pe32, Pe64> {
		match self {
			Wrap::T32(tls) => Wrap::T32(tls.pe()),
			Wrap::T64(tls) => Wrap::T64(tls.pe()),
		}
	}
	/// Returns the underlying TLS directory image.
	#[inline]
	pub fn image(&self) -> Wrap<&'a image::IMAGE_TLS_DIRECTORY32, &'a image::IMAGE_TLS_DIRECTORY64> {
		match self {
			Wrap::T32(tls) => Wrap::T32(tls.image()),
			Wrap::T64(tls) => Wrap::T64(tls.image()),
		}
	}
	/// Gets the raw TLS initialization data.
	#[inline]
	pub fn raw_data(&self) -> Result<&'a [u8]> {
		match self {
			Wrap::T32(tls) => tls.raw_data(),
			Wrap::T64(tls) => tls.raw_data(),
		}
	}
	/// Gets the TLS slot location.
	#[inline]
	pub fn slot(&self) -> Result<&'a u32> {
		match self {
			Wrap::T32(tls) => tls.slot(),
			Wrap::T64(tls) => tls.slot(),
		}
	}
	/// Gets the TLS initialization callbacks.
	#[inline]
	pub fn callbacks(&self) -> Result<Wrap<&'a [u32], &'a [u64]>> {
		match self {
			Wrap::T32(tls) => Wrap::T32(tls.callbacks()).transpose(),
			Wrap::T64(tls) => Wrap::T64(tls.callbacks()).transpose(),
		}
	}
}