Hacker News new | ask | show | jobs
by viraptor 3566 days ago
Ok, my (unmentioned) assumption was VC-created code with no added assembly. I realise that VB code for example would be stupid hard to convert this way.

I'm curious what do you mean by thunks in this case - specifically why would they be different than other code. Is it that the common code in original program may not be valid common code after translation?

2 comments

There was some use of self-modifying code, although I can't find exact references. It'll be on Raymond Chen's blog somewhere.

I don't think it should matter whether the original source was VC or not, and if you write a solution that does make it matter you'll find yourself tripped up a lot. (Your favourite game turns out to have been compiled with Watcom or Borland rather than VC, etc). Presumably if you could find the 16-bit VB interpreter bits and pieces you could run those too and run your VB app.

I did run across this blog post http://discuss.joelonsoftware.com/default.asp?joel.3.607174...., which could be turned into a Win10 complaint with a simple search-and-replace.

Some compatibility craziness, that isn't quite relevant to our win16 emulation case: https://blogs.msdn.microsoft.com/oldnewthing/20071224-00/?p=...

Thunks were used to execute 32 applications in 16 bit mode via Win32s, and were also the way you would prepare callbacks to be exposed to Windows APIs.
I was about to add a reference to the win32s thunking, and then chanced upon this [0] MSDN article that talks about supporting 32 bit I/O in 64 bit drivers. [0] https://msdn.microsoft.com/en-us/library/windows/hardware/ff...