Skip to content

smb: add READ_RAW for ~20× faster file copies#366

Merged
felixrieseberg merged 1 commit into
mainfrom
claude/quizzical-haibt
Apr 13, 2026
Merged

smb: add READ_RAW for ~20× faster file copies#366
felixrieseberg merged 1 commit into
mainfrom
claude/quizzical-haibt

Conversation

@felixrieseberg
Copy link
Copy Markdown
Owner

Win95's redirector was falling back to ~2.8 KB core READs because we advertised no raw mode, so copying a 200 KB file took ~360 round-trips through the emulated ne2k/TCP stack (~10 s). With SMB_COM_READ_RAW it pulls up to 64 KB per round-trip.

Changes

  • server.tsreadRaw() handler (response is raw bytes only, no SMB header; 0-byte NetBIOS frame on error/EOF per [MS-CIFS] §2.2.4.24). Negotiate now advertises MaxRawSize=65535 + CAP_RAW_MODE (NT dialect) and RawMode bit 0 (LM dialect). Per-packet hex capture is now gated on WIN95_SMB_CAPTURE instead of always-on.
  • smb.tsCMD_READ_RAW = 0x1a
  • test-standalone.ts — READ_RAW happy-path + bad-fid → 0-byte cases

Test

npx tsc --ignoreConfig --module commonjs --target es2020 --esModuleInterop \
  --moduleResolution bundler --types node --outDir /tmp/smb-test --skipLibCheck \
  src/renderer/smb/*.ts && node /tmp/smb-test/test-standalone.js
# 57 passed, 0 failed

Win95's redirector was falling back to ~2.8KB core READs (no raw mode
advertised), so a 200KB copy took ~360 round-trips through the emulated
NIC/TCP stack (~10s). With READ_RAW it pulls up to 64KB per round-trip.

- server.ts: readRaw() handler (raw bytes only, 0-byte frame on error);
  negotiate now sets MaxRawSize=65535 + CAP_RAW_MODE (NT) and RawMode
  bit 0 (LM); per-packet hex capture gated on WIN95_SMB_CAPTURE
- smb.ts: CMD_READ_RAW constant
- test-standalone.ts: READ_RAW happy-path + bad-fid tests (57 pass)
@felixrieseberg felixrieseberg merged commit a1637b1 into main Apr 13, 2026
8 checks passed
@felixrieseberg felixrieseberg deleted the claude/quizzical-haibt branch April 13, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant