dosemu2 / comcom64

64bit command.com
https://github.com/dosemu2/comcom32/
GNU General Public License v3.0
32 stars 5 forks source link

suppress Runtime error 200 #79

Closed stsp closed 1 year ago

stsp commented 1 year ago

Discussed in https://github.com/dosemu2/comcom32/discussions/78

Originally posted by **nelgin** October 5, 2023 I'm trying to help a sysop configure a game. I gave him a copy of all my configuration files including the .dosemu directory. It displays a welcome screen but then exists. Comparing logfiles, the only difference is that he's seeing Warning: PKT: Cannot open sock so I'm guessing there's some sort of permissions issue, but under what circumstances would this be generated so I can try and figure out what permissions need fixing? Thanks,
stsp commented 1 year ago

https://github.com/dosemu2/dosemu2/files/12823084/CASINO.ZIP Test-case. Needs to introduce the r200fix command to comcom32 by hooking the RM exception 0.

stsp commented 1 year ago

The problem is that due to unknown packer, the direct patching is not possible. So we need a comcom32-based solution.

andrewbird commented 1 year ago

The problem is that due to unknown packer, the direct patching is not possible.

I'm casually following along here. I don't really know much about packers, so I'm presuming that the packer's decompression routine must expand the payload into memory somehow, then jump to it. At that point do we have enough information for say a new dosdebug feature to write a new uncompressed .exe to disk?

stsp commented 1 year ago

You need 2 passes, loading the program at different addresses. Then you compare these 2 dumps, find relocations and write them to an exe header. The challenge here is to find a proper entry point. Unpackers usually look for the long jumps, and use Nth long jump (with N=3) as an indication of an entry. That said, if you want to write the dosdebug-based unpacker - you are more than welcome. But its not an easy task.

stsp commented 1 year ago

r200fix is now implemented. You also need dosemu2 from git as there were bugs with RM exceptions handling. Good that we finally have a test-case for that (probably the last one) untested dpmi bit.