Files

64 lines
2.6 KiB
C

#ifndef GW_DIRECT_TWO_SITE_INSTALL_H
#define GW_DIRECT_TWO_SITE_INSTALL_H
#include <windows.h>
#include <stdint.h>
#include "direct_login_capture.h"
#include "direct_near_relays.h"
#include "direct_two_site_transaction.h"
/* Numeric-only snapshot of the last retirement transaction. No code addresses,
* account data or patch bytes. The owned primary thread publishes/reads it. */
struct GwDirectRetireDiagnostic {
uint32_t transaction_result, reason, index, winerror, state, protect;
};
extern struct GwDirectRetireDiagnostic gw_direct_retire_diagnostic;
struct GwDirectInstallConfig {
uint32_t abi, size;
/* Supplied only by the first owned poll frame for which the coordinator
* already returned frame_admitted. No timer or UI input replay. */
int frame_admitted;
uintptr_t pipe_return_thunk;
struct GwDirectLoginBinding login;
};
struct GwDirectInstallation {
uint32_t abi, size, state, error;
uint32_t primary_thread;
void *owner;
void *volatile *original_owner_slot;
struct GwDirectRelays relays;
/* Login capture and original OpenRealm return. */
struct GwStartupPatch patches[2];
HMODULE login_module, pipe_module;
};
/* Site order is Login0, OpenRealm-return1. The first admitted poll frame
* publishes Login; the realm site is armed before admitted OpenRealm. */
int gw_direct_install_login_site(const struct GwDirectInstallConfig *config,
struct GwDirectInstallation *installation);
int gw_direct_install_realm_site(struct GwDirectInstallation *installation,
int pre_open_admitted);
/* Qualified owned frames only: request the client's own first-execution page
* handling once for each exact front/Login page, then poll for RX for at most
* 120 s. Returns 1 ready, 2 pending, -1 expired. No install latch is consumed
* while pending and no page protection is forced. */
int gw_direct_front_pages_prepare(void);
/* Private first-login candidate: restore only the Login E9 after its captured
* generation is published. Keep the front/Realm patches and relays pinned. */
int gw_direct_rearm_login_site(struct GwDirectInstallation *installation);
int gw_direct_retire_login_site_after_capture(
struct GwDirectInstallation *installation, uint32_t generation,
void *owner);
int gw_direct_login_site_retired(void);
/* Caller must first prove owned client callbacks drained and stop new Login /
* OpenRealm dispatch. This restores original code before releasing relays. */
int gw_direct_restore_sites(struct GwDirectInstallation *installation,
int owned_quiescent);
#endif