How Win32-Based Applications Are Loaded Under Windows

ID: Q110845

1.00 1.10 1.20 1.30 WINDOWS kbprg

The information in this article applies to:

SUMMARY

Microsoft Win32s is an operating system extension that allows Win32-based applications to be run on Windows 3.1. Win32s consists of a VxD and a set of dynamic-link libraries (DLLs).

It is possible to distinguish whether an executable was built for Win32 or Win16. Win32 executables use the Portable Executable (PE) format, while Win16 executables use the New Executable (NE) format.

The Windows 3.1 loader was designed to be aware that Win32-based applications would potentially be loaded. When the user starts a Win32-based application, the Windows 3.1 loader tries to load the Win32-based application via WinExec(). WinExec() calls LoadModule(), which will fail with an error indicating that it was passed an .EXE with the PE format. At this point, WinExec() calls a special function to start up Win32s. This function loads W32SYS.DLL (16-bit DLL) via LoadModule(). If W32SYS determines that the EXE is indeed a valid PE file, it calls LoadModule() on WIN32S.EXE (16-bit EXE) (it is similar to WinOldApp for MS- DOS-based programs running in Windows). WIN32S.EXE contains the task database, PSP, task queue, and module database. WIN32S.EXE calls its only function to load the Win32s 16-bit translator DLL, W32S16.DLL, which does work as a translator between the Win32-based application and the 16-bit world that it is running in.

MORE INFORMATION

Win32-based applications are loaded in the upper 2 gigabytes (GB) of the 4 GB address space under Win32s, whereas Windows NT loads them in the lower 2 GBs. This is because W32S.386, a VxD, allocates the memory, and VxDs get memory in the 2 GB to 4 GB range. The first 64K and the last 64K cannot be read or written to (similar to a null page on other architectures).

On Windows 3.1, all applications, even the Win32-based applications, share the same address space, unlike Windows NT where each Win32-based application gets its own address space. Each Windows-based application may be given its own address space, starting with Windows NT 3.5.

KBCategory: kbprg KBSubcategory: W32s Additional reference words: 1.00 1.10 1.20 1.30 G byte

Keywords          : kbWin32s 
Version           : 1.00 1.10 1.20 1.30
Platform          : WINDOWS

Last Reviewed: January 17, 1997