Printer Friendly

Windows program information files: how Windows and non-Windows programs cooperate through PIFs.

How Windows and non-Windows programs cooperate through PIFs

When using Microsoft Windows, we must always remember that Windows is not an operating system. Rather, it is an environment that resides on top of the operating system (DOS) itself. In a sense, one could say that Windows is the chief administrator of the computing environment. It is the job of Windows to perform the logistical operations that enable the user to accomplish certain desired tasks.

In order to do its job, Windows must manage the computer's memory, control the screen display, monitor access to the printer and communications ports, and, because this is a multitasking environment, act as a referee should conflicts arise between different applications.

That's a big job. Windows can succeed only by knowing a lot about the programs you use. It needs to know such things as whether an application was written for Windows, what its memory requirements are, how it uses the video display, whether it can write to a communications port, and much more.

Programs written specifically for Windows have this information built into them, and they can talk to Windows as they are running. The can, for example, request more memory when they need it and release memory when they don't need it. In other words, they cooperate with Windows and with each other.

Non-Windows (DOS) applications, on the other hand, do not have this capability. Since Windows can't learn about a DOS application from the program itself, it gains this information from a Program Information File (PIF). Here's how this works.

Starting DOS Applications Under Windows

Let's assume for now that you want to run a DOS program such as WordPerfect and that you haven't set up an icon for it in Program Manager or whatever shell you are using in Windows. You can start Wordperfect from the File Run command by typing WP.EXE (assuming WordPerfect is located on your search path), or by using the File Manager to locate WP.EXE and double-clicking on the program name.

In either case, Windows starts to run the program and realizes right away that it is not a Windows application. Instead of running WP.EXE immediately, Windows first looks along the search path for a WordPerfect PIF file. It assumes it has found one if it locates one with the same name as the executable file (WP, in this case) and a .PIF extension, i.e., WP.PIF. If it does not find a suitable PIF, it will use its default PIF and start WordPerfect running with the default information.

The important point to remember here is that Windows will not start a DOS application running all by itself. It will insist on using the applications's PIF file, and if it can't find one, it will use a default PIF. The information contained in the default Program Information File Windows uses will determine how that application behaves under Windows, or even whether it will run at all. Since most Windows users still have one or more DOS programs they want to run under Windows, it's a good idea to have some understanding of these mysterious PIFs.

So What Exactly Is in a PIF?

In the first place, PIFS are Janus-like in that they have two faces, one for Standard mode[1] and one for Enhanced mode. Windows will automatically use the appropriate one for the mode in which it is running. Figures 1 and 2 show the default. PIF settings for each mode. Notice that although some options are common to both modes, each has some settings not found in the other, and Enhanced-mode (Fig. 2) PIFs contain much additional information.

One interesting aspect of this dual-mode capability is that some of the shared options are not automatically effective in each mode. There are five shared options that can hold different values in the two modes: Optional parameters; Video mode; Memory requirements; XMS (Extended) memory; and Reserve shortcut keys. Of course, if you always run Windows in the same mode, then you don't need to worry about this.[2] If you ever change the mode in which you run Windows, however, this has two ramifications:

* You can, if you want, create a PIF that contains different values for each mode. Why would you want to do that? Suppose you use a word processor that can run either in text or graphics mode depending on a command-line switch that you specify when your start it. In Enhanced mode you can run the DOS application in a window, but only in text mode. Optionally, you might specify Standard-mode to run the program in graphics mode. In this case, you would probably need different settings for the video mode values.

* If you don't explicitly set the values for both modes. Windows will still use the default in one mode even if you have entered a different value in the other mode. So if you forget to set them both, you might find that your DOS application behaves strangely in one mode, or that it won't run at all.

You create and edit PIFs with the Windows PIF Editor, which is accessible via the Accessories group. The boxes you see in Figures 1 and 2 are from the PIF Editor. The Advanced Options box in the Enhanced-mode PIF appears when you click on the Advanced button of the main box. The Mode command on the menu bar enables you to switch between the two modes seen in Figures 1 and 2. Windows will present a rather intimidating warning when you switch to a PIF mode different from the mode in which Windows is running, but you cant just ignore it.

Standard Mode

I described the Standard mode PIF in an article previously published in this journal (see "Windows 3.0: Confessions of a Convert (Part II)," Computers in Libraries, vol. 10, November 1990, pp. 18-21, particularly the sidebar on p. 21), so in the interest of space I won't go into those options again here. A few comments on some of them, however, would probably be useful to the reader.

Optional Parameters: Placing a question mark here will cause a dialog box to open and prompt you for parameters such as a file to load with the application (this also works in Enhanced mode).

Video Mode: Setting this option to Text allocates one video page (4K) for text screen displays, thus leaving more memory available for other things. Setting it to Graphics/Multiple Text allocates 32K for graphics or eight video pages (a "video page" is one screen). Some text-only applications use multiple video pages as a way to switch rapidly from the top of a document to the bottom by storing both in video memory.

Directly Modifies: Leave these boxes unchecked unless the application is a communications program that uses a serial port or if it takes direct control of the keyboard.

No Screen Exchange: You can gain a little extra memory for the application by checking this box, but that will disable the ability to copy the screen to the Clipboard by pressing the Print Screen key.

Reserve Shortcut Keys: Windows uses each of these key combinations for special purposes and will intercept them. If your application requires one or more then check its box; otherwise leave them unchecked.

Enhanced Mode

Some of the options in the Enhanced-mode PIF are the same as those for Standard mode, with the exceptions noted earlier. However, there are several additional values to set (many of them pertain to multitasking DOS applications, which is not possible in Standard mode), and they deserve explanation.

Display Usage: DOS applications take slightly more memory if you start them in a window, so if memory is in short supply, you may want to run some DOS programs full-screen even in Enhanced mode. Also, some text-based DOS applications display a logo in graphics mode on start-up. Windows doesn't allow graphics in a DOS window, so you may have to start some programs full screen and then switch them to a window by pressing Alt-Enter.

Execution: Checking the Background box permits the application to execute in the background. Leaving it unchecked causes the application to be suspended whenever you bring anything else to the foreground (i.e., make it the active window).

Checking the Exclusive box means that this program, when in the foreground, gets all the CPU cycles (sometimes expressed as "time-slices") Windows might otherwise allocate to another DOS window that has Background checked. If the program is running in a window, Windows programs in the background will continue to receive cycles, but not if the DOS program is running full-screen. A better way to give a DOS session [3] full priority is described below.

Multitasking Options

Multitasking Options: This is where you specify the priority Windows gives to the DOS application when it is running in the background and in the foreground. This can be confusing, because there is no real unit of measurement indicated by the values you enter here. Fifty doesn't mean fifty percent, or fifty clock ticks, or fifty milliseconds. It means fifty, period. Actually, it's more of a ratio than anything else, although it's not strictly a ratio, either.

The default values of Background 50 and Foreground 100 theoretically mean than a DOS session in the foreground will receive twice as much processor time as one in the background, if both are using default PIF values.

In reality, however, Windows will give more than twice he priority to the foreground application than to the one in the background. This is so that the foreground program will respond more quickly to your keystrokes and not be as sluggish as it otherwise would. If you want a DOS program to have the highest priority possible, the best method is to leave the Exclusive box unchecked, assign a Foreground value of the 10,000 (the maximum), and run it full screen.

The Detect Idle Time box, if checked, allows Windows to ignore a background DOS session that is idle, e.g., waiting for you to press a key. This enables other applications to run faster, because they are not sharing timeslices with a program that doesn't need them. The problem is that some older DOS programs (calendars or schedules, for example) need timeslices even if they are doing nothing more than updating their clocks. Many newer programs are Windows-aware and can inform Windows of their needs. If you use one of the older, non-aware programs, leave this box unchecked.

Memory Options

Memory Options: The EMS line is for expanded memory, the XMS line for extended memory. A value greater than 0 in the KB Required field will prevent the application from running if that amount is not available. If a DOS program can use expanded memory, but does not require it (Lotus 1-2-3 versus 2.01 is such a program), then you should enter an appropriate value in the EMS Required field; otherwise it won't know the memory is there, because Windows won't make it available unless specifically told to do so.

A value of -1 in the KB Limit field enables the application to use all available memory of that type, but it will run slightly faster if you specify an actual limit.

Windows has the ability to swap an application's memory to disk when you switch away from it. It actually takes the contents of the area in memory used by the application and writes them to a temporary disk file, thus freeing up that memory for use by another program.

That's good, in that it enables you to load more programs than you would otherwise be able to load. However, it's not so good if speed is a concern because disk writes are comparatively slow. This is one reason why Windows can appear to be agonizingly slow in equipment that is less than high-end.

The boxes labeled Locked, if checked, prevent such swapping from taking place. This makes switching between applications much faster but prevents others from using that memory. The box labeled Lock Application Memory does the same thing, but for conventional memory.

The first 64K of extended memory is the High Memory Area (HMA). A few (not many) DOS applications can use this area. If yours does, then check the HMA box; otherwise leave it unchecked.

Display Options: In most cases, selecting Text on the Video Memory line will suffice. If you have trouble switching away from the application and back again in graphics mode, you may not to select Low of even High graphics. Low graphics reserves 32K for CGA resolution graphics while High Graphics reserves 128K for EGA or VGA resolution graphics.

Unless your DOS program uses EGA graphics, you should leave the Monitor Ports line unchecked. This will significantly speed up screen writes. If it does use EGA graphics, you should check the High Graphics box if the screen gets garbled or goes blank when you switch back to it.

Checking the Emulate Text Mode box enables your application to write to the screen much faster. Uncheck it only if the screen gets garbled or you lose control of the mouse.

Retain Video Memory functions similarly to the "lock memory" options described above. If you leave the box unchecked, when you switch away from a DOS program, start a Windows application, then return to the DOS program, there might not be enough memory available to change its graphics mode. If you check the box, this problem won't occur, but you will have less memory available for other programs. Leave it unchecked unless you encounter a problem.

Other options: Normally you can leave the Allow Fast Paste box checked and let the Clipboard paste data to the DOS session as fast as possible. If characters get lost, or if nothing happens when you try to paste, then uncheck the box.

By default, Windows will force you to close a DOS session, either by exiting from the program or by typing can exit from Windows. Checking the Allow Close When Active box gives Windows the ability to terminate the DOS session itself, although a dialog box will ask your permission. There is no harm in this as long as the DOS session has no files open, but it can wreak havoc with your data if a DOS program has open files. Better to be safe and leave this box unchecked unless you are positive it won't hurt anything. If your DOS session is simply a C:> prompt, there's no problem.

Shortcut Keys

If you define an Application Shortcut Key (actually a key combination), you will be able to use that key to bring your DOS session to the foreground if it's already running. The shortcut key must consist of either the Alt or Control key, plus any function key or character key. You may also include the Shift key as long as you use either Alt or Control as well.

Take care in selecting your shortcut keys, because once you define one for a DOS session, that key combination is lost to any other program and even to Windows itself as long as that session is running. For example, the keystroke that tells PageMaker you want to place an object in a document is Control-D.

I made the mistake of defining Control-D as the shortcut key in a PIF that keeps a DOS window icon at the bottom of my screen. Well, of course when I hit Control-D in PageMaker, instead of it opening the dialog box for me to place an object, my DOS window popped up.

If you ever need to change a PIF's shortcut key, you must open it in the PIF editor, go to the field, and do one of two things: either hit Backspace to erase the combination and then select another, or hit Shift-Backspace.

The second method replaces the existing combination with the word None, which is the only way to cancel shortcut keys. Then make any other desired changes to the PIF and save it. If the DOS session is running, you must exit and restart it before the change takes effect (this applies to any changes you might make in a PIF).

Where PIFs Come From

One of the options in the Windows Setup program is to have it scan your hard drive for applications. There is a file in your WINDOWS\SYSTEM directory called SETUP.INF that contains, among other things, information about many DOS applications. When Setup finds a DOS application on the hard drive that it recognizes, it creates a PIF based on the data in SETUP.INF. In most cases, PIFs created in this manner will do just fine. It's a good idea, however, to take a look at them and make sure they fit your computing environment.

Since the release of Windows 3.0 almost two years ago, the makers of many DOS applications have been including PIFs as part of their distribution files. These will generally contain the optimum settings for that program and will save you the trouble of experimenting to find the best values. As with the PIFs created by Setup, however, you should verify that they suit your specific needs.

For programs that won't have a PIF supplied by the software publisher, you might try calling their technical support lines and asking for assistance. Your other option is to read the documentation and try to glean the necessary information as best you can, and then just experiment with some of the settings.

A DOS Prompt PIF

I Find it useful to keep a DOS session minimized as an icon at the bottom of my screen. The session consists simply of a C:> prompt that I can pop up whenever I need it. Figures 3 and 4 show that Standard and Enhanced PIFs for this session. Let's take a brief look at it.

Notice from that the Program Filename specifies the complete with to COMMAND.COM, the DOS command processor. This PIF runs a secondary copy of the processor which creates the DOS session.

I've assigned WinDOS as the Window Title. This is what will display on the icon and in the window's title bar, and it's also the name that appears in the Windows Task Manager list.

The Optional Parameter (/E: 512) instructs DOS to provide 512 bytes of environmental space for this session instead of the normal 160 bytes. The DOS environment is where the PATH= and PROMPT= statements are stored, plus any other environment variables you might use. In most cases, it really isn't necessary to reserve more environment space for this DOS session, but you never know when you might have need of it, and 512 bytes is an insignificant amount of memory.

The only other difference between the default settings in Figure 1 and those for my DOS session in Figure 3 is that I have checked PrtSc in the Reserve Shortcut Keys section. This gives me the ability to do a standard screen dump to the printer. If I left the box unchecked, hitting the PrtSc key would cause Windows to send the screen contents to the Clipboard rather than the primer.

Enhanced Settings for the DOS PIF

Comparing Figures 1 and 4, we see several changes. I've changed the KB Desired to 218, because nothing I do in this window will require more than that. As a personal preference, I opted for my DOS prompt to appear in a window rather than full screen.

Note that I've changed the Background and Foreground priorities in the Advanced Options. Foreground is set to the maximum of 10,000 because when this session is active I want it receive the highest priority Windows can give it.

I should also point out that the Background setting of 100 is irrelevant here, because the Background box is not checked in the Execution section of the main screen, so this session will not run in the background in any case. I changed it to make the point that, if you do want to enable background execution, 100 is most likely the best choice.

Nothing I'm going to do in this window requires access to extended or expanded memory or the High Memory Area, so all of the Memory Options are set to zero or unchecked. I won't be using EGA graphics either, so I unchecked the Monitor Ports box.

Finally, since this window spends most of its time just sitting at a DOS prompt, I can allow Windows to close it for me instead of having to do it myself. I still have to confirm to Windows that this is okay, but that's easier than manually exiting from the session.

I saved this under the name DOSPROMPT.PIF, and my WIN.INI file has DOSPROMPT.PIF listed on the LOAD= lines. This ensures that my DOS prompt window loads every time I start Windows running, and it's always only a couple of clicks away whenever I want it.

Working with PIF's isn't a very exciting way to pass the time, but it is necessary. Otherwise, you could be wasting valuable computing resources, or you could find that a DOS application will not run at all. One of my favorite DOS programs (Info Select) not only would not run with the original PIF I had, it flashed an error message, beeped many times, and then popped me completely out of Windows, out of DOS, all the way back to my CMOS setup screen. After a few adjustments to the PIF, Info Select runs just fine in a DOS window in Enhanced mode.

Don't be intimidated by Program Information Files. Spend some time with them, experiment a little if you need to, and make them work for, rather than against you. [Figures 3 and 4 Omitted]

Notes

1. The PIF face for Real mode is the same as for Standard mode, but nobody runs Windows in real mode, do they?

2. Standard and Enhanced modes each have advantages and disadvantages when compared to one another. Standard mode is more efficient than Enhanced, and Windows applications will usually run 10 to 15 percent (or more, depending on the application -- Asymetrix Toolbook, for example, can achieve a 50 percent increase) faster in Standard mode.

DOS programs, however, must run full-screen in Standard mode and will be suspended when they are in the background (i.e., not the active window). Enhanced mode allows you to run DOS applications in a window, and they will not be suspended while in the background.

Also, in Enhanced mode the Clipboard can send both text and bitmap graphics to a DOS program, whereas in Standard mode it can only paste text. There are indeed valid reasons for choosing one mode over the other.

3. A "DOS session" may be either a non-Windows program like WordPerfect or simply a window that displays a DOS prompt. Dan Marmion is the head of the library systems department at Edmon Low Library, Oklahoma State University, Stillwater, Oklahoma.
COPYRIGHT 1992 Information Today, Inc.
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 1992 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Author:Marmion, Dan
Publication:Computers in Libraries
Date:Apr 1, 1992
Words:3823
Previous Article:Using Lotus to create a database (part one).
Next Article:Systems librarian and automation review.
Topics:

Terms of use | Privacy policy | Copyright © 2020 Farlex, Inc. | Feedback | For webmasters