Files
WoW-Hybrid-gateway/tests/windows_module_pair_load.cpp
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

25 lines
2.1 KiB
C++

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "wine_wire_abi.h"
#include <cstdint>
#include <cstring>
#include <iostream>
#include <stdexcept>
#include <string>
static void require(bool value,const char* text){if(!value)throw std::runtime_error(text);}
template<class T> static T symbol(HMODULE module,const char* name){auto raw=GetProcAddress(module,name);require(raw!=nullptr,"paired module export missing");T result{};static_assert(sizeof(result)==sizeof(raw));std::memcpy(&result,&raw,sizeof(result));return result;}
int wmain(int argc,wchar_t** argv){try{
require(argc==3,"Backend and codec absolute paths required");
constexpr DWORD flags=LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR|LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;
auto backend=LoadLibraryExW(argv[1],nullptr,flags);require(backend!=nullptr,"updated Backend dependency load failed");
auto codec=LoadLibraryExW(argv[2],nullptr,flags);require(codec!=nullptr,"relinked codec dependency load failed");
using Dispatch=int32_t(WINAPI*)(void*);using Abi=uint32_t(*)();
auto dispatch=symbol<Dispatch>(backend,"gw_native_wire_dispatch");auto abi=symbol<Abi>(codec,"gw_codec_abi");require(abi()==1,"paired codec ABI mismatch");
gw_wire_call call{};call.abi=GW_WINE_WIRE_ABI;call.size=sizeof(call);call.operation=GW_WIRE_PING;
require(dispatch(&call)==0&&call.result==0&&call.value==1,"updated registry Ping failed");
uint64_t clock=1;uint8_t output[16]{};call={};call.abi=GW_WINE_WIRE_ABI;call.size=sizeof(call);call.operation=GW_WIRE_WORLD_PACKET;call.index=1;call.input=reinterpret_cast<const uint8_t*>(&clock);call.input_bytes=sizeof(clock);call.output=output;call.capacity=sizeof(output);
require(dispatch(&call)==0&&call.result<0&&call.required==0,"preworld index1 accepted absent authenticated transport");
require(FreeLibrary(codec)!=0,"codec release failed");require(FreeLibrary(backend)!=0,"Backend release failed");
std::cout<<"PASS updated Backend/registry and relinked codec load, ABI, absent-transport index1 refusal; no authentication or original client\n";return 0;
}catch(const std::exception& e){std::cerr<<e.what()<<" (WinError "<<GetLastError()<<")\n";return 1;}}