41 lines
1.7 KiB
C
41 lines
1.7 KiB
C
/* Pure native ABI + local SEH qualification. No RPC/network/time query. */
|
|
#define _WIN32_WINNT 0x0a00
|
|
#include <windows.h>
|
|
#include <rpc.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include "w32time.h"
|
|
|
|
typedef struct {
|
|
uint32_t leap, stratum, state, flags, last_result, size;
|
|
uint64_t last_sync, sync_age;
|
|
int64_t root_delay;
|
|
uint64_t root_dispersion;
|
|
int64_t phase;
|
|
} RmmClockStatus;
|
|
|
|
_Static_assert(sizeof(void *) == 8, "native AMD64 pointers");
|
|
_Static_assert(sizeof(unsigned long) == 4, "Microsoft LLP64");
|
|
_Static_assert(sizeof(RmmClockStatus) == 64, "Rust numeric clock ABI");
|
|
_Static_assert(offsetof(RmmClockStatus, last_sync) == 24, "Rust FILETIME offset");
|
|
_Static_assert(offsetof(RmmClockStatus, phase) == 56, "Rust phase offset");
|
|
_Static_assert(sizeof(RMM_W32TIME_STATUS) == 120, "MS-W32T x64 wire structure");
|
|
_Static_assert(offsetof(RMM_W32TIME_STATUS, qwLastSyncTicks) == 24, "MS-W32T FILETIME offset");
|
|
_Static_assert(offsetof(RMM_W32TIME_STATUS, toSysPhaseOffset) == 64, "MS-W32T phase offset");
|
|
_Static_assert(offsetof(RMM_W32TIME_STATUS, pEntries) == 112, "MS-W32T array pointer offset");
|
|
|
|
int main(void) {
|
|
unsigned long caught = 0;
|
|
/* Exercise the same SDK SEH macros/filter as clock_rpc.c. The exception
|
|
originates locally; it must terminate in C and never cross into Rust. */
|
|
RpcTryExcept {
|
|
RpcRaiseException(RPC_S_SERVER_UNAVAILABLE);
|
|
} RpcExcept(RpcExceptionFilter(RpcExceptionCode())) {
|
|
caught = RpcExceptionCode();
|
|
} RpcEndExcept
|
|
if (caught != RPC_S_SERVER_UNAVAILABLE) return 1;
|
|
printf("{\"amd64\":true,\"numeric_size\":64,\"wire_size\":120,\"seh_caught\":%lu,\"network_called\":false}\n", caught);
|
|
return 0;
|
|
}
|