← Back to context

Comment by jussij

6 years ago

> and I faced this obscure Win32 API, which looks ugly, appalling, antiquated and plainly awful.

As you point out, the code you had to deal with was actually written using the Win16 API.

That Win16 API dates back to the first ever version of Windows which takes you back to a pre 1990 era.

As someone who did work on both Win16 and Win32, what I found amazing is Microsoft designed Win32 such that you could take your Win16 code, do a minimal number of changes and recompile that code for Win32.

That meant you could take your old Win16 code designed for a now obsolete version of Windows, do a minimal number of tweaks, recompile the code using a 32 bit compiler and have it running on the most resent 32 bit versions of Windows.

It was my first experience of a major coding upgrade and it was the last such upgrade that was anywhere near as simple as that upgrade.

> and have it running on the most resent 32 bit versions of Windows.

Or 64-bit, for that matter.

  • Well, those 32-bit apps run in a hypervisor. The compatibility is so good because you have both 64-bit and 32-bit Windows in your 64-bit installation.

    • 32-bit apps running on 64-bit Windows run using a Windows component called "WoW64". There is another compatibility layer used to run 16-bit apps on 32-bit Windows called "WoW".

      Neither "WoW64" nor "WoW" are usually referred to as "hypervisors". That term is usually reserved for systems which run a full operating system using CPU virtualisation technology – Hyper-V, VMWare, VirtualBox, Xen, KVM, etc.

      By contrast, WoW64 and WoW are rather thin translation layers. WoW64 just intercepts the 32-bit API calls, translates the parameters, invokes the 64-bit API, and then translates the results back to 32-bit. (WoW does basically the same thing for 16-bit calls to 32-bit.) This is possible because all of the Win32 API calls have Win64 equivalents (likewise, most Win16 API calls have Win32 API equivalents, except for a handful of obscure Win16 APIs which newer versions of Windows don't support.)

      WoW runs under NTVDM which uses virtual 8086 mode, so you might call WoW a "hypervisor" in that sense (although the hypervisor is really NTVDM not WoW.) But WoW64 does not use any virtualisation technology at all.

Over the decades a lot of win32 code was written. You can expect that all changes from 1995 on were win32 API only