More 32 bit fixes

This commit is contained in:
Maurice Heumann
2025-04-14 14:15:58 +02:00
parent 00084e8ad0
commit 0e9cffa5cb
10 changed files with 152 additions and 152 deletions

View File

@@ -212,7 +212,7 @@ namespace syscalls
const emulator_object<PROCESS_BASIC_INFORMATION64> info{c.emu, process_information};
info.access([&](PROCESS_BASIC_INFORMATION64& basic_info) {
basic_info.PebBaseAddress = c.proc.peb.ptr();
basic_info.PebBaseAddress = c.proc.peb.value();
basic_info.UniqueProcessId = 1;
});
@@ -306,11 +306,12 @@ namespace syscalls
thread_iterator->second.teb->access([&](TEB64& teb) {
entry.ThreadId = teb.ClientId.UniqueThread;
auto* tls_vector = teb.ThreadLocalStoragePointer;
const auto tls_vector = teb.ThreadLocalStoragePointer;
constexpr auto ptr_size = sizeof(EmulatorTraits<Emu64>::PVOID);
if (tls_info.TlsRequest == ProcessTlsReplaceIndex)
{
auto* tls_entry_ptr = tls_vector + tls_info.TlsIndex;
const auto tls_entry_ptr = tls_vector + (tls_info.TlsIndex * ptr_size);
const auto old_entry = c.emu.read_memory<EmulatorTraits<Emu64>::PVOID>(tls_entry_ptr);
c.emu.write_memory<EmulatorTraits<Emu64>::PVOID>(tls_entry_ptr, entry.TlsModulePointer);
@@ -319,12 +320,12 @@ namespace syscalls
}
else if (tls_info.TlsRequest == ProcessTlsReplaceVector)
{
auto* new_tls_vector = entry.TlsVector;
const auto new_tls_vector = entry.TlsVector;
for (uint32_t index = 0; index < tls_info.TlsVectorLength; ++index)
{
auto* old_entry = c.emu.read_memory<void*>(tls_vector + index);
c.emu.write_memory<void*>(new_tls_vector + index, old_entry);
const auto old_entry = c.emu.read_memory<uint64_t>(tls_vector + index * ptr_size);
c.emu.write_memory(new_tls_vector + index * ptr_size, old_entry);
}
teb.ThreadLocalStoragePointer = new_tls_vector;
@@ -386,4 +387,4 @@ namespace syscalls
return STATUS_NOT_SUPPORTED;
}
}
}

View File

@@ -73,7 +73,7 @@ namespace syscalls
t.teb->access([&](TEB64& teb) {
if (tls_cell < TLS_MINIMUM_AVAILABLE)
{
teb.TlsSlots.arr[tls_cell] = nullptr;
teb.TlsSlots.arr[tls_cell] = 0;
}
else if (teb.TlsExpansionSlots)
{
@@ -136,7 +136,7 @@ namespace syscalls
const emulator_object<THREAD_BASIC_INFORMATION64> info{c.emu, thread_information};
info.access([&](THREAD_BASIC_INFORMATION64& i) {
i.TebBaseAddress = thread->teb->ptr();
i.TebBaseAddress = thread->teb->value();
i.ClientId = thread->teb->read().ClientId;
});
@@ -542,7 +542,7 @@ namespace syscalls
}
else if (type == PsAttributeTebAddress)
{
write_attribute(c.emu, attribute, thread->teb->ptr());
write_attribute(c.emu, attribute, thread->teb->value());
}
else
{