Files
reverse-engineering-anything/tests/fixtures/windowsNativeArtifact.ts
T
gensokyo-dev 740c0f5615 fix(windows): restore native verification fixture coverage (#7479)
Restore independent PE fixtures and dependency-complete standalone artifact verifier tests. Execute existing real Windows native behavior and inspection recovery proofs before unrelated curated tests.

Validation: 101 focused tests; full typecheck; scoped lint, module/discovery/format/docs checks; valid/corrupt real-image verifier controls; real Windows artifact, behavior, and inspection recovery proof steps passed. Greptile found no actionable issues. Codex review quota exhausted.

CI remains red from exact-base failures: Source 9, Windows 7 (base 15; loader 8 repaired), and built shard 4's 7 matching failures; 7 other shards cancelled by fail-fast. Later Windows package/Node 22/24 checks skipped. User explicitly authorized bypass of established main failures. No claim of complete CI or unavailable coverage.

Fixes #7474.
2026-10-27 18:50:40 +08:00

27 lines
982 B
TypeScript

import { createHash } from "node:crypto";
/** Inert PE32+ identity bytes, never an executable addon or native authority. */
export const windowsNativeArtifactFixture = () => {
const peOffset = 64;
const optionalHeaderOffset = peOffset + 4 + 20;
const optionalHeaderSize = 64;
const bytes = Buffer.alloc(optionalHeaderOffset + optionalHeaderSize);
bytes.write("MZ");
bytes.writeUInt32LE(peOffset, 0x3c);
bytes.write("PE\0\0", peOffset, "ascii");
bytes.writeUInt16LE(0x8664, peOffset + 4);
bytes.writeUInt16LE(optionalHeaderSize, peOffset + 4 + 16);
bytes.writeUInt16LE(0x20b, optionalHeaderOffset);
// Keep the expected wire identity independent of the production producer.
const manifest = {
packageVersion: "1.0.0",
platform: "win32",
architecture: "x64",
abiVersion: 1,
nodeApiVersion: 8,
artifact: "rea-windows-x64.node",
artifactSha256: createHash("sha256").update(bytes).digest("hex"),
};
return { bytes, manifest };
};