mbbsemu / MBBSEmu

The MajorBBS Emulation Project is an Open Source, Cross-Platform emulator for easily running The MajorBBS & Worldgroup Modules
https://www.mbbsemu.com
MIT License
128 stars 14 forks source link

[MBBSEmu] Archery/Console - Critical Exception has occurred #349

Closed TQPS closed 3 years ago

TQPS commented 3 years ago

Module Information

Describe the bug Running the following MBBSEmu.exe -console -c modules.json from an elevated or non-elevated CMD prompt generates the following error

``` Critical Exception has occurred: System.IO.IOException: The handle is invalid. at System.ConsolePal.Clear() at System.Console.Clear() at MBBSEmu.Session.LocalConsole.LocalConsoleSession..ctor(ILogger logger, String sessionId, IMbbsHost host) at MBBSEmu.Program.Run(String[] args) ```

The system loads correctly if the -console parameter is removed, however, there is no console.

To Reproduce Steps to reproduce the behavior:

  1. Run a CMD from Windows 7 x64
  2. Execute the following command: MBBSEmu.exe -console -c modules.json
  3. Program executes in a separate window, fails with the error Critical Exception has occurred and closes

Expected behavior Expecting to see the console view

Screenshots The window closes so captured the results to a file.

``` 2020-12-27 16:54:34.9493 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\BBSGEN.DB 2020-12-27 16:54:35.1053 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\BBSUSR.DB 2020-12-27 16:54:35.1209 Info MBBSEmu.Program.Run Loading GWWARROW 2020-12-27 16:54:35.1365 Info MBBSEmu.HostProcess.MbbsHost..ctor Constructing MBBSEmu Host... 2020-12-27 16:54:35.1365 Info MBBSEmu.HostProcess.MbbsHost.NowUntil Waiting 13:05:24.8634127 until 06:00:00 to perform nightly cleanup 2020-12-27 16:54:35.1365 Info MBBSEmu.HostProcess.MbbsHost..ctor Constructed MBBSEmu Host! 2020-12-27 16:54:35.1521 Info MBBSEmu.Module.MsgFile..ctor Compiling MCV from GWWARROW.MSG 2020-12-27 16:54:35.1521 Info MBBSEmu.Module.MsgFile.BuildMCV Compiled GWWARROW.MCV (56 values, 12254 bytes) 2020-12-27 16:54:35.1677 Info MBBSEmu.Module.MbbsModule..ctor Located _INIT__: 0002:0000 2020-12-27 16:54:35.1677 Info MBBSEmu.HostProcess.MbbsHost.AddModule Adding Module GWWARROW... 2020-12-27 16:54:35.2145 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 1 (424 bytes) loaded! 2020-12-27 16:54:35.2301 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 2 (10917 bytes) loaded! 2020-12-27 16:54:35.2301 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 3 (9612 bytes) loaded! 2020-12-27 16:54:35.2301 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 4 (149 bytes) loaded! 2020-12-27 16:54:35.2301 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 5 (0 bytes) loaded! 2020-12-27 16:54:35.2301 Warn MBBSEmu.Module.MbbsModule.Execute GWWARROW exhausted execution Units, creating additional 2020-12-27 16:54:35.2457 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\Modules\GWWARROW\GWWARROW.DB 2020-12-27 16:54:35.2457 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\Modules\GWWARROW\GWWARRO1.DB AUDIT SUMMARY: Archery Total AUDIT DETAIL: Archery total collected: 750 AUDIT SUMMARY: Archery Paid AUDIT DETAIL: Archery total paid : 0 AUDIT SUMMARY: Archery V1.4D Channel 0 DEMO AUDIT DETAIL: Call GraphicWares or Wizard Software for ARCHERY DEMO KEY AUDIT SUMMARY: Tech Support: [706] 737-2235 AUDIT DETAIL: AUDIT SUMMARY: For a KEY call toll free AUDIT DETAIL: AUDIT SUMMARY: 1 800 688-7049 AUDIT DETAIL: AUDIT SUMMARY: Anywhere in the USA, or CANADA AUDIT DETAIL: 2020-12-27 16:54:35.2769 Info MBBSEmu.HostProcess.MbbsHost.AddModule Module GWWARROW added! 2020-12-27 16:54:35.3705 Info MBBSEmu.Program.Run Telnet listening on port 23 2020-12-27 16:54:35.3705 Info MBBSEmu.Program.Run Rlogin listening on port 513 2020-12-27 16:54:35.3705 Info MBBSEmu.Program.Run Rlogin GWWARROW listening on port 514 2020-12-27 16:54:35.3861 Info MBBSEmu.Program.Run Started MBBSEmu Build #122220-8 Critical Exception has occurred: System.IO.IOException: The handle is invalid. at System.ConsolePal.Clear() at System.Console.Clear() at MBBSEmu.Session.LocalConsole.LocalConsoleSession..ctor(ILogger logger, String sessionId, IMbbsHost host) at MBBSEmu.Program.Run(String[] args) ```

For context, the contents of my modules.json file is as follows:

```json { "Modules": [ { "Identifier": "GWWARROW", "Path": "C:\\MajorBBS\\Modules\\GWWARROW\\" } ] } ```

For additional context, my appsettings.json file are as follows:

```json { "BBS.Title": "TQPS", "BBS.Channels": "4", "GSBL.BTURNO": "[_redacted_]", "Cleanup.Time": "06:00", "Module.DoLoginRoutine": "True", "Telnet.Enabled": "True", "Telnet.Port": "23", "Telnet.Heartbeat": "False", "Rlogin.Enabled": "True", "Rlogin.Port": "513", "Rlogin.RemoteIP": "[_redacted_]", "Rlogin.PortPerModule": "True", "Database.File": "mbbsemu.db", "Btrieve.CacheSize": 4, "Account.DefaultKeys": [ "DEMO", "NORMAL", "USER" ] } ```

Software Information:

tuday2 commented 3 years ago

MBBSEmu_ConsoleFix.zip

TQPS commented 3 years ago

Here's the output from this executable ...

``` 2020-12-28 08:13:57.6269 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\BBSGEN.DB 2020-12-28 08:13:57.7676 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\BBSUSR.DB 2020-12-28 08:13:57.7833 Info MBBSEmu.Program.Run Loading GWWARROW 2020-12-28 08:13:57.7989 Info MBBSEmu.HostProcess.MbbsHost..ctor Constructing MBBSEmu Host... 2020-12-28 08:13:57.7989 Info MBBSEmu.HostProcess.MbbsHost.NowUntil Waiting 21:46:02.2010464 until 06:00:00 to perform nightly cleanup 2020-12-28 08:13:57.7989 Info MBBSEmu.HostProcess.MbbsHost..ctor Constructed MBBSEmu Host! 2020-12-28 08:13:57.7989 Info MBBSEmu.Module.MsgFile..ctor Compiling MCV from GWWARROW.MSG 2020-12-28 08:13:57.8145 Info MBBSEmu.Module.MsgFile.BuildMCV Compiled GWWARROW.MCV (56 values, 12254 bytes) 2020-12-28 08:13:57.8145 Info MBBSEmu.Module.MbbsModule..ctor Located _INIT__: 0002:0000 2020-12-28 08:13:57.8145 Info MBBSEmu.HostProcess.MbbsHost.AddModule Adding Module GWWARROW... 2020-12-28 08:13:57.8614 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 1 (424 bytes) loaded! 2020-12-28 08:13:57.8614 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 2 (10917 bytes) loaded! 2020-12-28 08:13:57.8614 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 3 (9612 bytes) loaded! 2020-12-28 08:13:57.8614 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 4 (149 bytes) loaded! 2020-12-28 08:13:57.8614 Info MBBSEmu.HostProcess.MbbsHost.AddModule Segment 5 (0 bytes) loaded! 2020-12-28 08:13:57.8614 Warn MBBSEmu.Module.MbbsModule.Execute GWWARROW exhausted execution Units, creating additional 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.time Passed seconds: 1609143237 (AX:93C5, DX:5FE9) 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.alczer Allocated 70 bytes starting at 1000:9D31 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.alczer Allocated 70 bytes starting at 1000:9D78 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.alczer Allocated 40 bytes starting at 1000:9DBF 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.gmdnam Retrieved Module Name "GWW Archery " and saved it at host memory offset 1000:9DE8 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "GWW Archery " (25 bytes) from 1000:9DE8 to 0003:0000 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.register_module MODULE pointer (1000:4F38) set to 1000:9DF5 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.register_module Module Description set to GWW Archery 2020-12-28 08:13:57.8771 Info MBBSEmu.Module.McvFile..ctor Loading MCV File: GWWARROW.MCV 2020-12-28 08:13:57.8771 Info MBBSEmu.Module.McvFile..ctor Parsing MCV File: GWWARROW.MCV 2020-12-28 08:13:57.8771 Info MBBSEmu.Module.McvFile.Parse Successfully parsed and loaded 56 messages from GWWARROW.MCV 2020-12-28 08:13:57.8771 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.opnmsg Opened MCV file: GWWARROW.MCV, assigned to FFFF:0000 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.numopt Retrieved option 12 value: 5 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 2 value: False 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 6 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 9 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 16 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 17 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 19 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 20 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 21 value: False 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ynopt Retrieved option 14 value: True 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.numopt Retrieved option 15 value: 250 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.lngopt Retrieved option 13 value: 10000 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.numopt Retrieved option 8 value: 7200 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.numopt Retrieved option 11 value: 25 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.lngopt Retrieved option 10 value: 1800 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stgopt Retrieved option 3 string value: 7 bytes saved to 1000:9E33 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stgopt Retrieved option 43 string value: 7 bytes saved to 1000:9E3B 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stgopt Retrieved option 1 string value: 17 bytes saved to 1000:9E43 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.getasc Called, redirecting to stgopt() 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stgopt Retrieved option 32 string value: 12 bytes saved to 1000:9E55 2020-12-28 08:13:57.8927 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\Modules\GWWARROW\GWWARROW.DB 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.AllocateBB Opened file GWWARROW.DAT and allocated it to 1000:9E62 2020-12-28 08:13:57.8927 Info MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB C:\MajorBBS\Modules\GWWARROW\GWWARRO1.DB 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.AllocateBB Opened file GWWARRO1.DAT and allocated it to 1000:9FBF 2020-12-28 08:13:57.8927 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.setbtv Setting current Btrieve file to GWWARRO1.DAT (1000:9FBF) AUDIT SUMMARY: Archery Total AUDIT DETAIL: Archery total collected: 750 AUDIT SUMMARY: Archery Paid AUDIT DETAIL: Archery total paid : 0 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.setbtv Setting current Btrieve file to GWWARROW.DAT (1000:9E62) 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.rtihdlr Registered routine 0002:2394 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.rtkick Registered routine 0002:2A34 to execute every 7200 seconds 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.f_scopy Copied 9 bytes from 0003:003D to 0000:FFE4 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.f_scopy Copied 9 bytes from 0003:0046 to 0000:FFDA 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.f_scopy Copied 9 bytes from 0003:004F to 0000:FFD0 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.today Returned packed date: 20892 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.ncdate Received value: 20892, decoded string 12/28/20 saved to 1000:A0E0 2020-12-28 08:13:57.9083 Warn MBBSEmu.HostProcess.ExportedModules.Majorbbs.atol Unable to cast ?3 (0000:FFC2) to long 2020-12-28 08:13:57.9083 Warn MBBSEmu.HostProcess.ExportedModules.Majorbbs.atol Unable to cast =2 (0000:FFC2) to long AUDIT SUMMARY: Archery V1.4D Channel 0 DEMO AUDIT DETAIL: Call GraphicWares or Wizard Software for ARCHERY DEMO KEY AUDIT SUMMARY: Tech Support: [706] 737-2235 AUDIT DETAIL: AUDIT SUMMARY: For a KEY call toll free AUDIT DETAIL: AUDIT SUMMARY: 1 800 688-7049 AUDIT DETAIL: AUDIT SUMMARY: Anywhere in the USA, or CANADA AUDIT DETAIL: 2020-12-28 08:13:57.9083 Info MBBSEmu.HostProcess.MbbsHost.AddModule Module GWWARROW added! 2020-12-28 08:13:58.0021 Info MBBSEmu.Program.Run Telnet listening on port 23 2020-12-28 08:13:58.0021 Info MBBSEmu.Program.Run Rlogin listening on port 513 2020-12-28 08:13:58.0021 Info MBBSEmu.Program.Run Rlogin GWWARROW listening on port 514 2020-12-28 08:13:58.0021 Info MBBSEmu.Program.Run Started MBBSEmu Build #Development (Overwritten in Azure Pipeline) C r i t i c a l E x c e p t i o n h a s o c c u r r e d : S y s t e m . E x c e p t i o n : F a i l e d t o g e t O u t p u t C o n s o l e M o d e a t M B B S E m u . S e s s i o n . L o c a l C o n s o l e . W i n 3 2 V T 1 0 0 . E n a b l e ( ) a t M B B S E m u . S e s s i o n . L o c a l C o n s o l e . L o c a l C o n s o l e S e s s i o n . . c t o r ( I L o g g e r l o g g e r , S t r i n g s e s s i o n I d , I M b b s H o s t h o s t ) a t M B B S E m u . P r o g r a m . R u n ( S t r i n g [ ] a r g s ) ```

Additional information:

tuday2 commented 3 years ago

TODO: Detect version of windows and throw a friendly error if trying to use -console on < Windows 8

https://docs.microsoft.com/en-us/dotnet/api/system.environment.osversion?view=net-5.0