Windows Libraries for OS/2

From DisNCord Community Wiki
Revision as of 12:18, 10 December 2022 by Dr. Shuppet (talk | contribs) (Added information about compatibility warning override)
Jump to navigation Jump to search

Microsoft Windows Libraries for OS/2 (shortened to WLO) is an implementation of the Win16 API for OS/2 1.21 and higher, along with an SDK for converting existing Win16 applications to run on OS/2.

History

The first version was 0.9, announced on February 4, 1991 as Microsoft Windows Libraries for OS/2 Development Kit[1][note 1]. To make matters confusing, as is common with Microsoft, another "advanced" version named 0.9 was distrubuted on Compuserve earlier on January 1, 1991. This version is, according to Microsoft and unlike 0.9 DK, not compatible with later versions.

Version 1.0 was released some time after that, along with a Demonstration Applications distribution (WLO10.ZIP), containing WLO DLLs and the so-called Windows 3.0 accessory applets, which are ports of Calc, Calendar, Cardfile, Clipboard, Clock, Notepad, Paintbrush, Reversi, Solitaire, Windows Help, and Write from Windows 3.0. This is the only known preserved distribution of WLO, hence most of the information in this article is derived from it, if not specified otherwise.

No later version is known to exist, and most likely it doesn't, since IBM and Microsoft parted ways later in 1991. OS/2 2.0 and later includes WinOS/2, which makes use of 386 specific features; however, WLO 1.0 still works at least up to OS/2 Warp 4.5[2][3].

Development

TODO: Write up how to build WLO applications under OS/2 or Windows/DOS.

Implementation

Unlike the later WinOS/2, no virtualization is used to implement WLO. Instead, it makes use of the fact OS/2 and Windows executables have the same format, which is New Executable (NE, sometimes also called segmented executable). This is a rather complicated format, the precise description of which is out of the scope of this article. What is important here is that it contains a module reference and imported names table, which specify which modules are used by the program[4].

These are usually at the beginning of the file, hence they can be analyzed using simple string extraction:

$ strings ie5win31.exe | head
This is a Windows self-extracting ZIP file.  You can run it from
Windows or unzip it with a utility like WinZip or PKUNZIP.$
WZ-SE-01
KERNEL
KEYBOARD
USER

Here, the module names are KERNEL, KEYBOARD, and USER. These correspond to other New Executable files and contain functions that can be imported into and used to by the original program (more precisely, for this case these contain the functions exported by Windows itself). Windows can have various extensions here, for example on Windows 3.0, the corresponding files are KERNEL.EXE, USER.EXE, and KEYBOARD.DRV (all in C:\WINDOWS\SYSTEM), however, these are, in fact, of course all NE executables.

WLO ships its own version of these Windows modules, which are named KERNEL.DLL, USER.DLL, and KEYBOARD.DLL, and reside in C:\OS2\DLL (which is one of the default library paths, hence they will be found when launching an Windows executable). These are essentially a Windows implementation on top of OS/2 instead of DOS, making use of Presentation Manager for GUI.

When a Windows executable is launched on a OS/2 system with WLO installed, it is treated the same as an OS/2 executable linking to the aforementioned modules; if you are lucky (see the compatibility section below), it will work as expected. On WLO 0.9, relinking was necessary, but with WLO 1.0, this is no longer required[5].

Compatibility

Generally, Windows binaries that only use the C runtime and Windows functions should run without issue under WLO. Binaries using direct DOS calls using INT 21h or similar will trap, since this interface is not present under OS/2[note 2]. These include stock Windows 3.0 applications like CLOCK (traps on DOS call to get time) and NOTEPAD (traps on DOS call to exit program).

Some (but not all) applications other than WLO applets display a compatiblity warning ("Application has not been tested to run compatibly on OS/2. Choose Cancel to quite or OK to proceed. If you choose OK, the application could terminate unexpectedly"). Setting OS2EXEFlags to 0x80, a possibly undocumented flag (only bits 0, 1, 2, 3 are known to be used) present on WLO applets, removes the warning (tested on FLAGGEN.EXE); this is probably an option to override it or something similar.

Some applications, for example CONTROL.EXE and PROGMAN.EXE from Windows 3.0, fail with "SYS0182: The operating system cannot run %1."; others, for example RECORDER.EXE, fail with "Cannot find the file or directory. Be sure that the path(s) and file name(s) are entered correctly. (PMV1024)". These seem to appear before the program is loaded and executed.

yksoft1 mentions in the BetaArchive post referenced earlier using a special "WLO's" stub and changing a byte to create a WLO executable from Windows 3.0 SDK examples. There is indeed a specific MS-DOS stub in the WLO applets (in contrast with their Windows 3.0 counterparts, whose MS-DOS stub only displays "Cannot be run in DOS mode"); when run in DOS mode, it prints '<executable-name>: can't open quotefile "quotes.txt"', pauses for a few seconds and exits. If quotes.txt exists, it prints its contents instead of the error mesasge. WLO 0.9 did not have the stub, at least from what is known from the description on how a WLO 0.9 binary is created in IBM PSD.

Static version of WLO

TODO: Microsoft Word and Excel for OS/2

Notes

  1. Wikipedia says April 2, 1987, but this is likely an error, since that pre-dates the release of OS/2 1.0 by a few months.
  2. Under real-mode Windows, these are handled by the underlying DOS directly; protected mode Windows works as a DOS extender.

References