Blame include/pemagine/bits/nt32/pe_inline_asm__msvc.h
|
|
feffc7 |
/* optimize: use __readfsdword rather than explicit eax */
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ void * pe_get_teb_address(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x18
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ void * pe_get_peb_address(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x18
|
|
|
feffc7 |
mov eax, ds:[eax+0x30]
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ void * pe_get_peb_address_alt(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x30
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ void * pe_get_peb_ldr_data_address(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x18
|
|
|
feffc7 |
mov eax, ds:[eax+0x30]
|
|
|
feffc7 |
mov eax, ds:[eax+0x0C]
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ void * pe_get_peb_ldr_data_address_alt(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x30
|
|
|
feffc7 |
mov eax, ds:[eax+0x0C]
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ uint32_t pe_get_current_process_id(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x20
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ uint32_t pe_get_current_thread_id(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x24
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|
|
|
feffc7 |
|
|
|
feffc7 |
static __inline__ uint32_t pe_get_current_session_id(void)
|
|
|
feffc7 |
{
|
|
|
feffc7 |
__asm {
|
|
|
feffc7 |
mov eax, fs:0x18
|
|
|
feffc7 |
mov eax, ds:[eax+0x30]
|
|
|
feffc7 |
mov eax, ds:[eax+0x1d4]
|
|
|
feffc7 |
};
|
|
|
feffc7 |
}
|