📄 ch63.htm
字号:
like the longest part. To build Wine from scratch takes approximately eight minutes
on a 90MHz Pentium. You will also need the <TT>-lXext</TT> libraries for the final
link to work, so install it from your CD-ROM first.
<H3 ALIGN="CENTER"><A NAME="Heading12<FONT COLOR="#000077">Using Wine</FONT></H3>
<P>Using Wine can be as simple as typing <TT>wine </TT>filename. Wine can be configured
and used with a number of different options--including a debugger for tracking down
internal errors in Wine itself.
<H4 ALIGN="CENTER"><A NAME="Heading13<FONT COLOR="#000077">Specifying Configuration
Parameters</FONT></H4>
<P>Wine's global configuration file is typically <TT>/usr/local/etc/wine.conf</TT>.
The configuration pa-rameters match mostly with the above questions and are organized
in the format of MS-Windows <TT>.ini</TT> files. A sample file follows, with some
comments on the usage of each section.</P>
<P>The following statements map MS-DOS drive letters to the matching subdirectory
under Linux:</P>
<PRE><FONT COLOR="#0066FF">[drives]
A=/a
C=/c
</FONT></PRE>
<P>These parameters tell Wine where to find Windows- and Wine-specific DLLs and directories:</P>
<PRE><FONT COLOR="#0066FF">[wine]
Windows=c:\windows
System=c:\windows\system
Temp=c:\temp
Path=c:\windows;c:\windows\system
SystemResources=/users/wine/wine950122/sysres.dll
</FONT></PRE>
<P>The following section applies to the mapping of MS-Windows fonts to X font (note
that the <TT>*</TT> is used for wildcard matching of X fonts):</P>
<PRE><FONT COLOR="#0066FF">[fonts]
system=*-helvetica
mssansserif=*-helvetica
msserif=*-times
fixedsys=*-fixed
arial=*-helvetica
helv=*-helvetica
roman=*-times
default=*-*
</FONT></PRE>
<P>The following section maps serial ports available under Wine with corresponding
Linux serial port identifiers:</P>
<PRE><FONT COLOR="#0066FF">[serialports]
Com1=/dev/cua0
Com2=/dev/cua1
</FONT></PRE>
<P>The following section maps printer ports available under Wine with the corresponding
printer port under Linux:</P>
<PRE><FONT COLOR="#0066FF">[parallelports]
Lpt1=/dev/lp0
</FONT></PRE>
<P>These parameters determine the amount of logging and the destination:</P>
<PRE><FONT COLOR="#0066FF">[spy]
File=CON
Exclude=WM_SIZE;WM_TIMER
</FONT></PRE>
<H4 ALIGN="CENTER"><A NAME="Heading14<FONT COLOR="#000077">Using Command-Line
Options</FONT></H4>
<P>The Wine command line has the following format: <TT>wine </TT>wine<TT>_</TT>options
program program_options. For example:</P>
<PRE><FONT COLOR="#0066FF">bash# /usr/wine/wine -debugmsg +all /c/windows/winmine.exe
</FONT></PRE>
<P>Table 63.1 shows command-line options available with Wine. </P>
<CENTER>
<P><FONT SIZE="4"><B>Table 63.1. Wine command-line options. </B></FONT>
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><I>Option</I></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP"><I>Meaning</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-depth n</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Change the depth to use for multiple-depth screens. This configures Wine to use other
than the default number of colors. (8 bitplanes is 256 colors and usually the only
acceptable answer.)</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-desktop geom</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Run an MS-Windows application with a desktop of the size specified. For example,
850x620 would create a window of 850 by 620. Running with a desktop also eliminates
the modal, or stuck-on-top, behavior of Wine applications.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-display name</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Use an X display other than the default. This enables users to run an MS-Windows
application on another X device over an attached network.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-iconic</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Start the application as an icon rather than full-screen. This is the same functionality
as run minimized from the Program Manager under native MS-Windows.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-debug</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Enter the debugger before starting the application.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-name </TT>name</TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Set the application name. This is useful for telling the X Window manager a meaningful
name for the application. The default name is <TT>wine</TT>.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-privatemap</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Use a private color map. This is useful for applications that make extensive use
of color. Running an application this way causes the colors of other X applications
to look weird while the Wine session is the selected window.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-synchronous</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Turn on synchronous display mode. This can severely slow down applications, because
it causes X Window to wait for the completion of each command before sending the
next one. X applications can send commands to an X server that may or may not be
on the same machine. Under some applications, synchronization is necessary so that
graphics operations do not get optimized away by the X server.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-backingstore</TT></TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">This is an optimization that enables an X server to handle <TT>expose</TT> events
without interrupting the client program.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-spy </TT>file</TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Turn on message spying to the specified file. This can also be done by output redirection.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>-debugmsg </TT>name</TD>
<TD WIDTH="359" ALIGN="LEFT" VALIGN="TOP">Turn specific debugging information on or off. To get a current list of debug message
types, type the following command: <TT>wine -debugmsg help help</TT>.</TD>
</TR>
</TABLE>
</CENTER>
<CENTER>
<H4><A NAME="Heading15<FONT COLOR="#000077">The Wine Debugger</FONT></H4>
</CENTER>
<P>Wine has a built-in debugger that is useful for uncovering problems within the
program. When an MS-Windows program exits due to a problem, the debugger starts in
the <TT>xterm</TT> from which Wine was started. If you are not interested in troubleshooting
Wine, you need only type <TT>quit</TT> at the prompt and skip to the next section
of this chapter.</P>
<P>The Wine debugger is similar to the GNU debugger <TT>gdb</TT>. Breakpoints can
be set; examination and modification of registers as well as memory locations are
possible. However, this is a minimal debugger that includes only the commands listed
in Table 63.2. </P>
<CENTER>
<P><FONT SIZE="4"><B>Table 63.2. Wine debugger commands. </B></FONT>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><I>Command</I></TD>
<TD ALIGN="LEFT"><I>Meaning</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>break</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Set a breakpoint at a specified address or symbolic value. Wine will stop before
executing instructions at this address. For example, <TT>break * GDI_Ordinal_24</TT>
sets a breakpoint at the start of the Windows <TT>Ellipse</TT> function, known internally
as GDI.24.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>bt</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Backtrace, or show the history of Wine calls leading to the current place. The addresses
shown are the return addresses, not the calling addresses.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>cont</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Continue program execution until a breakpoint or error condition is reached.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>define</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Equate a symbol to a value. For example: <TT>define </TT>myproc <TT>0x000001c6</TT>.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>disable</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Disable a specific breakpoint. Breakpoints defined by the <TT>break</TT> command
are stored by breakpoint numbers. To disable a breakpoint, you need to find the breakpoint
number with the <TT>info</TT> command. To disable breakpoint number 1, simply type
<TT>disable 1</TT>.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>enable</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Enable a breakpoint number, the opposite of <TT>disable</TT>. To enable the previously
disabled breakpoint number 1, simply type <TT>enable 1</TT>.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>help</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Print a help text of the available commands.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>info</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Provide information on the following:</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><TT>reg</TT> registers information.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><TT>stack</TT> dumps the current stack.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><TT>break</TT> shows the current breakpoints and if they are enabled.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><TT>segments</TT> shows information about memory segments in use.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>mode</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Switch between 16- and 32-bit modes.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>print</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Print values of expressions given.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>quit</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Exit debugger and end any MS-Windows program in progress.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>set</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Enable depositing of values in registers and memory.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>symbolfile</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Load a symbol file containing symbolic values. The file <TT>wine.sym</TT> is created
as part of the Wine build.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>x</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Examine memory values in several different formats. The format of <TT>x</TT> is <TT>x
/ </TT>format address, where format can be one of the following:</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>x</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">longword hexadecimal (32-bit integer)</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>d</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">longword decimal</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>w</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">word hexadecimal</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>b</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">byte</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>c</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">single character</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>s</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">null-terminated ASCII string</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>I</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">i386 instruction A number can be specified before the format to indicate a repeating
group. For example, listing 10 instructions after a given address would be <TT>x
/ 10 I </TT>0x000001cd.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"></TD>
<TD ALIGN="LEFT" VALIGN="TOP"></TD>
</TR>
</TABLE>
</P>
</CENTER>
<P>In order to benefit from using the Wine debugger, an understanding of debugging
i386 assembly is essential. If you are serious about debugging Wine, an assembly
language output from GCC is essential.
<CENTER>
<H3><A NAME="Heading16<FONT COLOR="#000077">How Wine Works</FONT></H3>
</CENTER>
<P>Wine is composed of an MS-Windows program loader and a library of MS-Windows functions.
<CENTER>
<H4><A NAME="Heading17<FONT COLOR="#000077">How Wine Loads Programs</FONT></H4>
</CENTER>
<P>Wine's first duty is to load an MS-Windows executable image into memory. This
also includes any DLL files and other resources that the application needs. MS-Windows
uses a different executable image type than does DOS called NE, or new executable.
DLLs and font files also use this NE format, which makes Wine's job easier.</P>
<P>Individual segments of the NE image must be load into memory, and references to
other DLL and Windows calls need to be resolved. Calls to functions outside an image
are referred to by the module name and function number. A call to <TT>Ellipse</TT>
is actually stored as GDI.24.</P>
<P>After an executable image is loaded into memory, Wine simply jumps to the <TT>WinMain()</TT>
function defined in the image. A call to MS-Windows graphics function <TT>Ellipse</TT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -