Files
TerraSharp/src/TerraSharp.Injector/bootstrap.h
T

56 lines
1.6 KiB
C

#pragma once
#define NOMINMAX
#include <windows.h>
#include <cstddef>
enum class BootstrapStage : DWORD
{
Pending,
CreateInstance,
GetRuntime,
GetInterface,
Start,
Execute,
RegisterUnwind,
GetDelegates,
LoadAssembly,
GetEntryPoint,
Invoke,
RemoveUnwind,
};
// Layout and stages match bootstrap-x86.asm and bootstrap-x64.asm; pointer slots are always 64 bits.
struct BootstrapData
{
BootstrapStage stage;
HRESULT result;
INT32 managedResult;
BOOL completed;
UINT64 assembly;
UINT64 typeName;
UINT64 methodName;
UINT64 argument;
UINT64 runtimeVersion;
UINT64 clrCreateInstance;
UINT64 getRuntimeDelegate;
UINT64 clsidMetaHost;
UINT64 iidMetaHost;
UINT64 iidRuntimeInfo;
UINT64 clsidRuntimeHost;
UINT64 iidRuntimeHost;
};
static_assert(offsetof(BootstrapData, assembly) == 16);
static_assert(offsetof(BootstrapData, typeName) == 24);
static_assert(offsetof(BootstrapData, methodName) == 32);
static_assert(offsetof(BootstrapData, argument) == 40);
static_assert(offsetof(BootstrapData, runtimeVersion) == 48);
static_assert(offsetof(BootstrapData, clrCreateInstance) == 56);
static_assert(offsetof(BootstrapData, getRuntimeDelegate) == 64);
static_assert(offsetof(BootstrapData, clsidMetaHost) == 72);
static_assert(offsetof(BootstrapData, iidMetaHost) == 80);
static_assert(offsetof(BootstrapData, iidRuntimeInfo) == 88);
static_assert(offsetof(BootstrapData, clsidRuntimeHost) == 96);
static_assert(offsetof(BootstrapData, iidRuntimeHost) == 104);
static_assert(sizeof(BootstrapData) == 112);