Reece Wilson
4671664396
[+] IProcessSectionView::AllocateEx2 [+] IProcessSectionView::MapFileByPathEx [+] IProcessSectionView::MapFileByObjectEx [+] IProcessSectionView::MapIPCMemoryEx [+] IProcessSectionView::GetAllocations [+] ReserveAddressSpace(AuUInt uLength) [*] Modified default value of: PageTable::NX
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: ProcessSectionFileMapView.NT.cpp
|
|
Date: 2022-08-09
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "ProcessSectionFileMapView.NT.hpp"
|
|
#include "ProcessSectionViewReserved.NT.hpp"
|
|
#include "ProcessSectionView.NT.hpp"
|
|
|
|
namespace Aurora::Process
|
|
{
|
|
ProcessSectionFileMapView::~ProcessSectionFileMapView()
|
|
{
|
|
Unmap();
|
|
}
|
|
|
|
ProcessSectionFileMapView::ProcessSectionFileMapView(AuUInt uAddress, HANDLE hSection) :
|
|
uAddress(uAddress),
|
|
hFileSection(hSection)
|
|
{
|
|
|
|
}
|
|
|
|
void ProcessSectionFileMapView::Unmap()
|
|
{
|
|
if (AuExchange(this->bIsDead_, true))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (this->uAddress)
|
|
{
|
|
if (this->pSharedSectionHint)
|
|
{
|
|
SysAssert(AuStaticCast<ProcessSectionViewReserved>(this->pSharedSectionHint)->ReleaseAndCoaleceAddress(this->uOffset, this->uLength));
|
|
}
|
|
else
|
|
{
|
|
::UnmapViewOfFile((PVOID)this->uAddress);
|
|
}
|
|
this->uAddress = 0;
|
|
}
|
|
|
|
AuWin32CloseHandle(this->hFileSection);
|
|
this->pSharedSectionHint.reset();
|
|
this->pProcessGlobalHint = nullptr;
|
|
}
|
|
|
|
bool ProcessSectionFileMapView::Flush(AuUInt offset, AuUInt length)
|
|
{
|
|
return ::FlushViewOfFile(this->GetPointer(offset), length);
|
|
}
|
|
|
|
AuUInt ProcessSectionFileMapView::GetBaseAddress()
|
|
{
|
|
return this->uAddress;
|
|
}
|
|
|
|
AuUInt ProcessSectionFileMapView::GetAddress(AuUInt offset)
|
|
{
|
|
return this->uAddress ? this->uAddress + offset : 0;
|
|
}
|
|
|
|
AuUInt8 *ProcessSectionFileMapView::GetBasePointer()
|
|
{
|
|
return AuReinterpretCast<AuUInt8 *>(this->uAddress);
|
|
}
|
|
|
|
AuUInt8 *ProcessSectionFileMapView::GetPointer(AuUInt offset)
|
|
{
|
|
return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0;
|
|
}
|
|
} |