Hacker News
points by my123 3 days ago | 0 comments
being able to transfer HANDLEs across the 16/32-bit boundary notably for COM/OLE integration becomes a lot more painful

Microsoft says at https://learn.microsoft.com/en-us/windows/win32/winprog64/ru...:

> Note that 64-bit Windows does not support running 16-bit Windows-based applications. The primary reason is that handles have 32 significant bits on 64-bit Windows. Therefore, handles cannot be truncated and passed to 16-bit applications without loss of data. Attempts to launch 16-bit applications fail with the following error: ERROR_BAD_EXE_FORMAT.

winevdm on Windows eschews that level of integration, but perhaps MS should have shipped WoW16 with limitations instead of nothing.

[–] vintagedave 2 days ago
Naive question from someone who's never written this sort of compatibility layer: couldn't a VDM map handles? They are opaque values. Change the value, basically, keep a 16-bit table mapping to the host OS's 32/64-bit real handles?

Edit: the readme has something very similar:

    wine based Win16->Win32 conversion codes:
    BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
    {
        return DestroyWindow( WIN_Handle32(hwnd) );
    }
I would guess that's what the WIN_Handle32 method/macro is doing.
[–] my123 2 days ago
Looks like they tried some level of mapping but it didn't go too well: https://www.vttoth.com/CMS/technical-notes/?view=article&id=...