xrecv.exe is a minimal XMODEM Checksum receiver for Windows 98, designed specifically for recovery scenarios where the system can only operate in Safe Mode and lacks access to normal file transfer methods (no USB, no LAN, no CD/DVD, no floppy). It enables transferring binary files (DLL/EXE) over a serial port using a second machine (e.g., Ubuntu/Linux).
This document describes:
- What
xrecv.exedoes - How to compile
xrecv.cusing mingw-w64 on Linux - How to deliver the EXE to Windows 98 using a DEBUG script
- How to perform XMODEM transfers from Linux to Win98
xrecv.exe provides a lightweight implementation of XMODEM (128-byte, checksum mode) and writes the received binary data to a file.
- SOH (0x01) for block start (128-byte)
- EOT (0x04) for transfer end
- ACK (0x06) on valid block
- NAK (0x15) on checksum or header error
- Block number and inverse (0xFF - blk)
- Simple checksum
- 38400 baud
- 8 data bits, no parity, 1 stop bit (8N1)
- Flow Control Off (no RTS/CTS, no XON/XOFF)
This tool is intended for scenarios such as:
- Windows 98 system boots only in Safe Mode
- Network stack is broken (e.g., missing
msnp32.dll) - No working floppy, CD-R, USB, PCMCIA
- Only COM1/COM2 works
In such cases, xrecv.exe allows recovery of critical system files.
Command format:
xrecv COM1 output.bin
xrecv COM2 msnp32.dll- Argument 1: COM port name (
COM1–COM4) - Argument 2: Output file name (binary)
Example:
xrecv COM1 msnp32.dllThis puts xrecv.exe into waiting mode, where it repeatedly sends NAK until the sender begins transmitting.
sudo apt update
sudo apt install mingw-w64i686-w64-mingw32-gcc -Os -s -o xrecv.exe xrecv.c-Os: Optimize for size-s: Strip symbols to minimize EXE size
ls -l xrecv.exeThe resulting binary is safe to reconstruct via Windows 98 debug.exe.
You can also use the bundled helper:
./build.sh # builds xrecv.exe
./build.sh --debug-script # builds xrecv.exe + xrecv_dbg.txt--debug-scriptadditionally producesxrecv.hexand a DEBUG script (xrecv_dbg.txt) usingmake_debug_script.py. The script defaults to emittingXRECV.EXEinside the DEBUG recipe.
If you cannot copy the file normally, you can re-create the binary using a DEBUG script.
-
Convert binary to hex text:
xxd -p xrecv.exe > xrecv.hex -
Generate a DEBUG script (CR+LF required):
python3 make_debug_script.py xrecv.hex XRECV.EXE > xrecv_dbg.txt -
Transfer
xrecv_dbg.txtto Windows 98 via plain ASCII serial transfer (e.g., usingCOPY COM1:). -
On Windows 98:
debug < xrecv_dbg.txt
This reconstructs XRECV.EXE in the current directory.
make_debug_script.py converts a plain hex dump (e.g., xxd -p output) into a DEBUG script that:
- writes the bytes starting at
0100h(DEBUG load address) - sets
CXto the binary size - saves the file with the name you pass as the second argument
- emits all lines with CR+LF endings (as required by DEBUG)
Usage:
python3 make_debug_script.py INPUT.hex OUTPUT.EXE > script.txtUse the generated script.txt with debug < script.txt on Windows 98 to re-create the executable.
sudo stty -F /dev/ttyUSB0 38400 cs8 -parenb -cstopb -ixon -ixoff -crtsctssudo minicom -sSet:
- Serial port:
/dev/ttyUSB0 - 38400 8N1
- Hardware Flow Control: No
- Software Flow Control: No
xrecv COM1 msnp32.dll- Press Ctrl+A → S (Send)
- Choose xmodem (checksum mode)
- Select
msnp32.dll - Press Enter
When the transfer completes, Win98 will show:
Completed.
A new file msnp32.dll will appear in the current directory.
Ubuntu:
ls -l msnp32.dllWindows 98:
dir msnp32.dllSizes must match.
xrecv COM1 msnp32a.dll
xrecv COM1 msnp32b.dll
fc /b msnp32a.dll msnp32b.dllIf FC /B reports no differences, your transfer is fully reliable.
If errors occur, use 9600 baud on both sides.
xrecv.exe is intentionally minimal. It lacks:
- CRC XMODEM
- XMODEM-1k support
- CAN-based session abort
- Advanced block number handling (only basic validation)
However, for short-range cable transfers in a recovery scenario, it is sufficiently robust.
- Build
xrecv.exeon Ubuntu - Convert to HEX
- Generate DEBUG script (CR+LF)
- Send script to Win98
- Rebuild
XRECV.EXEusing DEBUG - Run
xrecv COM1 target.dll - Send DLL via XMODEM from Ubuntu
- Place DLL into the correct Win98 system directory and reboot
This restores broken components (like msnp32.dll) while avoiding all non-working devices.
This project is released under the MIT License (see MIT LICENSE.txt).