Files
2026-11-23 04:26:37 +02:00

28 lines
1.3 KiB
C

/* push_digests.exe <forever_codec.dll> <push_id>...: prints "push_id fnv1a64" of the codec's
exact hotfix reply (numeric ABI mode 27 = --native-hotfix-reply) for each push. */
#include <windows.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef int (*Serialize)(uint32_t, const void *, uint32_t, uint32_t, void *, uint32_t, uint32_t *);
int main(int argc, char **argv) {
if (argc < 3) return 1;
HMODULE codec = LoadLibraryA(argv[1]);
if (!codec) return 2;
Serialize serialize = (Serialize)(void *)GetProcAddress(codec, "gw_codec_serialize");
if (!serialize) return 3;
for (int i = 2; i < argc; ++i) {
int32_t push = (int32_t)strtol(argv[i], NULL, 10);
uint32_t query[4] = {70334, 0, 1, (uint32_t)push};
uint32_t bytes = 0;
if (serialize(27, query, sizeof(query), 0, NULL, 0, &bytes) != 3 || bytes > 1048576) return 5;
unsigned char *reply = malloc(bytes ? bytes : 1);
if (!reply || serialize(27, query, sizeof(query), 0, reply, bytes, &bytes)) return 6;
uint64_t hash = 1469598103934665603ull;
for (uint32_t k = 0; k < bytes; ++k) { hash ^= reply[k]; hash *= 1099511628211ull; }
printf("%d %016llx %u\n", push, (unsigned long long)hash, bytes);
free(reply);
}
return 0;
}