Microsoft KB Archive/110845

{|
 * width="100%"|

How Win32-Based Applications Are Loaded Under Windows

 * }

Q110845

-

The information in this article applies to:


 * Microsoft Win32s versions 1.0, 1.1, 1.2, 1.3

-

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.

Additional query words: 1.00 1.10 1.20 G byte

Keywords : kbOSWin32s

Issue type :

Technology : kbWin32sSearch kbWin32s100 kbWin32s110 kbWin32s120 kbWin32s130