User Tools

Site Tools


blog:pushbx:2025:0803_july:august_work

July/August work

2025-08-03

callver, fdapm, seekext

Preserve CF when chaining to the int 21h downlink:

For seekext, additionally:

Preserving CF for int 21h handlers is based on an answer on stackoverflow in which I modified an example to create an int 21h hook that can call its downlink (using pushed flags and a far call). The needed modifications:

  • Pass CF and ZF returned from the downlink call to our caller, done using lahf and setting up bp to access the iret frame.
  • Chain certain functions (00h, 26h, 31h, 4Bh, 4Ch) using a far jump to the downlink rather than using the pushf and far call. As mentioned, dosemu2 passes the same functions like a jump.
  • Pass input flags to the downlink (either in the far call or far jump). DOS probably doesn't care about the live flags in the fl register, but another caller using pushf would pass along the live fl to its iret stack frame.
  • Free the environment and close all process file handles.

LZEXE

inicomp lzexedat.asm

Interc3

lDebug

You could leave a comment if you were logged in.
blog/pushbx/2025/0803_july/august_work.txt · Last modified: 2025-08-03 17:44:25 +0200 Aug Sun by ecm