Usurper Reborn v0.25.1-alpha - BBS Compatibility
BBS Socket Handle Improvements
This release focuses on improving compatibility with BBS software, particularly for BBSes that use non-standard socket handle inheritance.
New Diagnostics
When running with --verbose flag, sysops now see detailed handle information:
[SOCKET] Handle is valid. Flags: 0x1
[SOCKET] HANDLE_FLAG_INHERIT is set
[SOCKET] Handle type: FILE_TYPE_PIPE (pipe or socket) - good!
Windows API Integration:
- GetFileType() - Identifies whether the handle is a socket/pipe, console device, or file
- GetHandleInformation() - Checks handle validity and inheritance flags
- DuplicateHandle() - Duplicates handles for safer access when needed
Raw Handle Fallback Mode
If the .NET Socket class fails to wrap an inherited handle, the game now automatically tries a FileStream-based fallback:
- Attempts to duplicate the handle via Windows API
- Creates a FileStream directly from the handle
- Writes a visible test message:
[Usurper Raw Handle Mode]
When fallback succeeds:
[SOCKET] Using raw handle I/O mode
Handle Type Detection
The new diagnostics identify what type of handle the BBS is passing:
| File Type | Description | Action |
|---|---|---|
FILE_TYPE_PIPE
| Socket or pipe (correct) | Normal socket I/O |
FILE_TYPE_CHAR
| Console/character device | Try --stdio flag
|
FILE_TYPE_UNKNOWN
| Invalid or wrong type | Check BBS configuration |
Testing for Sysops
# Enable verbose diagnostics
UsurperReborn.exe --door32 door32.sys --verbose
# Watch [SOCKET] lines for handle information
# If FILE_TYPE_CHAR, use Standard I/O mode instead:
UsurperReborn.exe --door32 door32.sys --stdioFiles Changed
| File | Changes |
|---|---|
Scripts/BBS/SocketTerminal.cs
| Added Windows API imports, handle diagnostics, raw handle fallback |
Scripts/Core/GameConfig.cs
| Version bump to 0.25.1 |
README.md
| Updated version, added v0.25.0 changelog |
Technical Details
New P/Invoke Declarations
[DllImport("kernel32.dll", SetLastError = true)]
private static extern int GetFileType(IntPtr hFile);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetHandleInformation(IntPtr hObject, out uint lpdwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool DuplicateHandle(...);Fallback Flow
1. Parse socket handle from DOOR32.SYS
2. Run DiagnoseWindowsHandle() for verbose output
3. Try CreateSocketFromHandle() with .NET Socket class
4. If failed, try TryInitializeRawHandle() with FileStream
5. If both fail, suggest --stdio mode
Compatibility
- Windows: Full support with new diagnostics and fallback
- Linux/macOS: Standard socket handling (no changes needed)
- EleBBS: Improved diagnostics to identify handle type issues
- Synchronet: Continue using
--stdiofor best results - Mystic/WWIV: Standard DOOR32.SYS socket mode
Version Info
- Version: 0.25.1-alpha
- Version Name: "BBS Compatibility"
- Build: 244 tests passing