[+] IProcessSectionMapView::LockSwap

[+] IProcessSectionMapView::UnlockSwap
[*] Fix critical tag under ILogger
[*] Added missing includes to experimental APIs
This commit is contained in:
Reece Wilson 2023-04-17 15:55:51 +01:00
parent 0c494cb99a
commit b2311a8824
11 changed files with 69 additions and 13 deletions

View File

@ -34,3 +34,7 @@
#if 1 #if 1
#include "IOExperimental.hpp" #include "IOExperimental.hpp"
#endif #endif
#include "Protocol/Protocol.hpp"
#include "TLS/TLS.hpp"

View File

@ -12,10 +12,10 @@ namespace Aurora::IO::TLS
struct ICertificateChain struct ICertificateChain
{ {
virtual AuUInt32 GetCertificateCount() = 0; virtual AuUInt32 GetCertificateCount() = 0;
virtual AuSPtr<AuMemoryViewRead> GetCertificate(AuUInt32 idx) = 0; virtual AuSPtr<Memory::MemoryViewRead> GetCertificate(AuUInt32 idx) = 0;
virtual Crypto::X509::DecodedCertificate GetCertificateDetails(AuUInt32 idx) = 0; virtual Crypto::X509::DecodedCertificate GetCertificateDetails(AuUInt32 idx) = 0;
}; };
AUKN_SYM AuSPtr<ICertificateChain> ChainFromOne(const AuMemoryViewRead &read); AUKN_SYM AuSPtr<ICertificateChain> ChainFromOne(const Memory::MemoryViewRead &read);
AUKN_SYM AuSPtr<ICertificateChain> ChainFromMany(const AuList<AuMemoryViewRead> &read); AUKN_SYM AuSPtr<ICertificateChain> ChainFromMany(const AuList<Memory::MemoryViewRead> &read);
} }

View File

@ -26,7 +26,7 @@ namespace Aurora::IO::TLS
/** /**
* @brief * @brief
*/ */
AuByteBuffer serverTransportId {}; Memory::ByteBuffer serverTransportId {};
int iServerCookies { 0 }; int iServerCookies { 0 };
@ -117,7 +117,7 @@ namespace Aurora::IO::TLS
/** /**
* @brief * @brief
*/ */
AuNet::ETransportProtocol transportProtocol { AuNet::ETransportProtocol::eProtocolTCP }; Net::ETransportProtocol transportProtocol { Net::ETransportProtocol::eProtocolTCP };
/** /**
* @brief * @brief

View File

@ -11,8 +11,8 @@ namespace Aurora::IO::TLS
{ {
struct TLSPrivateKeyPair struct TLSPrivateKeyPair
{ {
AuList<AuByteBuffer> certificateChain; AuList<Memory::ByteBuffer> certificateChain;
AuByteBuffer privateKey; Memory::ByteBuffer privateKey;
AuString sPassword; AuString sPassword;
}; };
} }

View File

@ -90,7 +90,7 @@ namespace Aurora::Logging
template<typename ... T> template<typename ... T>
inline void LogCritical(const AuString &line, T&& ... args) inline void LogCritical(const AuString &line, T&& ... args)
{ {
WriteLinef(static_cast<AuUInt8>(ELogLevel::eCritical), EAnsiColor::eBoldRed, "Warn", line, AuForward<T>(args)...); WriteLinef(static_cast<AuUInt8>(ELogLevel::eCritical), EAnsiColor::eBoldRed, "Critical", line, AuForward<T>(args)...);
} }
template<typename ... T> template<typename ... T>

View File

@ -20,5 +20,8 @@ namespace Aurora::Process
virtual AuUInt8 *GetBasePointer() = 0; virtual AuUInt8 *GetBasePointer() = 0;
virtual AuUInt8 *GetPointer(AuUInt offset) = 0; virtual AuUInt8 *GetPointer(AuUInt offset) = 0;
virtual bool LockSwap() = 0;
virtual bool UnlockSwap() = 0;
}; };
} }

View File

@ -73,4 +73,24 @@ namespace Aurora::Process
{ {
return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0; return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0;
} }
bool ProcessSectionFileMapView::LockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Lock({ { this->uAddress, this->uLength} });
}
bool ProcessSectionFileMapView::UnlockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Unlock({ { this->uAddress, this->uLength} });
}
} }

View File

@ -16,9 +16,9 @@ namespace Aurora::Process
virtual ~ProcessSectionFileMapView(); virtual ~ProcessSectionFileMapView();
ProcessSectionFileMapView(AuUInt uAddress, HANDLE hFileSection); ProcessSectionFileMapView(AuUInt uAddress, HANDLE hFileSection);
virtual void Unmap() override; void Unmap() override;
virtual bool Flush(AuUInt offset, AuUInt length) override; bool Flush(AuUInt offset, AuUInt length) override;
AuUInt GetBaseAddress() override; AuUInt GetBaseAddress() override;
AuUInt GetAddress(AuUInt offset) override; AuUInt GetAddress(AuUInt offset) override;
@ -26,6 +26,9 @@ namespace Aurora::Process
AuUInt8 *GetBasePointer() override; AuUInt8 *GetBasePointer() override;
AuUInt8 *GetPointer(AuUInt offset) override; AuUInt8 *GetPointer(AuUInt offset) override;
bool LockSwap() override;
bool UnlockSwap() override;
ProcessSectionView *pProcessGlobalHint {}; ProcessSectionView *pProcessGlobalHint {};
AuSPtr<IProcessSectionView> pSharedSectionHint {}; AuSPtr<IProcessSectionView> pSharedSectionHint {};
AuUInt uOffset {}; AuUInt uOffset {};

View File

@ -87,4 +87,24 @@ namespace Aurora::Process
{ {
return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0; return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0;
} }
bool ProcessSectionFileMapView::LockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Lock({ { this->uAddress, this->uLength} });
}
bool ProcessSectionFileMapView::UnlockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Unlock({ { this->uAddress, this->uLength} });
}
} }

View File

@ -16,9 +16,9 @@ namespace Aurora::Process
ProcessSectionFileMapView(AuUInt uAddress, AuUInt uLength, bool bShouldUnmap, int optFd = -1); ProcessSectionFileMapView(AuUInt uAddress, AuUInt uLength, bool bShouldUnmap, int optFd = -1);
virtual ~ProcessSectionFileMapView(); virtual ~ProcessSectionFileMapView();
virtual void Unmap() override; void Unmap() override;
virtual bool Flush(AuUInt offset, AuUInt length) override; bool Flush(AuUInt offset, AuUInt length) override;
AuUInt GetBaseAddress() override; AuUInt GetBaseAddress() override;
AuUInt GetAddress(AuUInt offset) override; AuUInt GetAddress(AuUInt offset) override;
@ -28,6 +28,9 @@ namespace Aurora::Process
AuSPtr<IProcessSectionView> pSharedSectionHint {}; AuSPtr<IProcessSectionView> pSharedSectionHint {};
bool LockSwap() override;
bool UnlockSwap() override;
private: private:
AuUInt uAddress {}; AuUInt uAddress {};
AuUInt uLength_ {}; AuUInt uLength_ {};

View File

@ -153,6 +153,7 @@ namespace Aurora::Process
} }
pNewObject->pProcessGlobalHint = this; pNewObject->pProcessGlobalHint = this;
pNewObject->uLength = uLength;
return pNewObject; return pNewObject;
} }
@ -246,6 +247,7 @@ namespace Aurora::Process
} }
pNewObject->pProcessGlobalHint = this; pNewObject->pProcessGlobalHint = this;
pNewObject->uLength = uLength;
return pNewObject; return pNewObject;
} }
@ -348,6 +350,7 @@ namespace Aurora::Process
} }
pNewObject->pProcessGlobalHint = this; pNewObject->pProcessGlobalHint = this;
pNewObject->uLength = uLength;
return pNewObject; return pNewObject;
} }