[Kernel] More TranslateVirtual/HostToGuestVirtual usage
This commit is contained in:
@@ -241,7 +241,7 @@ dword_result_t RtlUnicodeStringToAnsiString(
|
||||
uint32_t buffer_ptr =
|
||||
kernel_memory()->SystemHeapAlloc(uint32_t(ansi_str.size() + 1));
|
||||
|
||||
memcpy(kernel_memory()->virtual_membase() + buffer_ptr, ansi_str.data(),
|
||||
memcpy(kernel_memory()->TranslateVirtual(buffer_ptr), ansi_str.data(),
|
||||
ansi_str.size() + 1);
|
||||
destination_ptr->length = static_cast<uint16_t>(ansi_str.size());
|
||||
destination_ptr->maximum_length =
|
||||
@@ -250,7 +250,7 @@ dword_result_t RtlUnicodeStringToAnsiString(
|
||||
} else {
|
||||
uint32_t buffer_capacity = destination_ptr->maximum_length;
|
||||
auto buffer_ptr =
|
||||
kernel_memory()->virtual_membase() + destination_ptr->pointer;
|
||||
kernel_memory()->TranslateVirtual(destination_ptr->pointer);
|
||||
if (buffer_capacity < ansi_str.size() + 1) {
|
||||
// Too large - we just write what we can.
|
||||
result = X_STATUS_BUFFER_OVERFLOW;
|
||||
@@ -332,7 +332,7 @@ pointer_result_t RtlImageNtHeader(lpvoid_t module) {
|
||||
if (nt_magic != 0x4550) { // 'PE'
|
||||
return 0;
|
||||
}
|
||||
return static_cast<uint32_t>(nt_header - kernel_memory()->virtual_membase());
|
||||
return kernel_memory()->HostToGuestVirtual(nt_header);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(RtlImageNtHeader, kNone, kImplemented);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user