883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
51 lines
2.4 KiB
C
51 lines
2.4 KiB
C
/* Private owned PE fixture: no game, credentials, network, or process owner. */
|
|
#include <windows.h>
|
|
#include "wine_wire_abi.h"
|
|
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];
|
|
};
|
|
typedef LONG (WINAPI *Initialize)(const WCHAR*);
|
|
typedef LONG (WINAPI *Dispatch)(struct gw_wire_call*);
|
|
typedef LONG (WINAPI *Shutdown)(void);
|
|
typedef void (WINAPI *Frame)(void*);
|
|
static int owner, forwarded;
|
|
static void WINAPI poll(void* object) { if (object == &owner) ++forwarded; }
|
|
static int run(const char* name, int opt_in) {
|
|
HMODULE dll=LoadLibraryA(name); struct PollHost host={0}; struct FrameData* frame;
|
|
Frame callback; Initialize initialize; Dispatch dispatch; Shutdown shutdown;
|
|
struct gw_wire_call call={0};
|
|
if(!dll)return 1;
|
|
callback=(Frame)GetProcAddress(dll,"gw_wire_frame_callback");
|
|
frame=(struct FrameData*)GetProcAddress(dll,"gw_wire_frame_data");
|
|
initialize=(Initialize)GetProcAddress(dll,"gw_wire_initialize");
|
|
dispatch=(Dispatch)GetProcAddress(dll,"gw_wire_dispatch");
|
|
shutdown=(Shutdown)GetProcAddress(dll,"gw_wire_shutdown");
|
|
if(!callback || !frame || !initialize || !dispatch || !shutdown)return 2;
|
|
if(!initialize(L""))return 3; /* Public explicit-path ABI is unchanged. */
|
|
host.abi=1;host.size=sizeof(host);host.owner=(unsigned long long)&owner;host.poll=(unsigned long long)poll;
|
|
frame->host=&host;frame->command=1;callback(&owner);
|
|
if(frame->completed!=1 || frame->error || forwarded!=1)return 4;
|
|
if(!opt_in) {
|
|
if(!frame->initialize_status)return 5;
|
|
} else {
|
|
if(frame->initialize_status || frame->call_status || frame->result || frame->echoed!=GW_NATIVE_ABI)return 6;
|
|
call.abi=GW_WINE_WIRE_ABI;call.size=sizeof(call);call.operation=GW_WIRE_PING;
|
|
if(dispatch(&call) || call.result || call.value!=GW_NATIVE_ABI || shutdown())return 7;
|
|
if(initialize(GW_EXPLICIT_WINE_PATH) || shutdown())return 8;
|
|
}
|
|
if(!FreeLibrary(dll))return 9;
|
|
forwarded=0;
|
|
return 0;
|
|
}
|
|
void fixture_start(void) {
|
|
int result=run(GW_DEFAULT_WIRE_DLL,0);
|
|
if(!result)result=run(GW_SELF_LOCATING_WIRE_DLL,1);
|
|
ExitProcess((UINT)result);
|
|
}
|