Files
reverse-engineering-anything/src/domain/dosCom.ts
T
Matt Van Hornandmorluto 7c207c7951 feat(native): admit raw binaries with caller-supplied architecture and entry (#1868)
* feat(native): admit raw binaries with caller-supplied architecture and entry

* fix(native): honor raw-binary preparation and entry identity

* fix(ghidra): stream raw snapshot attestation with cancellation

* fix(native): preserve and validate raw lifecycle entries

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-10-12 00:06:29 +08:00

16 lines
752 B
TypeScript

import { z } from "zod";
import { err, ok, type Result } from "./result.js";
/** Headerless executable interpretation explicitly selected by the caller. */
export const executableFormatHintSchema = z.enum(["dos-com", "raw-binary"]);
/** Explicit executable interpretation for formats with no identifying header. */
export type ExecutableFormatHint = z.infer<typeof executableFormatHintSchema>;
/** Validate the single 64 KiB COM segment, excluding its 256-byte PSP prefix. */
export const validateDosComLength = (length: number): Result<null, string> =>
Number.isSafeInteger(length) && length >= 1 && length <= 0xff00
? ok(null)
: err(
"DOS COM requires 1..65280 file bytes (64 KiB segment minus the 256-byte PSP prefix)",
);