Replace the partial mechanics transcriptions with a separate, readable C11 reconstruction of the complete Win16 image while preserving the original raw Ghidra export as immutable evidence. Cover all ordinary and overlapping entry points, Borland runtime behavior, Win16 imports, segmented data, callbacks, resources, indirect control flow, physics, rendering, persistence, and startup/shutdown lifecycles. Add deterministic extraction and audit tooling plus address-linked ledgers for functions, imports, DGROUP ranges and objects, relocations, resources, and callbacks. The final gate records zero raw, partial, restored, unknown, blocked, or unclassified required units. Keep the semantic-fidelity boundary explicit: the portable C is not claimed to reproduce a byte-identical Borland NE build. Add strict focused harnesses for every reconstructed C unit, exact resource round-trip checks, and a 16-bit Borland Real48 reference probe. No Rust source or Cargo metadata is changed in this phase. Test Plan: - `bash original/tools/test_reconstructed_c.sh` -- passed - `bash original/tools/probe_real48_reference.sh` -- passed bit-for-bit - `python3 original/tools/audit_reconstruction.py --require-complete` -- passed - `git diff --cached --check` -- passed - `git diff HEAD -- '*.rs' Cargo.toml Cargo.lock` -- empty
102 lines
3.0 KiB
C
102 lines
3.0 KiB
C
#ifndef TDKPIN_OBJECT_WINDOWS_H
|
|
#define TDKPIN_OBJECT_WINDOWS_H
|
|
|
|
#include "tdkpin_segmented.h"
|
|
|
|
#pragma pack(push, 1)
|
|
typedef struct {
|
|
HWND16 window;
|
|
UINT16 message;
|
|
WPARAM16 wparam;
|
|
LPARAM16 lparam;
|
|
LRESULT16 result;
|
|
} ObjectWindowsMessage;
|
|
#pragma pack(pop)
|
|
|
|
_Static_assert(
|
|
sizeof(ObjectWindowsMessage) == 14,
|
|
"ObjectWindows message record layout drift");
|
|
|
|
#pragma pack(push, 1)
|
|
typedef struct {
|
|
uint16_t parent_table;
|
|
uint16_t cached_message;
|
|
uint16_t cached_handler_slot;
|
|
uint16_t count;
|
|
uint16_t message_ids[9];
|
|
Win16FarPtr handlers[9];
|
|
} ObjectWindowsMessageTable9;
|
|
#pragma pack(pop)
|
|
|
|
_Static_assert(
|
|
sizeof(ObjectWindowsMessageTable9) == 62,
|
|
"ObjectWindows dynamic message table layout drift");
|
|
extern ObjectWindowsMessageTable9 g_object_windows_base_message_table;
|
|
/* Binary overlay: 1028:05cc..0609; cache words are mutable. */
|
|
|
|
void object_windows_bind_window(HWND16 window, Win16FarPtr object);
|
|
void object_windows_unbind_window(HWND16 window);
|
|
Win16FarPtr object_windows_object_from_window(HWND16 window);
|
|
LRESULT16 object_window_bootstrap_proc(
|
|
HWND16 window, UINT16 message, WPARAM16 wparam, LPARAM16 lparam);
|
|
Win16FarPtr object_windows_allocate_bound_thunk(
|
|
Win16FarPtr object); /* 1018:01dc */
|
|
void object_windows_release_bound_thunk(
|
|
Win16FarPtr thunk); /* 1018:02fa */
|
|
|
|
extern uint16_t g_object_windows_thunk_code_selector; /* 1028:066c */
|
|
extern Win16FarPtr g_object_windows_free_thunk; /* 1028:066e/0670 */
|
|
extern Win16FarPtr g_object_windows_dispatch_proc; /* 1028:0672/0674 */
|
|
extern Win16FarPtr g_object_windows_message_hook; /* 1028:0682/0684 */
|
|
extern Win16FarPtr g_object_windows_creating_object; /* 1028:0676/0678 */
|
|
|
|
Win16FarPtr object_windows_resolve_message_handler(
|
|
uint16_t vmt,
|
|
uint16_t message,
|
|
uint16_t fallback_slot); /* 1018:0002 */
|
|
void object_windows_call_message_hook(
|
|
Win16FarPtr object,
|
|
Win16FarPtr handler,
|
|
const ObjectWindowsMessage *message); /* 1018:0103 */
|
|
LRESULT16 object_dispatch_window_or_dialog_proc(
|
|
Win16FarPtr object,
|
|
HWND16 window,
|
|
UINT16 message,
|
|
WPARAM16 wparam,
|
|
LPARAM16 lparam); /* 1018:0133 */
|
|
void object_windows_dispatch_event(
|
|
uint16_t fallback_slot,
|
|
uint16_t method_id,
|
|
Win16FarPtr event,
|
|
Win16FarPtr object); /* 1018:08c3 */
|
|
|
|
/* Platform bridge for the original indirect far calls. */
|
|
void win16_call_object_message_handler(
|
|
Win16FarPtr procedure,
|
|
Win16FarPtr object,
|
|
ObjectWindowsMessage *message);
|
|
void win16_call_object_message_hook(
|
|
Win16FarPtr procedure,
|
|
Win16FarPtr object,
|
|
Win16FarPtr handler,
|
|
HWND16 window,
|
|
UINT16 message,
|
|
WPARAM16 wparam,
|
|
LPARAM16 lparam);
|
|
void win16_call_object_event_handler(
|
|
Win16FarPtr procedure,
|
|
Win16FarPtr object,
|
|
Win16FarPtr event);
|
|
void win16_call_object_scroll_method(
|
|
Win16FarPtr procedure,
|
|
Win16FarPtr object,
|
|
uint16_t position,
|
|
uint16_t command);
|
|
void win16_call_object_paint_method(
|
|
Win16FarPtr procedure,
|
|
Win16FarPtr object,
|
|
PAINTSTRUCT16 *paint,
|
|
HDC16 dc);
|
|
|
|
#endif
|