I should be asking chatgpt... ....
You should go back to your Windows XP image and not force your brain.
But if you still try to intercept dll - you can start the graphical interface directly in your fake dll, while being in the namespace and resources of the calling dll program. That is, you can rewrite your application as such a dll - and you will not have a communication problem, and everything will work fine on any system (you can also control the memory leak through your dll).
... In case anyone is interested: .....
No need to confuse people with stupid assumptions. The program simply switches the mode automatically, this should be visible in the source code.
It is also necessary to take into account that winspy injects itself into the process being examined (to read passwords), therefore I suggested doing the same in the most correct way - through its dll. In my example, the program loads the dll by its usual name, and the original dll is renamed. This approach is used because the dll for win9x is being corrected, and the original is needed for winXP. In your case, you need to change the name in the import table of the immutable application (directly with a binary editor) and create a dll with a changed name, which will call the original dll through itself.
I also know that there is a way to run your immutable application as a dll in the address space of your program, but I have never tried it. It would be convenient in your case. But no one can give advice, because the TRIM command is much more interesting to discuss.
I also just figured out how to compile a program for x86 and then, when running it on a 64-bit system, use 64-bit dlls from a 32-bit program. I need to try it. First, the program is compiled with assembler inserts, filled with nop to the required size. Then the code for the inserts is compiled in 64-bit assembler and directly inserted into the compiled program using a binary editor.