Diagnosed and fixed the crash that killed HAVOC_NOCD.EXE ~1s after launch
(dgVoodoo window appears black, then the process exits). It was not a clean
exit: an ACCESS_VIOLATION (null-pointer read at VA 0x444E6A) during init.
Root cause is a copy-protection check in the WORLDS\ data-file loader
(0x42a480). It opens each file (GRAFIX/LAND/MAP/STUF) from both a local
"WORLDS\<name>" path and a CD-drive path (HAVOC.INI [SETUP] DRIVE=D:\), and
returns a valid stream only when the local open fails and the CD-drive open
succeeds. With files present locally and no D: drive it returned NULL, and the
GRAFIX loader (0x444db0) dereferenced that NULL without checking.
Fix: 14-byte patch at FO 0x29a2b rewrites the return decision to hand back the
successfully-opened local object. The game now boots to the title screen
("HAVOC(tm) by Reality Bytes"), responsive, main loop running.
- docs/PATCHES.md: full patch table (28 patches) + crash write-up
- tools/: RE + patching scripts (r2pipe disasm, minidump parser, ctypes
debugger, PE/IAT/import analysis)
- run_probe.bat / run_and_log.bat: reliable native launch for repro
- .gitignore: exclude CD images, Ghidra install/project, dgVoodoo, *.ini
Diagnosed via WER minidumps (%LOCALAPPDATA%\CrashDumps) parsed in pure Python
(no cdb/windbg available).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TN4Ytn3gdWRonNmHpisWQv
51 lines
2.4 KiB
Python
51 lines
2.4 KiB
Python
import struct, sys, io
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
|
data = open('HAVOC_NOCD.EXE','rb').read()
|
|
FO2VA = lambda fo: fo + 0x400C00
|
|
VA2FO = lambda va: va - 0x400C00
|
|
|
|
IAT = {
|
|
0x482370:'VirtualAlloc', 0x4823cc:'LocalAlloc', 0x48240c:'ExitProcess',
|
|
0x482390:'CreateFileA', 0x4822f4:'DirectDrawCreate', 0x4822fc:'DirectSoundCreate',
|
|
0x48248c:'MessageBoxA', 0x48243c:'GetVersion', 0x48242c:'GetStartupInfoA',
|
|
}
|
|
|
|
def show(start, length, label=''):
|
|
if label: print("=== %s ===" % label)
|
|
for row in range(start, start + length, 16):
|
|
chunk = data[row:row+16]
|
|
ann = []
|
|
for j in range(len(chunk)):
|
|
f = row + j
|
|
try:
|
|
if data[f] == 0xe8 and f+5 <= len(data):
|
|
rel = struct.unpack_from('<i', data, f+1)[0]
|
|
tgt = (FO2VA(f+5) + rel) & 0xFFFFFFFF
|
|
ann.append('+%d:CALL_0x%x' % (j, tgt))
|
|
if data[f] == 0xff and data[f+1] == 0x15 and f+6 <= len(data):
|
|
iat = struct.unpack_from('<I', data, f+2)[0]
|
|
ann.append('+%d:[%s]' % (j, IAT.get(iat, 'iat_0x%x' % iat)))
|
|
if data[f] == 0xa3 and f+5 <= len(data):
|
|
va = struct.unpack_from('<I', data, f+1)[0]
|
|
if 0x47C000 <= va <= 0x482000:
|
|
ann.append('+%d:MOV[0x%x],EAX' % (j, va))
|
|
if data[f] == 0xc3: ann.append('+%d:RET' % j)
|
|
if data[f] == 0xc2 and f+3 <= len(data):
|
|
ann.append('+%d:RET%d' % (j, struct.unpack_from('<H', data, f+1)[0]))
|
|
if data[f] == 0xe9 and f+5 <= len(data):
|
|
rel = struct.unpack_from('<i', data, f+1)[0]
|
|
tgt = (FO2VA(f+5) + rel) & 0xFFFFFFFF
|
|
ann.append('+%d:JMP_0x%x' % (j, tgt))
|
|
except Exception: pass
|
|
line = 'FO 0x%05x VA 0x%07x: %s' % (row, FO2VA(row), ' '.join('%02x' % b for b in chunk))
|
|
if ann: line += ' [%s]' % ','.join(ann)
|
|
print(line)
|
|
|
|
# 0x464F52 = the "both free lists at sentinel" path in 0x464E77
|
|
show(VA2FO(0x464F52), 64, "0x464F52 (empty-lists fallback in 0x464E77)")
|
|
print()
|
|
# 0x464F67 = second alloc helper called from 0x4633D1 when 0x464E77 returns NULL
|
|
show(VA2FO(0x464F67), 96, "0x464F67 (second alloc helper)")
|
|
print()
|
|
# 0x4633D1 full - 0x60 bytes to see what it does after 0x464E77 returns
|
|
show(VA2FO(0x4633D1), 96, "0x4633D1 (real allocator, full body)")
|