Initial RetroNFS95 Win9x VxD prototype
This commit is contained in:
166
docs/BUILD_TOOLCHAIN.md
Normal file
166
docs/BUILD_TOOLCHAIN.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# Build Toolchains For RetroNFS95
|
||||
|
||||
There are two different build problems:
|
||||
|
||||
1. Win32 user-mode pieces:
|
||||
- `bin/retronfs95.exe`
|
||||
- `provider/RETRONP.DLL`
|
||||
- `mounter/RetroMap95.exe`
|
||||
|
||||
2. Win95/98 ring-0 VxD:
|
||||
- `vxd/RETROVXD.VXD`
|
||||
|
||||
Do not use one modern default Windows compiler for everything. Modern MinGW and
|
||||
MSVC builds often import APIs or CRT startup code that Windows 95/98 cannot
|
||||
load.
|
||||
|
||||
## Recommended Setup
|
||||
|
||||
### User-Mode EXE/DLL
|
||||
|
||||
Best options:
|
||||
|
||||
- old MinGW 3.x/4.x targeting `msvcrt`
|
||||
- MinGW Lite with a Win95/98 profile
|
||||
- Open Watcom v2 targeting Win32
|
||||
|
||||
Avoid:
|
||||
|
||||
- UCRT builds
|
||||
- x86_64 builds
|
||||
- binaries that depend on APIs newer than Win98
|
||||
|
||||
For the current Makefiles, a suitable MinGW command set is:
|
||||
|
||||
```sh
|
||||
mingw32-g++ --version
|
||||
```
|
||||
|
||||
or, on Linux:
|
||||
|
||||
```sh
|
||||
i586-mingw32msvc-g++ --version
|
||||
i686-w64-mingw32-g++ --version
|
||||
```
|
||||
|
||||
The safest CRT target is old `msvcrt.dll`, not UCRT.
|
||||
|
||||
### VxD
|
||||
|
||||
Best options:
|
||||
|
||||
1. Windows 98 DDK in a Windows 98/2000/XP VM
|
||||
- most historically accurate
|
||||
- least surprise
|
||||
|
||||
2. Linux cross build with:
|
||||
- Open Watcom v2
|
||||
- JWasm/UASM
|
||||
- Windows 98 DDK headers/libs/includes
|
||||
- custom linker command file
|
||||
|
||||
Open Watcom's linker has VxD output support, but VxD builds still depend on DDK
|
||||
headers, segment layout, control procedure glue, and import definitions.
|
||||
|
||||
## Practical Recommendation
|
||||
|
||||
Use two build environments:
|
||||
|
||||
```text
|
||||
Linux host
|
||||
builds and tests portable NFS core
|
||||
builds Win32 EXE/DLL if MinGW-Lite or old MinGW is installed
|
||||
|
||||
Win98/XP VM with Win98 DDK
|
||||
builds RETROVXD.VXD
|
||||
tests driver loading and IFSMgr behavior
|
||||
```
|
||||
|
||||
This avoids spending days fighting linker/segment issues before the redirector
|
||||
logic itself is working.
|
||||
|
||||
## Linux Package Names To Look For
|
||||
|
||||
Depending on distribution:
|
||||
|
||||
```text
|
||||
openwatcom-v2
|
||||
jwasm or uasm
|
||||
mingw-w64-i686
|
||||
wine
|
||||
dosbox-x
|
||||
qemu-system-i386
|
||||
```
|
||||
|
||||
For true Win95 compatibility, prefer a dedicated Win95/98-capable MinGW build
|
||||
over a modern distro default.
|
||||
|
||||
## Suggested Build Order
|
||||
|
||||
1. Build portable NFS core:
|
||||
|
||||
```sh
|
||||
make -f Makefile.posix
|
||||
```
|
||||
|
||||
2. Build Win32 mapping app and provider:
|
||||
|
||||
```sh
|
||||
tools/build-win32-mingw.sh
|
||||
```
|
||||
|
||||
The script rebuilds `retronfs95.exe`, `RetroMap95.exe`, and `RETRONP.DLL`,
|
||||
then refreshes `dist/RetroNFS95-win32-artifacts.zip` and
|
||||
`dist/SHA256SUMS.txt`.
|
||||
|
||||
3. Build VxD in DDK environment:
|
||||
|
||||
```bat
|
||||
cd vxd
|
||||
build
|
||||
```
|
||||
|
||||
or with an Open Watcom/JWasm cross setup once DDK includes are available:
|
||||
|
||||
```sh
|
||||
tools/build-vxd-watcom.sh /path/to/win98ddk
|
||||
```
|
||||
|
||||
The script prefers `jwasm` when available and assembles the control stub with
|
||||
MASM-compatible options:
|
||||
|
||||
```sh
|
||||
jwasm -nologo -c -omf -Cp -Zm -3p -I/path/to/win98ddk/inc ...
|
||||
```
|
||||
|
||||
`-Cp` preserves symbol case, `-Zm` enables MASM compatibility, and `-omf` is the
|
||||
default because Open Watcom `wlink` expects OMF objects for this VxD flow. COFF
|
||||
can be tested explicitly:
|
||||
|
||||
```sh
|
||||
VXD_OBJ_FORMAT=coff tools/build-vxd-watcom.sh /path/to/win98ddk
|
||||
```
|
||||
|
||||
The VxD build enables the real IFSMgr registration service call by default:
|
||||
|
||||
```sh
|
||||
make -C vxd VXD_IFSMGR_REGISTER=real
|
||||
```
|
||||
|
||||
For safer load/debug cycles where the FSD entry should only be prepared and
|
||||
reported through `/status`, use:
|
||||
|
||||
```sh
|
||||
make -C vxd VXD_IFSMGR_REGISTER=prepared
|
||||
```
|
||||
|
||||
The Linux DDK include tree may contain both uppercase and lowercase copies such
|
||||
as `VMM.INC` and `vmm.inc`. The current `vxd/retroctrl.asm` avoids that macro
|
||||
path completely: it carries the small DDB/control-dispatch subset needed by
|
||||
RetroNFS95, because the stock Win98 DDK `vmm.inc` MakeCodeSeg macro uses old
|
||||
MASM concatenation syntax that JWasm rejects.
|
||||
|
||||
That script is still not a substitute for a real Win95/98 test machine. It
|
||||
builds a loadable-format `RETROVXD.VXD`; runtime loading, MPR interaction, and
|
||||
IFSMgr file-operation dispatch still need to be tested and completed under
|
||||
Windows 95/98.
|
||||
69
docs/DRIVE_MAPPING.md
Normal file
69
docs/DRIVE_MAPPING.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Windows 95/98 Drive Mapping Plan
|
||||
|
||||
The NFS core in this repository is user-mode. Mapping a real drive letter on
|
||||
Windows 95/98 requires a second layer.
|
||||
|
||||
## Goal
|
||||
|
||||
Expose an NFS export as a normal drive such as:
|
||||
|
||||
```text
|
||||
R:\
|
||||
```
|
||||
|
||||
with long filenames visible to Win32 applications.
|
||||
|
||||
## Architecture
|
||||
|
||||
```text
|
||||
Win32 apps
|
||||
|
|
||||
MPR / WNet APIs
|
||||
|
|
||||
RetroNFS network provider DLL
|
||||
|
|
||||
Win9x redirector / IFSMgr layer
|
||||
|
|
||||
RetroNFS user-mode service or VxD bridge
|
||||
|
|
||||
NFSv3 client core
|
||||
|
|
||||
Winsock TCP/IP
|
||||
```
|
||||
|
||||
## Why This Is Separate
|
||||
|
||||
Win95/98 drive mapping is not just an NFS protocol problem. The operating
|
||||
system needs a network provider/redirector that handles file opens, reads,
|
||||
writes, directory enumeration, attributes, locks, and name conversion.
|
||||
|
||||
The current source tree provides the protocol core that this redirector will
|
||||
call.
|
||||
|
||||
## Long Filename Strategy
|
||||
|
||||
Windows 95/98 supports long filenames through Win32 APIs and VFAT semantics.
|
||||
The redirector should:
|
||||
|
||||
- preserve server filenames as long names
|
||||
- synthesize 8.3 aliases for old 16-bit/DOS applications
|
||||
- store no extra metadata on the NFS server unless needed
|
||||
- reject or map characters invalid on Windows clients
|
||||
|
||||
Pure real-mode MS-DOS is different. It has no native LFN layer, so a DOS client
|
||||
would need an LFN TSR/API shim or would expose 8.3 aliases only.
|
||||
|
||||
## Implementation Milestones
|
||||
|
||||
1. Add write/create/remove/rename/mkdir/rmdir to the NFS core.
|
||||
2. Add attribute translation and basic DOS file mode mapping.
|
||||
3. Add file handle cache and directory entry cache.
|
||||
4. Build a Win32 network provider DLL for connection UI and persistent mappings.
|
||||
5. Implement the redirector/VxD bridge for file operations.
|
||||
6. Add installer INF for Win95/98.
|
||||
|
||||
## Risk
|
||||
|
||||
The VxD/IFSMgr portion is the hardest part and needs the Windows 95/98 DDK.
|
||||
The protocol code can be developed and tested first on XP or Linux.
|
||||
|
||||
36
docs/SECURITY.md
Normal file
36
docs/SECURITY.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Security Notes
|
||||
|
||||
NFSv3 with AUTH_SYS is not a modern security boundary. The client tells the
|
||||
server which UID/GID it wants to use, and the server trusts network placement
|
||||
and export rules.
|
||||
|
||||
Use a gateway design:
|
||||
|
||||
```text
|
||||
legacy PC -> gateway -> modern storage/service
|
||||
```
|
||||
|
||||
Gateway controls:
|
||||
|
||||
- host firewall permits NFS only from approved legacy IPs
|
||||
- static DHCP reservation for the old PC
|
||||
- dedicated export path, no shared home directories
|
||||
- read-only export unless writes are necessary
|
||||
- no inbound NFS from the rest of the LAN
|
||||
- logs for mount and file access
|
||||
|
||||
Example Linux export:
|
||||
|
||||
```text
|
||||
/srv/retro 192.168.50.20(ro,sync,no_subtree_check,all_squash,anonuid=65534,anongid=65534)
|
||||
```
|
||||
|
||||
Example nftables idea:
|
||||
|
||||
```text
|
||||
allow tcp dport {111,2049,mountd-port} from 192.168.50.20
|
||||
drop tcp dport {111,2049,mountd-port}
|
||||
```
|
||||
|
||||
Pin mountd/statd/lockd ports if you need firewall predictability.
|
||||
|
||||
124
docs/WIN9X_REDIRECTOR.md
Normal file
124
docs/WIN9X_REDIRECTOR.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# Win95/98 Redirector Design
|
||||
|
||||
Windows 95/98 SMB-style behavior requires three cooperating pieces:
|
||||
|
||||
1. `RETROVXD.VXD`
|
||||
- remote file system redirector layer
|
||||
- registers with IFSMgr
|
||||
- owns drive-letter mappings
|
||||
- dispatches open/read/write/find/attr operations
|
||||
|
||||
2. `RETRONP.DLL`
|
||||
- Network Provider DLL loaded by MPR
|
||||
- implements `NPGetCaps`, `NPAddConnection3`, `NPCancelConnection`,
|
||||
`NPGetConnection`, and enumeration stubs
|
||||
- persists mappings
|
||||
- talks to the VxD through `DeviceIoControl`
|
||||
|
||||
3. `RetroMap95.exe`
|
||||
- user-facing mapping tool
|
||||
- calls `WNetAddConnection3`
|
||||
- installs a startup remapper in the Run key
|
||||
|
||||
The source tree now contains all three layers.
|
||||
|
||||
## Current VxD Contract
|
||||
|
||||
`RETROVXD.VXD` exposes a small `DeviceIoControl` contract shared in
|
||||
`include/retro_ioctl.h`.
|
||||
|
||||
Supported control codes:
|
||||
|
||||
- `RETRO_IOCTL_MAP`
|
||||
- input: `RETRO_MAP_REQUEST`
|
||||
- output: `RETRO_MAPPING_INFO`
|
||||
- validates `R:`-style drive letters
|
||||
- parses `\\RetroNFS\server\export_path` into server/export fields
|
||||
- stores the mapping in a 26-slot drive table
|
||||
- `RETRO_IOCTL_UNMAP`
|
||||
- input: `RETRO_QUERY_REQUEST`
|
||||
- removes a drive-table entry
|
||||
- `RETRO_IOCTL_QUERY`
|
||||
- input: `RETRO_QUERY_REQUEST`
|
||||
- output: `RETRO_MAPPING_INFO`
|
||||
- returns one mapped drive
|
||||
- `RETRO_IOCTL_ENUM`
|
||||
- input: `RETRO_ENUM_REQUEST`
|
||||
- output: `RETRO_MAPPING_INFO`
|
||||
- enumerates active mappings by zero-based active-entry index
|
||||
- `RETRO_IOCTL_STATUS`
|
||||
- output: `RETRO_STATUS_INFO`
|
||||
- returns loaded-driver state and mapping counts
|
||||
|
||||
`RETRONP.DLL` now calls `MAP` and `UNMAP`; `RetroMap95.exe /status [R:]`
|
||||
queries the VxD directly.
|
||||
|
||||
## Mapping Syntax
|
||||
|
||||
Use UNC-like names so MPR can route them to the provider:
|
||||
|
||||
```text
|
||||
\\RetroNFS\server\export_path
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```bat
|
||||
RetroMap95.exe /map R: \\RetroNFS\192.168.1.10\srv_retro
|
||||
RetroMap95.exe /unmap R:
|
||||
RetroMap95.exe /install-startup
|
||||
```
|
||||
|
||||
## Startup Behavior
|
||||
|
||||
Persistent mappings are stored in:
|
||||
|
||||
```text
|
||||
%WINDIR%\RETRO95\mappings.ini
|
||||
```
|
||||
|
||||
`RetroMap95.exe /startup` reads that file and calls `WNetAddConnection3` for
|
||||
each saved drive. This mirrors the user-visible behavior of the Windows SMB
|
||||
client, where Explorer and applications see stable drive letters after login.
|
||||
|
||||
## Remaining VxD Work
|
||||
|
||||
The current VxD source now has:
|
||||
|
||||
- device init/exit hooks
|
||||
- IOCTL command IDs for map/unmap/query/enum/status
|
||||
- payload structures shared with `RETRONP.DLL` and `RetroMap95.exe`
|
||||
- drive-letter mapping table
|
||||
- UNC parser for `\\RetroNFS\server\export_path`
|
||||
- status/query/enumeration support
|
||||
- a JWasm-compatible control stub that builds `RETROVXD.VXD` without including
|
||||
the incompatible Win98 DDK `vmm.inc` macro layer
|
||||
- an `RetroIFS_*` scaffold:
|
||||
- `RetroIFS_Init` / `RetroIFS_Exit`
|
||||
- `RetroIFS_Dispatch`
|
||||
- prepared FSD entry state and optional real `IFSMgr_RegisterFILE_System` /
|
||||
`IFSMgr_DeregisterFILE_System` VxDCall wiring
|
||||
- `IFSFN_*` function-number routing for connect/disconnect/open/read/write/
|
||||
close/find/disk-info
|
||||
- a 64-entry internal open-file cache placeholder
|
||||
- read-only dispatch behavior:
|
||||
- `OPEN` allocates an internal handle and stores the requested path
|
||||
- `READ` returns deterministic EOF until NFS file handles are wired in
|
||||
- `WRITE` returns access denied
|
||||
- `FINDFIRST`/`FINDNEXT` return no-more-files until NFS `READDIR` is wired
|
||||
- `GETDISKINFO` returns stable placeholder geometry
|
||||
|
||||
Still required for a usable drive:
|
||||
|
||||
- live Win95/98 validation of the IFSMgr network FSD register/deregister calls
|
||||
- file operation dispatch table
|
||||
- validation of the simplified IFSMgr parameter tails against a live Win95/98
|
||||
target
|
||||
- NFS `LOOKUP`/`READ`/`READDIR` handle binding
|
||||
- write/create/delete/rename implementation
|
||||
- real directory search implementation
|
||||
- attribute and timestamp translation
|
||||
- 8.3 alias generation for old DOS/16-bit callers
|
||||
- cache invalidation and reconnect handling
|
||||
|
||||
The existing NFSv3 core is the protocol engine the redirector should call.
|
||||
Reference in New Issue
Block a user