mirror of
https://github.com/8damon/Blackbird-Platform
synced 2026-06-21 13:41:12 +00:00
005f2b7e07
Move all globals and helpers into BK_RUNTIME_INTERNAL namespace and include runtime_private.h as the shared definition header. Add BkDbgLog (tagged OutputDebugStringA wrapper with PID/TID/tick prefix) and BkRuntimeReportFault as the shared logging primitives for all runtime translation units. Introduce the launch-gate global state: g_LaunchGatePages, g_LaunchGateParkContexts, g_LaunchGatePrepared, g_LaunchGateReady, g_LaunchGateDeferredOpen, and g_LaunchGateCallbacks. Track g_LastPublishedHookReadyMask atomically to detect state changes without sending duplicate hook-ready notifications. Refs #16.
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <Windows.h>
|
|
#include <cstdint>
|
|
|
|
enum class BkRuntimeFaultCode : std::uint32_t
|
|
{
|
|
LaunchGatePrepareFailed = 1,
|
|
LaunchGateReadyEventCreateFailed = 2,
|
|
LaunchGateDeferredEventNameFailed = 3,
|
|
LaunchGateNoParkSlot = 4,
|
|
LaunchGateContextStageFailed = 5,
|
|
LaunchGateResumeRejected = 6,
|
|
RuntimeInitializeFailed = 7,
|
|
IpcInitializeTimedOut = 8,
|
|
HookReadyTimedOut = 9,
|
|
CoreHookInitFailed = 10,
|
|
BootstrapThreadCreateFailed = 11,
|
|
FailClosedTriggered = 12,
|
|
NtHookInitFault = 13,
|
|
ModuleHookInitFault = 14,
|
|
};
|
|
|
|
DWORD WINAPI BkRuntimeThreadProc(LPVOID);
|
|
|
|
void BkRuntimePrimeHooks() noexcept;
|
|
|
|
void BkDbgLog(_In_z_ _Printf_format_string_ PCSTR format, ...) noexcept;
|
|
void BkRuntimeReportFault(BkRuntimeFaultCode code, std::uint64_t arg0 = 0, std::uint64_t arg1 = 0) noexcept;
|
|
|
|
HANDLE BkRuntimeCreateBootstrapThread(LPTHREAD_START_ROUTINE startRoutine, LPVOID parameter) noexcept;
|
|
|
|
void BkRuntimeCloseHandle(HANDLE handle) noexcept;
|
|
|
|
void BkRuntimeFailClosed(DWORD exitStatus) noexcept;
|
|
|
|
bool BkInitializeSubsystems() noexcept;
|
|
|
|
void BkRuntimeSignalLaunchGateReady() noexcept;
|
|
|
|
void BkRuntimeShutdown();
|