Win4Lin User's Guide

Chapter 3 -- Working in the Win4Lin environment

(User's Guide Table of Contents) (Chapter Table of Contents)
Previous Chapter - Installing Windows     Next Chapter - Configuring DOS and Windows sessions

The DOS or Windows environment that is created when you start a Win4Lin session has all the important characteristics of DOS or Windows on a conventional personal computer.

Each session under Win4Lin runs in its own separate, protected virtual machine and cannot interfere with the operation of other Win4Lin sessions or the Linux operating system.

The Win4Lin sessions do share file systems and system resources with each other and with the Linux operating system. You might be the only person using your Linux system, or you might be sharing it with others. For these reasons, you may notice some differences between the DOS or Windows environment under Win4Lin and DOS or Windows on a conventional personal computer.

This chapter describes those differences.


The default Win4Lin environment

Win4Lin automatically makes the following devices available to DOS or Windows sessions:

If you need to change these defaults or add devices, see Chapter 4, "Configuring DOS and Windows sessions".

About drives and file systems

Win4Lin makes the Linux file system available to your DOS or Windows sessions. You use different DOS drive letters to access different sections of the Linux file system. You can customize the drive letter assignments to access different parts of the Linux file system and any DOS file systems that might be on your fixed disks. The drive letters C through J are used for the Linux filesystem access. You can also access CD-ROM drives, typically using drives K and higher. (In a DOS session, each unassigned drive letter below J has a place holder drive with the label None. You cannot put files on these place holder drives.) See ``Configuring drives'' in Chapter 4 for more information about customizing your drive setup.

Typical drive setup

A typical configuration is to have drives A and B for floppy drive use, drive C for access to your own private files, and drive J for DOS and Win4Lin system files. The typical Drive D setting depends on if you are using DOS or Windows. The following sections describe this configuration.

Drives A and B: The floppy drives

If you have floppy drives on your computer, Win4Lin automatically makes them available via drives A and B just as on a normal DOS PC. Only one user at a time can use the floppies. If the floppy drives have not been accessed for a short time, they are made available to the next Win4Lin session that tries to access them.

Drive C: The personal drive

On a conventional personal computer running DOS or Windows, you typically install Windows and your applications as well as store your data files on the C drive. For this purpose, Win4Lin provides a drive C that is your personal drive. Each user has a personal drive on the Linux file system under his or her Linux home directory, normally in the win subdirectory. This means that each user's personal drive is completely separate from other users' personal drives. To use Windows, each user has to first install a copy of Windows on his or her personal drive.

Drive D:

For your DOS sessions, drive D is by default set up to access the entire Linux file system.

For your Windows sessions, there is by default no drive D already set up. We suggest that you set up drive D to be a directory of you own where you keep your Data and Document files.

Note: Because the Linux file system can often be much larger than a typical file system on a DOS or Windows machine, using a drive to access the entire Linux file system can cause complications. One problem is that some applications search the entire file system, which does not take very long on a small PC, but can take a long time on a large or networked Linux file system. For this reason, only the default configuration for DOS is set up with drive D providing access to the whole Linux file system; the default configuration for Windows is to not have such a drive.

Drive J: The shared drive

Drive J is designated as the shared drive. Win4Lin system files and other shared files are located on this drive. (E.g. The Windows files loaded from the Windows installation CD are in the "J:\wincabs" directory.) It also has some directories where you can easily share files with other users. These are subdirectories J:\share and J:\tmp. Typically "J:\tmp" is the same directory as Linux "/var/tmp". Note that files might be automatically and periodically deleted from /var/tmp, so only temporary files should be placed in "J:\tmp".

Drive N: The CD-ROM drive

For Windows sessions (but not DOS sessions), by default the first CD-ROM drive is automatically (in most situations) set up to be accessible as drive N. If you have more than one CD-ROM drive then you can set up other drive letters to access them. (Note: A DOS session can only access one CD-ROM drive.)

Ejecting the CD from the drive

Win4Lin sessions access the CD-ROM drive via the Linux CD-ROM driver. Some Linux CD-ROM drivers work more smoothly than others with Win4Lin. In particular, the way to remove a CD from the drive varies from the effortless convenience typical of DOS and Windows systems (where just pressing the eject button at any time ejects the CD) to the traditional Unix way of making you type in commands to allow the CD to be removed.

So if you are having trouble ejecting your CD while it is in use by a Win4Lin session, here are is what is going on: The problem is that the Linux CD-ROM driver is disabling the eject button when you first access the CD-ROM drive. By default Win4Lin automatically closes the the CD-ROM device when 18 seconds elapse without any disk access, which re-enables the eject button.

So if you wait long enough you will be able to eject the CD. (You can change the timeout if you want by setting the environment variable "MERGE_CD_RELEASE_SECONDS" to the desired number of seconds. The default setting is in the file "/etc/default/merge". You can update the setting there to change it for all users.

You can also eject the CD before the timeout expires by first 'releasing' the drive and then pushing the eject button on the CD drive.

Changing your Drive setup

See ``Configuring drives'' in Chapter 4 for more information about customizing your drive setup.

The startup directory

When you boot DOS on a conventional stand-alone personal computer, your working directory is at the top or root of the file system tree, and you own all files in the file system.

With Win4Lin, your DOS sessions start on drive D: with the initial directory configured to be the same as your current Linux directory at the time you start the session.

Your Windows sessions start with the initial directory configured to be at the root of your personal drive (normally drive C).

You can change these defaults by running the Win4Lin Setup utility in the Desktop environment and using the Start on personal drive option in the Drives and Filesystem view of the Personal Win4Lin Session Configuration window.

Alternatively, you can change your initial location by using the "r" option from the Linux command line. For example, "dos +r"   starts your DOS session with the initial directory at the root of the personal drive, while win -r starts your Windows session with the initial directory configured to be the same as your current Linux directory (given that you have a Linux drive available in your Windows configuration that provides access to this directory, which it probably does NOT with the default configuration).

File name issues

You can access any file or directory in the Linux file system from a Win4Lin session, whether it is created with DOS, with Windows, or with the Linux system (provided that you have permission). Windows 95 and 98 applications support long file names, so long Linux file names can be used as is, but older Windows and DOS applications are limited to short file names.

To deal with this problem on a regular Windows 95 or 98 system, Windows provides a mapping of long file names to short names for those older applications. (This file name mapping is also known as "file name mangling.") Win4Lin provides a similar file name mapping for those older applications. By default the mapping done on each user's private drive C is a standard Windows 9x mapping. The mapping of file names on other parts of the Linux filesystem is slightly different, but the difference should not concern most people.

Refer to Appendix C, "Filename mapping" for more detailed information about this subject.

Printing in the Win4Lin environment

During installation, Win4Lin creates a printer definition with the name default, which provides for printing to the default Linux printer. (For this to work, there must be a default printer set up on your Linux system.)

You can also create other printer definitions for other printers or to use special Linux printer options. See ``Printer administration'' in Chapter 5 for more information.

You use these named printer definitions to configure your Windows or DOS session to have a connection to the Linux printing system.

Printing from a Windows session

To print from a Windows session, you first need to set up Windows for your printer as you would on a standard Windows PC. All the Win4Lin printer definitions automatically show up as selections in the "Add Printer" utility. In detail here are the steps to take:

  1. Invoke the Add Printer utility by opening the Windows 95/98 Control Panel window, double clicking on the Printers icon, and then double clicking on the Add Printer icon.

  2. Select the correct manufacturer and printer. Note that your printer must be supported by Windows 95/98; i.e., a printer driver must be available either on the Windows 95/98 CD or on a disk provided by the printer manufacturer.

    (In many cases, if the exact model of your printer is not already listed in the selection models that Windows presents to you, you can select a similar model from the list, and it will work fine. You might even want to try this first before trying to track down the drivers disk that came with your printer.)

  3. If the printer driver came on the Windows CD, then Windows will pick it up from where the Windows file were loaded (J:\wincabs). Or click Have Disk if the printer driver is in some other location.

  4. From the list of available ports, select the Win4Lin printer definition. (E.g. pick default to use the default Linux printer.)

  5. Confirm or change the entry in the Printer name field.

  6. As you click Finish to complete the installation, with some versions of Windows, your Windows session will be unresponsive while the printer is configured, which can take a minute or two. Also with some versions of Windows, the printing of the first test page will fail. If this happens just wait a minute or two and retry. Due to these problems we recommend that you do not print the test page, and wait a minute or two before printing.

If you are having problems with printing, you can check the Trouble Shooting Guide's Problems with Printers help page.

Because setting up printing for some models of printers can be tricky, and because there are so many different models of printers, you might want to share your successes (and failures) via TreLOS Web Site. This way the Win4Lin user community can help each other out.

Printing from a DOS session

Setting up for printing from a DOS session is not as easy as setting up for printing from Windows. To print from DOS to the Linux printing system, you have print via a "redirected LPT port". You set this up in your Win4Lin Setup Personal Win4Lin Session "dos" configuration. In the "Devices" view there is a "DOS Printer" control that lets you select a Win4Lin printer definition to have the output of each DOS LPT port redirected to.

Win4Lin stores printer output to any of the DOS LPT ports in a temporary file. It prints this output when more than 15 seconds have elapsed since the application sent a character to be printed. The timeout is needed because when DOS applications print to the LPT port there is no standard indication as to when the application has finished printing. If an application has normal delays of more than 15 seconds, then your printout can get split up or otherwise not print correctly. You can use the "DOS Printer" control to change that timeout to make it longer or shorter as needed.

Direct printing

You can also bypass the Linux printing system if there is a special need to do so. This involves printing "directly" to the printer via the parallel port. To do this requires that you "directly" attach the parallel port.

The Win4Lin Setup "Personal Win4Lin Session configuration" contains the setting for attaching parallel ports. It is in the "Devices" view "Other Devices" control. All the possible direct attach parallel ports are listed. Note that you might not be able to use some or any of the listed devices. To check, click on the "Detail" button. This brings up the "Custom Devices Detail Viewer". All the possible devices are listed in the top window. When you click on a device name in the top frame, the definition information is printed in the lower frame. In this case, you want to check for the "Access" setting. If is is "Root Only", then you do not have permission to attach to that device. (By default when Win4Lin is installed, all the definitions have the access set to "Root Only".)

To change the access permission, you have to log in as root, and use the Win4Lin Setup System-Wide Win4Lin Administration "View/Create/Modify Device Definitions" utility. Refer to chapter 5 for information about using this utility.

Once the parallel port has been made available to a running Windows session, there are some things that can still prevent you from using the port:

These problems among others are covered in Chapter 5 section Limitations of direct attachment.

If you are still having problems with printing, you can check the Trouble Shooting Guide's Problems with Printers help page.

Because setting up printing for some models of printers can be tricky, and because there are so many different models of printers, you might want to share your successes (and failures) via TreLOS Web Support. This way the Win4Lin user community can help each other out.

Using networking under Windows

Win4Lin supports Windows applications that access the network using the Windows Sockets Interface (WinSock Version 1.1). Most modern networking applications, such as e-mail and news readers, Internet browsers and file transfer applications use this interface.

Win4Lin provides its own WinSock libraries (WINSOCK.DLL and WSOCK32.DLL) which implement Windows networking functions by routing them through the underlying Linux networking. Therefore, Win4Lin does not require Windows networking components (such as TCP/IP) to be installed in order to support the applications.

To run WinSock applications under Windows, simply install them and start using them. If during installation you are given an option to install the WinSock libraries or TCP/IP, make sure you DO NOT install them, as they will overwrite equivalent Win4Lin libraries. (If you inadvertently install Microsoft networking, you might be able to remove it and restore the system by running /usr/bin/fixWin95symlinks, but this is not guaranteed.)


NOTE: When Windows is installed under Win4Lin, Microsoft TCP/IP utilities telnet and ftp are automatically installed.

The Windows Control Panel will show that no networking components are installed. This is as it should be because the low-level support is implemented by Linux. (Of course, your Linux system has to be configured to use the network.)

Because Win4Lin must share the space of well-known networking ports with Linux, and Linux servers are always "listening" on these ports, Win4Lin supports only WinSock client applications; it does not support WinSock server applications. For example, the Netscape browser is supported under Win4Lin, while the Netscape server is not.


NOTE: Networking applications that rely on Microsoft networking components other than the WinSock libraries (e.g. Network Neighborhood ) are not currently supported under Win4Lin. You can access remote Windows files by mounting the remote file system under Linux (using NFS or Samba ), and then defining a Windows drive for access to the mount directory through the Personal Win4Lin Session Configuration option of the Win4Lin Setup utility.

Installing applications

In general, you can install most applications under Win4Lin simply by following the application manufacturer's instructions for installing on a fixed disk. The main exception is with Windows VxD drivers. Installing an application or device driver that includes a VxD might cause the Windows session to hang or abort every time it is started.

If you have installed a VxD driver that is not supported, you can try to recover by using the following procedure. (This example assumes that your C drive directory is located at $HOME/win".)

  1. From a Linux prompt:
    cd $HOME/win/windows/system
    ls -lctr | grep -i 'vxd'
    cd vmm32
    ls -lctr | grep -i 'vxd'
    
    Take note of the most recently added VxD files.

  2. If you can identify the unsupported VxD, (for example fancydev.vxd) move it aside with:
    mv fancydev.vxd fancydev.vxd.bad
    
  3. Start Windows.

    You will probably get a message about a needed VxD that is missing, but you should be able to press <Enter> and continue.

  4. Once Windows is up, remove the software package with Add/Remove_Programs. (You can access it from the Control Panel window by clicking on the Start button and selecting Settings from the menu.)

    You might have to move the VxD file back to its original name before doing this in order for the package removal to work correctly.



Advanced information


Cutting and pasting

With Win4Lin, you can copy text and certain bitmap graphics between Windows applications and X applications that support ICCCM cutting and pasting using selections. Note that not all X applications use this method of cutting and pasting. (ICCCM is an X Window System standard for inter-client communication.)

Cutting and pasting between Windows and X applications only works when the X Cut & Paste feature is enabled. Note: If the X Cut & Paste option control is "greyed out", then this feature is not available for this version of Win4Lin.

By default, your Windows session starts with the X Cut & Paste option turned off, since it does consume system resources. You can turn this option on and off using the X Cut & Paste option from the Options menu. To change your Win4Lin configuration so that cutting and pasting between X and Windows applications is available when you start Windows, see `` X Cut & Paste''  in Chapter 4.

When you want to copy from a Windows application to an X application, make sure the X Cut & Paste option is turned on and use the Cut or Copy mechanism provided by your Windows application. Win4Lin makes this information available to your X application for pasting.

When you want to copy information from an X application to a Windows application, use the mechanism the X application provides for cutting or copying. Win4Lin supports either X cut buffers or the X clipboard selection. Win4Lin passes your information to the Windows Clipboard, where it is available for pasting into your Windows application using the standard Paste mechanism.

Win4Lin also supports the sharing of X text, bitmap, or pixmap formats and Windows text, bitmap, DIB, and OEMTEXT formats.

Depending on system performance, system load, and the amount of data you copy, you may need to wait a few seconds before your information appears in the target clipboard. A status bar at the bottom of your window tells you when the information is complete.

When the X Cut & Paste option is turned on, more CPU and memory resources are used than normal. So, you typically should only have this option turned on when you are actively cutting and pasting between Windows and an X application. Also, you may have memory resource limitations with your X server when copying large items, so copying in smaller chunks may work better in some situations.


Accessing other users' files

Win4Lin, unlike a conventional DOS or Windows system, is designed to accommodate multiple users. You can access your own files and subdirectories as you can on a conventional DOS or Windows computer, but you cannot access those belonging to other users without their permission.

Whether or not you can inspect or modify other users' files depends on how Linux permission modes are set on your system. All files and directories you create or access via Linux file system drives are protected by these permission assignments. See the umask and chmod commands for more information.

Normally, you should not allow other users to access the files or directories on your personal drive. Some of the optimizations that Win4Lin uses to run Windows efficiently depend on only you having access to your personal drive.

If you have data files you want to share with everyone on your Linux system, you should put them in the share directory on the shared drive J. You can create subdirectories there if you want to organize the shared files. You can also set the Linux access permissions so that only certain groups of users can access these directories.

To share access to files that are not or cannot be put under the share directory, you can update your drive configuration to have a drive letter for accessing any directory of your choice on the Linux file system (if the directory permissions allow it). Each Win4Lin user can do the same so that all can use the same drive letter to access the same location.

NOTE: You should not create drive letter aliases that allow users to get to your personal (C:) directory. Shared files should be in a directory outside the scope of your or anyone else's personal drive.

File and record locking

Many current applications, especially network versions, use DOS file- and record-locking facilities. Win4Lin supports the standard DOS file- and record- locking conventions.

An application that uses DOS file-locking opens files in such a way that other applications cannot access the file until it is closed. This prevents the file from being modified by more than one user at a time. Similarly, an application using record-locking opens files in such a way that no one else can access a particular record in that file while you are working on it.

Attempts to simultaneously access a file that is locked by another application may result in the following type of message:

   Sharing violation reading drive C:

Some applications' executable files can be shared only if they are read-only. Use the DOS attrib or Linux chmod command to set the file permissions for these executables to read-only when you want multiple users or processes to be able to read the file at the same time or to execute the application at the same time.

Applications and file permissions

Some current and many older applications are designed for a single-user environment and do not use DOS file- or record-locking conventions. When used with Win4Lin in a multi-user environment, these applications do not protect your files from being simultaneously updated by you and another user with write permission. In such cases, each user is responsible for avoiding simultaneous updates that could result in file corruption or data loss.

File permission errors

Sometimes the message DOS returns is affected by Linux file- permission modes. For example, when a DOS command you issue encounters a file for which you do not have read access, DOS may display a message that implies the file does not exist, even though the file does exist. Similarly, if you try to create a file in a directory for which you do not have write access, DOS may display an error message such as File creation error that does not clearly indicate the nature of the problem.

Network applications

Applications that can be installed once in one location and then used by more than one user are often called Network Applications. (Some applications might be advertised as Network Applications but actually can work only with shared data files on a network, and each user must install his or her own copy.) The shared network versions of applications can usually be installed and run in the Win4Lin environment, given the same restrictions for installing and running non-network applications. But, you need to be aware of a few complications, which are described in the following three sections.

Where to install network applications

To share the application only with users on the local Linux system, you can install the application in a subdirectory of J:\share because this location is available to all Win4Lin users on the local Linux system.

You can also install it in any other directory on the local Linux file system to which you have access, or even on a remote file server to which the Linux system has access. When you do this, you should change your personal Win4Lin session configuration to have a drive letter assigned to access the directory where you want to install the application. Then, each user that wants to use the application can change his or her configuration in the same way in order to use the application.

File permission issues

Many network applications, once installed, do not create or update files in the location where they are installed. When you have such an application, for security purposes, you should make the directory where the application is installed and all its subdirectories and files read-only.

Generally, the application's executable files (e.g., those file with the extension .exe or .dll) should not be writeable. Typically, the application's installation program automatically does this, but some installation programs do not. So, if more than one user cannot use the application at one time, or if users get sharing errors, you should make sure that the application's executable files are read-only.

Limiting access to public applications

You can limit who is allowed to use shared applications by using the group permission concept that the Linux file system uses. Refer to the documentation on the Linux chmod command for more information.

About autoexec.bat and config.sys files

DOS interprets the commands in two special files automatically every time you start a DOS or Windows session. These files are autoexec.bat and config.sys.

Because different users may want to include different commands in their autoexec.bat or config.sys files, Win4Lin provides for the following:

When you start DOS, Win4Lin first executes the system wide autoexec.bat file. If you create a personal autoexec.bat Win4Lin executes it next. You can use this personal autoexec.bat file to customize your DOS or Windows environment exactly as you would on a conventional DOS or Windows computer. Finally, Win4Lin executes any specialized autoexec.bat files that you have specified. You can use these specialized files to customize specific application environments.

The config.sys files contain information about your computer's configuration that the system needs to know every time you run DOS. In addition to the system-wide config.sys file, you might want a personal config.sys file that identifies device drivers required by applications that only you use. And, if there are device drivers that you want to load only when you run certain applications, you might want to include them in a specialized config.sys file that you use only in that application environment.


NOTE: Since Win4Lin allows you to use these specialized config.sys files, it does not support the multiple- boot configuration feature of config.sys. In addition, Win4Lin does not support the interactive config.sys execution featured in newer versions of DOS.

In general, Win4Lin interprets the commands in a config.sys file just as a conventional DOS system does. Refer to the following section for a list of commands that cannot be used in a config.sys file.

Restricted DOS commands

Nearly all standard DOS commands operate in the Win4Lin environment just as they do on a conventional stand-alone DOS computer. Some DOS commands, however, are either not usable in the Win4Lin environment or operate differently than they do on a stand-alone DOS computer.

Win4Lin emulates DOS file systems while preserving the underlying Linux file system structure, which is completely different. Some DOS commands do not work on emulated file systems.

If you issue a DOS command that does not work in the Win4Lin environment, DOS displays an error message. This does not harm your computer in any way or destroy any data.

You cannot use the following DOS command with Win4Lin:

Do not use the following commands on Linux file system drives. You may use them on true DOS file systems such as your diskette drives or DOS file system drives:

The following commands affect only the current DOS or Windows session:

The following commands are ignored when they appear in config.sys files:

Win4Lin uses built-in values for some of these commands. If you need to change those values, see ``Making config.sys changes'' in Chapter 5.


NOTE: Win4Lin does not support the third parameter of the country command, because the automatic National Language Support (NLS) features of Win4Lin use an alternate method for accessing the country.sys file. In general, you should not use the country command at all, but should use the automatic NLS features of Win4Lin, as described in Appendix A, ``National Language Support''.

The DOS search path

The DOS search path in Win4Lin works like the search path on a conventional DOS or Windows system. Win4Lin automatically puts the location of DOS and Win4Lin commands and applications at the front of the path, normally J:\DOS and J:\MERGE. Any PATH setting in your autoexec.bat file is appended to these directories.

DOS environment variables

By default, Win4Lin sets six DOS environment variables when you start a Win4Lin session:

COMSPEC
Set to the command.com file that is used with Win4Lin.

CD_DRIVE
Set to the letter of the CD drive that is available to DOS.

DOS_SHARE_DRIVE
Set to the letter of the drive that contains the files that are shared among all DOS and Windows users, normally drive J.

PATH
Set to where the DOS and Win4Lin commands and applications reside on the shared drive, normally J:\DOS and J:\MERGE. Any PATH setting in your autoexec.bat file is appended to these directories.

LANG
Set to be the same as the current Linux operating system locale LANG setting minus the code set part (i.e., only the part to the left of the period). The Linux locale command prints out the current Linux locale information, including the LANG setting.

PROMPT
Set to display the current directory following the drive letter.
You can view the current values of these environment variables by typing set at the DOS prompt.
> > Next Chapter - Configuring DOS and Windows sessions > >