Files
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

104 lines
7.0 KiB
C

/* Owned PE fixture for the installed Wine ABI. No game/auth/network access. */
#include <windows.h>
#include "wine_wire_abi.h"
#include "wine_wire_host.h"
#include "wine_wire_listener.h"
#include "wine_engine_realm.h"
#include "wine_pipe_host.h"
_Static_assert(sizeof(struct gw_wire_call)==640,"Cross-platform POD layout changed");
typedef LONG (WINAPI *Initialize)(const WCHAR*);
typedef LONG (WINAPI *Dispatch)(struct gw_wire_call*);
typedef LONG (WINAPI *Shutdown)(void);
struct PollHost {
unsigned int abi,size,stage,calls,thread,error;
unsigned long long owner,table,poll,methods[129];
};
struct FrameData {
unsigned int abi,size;
volatile LONG command,completed,calls,thread,error,initialize_status,call_status,result,echoed,elapsed_ms;
struct PollHost* host;WCHAR filename[512];
};
static unsigned int forwarded,owned;
static uint64_t listener_owner[64];
static uint64_t listener[2];static int connection,address,listener_forwarded;
static void WINAPI connected(void* l,void* c,void* accepted,const void* a){
if(l==listener&&c==&connection&&!accepted&&a==&address)++listener_forwarded;
}
static void WINAPI poll(void* object){if(object==&owned)++forwarded;}
void fixture_start(void){
HMODULE dll=LoadLibraryA(GW_WIRE_DLL);
Initialize initialize;Dispatch dispatch;Shutdown shutdown;
struct gw_wire_call call={0};
struct PollHost host={0};struct FrameData* frame;
void (WINAPI *callback)(void*);unsigned int i;
const WCHAR filename[]=GW_WIRE_UNIX;
if(!dll)ExitProcess(1);
initialize=(Initialize)GetProcAddress(dll,"gw_wire_initialize");
dispatch=(Dispatch)GetProcAddress(dll,"gw_wire_dispatch");
shutdown=(Shutdown)GetProcAddress(dll,"gw_wire_shutdown");
if(!initialize || !dispatch || !shutdown)ExitProcess(2);
call.abi=GW_WINE_WIRE_ABI;call.size=sizeof(call);call.operation=GW_WIRE_PING;
if(!dispatch(&call))ExitProcess(3); /* Not initialized; must not dispatch. */
if(initialize(GW_WIRE_UNIX) || initialize(GW_WIRE_UNIX))ExitProcess(4);
if(dispatch(&call) || call.result || call.value!=GW_NATIVE_ABI)ExitProcess(5);
call.abi=999;if(!dispatch(&call))ExitProcess(6);call.abi=GW_WINE_WIRE_ABI;
call.operation=GW_WIRE_AUTHENTICATED;call.transport=0x123456789;
if(dispatch(&call) || call.result!=-1 || call.value)ExitProcess(7);
call.operation=GW_WIRE_LOGIN_CLOSE;call.login=0x123456789;
if(dispatch(&call) || call.result!=-1)ExitProcess(8);
call.operation=GW_WIRE_COUNTS;
if(dispatch(&call) || call.result || call.value || call.consumed)ExitProcess(9);
frame=(struct FrameData*)GetProcAddress(dll,"gw_wire_frame_data");
callback=(void (WINAPI *)(void*))GetProcAddress(dll,"gw_wire_frame_callback");
if(!frame || !callback || sizeof(host)!=1080 || frame->abi!=1 || frame->size!=sizeof(*frame))ExitProcess(12);
host.abi=1;host.size=sizeof(host);host.owner=(unsigned long long)&owned;host.poll=(unsigned long long)poll;
frame->host=&host;for(i=0;i<sizeof(filename)/sizeof(filename[0]);++i)frame->filename[i]=filename[i];
frame->command=1;callback(&owned);
if(forwarded!=1 || host.calls!=1 || host.stage!=3 || frame->calls!=1 || frame->completed!=1 || frame->error || frame->initialize_status || frame->call_status || frame->result || frame->echoed!=1 || (DWORD)frame->thread!=GetCurrentThreadId())ExitProcess(13);
host.thread=0xffffffff;callback(&owned);
if(forwarded!=2 || frame->calls!=1 || frame->error!=3)ExitProcess(14);
host.thread=GetCurrentThreadId();frame->error=0;frame->command=3;callback(&owned);
if(forwarded!=3 || frame->command!=4 || frame->error!=5)ExitProcess(15); /* Unconfigured account cannot start. */
{
int (*build_address)(struct gw_engine_realm_address*,const struct gw_native_realm*,uint16_t)=(int (*)(struct gw_engine_realm_address*,const struct gw_native_realm*,uint16_t))GetProcAddress(dll,"gw_engine_realm_address_build");
struct gw_engine_realm_address endpoint;struct gw_native_realm realm={0};uint64_t inline_pointer;
const char host[]="127.0.0.1:8090";
if(!build_address)ExitProcess(18);
__builtin_memcpy(realm.address,host,sizeof(host));
if(build_address(&endpoint,&realm,8090))ExitProcess(19);
__builtin_memcpy(&inline_pointer,endpoint.bytes+0x48,8);
if(endpoint.bytes[0]!=127||endpoint.bytes[3]!=1||endpoint.bytes[0x10]!=1||endpoint.bytes[0x18]!=0x9a||endpoint.bytes[0x19]!=0x1f||inline_pointer!=(uint64_t)(endpoint.bytes+0x60)||endpoint.bytes[0x58]!=15||endpoint.bytes[0x5f]!=0x80)ExitProcess(20);
realm.flags=2;if(!build_address(&endpoint,&realm,8090))ExitProcess(21);
realm.flags=0;if(!build_address(&endpoint,&realm,8091))ExitProcess(22);
realm.address[0]='1';realm.address[1]='9';realm.address[2]='2';if(!build_address(&endpoint,&realm,8090))ExitProcess(23);
}
{
struct gw_wire_listener_control* observer=(struct gw_wire_listener_control*)GetProcAddress(dll,"gw_wire_listener_data");
void (WINAPI *observe)(void*,void*,void*,const void*)=(void (WINAPI *)(void*,void*,void*,const void*))GetProcAddress(dll,"gw_wire_listener_connected");
if(!observer||!observe||observer->abi!=1||observer->size!=sizeof(*observer))ExitProcess(16);
observer->owner=(uint64_t)listener_owner;observer->listener=(uint64_t)listener;observer->original_connected=(uint64_t)connected;
listener_owner[0x98/8]=4;listener_owner[0x1a0/8]=(uint64_t)&connection;
observe(listener,&connection,0,&address);
if(observer->calls!=1||observer->forwarded!=1||listener_forwarded!=1||observer->error||observer->accepted_present||!observer->address_present||observer->connection_slot||observer->owner_state!=4||observer->thread!=(LONG)GetCurrentThreadId())ExitProcess(17);
}
{
struct gw_pipe_db_queries* queries=(struct gw_pipe_db_queries*)GetProcAddress(dll,"gw_wire_pipe_queries");
void (*record)(const unsigned char*,uint32_t)=(void (*)(const unsigned char*,uint32_t))GetProcAddress(dll,"gw_wire_record_db_query");
const unsigned char request[]={0x78,0x56,0x34,0x12,0,16,10,0,0,0,20,0,0,0};
if(!queries||!record||queries->abi!=1||queries->size!=1168)ExitProcess(24);
record(request,sizeof(request));
if(queries->count!=1||queries->malformed||queries->rows[0].hash!=0x12345678||queries->rows[0].count!=2||queries->rows[0].ids[0]!=10||queries->rows[0].ids[1]!=20)ExitProcess(25);
record(request,sizeof(request)-1);record(0,0);
if(queries->count!=1||queries->malformed!=2)ExitProcess(26);
}
{
LONG (WINAPI *attach)(void)=(LONG (WINAPI *)(void))GetProcAddress(dll,"gw_wire_account_attach_engine_session");
LONG (WINAPI *beat)(void)=(LONG (WINAPI *)(void))GetProcAddress(dll,"gw_wire_account_engine_heartbeat");
struct gw_wire_session_lease* lease=(struct gw_wire_session_lease*)GetProcAddress(dll,"gw_wire_session_lease_data");
if(!attach||!beat||!lease||lease->abi!=1||lease->size!=32||!attach()||!beat()||lease->attached||lease->heartbeats)ExitProcess(27);
}
if(shutdown() || !dispatch(&call))ExitProcess(10);
if(!FreeLibrary(dll))ExitProcess(11);
ExitProcess(0);
}