Jamie Reece Wilson
bdec6ff8ba
[+] AuProcess::EnvironmentGetOne [+] AuProcess::EnvironmentSetOne [+] AuProcess::EnvironmentRemoveOne [+] AuProcess::EnvironmentRemoveMany [+] AuProcess::EnvironmentSetMany [+] AuProcess::GetProcessStartupTimeNS [+] AuProcess::GetProcessStartupTimeMS [*] Note WakeOnAddress on all platforms [*] Updated READMEs
83 lines
3.6 KiB
C++
83 lines
3.6 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Process.hpp
|
|
Date: 2021-6-10
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "Paths.hpp"
|
|
#include "ProcessMap.hpp"
|
|
#include "IProcessSectionMapView.hpp"
|
|
#include "IProcessSectionView.hpp"
|
|
#include "ProcessEnvironment.hpp"
|
|
#include "ProcessStartTime.hpp"
|
|
|
|
namespace Aurora::Process
|
|
{
|
|
/**
|
|
* @brief Aborts the current process with the provided exitcode
|
|
* @param exitcode
|
|
* @return
|
|
*/
|
|
AUKN_SYM AU_NORETURN void Exit(AuUInt32 exitcode);
|
|
|
|
AUE_DEFINE(EModulePath,
|
|
(
|
|
eModulePathCWD,
|
|
eModulePathSystemDir, /// /usr/lib/, windir/system32
|
|
eModulePathUserDir, /// /usr/local/lib
|
|
eProcessDirectory, ///
|
|
//eOSSpecified, /// LD_LIBRARY_PATH + /etc/ld.so.conf, AddDllDirectory
|
|
eSpecified
|
|
));
|
|
|
|
|
|
// eModulePathSystemDir -> why /usr/lib and not /lib?
|
|
// https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
|
|
// Arch 2012: https://archlinux.org/news/the-lib-directory-becomes-a-symlink/
|
|
// Ubuntu 2018 (mandatory 2021+): https://lists.ubuntu.com/archives/ubuntu-devel-announce/2018-November/001253.html https://wiki.debian.org/UsrMerge
|
|
// Fedora (2011?): https://fedoraproject.org/wiki/Features/UsrMove
|
|
|
|
static AuList<EModulePath> kUserOverloadableSearchPath = {EModulePath::eSpecified, EModulePath::eModulePathCWD, EModulePath::eProcessDirectory, EModulePath::eModulePathUserDir, EModulePath::eModulePathSystemDir};
|
|
static AuList<EModulePath> kAdminOverloadableSearchPath = {EModulePath::eSpecified, EModulePath::eModulePathSystemDir, EModulePath::eProcessDirectory, EModulePath::eModulePathCWD, EModulePath::eModulePathUserDir};
|
|
static AuList<EModulePath> kSpecifiedPath = {EModulePath::eSpecified};
|
|
static AuList<EModulePath> kCWDPath = {EModulePath::eModulePathCWD};
|
|
static AuList<EModulePath> kProcPath = {EModulePath::eProcessDirectory};
|
|
|
|
struct ModuleLoadRequest
|
|
{
|
|
inline ModuleLoadRequest(const AuList<AuString> &directories, const AuString &mod) : mod(mod), specifiedSearchPaths(&directories), searchPath(&kSpecifiedPath)
|
|
{}
|
|
|
|
inline ModuleLoadRequest(const AuList<AuString> &directories, const AuString &mod, const AuString &version) : mod(mod), version(version), specifiedSearchPaths(&directories), searchPath(&kSpecifiedPath)
|
|
{}
|
|
|
|
inline ModuleLoadRequest(const AuString &mod) : mod(mod), searchPath(&kAdminOverloadableSearchPath)
|
|
{}
|
|
|
|
inline ModuleLoadRequest(const AuString &mod, const AuString &version) : mod(mod), version(version), searchPath(&kAdminOverloadableSearchPath)
|
|
{}
|
|
|
|
AuString mod;
|
|
AuString version;
|
|
AuList<AuString> const * specifiedSearchPaths {};
|
|
AuList<EModulePath> const * searchPath {};
|
|
bool verify {}; // always effectively true if the executable is signed and enableMitigations is true
|
|
bool unixCheckPlusX {};
|
|
bool enableMitigations {true};
|
|
};
|
|
|
|
/**
|
|
* @brief Loads a dynamic link module into cache, by the name of 'mod', somewhere in the directories specified by 'searchPath'.
|
|
* You should not provide a suffix, platform extension, or the full aurora dll string. Path resolution will take care of
|
|
* resolving the Aurora ABI, falling back to mod.platformext.
|
|
* @param request
|
|
* @return
|
|
*/
|
|
AUKN_SYM bool LoadModule(const ModuleLoadRequest &request);
|
|
|
|
|
|
AUKN_SYM AuMach GetProcAddress(AuString mod, AuString symbol);
|
|
} |