Windows 95/98

Home
Windows Support Menu

 

System Tools

Winalign

Winalign is a simple program designed to optimize the performance of executable code (binaries). This allows the CacheMap feature to map directly to sections in cache, resulting in a significant increase in performance through more available memory.

WinAlign restructures an executable file’s sections so that they are aligned on 4K boundaries. WinAlign starts by rewriting the file’s headers. After the headers, it writes a new section table. It then writes out the file’s sections, each one starting on a 4K boundary. The new section table is updated with this information. The headers are also updated to show that the file is now aligned on 4K boundaries. There are various support files used by Winalign.

The result is a slightly larger file. The program’s original section locations and the new section locations are written to the registry. This information is used to restore the file if the "–r" option is used. (This is discussed later.)

Walign.exe

This file comes with Windows 98 and is written to look for Microsoft Office during Setup. Once it finds the folder, it will call Winalign.dll to do the actual work and align those files.

Walign.exe automatically makes a log in your <windir> system directory. The file name is "WinAlign Report.txt" or winali~1.txt. It lists the number of files processed and name the files that were either aligned or if it failed it will list a reason if failed (For example, Already aligned.)

Tip: If you run Walign on a clean system that has nothing but Windows 98 installed Walign will not align anything as Windows 98 is already prealigned. But, Walign will add a task into Task Scheduler so that it will check your system twice a month to see if you have installed Microsoft Office. Once Walign successfully aligns Microsoft Office it will then remove itself from Task Scheduler.

Winali.ini

This file acts as an include list of files to align. Walign.exe references it during setup; Winalign.exe references it when run manually.

If the list is empty or missing, the following message appears:

Empty or missing list of files to be aligned. No files will be aligned.

If the list is not in the proper format, the following message appears:

List of files to be aligned in unrecognizable format. The list should be by file name, one file per line.

Winalx.ini

This file acts as an exclude list of files to align. Walign.exe references it during setup; Winalign.exe references it when run manually.

There are certain binaries that should not be aligned by WinAlign. Following is a list contains those binary types that we know should not be aligned, as the results are unpredictable. WinAlign will never align these binaries, regardless of the command syntax used. Both of these binary types can be determined from the header information:

• Signed binaries

• Windows NT system binaries

Winalign.dll

This file runs at the end of Setup and uses the contents of Winali.ini and Winalx.ini to align the Microsoft Office (95 & 97) binaries.

Winalign.exe

This file ships in the Resource Kit and simply calls Winalign.dll with the proper parameters to do the actual work. It allows a user to have some control over what gets aligned. The default will scan the entire drive looking for files that exist in the include list (Winali.ini). There is also a command line switch that will allow a user to use the exclude list (Winalx.ini) instead so that they can align an entire drive excluding only those files that we know are bad to align and exist in the Winalx.ini. For more information consult the Windows 98 Resource Kit.

WinAlign Commandline Syntax

WinAlign [target] [-x | -n | -r] [-s] [-t]

Target directory or files to be processed (default is all)

-x work from an exclude list (Winalx.ini)

-n work from an include list (Winali.ini)

-r restore previously aligned binaries (undo)

-s silent (no dialog box)

-t text file output

Rules for aligning binaries

All binaries shipped as part of Windows 98 come prealigned. There is the set of rules used to determine when to align other binaries on a computer:

• WinAlign will be run at the end of Setup. It checks for the existence of Microsoft Office in the registry and aligns the Office binaries, if present.

• WinAlign will add itself to the Task Scheduler, to be run once every month.

• WinAlign will run directly from the Task Scheduler. The name in the Task Scheduler will be "Tune-up Application Start."

• Once WinAlign finds and aligns specified binaries, it will take itself off of the Task Scheduler.

Application vendors have been notified to align their binaries for future versions.

If WinAlign modifies a file, all dates will be changed accordingly. If WinAlign does not modify a file, none of the date fields should be changed.

More About Winalign

A side effect of this realignment is that it will actually increase the size of some files. While this is not a problem for the vast majority of files (since they contain exactly the same contents in slightly bigger container), there are 2 known classes of applications that will have problems with this:

1. Virus-checkers. These applications often check to see if file attributes such as file size has changed, and may mistakenly interpret that a virus has been run on your system when in fact it had not.

2. Driver patch programs. These patch programs will rewrite small sections of a driver based on an offset from the starting of a file. Since we are "stretching" the file, a patch program run on an aligned binary would patch the incorrect area resulting in a broken driver. Driver patch programs are very uncommon, and can be revised to patch the "stretched" binaries.

Winalign keeps a record in the registry for all files it has aligned for restore purposes. Files that were not touched by the realignment process (either they were excluded via Winalign.ini, algorithm, or were prealigned) will not be recorded here. This registry key where the log is kept is located in:

Hkey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Winalign

Winalign uses these entries in the registry to restore realigned binaries to their unaligned state, but does not depend on the entries for any subsequent realignments. Winalign can detect whether a binary is already aligned or not if you run Winalign on a drive that has already been realigned, only those files needing update will be aligned.

The registry entry:

Hkey_Local_Machine\Software\Microsoft\Windows\Winalign\LogForErrorCase

Can be added to have Winalign log for file errors in the realignment process. Set the value to 1 for on, 0 for off. This creates a Winalign.log file.

General System Usage

One indicator of when a system begins to slow appreciably is when the swap file first starts being used, because hard drive transfers are much slower than memory transfers.

The following shows the results on a popular computer retailing for less than $1000 with 22MB of RAM. It ships with 24MB of system RAM, but 2MB is used for video memory (rather than separate memory for the VGA); hence the somewhat strange number for system memory.

The table below compares Swapfile usage between Windows 95 and Windows 98 with aligned files.

Applications launched

Windows 95

Windows 98

Outlook

1.9MB

0

Outlook + Word

2.6MB

0

Outlook + Word + Excel

3.4MB

0

This illustrates that a Windows98 system has to be more stressed than a Windows95 machine before it will even hit start hitting the Swapfile.