883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
31 lines
1.8 KiB
C
31 lines
1.8 KiB
C
/* Run as an ordinary native Windows console program. Never opens the client. */
|
|
#include <windows.h>
|
|
#include "wine_wire_abi.h"
|
|
typedef NTSTATUS (WINAPI *Init)(const WCHAR*);
|
|
typedef NTSTATUS (WINAPI *Dispatch)(struct gw_wire_call*);
|
|
typedef NTSTATUS (WINAPI *Shutdown)(void);
|
|
static void check(int yes,unsigned code){if(!yes)ExitProcess(code);}
|
|
static void sibling(WCHAR* path,const WCHAR* name){
|
|
DWORD n=GetModuleFileNameW(NULL,path,512);check(n && n<512,1);
|
|
while(n && path[n-1]!=L'\\' && path[n-1]!=L'/')--n;
|
|
check(n!=0,2);
|
|
while(*name){check(n<511,3);path[n++]=*name++;}path[n]=0;
|
|
}
|
|
void mainCRTStartup(void){
|
|
WCHAR path[512];sibling(path,L"GWNativeWire.dll");
|
|
HMODULE module=LoadLibraryExW(path,NULL,0x100u|0x1000u);check(module!=NULL,4);
|
|
Init init=(Init)GetProcAddress(module,"gw_wire_initialize");
|
|
Dispatch dispatch=(Dispatch)GetProcAddress(module,"gw_wire_dispatch");
|
|
Shutdown shutdown=(Shutdown)GetProcAddress(module,"gw_wire_shutdown");check(init&&dispatch&&shutdown,5);
|
|
check(init(NULL)==(NTSTATUS)0xc000000d,6);
|
|
check(init(L"GWNativeBackend.dll")== (NTSTATUS)0xc000000d,7);
|
|
sibling(path,L"absent-native-backend.dll");check(init(path)==(NTSTATUS)0xc0000135,8);
|
|
sibling(path,L"GWNativeBackendBad.dll");check(init(path)==(NTSTATUS)0xc000000d,9);
|
|
sibling(path,L"GWNativeBackend.dll");check(init(path)==0,10);check(init(path)==0,11);
|
|
struct gw_wire_call call={0};call.abi=GW_WINE_WIRE_ABI;call.size=sizeof(call);call.operation=GW_WIRE_PING;
|
|
check(dispatch(&call)==0 && call.result==0 && call.value==GW_NATIVE_ABI,12);
|
|
call.abi++;check(dispatch(&call)==(NTSTATUS)0xc000000d,13);call.abi--;
|
|
check(shutdown()==0,14);check(dispatch(&call)==(NTSTATUS)0xc0000184,15);
|
|
check(FreeLibrary(module)!=0,16);ExitProcess(0);
|
|
}
|