41 lines
2.1 KiB
C
41 lines
2.1 KiB
C
// Internal shared state for userspace PE dependency loading.
|
|
|
|
#pragma once
|
|
#include <stdbool.h>
|
|
|
|
#include <ntlite/module_loader.h>
|
|
#include <ntlite/pe_loader.h>
|
|
#include <ntlite/process_loader.h>
|
|
#include <ntlite/syscall.h>
|
|
|
|
typedef struct NTL_MODULE_CONTEXT NTL_MODULE_CONTEXT;
|
|
|
|
// Creates dependency-loader state for one constructing child or the current process.
|
|
KSTATUS NtlpCreateModuleContext(SYS_HANDLE processHandle,
|
|
SYS_HANDLE primaryModuleRootHandle,
|
|
SYS_STRING_VIEW primaryModuleDirectory,
|
|
SYS_HANDLE secondaryModuleRootHandle,
|
|
SYS_STRING_VIEW secondaryModuleDirectory,
|
|
SYS_HANDLE fallbackModuleRootHandle,
|
|
SYS_STRING_VIEW fallbackModuleDirectory,
|
|
NTL_MODULE_NAME_RESOLVER resolver,
|
|
void* resolverContext,
|
|
bool seedCurrentProcess,
|
|
NTL_MODULE_CONTEXT** contextOut);
|
|
// Releases loader metadata without releasing image mappings owned elsewhere.
|
|
void NtlpDestroyModuleContext(NTL_MODULE_CONTEXT* context);
|
|
// Materializes the main image while resolving startup dependencies through the context.
|
|
KSTATUS NtlpLoadMainImage(NTL_MODULE_CONTEXT* context,
|
|
SYS_HANDLE fileHandle,
|
|
NTL_PE_IMAGE* imageOut);
|
|
// Builds the opaque read-only loader-data block consumed later by userspace base services.
|
|
KSTATUS NtlpBuildLoaderData(NTL_MODULE_CONTEXT* context,
|
|
SYS_STRING_VIEW currentDirectory,
|
|
NTL_PROCESS_STRING_VECTOR arguments,
|
|
NTL_PROCESS_STRING_VECTOR environment,
|
|
const void* startupData,
|
|
size_t startupDataSize,
|
|
void** loaderDataOut);
|
|
// Returns the inherited canonical resource CWD stored in the current process loader data.
|
|
KSTATUS NtlpGetLoaderCurrentDirectory(SYS_STRING_VIEW* currentDirectoryOut);
|