免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1525 | 回复: 0
打印 上一主题 下一主题

Wine User Guide中文翻译(部分) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-14 14:46 |只看该作者 |倒序浏览
原文:http://www.winehq.org/site/docs/wineusr-guide/config-wine-main
翻译:若诲和尚
注  :Wine中文手册中关于安装的部分没太大变化,配置部分变化比较大,只翻了这部分

Chapter 3. Wine配置
章节:
3.1.使用Winecfg工具
3.2.使用“注册表”和“注册表编辑器”
3.3.其它配置
大部分普通的配置可以用Winecfg来修改。这里将一步步介绍Winecfg的基本用法及其它可选项。下一单元,我们将学习如何用regedit进行高级的wine配置,regedit会尽可以全面地对所涉及的Wine配置提供修改方法。最后,还有一些是用Winecfg和regedit没办法搞定的配置,另外再讲其配置。
3.1.使用Winecfg工具
过去,Wine使用一个特殊的配置文件~/.wine/config来保存配置。如果你仍然在使用这些版本的Wine(2005年06月以前的版本),最好先升级Wine。在新版本的Wine中,所有的配置都保存在“注册表”中并且当Wine启动时自动读取。
Winecfg是作为一个Wine的附加工具被安装的。如果不知道如何运行它,在终端中输入:
$ /usr/local/bin/winecfg
或者: $ winecfg
程序启动后程序窗口上会看到下面几个标签:
·Applications(应用程序)
·Libraries(库)
·Graphics(图形)
·Appearance(外观)
·Drives(磁盘驱动器)
·Audio(音频)
·About(关于)
对Applications和Libraries标签的修改能最有效地影响应用程序的运行。其它的配置则是更多地集中在对Wine本身运行方式的配置上。
注:应用程序,库和图形这三个标签是相互关联的!如果在Applications下确认了默认设置,所有在Libraries和Graphics标签下设置的修改将会应用于所有的应用程序。如果仅仅是对某个特殊的选定的应用程序进行了配置的修改,则Libraries或(和)Graphics交仅仅对选中的应用程序有效。即Applications设置存在习惯设置和特定设置两种模式。
3.1.1.应用程序设置
Wine可以模拟不同版本的Windows。通常来说最大的区别就在于是Win9x还是NT版。有一些应用程序运行时需要一些特殊的功能(模块)并且如果对这些部分进行修改将会引起程序运行时出现很多bug。(若诲和尚:就是说有些程序必须运行在特定的Windows下,则必须模拟特定的Windows)。Wine最近的版本中都将默认的Windows都设置成Windows 2000。但是仍有部分程序在Windows 98下运行更佳。
在Applications标签下可以看到“Default Settings entry”条目。如果选中此条目,将会对所有应用程序模拟默认的Windows版本。但是对于一个比较麻烦的应用程最好将其与默认设置分开配置。如下做法:
1.点“Add application”按钮;
2.查找应用程序(.exe后缀);
3.当应用程序添加好后,为它选择Windows版本来模拟它。
3.1.2.库设置
同理,一些应用程序需要特定的库来执行。Wine提供Window系统库文件(所谓的原始DLL),可以在不需要Microsoft许可的情况下完全以用户订制的形式来严格地执行应用程序(模拟)。Wine存在许多已知的内在缺陷,但是在许多情况下,这些功能已经够用了。仅仅用内置的DLL可以保证你所用到的Windows是免费的(废话!),当然Wine也可以使用原始的Windows DLL。
3.1.2.1.DLL 重载(Override不知道怎么翻译好)
一般来说仅用内置DLL很难运行好一个应用程序。此时原始的DLL运行得更好。当从Windows系统中挪DLL过来时,必须将它放在一个确定位置,然后配置Wine使其能找到相应的DLL。通常情况下,DLL文件放在已经配好的c:\windows\system(具体配置参考Drives部分)的目录下。有四个DLL绝对不能使用:kernel32.dll,gdi32.dll,user32.dll和ntdll.dll。这些库文件运行需要更底层的Windows内核,显然Wine是不可能实现的。
因此,一旦拷贝了Windows的库文件只需要告知Wine尝试使用即可。你可以配置Wine在不同的标准下对原始库文件和内置库文件进行选择。如果在Applications标签中已选中“Default Settings”,则该配置将对所有应用程序有效。否则可以对单独的某个应用程设置库环境。
例如,要添加一个FOO.DLL,在“New override for library”标签下面输入“FOO”,然后点“Add”按钮。如果要更改DLL,选中“Existing overrides”里对应的库文件然后点“Edit”,默认情况下DLL的载入顺序为优先载入Windows原始库文件(先Native然后Builtin)。可以选择仅native或者仅builtin甚至一个也不选。
3.1.2.2.系统库文件要注意的事项
有一些程序运行时会查询有一些功能(如Winsock和Windows的TCP/IP网络应用)是否可用,这种情况下Wine的做法是创建一个伪DLL文件来模拟,使得程序可以运行。(若诲:底层的应用必须用伪库文件来实现,程序在运行之时会查询)。如果遇到这种情况,可以在c:\windows\system目录下创建一个空文件使程序在查询时认为存在该库文件,同时当程序运行调用该模块时Wine将会用内置的库文件来实现。(可惜的是,tools/wineinstall本身不能创建这样的空文件。)
当然,Wine对DLL的实现并不是很完美,如果手上没有Windows来提供DLL,可以通过网络搜索引擎搜索Windows DLL的下载页来下载所需的库文件。请尊守下载的库文件的许可,有些是可发布的,有些则不是。
3.1.2.3.缺失的库文件
万一Wine提示缺失DLL文件,先确定该库文是一个公开的库文件还是一个应用程序的特定库文件(通过在网上搜索)。找到库文件后,确保Wine可以使用它。DLL文件通常按以下步骤载入:
1、程序运行的目录;
2、当前目录;
3、Windows system目录;
4、Windows目录;
5、PATH变量所指示的目录;
总之:所需的库文件放置在程序目录(会比较ugly,嘿嘿),或者放到Windows系统目录。同时,如果可以的话,最好不要用基于NT内核的Windows原始DLL,因为Wine对NT API的模拟要比对Win9x API的支持差。(possibly leading to even worse compatibility with NT DLLs than with a no-windows setup!)。
3.1.3.图形设置
只有五种不同的图形模式,对于大多数人来说默认的就已经最好了。
这部分照着各个选项后面的说明文字就可以看得懂,略过。
3.1.4.驱动器设置
Wine要模拟出Windows严格的驱动器的结构。大家应该都知道在Windows中A:表示软驱,C:表示系统磁盘等等。在Wine里用同样的概念来映射Windows磁盘到UNIX/LINUX系统中。
Wine驱动器(磁盘)配置相当简单。点Drives标签,将会看到“Add”和“Remove”按钮,如果需要添加新的盘符,按“Add”钮即可,要修改磁盘映射路径,只要选中相应的盘符,然后在下面的输入框中修改即可。如果不确定输入,可以点“Browse”来选。同样删除操作相同。
Winecfg提供了一个自动检查驱动的功能。在尝试手动配置磁盘前推荐使用该工具。只要简单一下“Autodetect”按钮,Wine就会自动检查系统中的磁盘。
你可能非常想知道如果不用Winecfg该怎么样配置磁盘,非常幸运,不用Winecfg配置也非常简单。所有的磁盘配置都保存在一个特殊的目录中:~/.wine/dosdevices。每一个“磁盘”实际上都是保存一个链接。Wine第一次运行时会自动创建两个目录:
$ ls -la ~/.wine/dosdevices/
lrwxrwxrwx l wineuser wineuser 10 Jul 23 15:12 c: -> ../drive_c
lrwxrwxrwx  1 wineuser wineuser    1 Jul 23 15:12 z: -> /
如果想创建一个新的磁盘,例如CD-ROM,只需创建一个指向它的新链接:
$ ln -s /mnt/cdrom ~/.wine/dosdevices/d:
注意DOS类系统命名习惯,格式是一个字母后跟一个冒号,如“a:”。因此,定义c:磁盘指向~/.wine/drive_c,就可以认为c:\windows\system所指的是~/.wine/drive_c/windows/system。
3.1.5.音频设置
Wine可以在一些不同的音频子系统下工作,这些音频子系统都列在“Audio”标签下。按“Autodetect”按钮可以帮你自动检测出来,不然你需要手动选择。老板本即2.4内核或更早的操作系统一般都使用“OSS”驱动。新版本2.6内核的操作系统换成了“ALSA”。如果使用了KDE桌面,可以不用管内核,还可以用“aRts”,如果用的是GNOME桌面也可以用“EsounD”。“OSS”和“ALSA”驱动经过最多测试,强烈推荐使用这两种驱动,如果可以的话。如果需要使用“Jack”或“NAS”驱动,你最好先了解它们。
DirectSound配置主要用于游戏。你可以选择你所期望的硬件加速度,但是一般来说用“Full”最好。
3.1.6.外观
Wine可以载入Windows主题,如果可用的话。虽然这对Wine和应用程序来说都不是必要的,但是它仍允许你定制你的程序的外观。Wine支持新的MSStyle类的主题。与旧的Microsoft插件不同,style主题是用uxtheme引擎来支持特别的.msstyle文件并可以重定义主题。你也可以用Linux桌面,它们或多或少相似,如果不你喜欢可以试着按如下做法:
1、下载Windows XP主题,一事实上要包含.msstyles文件;
2、在虚拟的Windows磁盘下建立一系列的新目录:
   $ mkdir -p ~/.wine/drive_c/windows/Resources/themes/name-of-your-theme
3、将.msstyles文件拷贝列相应主题的目录下;
4、在外观标签里选择新的标签即可。
3.2.使用“注册表”和“注册表编辑器”
除磁盘配置外,所有Winecfg中的配置都将保存在“注册表”文件中。在Windows中,注册表是一个用来存储操作系统和应用程序的重要数据的数据库。同样,Wine也实现了一个注册表,并且在Winecfg中不能实现的配置在这里可以修改。(事实上你有更多的机会去研究怎么配置运行应用程序而不是Wine本身。)
事实上,现在Wine本身用注册表来存储配置存在很大的争议。很多人指责这样太像Windows。与之相反,有几点必须考虑,首先,不可避免要实现一个注册表因为应用程序期望将设置存储在其中;其次如果要Wine使用一个单独结构的文件来实现配置的存取可能需要另外一部分的代码来实现一些类似Win32 API的基本功能,而这些是Wine已经实现的;最后,与Windows不同,Wine的注册表是用简单的文本写的,它可以用任何你喜欢的编辑器去修改。因此,即使很多正常的系统管理员(还有Wine开发人员)咒骂Windows的注册表变态无聊,但不得已,Wine仍需要实现它。
3.2.1.注册表结构
OK,回归正题,我们先研究一下注册表是怎么玩的。Windows注册表是一个精确的树状结构,并且并不是所有的Windows程序员都很清楚地知道注册表的结构,包含了无数乱七八糟的节点和链接;具体的情况超出本文要讲的范围。但是以下几个键是你必须了解的:
HKEY_LOCAL_MACHINE
这个基本根键(在win9x中它保存在隐藏文件system.dat中)包含当前Windows安装的所有附加属性。
HKEY_USERS
这个基本根键(在win9x中它保存在隐藏文件user.dat中)包含当前所有用户的配置数据。
HKEY_CLASSES_ROOT
这个键是一个指向HKEY_LOCAL_MACHINE\Software\Classes的链接。它包含的数据用来描述诸如联合体、OLE文档句柄及COM类等等。
HKEY_CURRENT_USER
该键是一个指向HKEY_USERS\your_username的链接,例如你的专有配置。
3.2.2.注册表文件
你现在一定很奇怪Windows注册表是怎么样转化为Wine格式的。事实上在Wine中是将上面提到的键保存在三个不同的文件中,这些文件都保存在各个用户的~/.wine目录下:
system.reg
此文件包含HKEY_LOCAL_MACHINE键
user.reg
此文件包含HKEY_CURRENT_USER键
userdef.reg
此文件包含HKEY_USERS\.Default键(例如默认用户的配置)
以上几个文件是在Wine第一次运行时由wineprefixcreate自动生成的。一些全局配置保存在c:\windows\inf\wine.inf中并由rundll32.exe程序处理。第一次运行Wine的时候它会处理wine.inf文件并生成初始注册表。想了解更多细节,可以查看wineprefixcreate脚本看它是如何操作的。如果将Wine升级,同样可以用wineprefixcreate来升级默认注册表。
如前所述,你可以用任何你喜欢的编辑器去编辑.reg文件。但是确保此时Wine没有在运行,否则所有的修改将会丢失。
3.2.3.使用“注册表编辑器”
一个处理注册表文件比较简单的方法是使用工具regedit。和Windows下的注册表相似,regedit程序提供一个系统级的可视的环境对注册表文件中的所有键进行编辑。运行regedit指令即可。你可以立即看到包括所有在文本中隐藏的键都有组织的列在编辑器中。
使用时,点击左框中的键打开深层目录。如果要删除某键,选中它并从编辑器菜单中点“Delete”来删除它。如果要添加一个键或值,找到欲添加的位置,然后点“New”。同样,如果想修改一个已存在的键值可以选中它然后到右边的窗口中修改。(其实使用的方法和Windows下的注册表编辑器是一样的)。后一句略。
关于Wine用户的细节配置保存在HKEY_CURRENT_USER\Software\Wine键下。大部分在winecfg中进行的配置都是改动这部分注册表文件。
3.2.4.系统管理技巧
有了对注册表文件结构的认识后,系统管理员可以将安装(或应用)Wine的系统进行配置使它能被所有用户使用,并分别使各个用户都有自己独立的配置。在安装完Wine和Windows应用程序之后,系统管理员找到对应的用户,将生成的system.reg拷贝生成全局注册表文件(假定存放在/usr/local/etc目录下),操作如下:
cd ~root/.wine
cp system.reg /usr/local/etc/wine.systemreg
并且还可以使其指向系统管理员账户,使其安装系统级的应用程序更加方便:
ln -sf /usr/local/etc/wine.systemreg system.reg
接下来你也许会尝试对user.reg文件作同样的操作,但是此文件包含不同用户的特殊信息。每个用户应该有一份不同的user.reg文件拷贝并有各自的修改权限。
你也许会担心磁盘映射的问题。如果已共享了system.reg文件,你可能期望对每个单独的用户使注册表文件中的磁盘映射配置与保存在~/.wine/dosdevices下的磁盘驱动器映射完全一致。对于这一点通常的规则是,wineprefixcreate程序提供的配置优先,这样更加便于管理。你也许需要向已安装的应用程序共享实际的“c:”盘驱动器,有些应用程序可能需要向这些磁盘写入一些特殊的配置,犹其是在Windows 95/98/ME系统下。
注意在安装Wine的时候如果是以root的身份用tools/wineinstall工具来安装,它也会做同样的工作,但是仅仅是这样而已。
最后再提醒一句:注意管理员账户,如果将管理员注册表拷贝或链接成为全局注册表,则所有用户都有权读取管理员的一些参数,甚至是一些敏感信息(口令,专有信息等等)。因此建议仅用管理员账户来安装软件,而不要用它来处理日常工作,一般情况下使用一个普通帐号来完成这些任务。
3.2.5.完整的注册表键列表
可以在developer's wiki上找到它。
Useful Registry Keys
Here you'll find useful registry keys that cannot be changed in winecfg. You can edit the registry using regedit. When updating your wine version, don't forget to run wineprefixcreate to update your registry.

I'll try to keep this list accurate but you might want to check it against current Wine source code (for Wine related keys that is): $ find . -exec grep "@@" {} \; | grep registry
HKEY_CURRENT_USER (a.k.a HKCU)
|
+-Software
   |
   +-Wine
      |
      +-Alsa Driver
      |  |
      |  +->AutoScanCards
      |  |   [Whether or not to scan all known sound cards and add them to Wine's list
      |  |    Set to "N", and then Devicexxx info is a way to exactly specify the devices
      |  |    used by Wine. (default yes)]
      |  |
      |  +->AutoScanDevices
      |  |   [Whether or not to scan all known PCM devices on each card (default no)]
      |  |
      |  +->DeviceCount
      |  |   [If present, specifies the number of hard coded Alsa devices to add to Wine's list
      |  |    default 0]
      |  |
      |  +->DeviceCTLn      (where n goes from 1 to DeviceCount)
      |  |   [Specifies the Alsa control devices to open for Device n
      |  |
      |  +->DevicePCMn      (where n goes from 1 to DeviceCount)
      |  |   [Specifies the Alsa PCM devices to open for Device n
      |  |
      |  +->UseDirectHW
      |      [When set to y, direct hardware access is used
      |       (can prevent buffer underruns in some cases)]
      |
      +-AppDefaults
      |  |
      |  --*
      |      [Application specific defaults. Replace app.exe with the name of the
      |       application you want to override defaults for. And use the same subtrees
      |       as the Wine subtree (i.e. DllOverrides, X11 Driver, etc.).]
      |
      +-Crypto
      |  |
      |  +-RSA
      |
      +-Debug
      |  |
      |  +->RelayExclude
      |      [Use this key to exclude some calls from the (overwhelming) +relay debug logging.]
      |
      +-Direct3D
      |  |
      |  +->Nonpower2Mode
      |      [When set to repack, this enables the repacking of nonpower2 textures for 'buggy'
      |       games (like warhammer 40k) that cannot cope with the default nonpower2 texture
      |       support.]
      |
      +-DirectInput
      |  |
      |  +->*  
      |      [Linux only. This maps axes of joystick "joystick name".  In "axes mapping" is comma
      |       separated list of "axes types", one type for each joystick axis (hat-pov is 2 axes
      |       also). "axes types": X, Y, Z, Rx, Ry, Rz, Slider1, Slider2, POV1, POV2, POV3,POV4 -
      |       POVx will use two joystick axes - example 4axes+POV: "X,Y,Rz,Slider1,POV1".]
      |
      +-DirectSound
      |  |
      |  +->EmulDriver
      |  |
      |  +->HardwareAcceleration
      |
      +-DllOverrides
      |
      +-Drives
      |
      +-Drivers
      |
      +-Fonts
      |  |
      |  +-Replacements
      |  |
      |  +-ExternalFonts
      |     |
      |     +->*
      |         [ExternalFonts has a list of font names whose
      |          values are the name of the actual font]
      |
      +-Network
      |
      +-Printing
      |  |
      |  +-PPD Files
      |  |  |  [When CUPS does not found a printer (wine compiled without CUPS,
      |  |  |   libcups not loadable or required functions not found in libcups), then
      |  |  |   this Key must Exist to use your printers from "/etc/printcap"]
      |  |  |
      |  |  +->*  
      |  |  |    [When there is no Value with the Name "PPD File" found in the Registry
      |  |  |     in the Settings for a Printer ("\\PrinterDriverData"),
      |  |  |     then this Key is tried as next]
      |  |  |
      |  |  +->generic  
      |  |      [This PPD File is used, when every other Key failed.
      |  |       "wineps.drv" need a PPD-File for every Printer.]
      |  |
      |  +-Spooler
      |
      +-shdocvw
      |  |
      |  +->MozillaUrl
      |      [This is the url to the Mozilla ActiveX control required by some applications.
      |       Default is

http://source.winehq.org/mozactivex
.]
      |
      +-TaskManager
      |
      +-Temporary System Parameters
      |
      +->Version
      |   [This is the version of Windows Wine will report.
      |    Values: win2003, winxp, win2k, winnt, winme, win98, win95, win31.]
      |
      +-VDM
      |  |
      |  +-Ports
      |  |
      |  +-ppdev
      |     |
      |     +->*  
      |         [This sets mapping between port_number and /dev/parportN device.
      |           For example  "378  /dev/parport0".]
      |
      +-Wine
      |  |
      |  +-MPR
      |
      +-WineBrowser
      |  |
      |  +->Browsers
      |  |    [List of browsers that Wine will attempt to launch when running winebrowser
      |  |     command or clicking on a link in a windows application. Default value is
      |  |     firefox,konqueror,mozilla,netscape,galeon,opera,dillo]
      |  |
      |  +->Mailers
      |       [List of mail clients that Wine will attempt to launch when running winebrowser
      |        Default value is mozilla-thunderbird,thunderbird,evolution]
      |
      +-WineDbg
      |
      +-WineMenuBuilder
      |
      +-X11 Driver
         |
         +-Fonts
         |
         +->ClientSideWithRender
         |  [Set this to "N" if you don't want to use the Render extension to render client side fonts]
         |
         +->ClientSideAntiAliasWithRender
         |  [Set this to "N" to disable font anti-aliasing when X-Render extension is present]
         |
         +->ClientSideAntiAliasWithCore
         |  [Set this to "N" to disable font anti-aliasing when X-Render extension is not present or disabled]
         |
         +->Desktop
         |   [This key is set to the size (resolution) when you are using the
         |    "Emulate a virtual desktop"-option in winecfg.
         |     The value is used as is (if not "n", "f" or "0") for the X11 geometry.]
         |
         +->DXGrab
         |   [Set this to "Y" to allow DirectX apps to stop the mouse leaving their window.]
         |
         +->Managed
         |   [Set this to "N" to disallow the window manager to manage created windows.]
         |
         +->Synchronous (removed as of 2006-02-24. use "synchronous" debug channel instead)
         |   [In case of X errors it sometimes helps to set it to "Y".]
         |
         +->UseDGA
         |   [Set this to "Y" to allow use of DGA.]
         |
         +->UseXRandR
         |   [Set this to "N" to prevent wine from switching the resolution using XRandr extension.]
         |
         +->UseXVidMode
             [Set this to "Y" to allow wine switch the resolution using XVidMode extension.]

HKEY_LOCAL_MACHINE (a.k.a HKLM)
|
+-Software
|  |
|  +-Microsoft
|  |  |
|  |  +-Internet Explorer
|  |  |  |
|  |  |  +->Version
|  |  |     [Useful to make application believe that you have Internet Explorer
|  |  |      installed (if you set it manually, you might need some IE provided
|  |  |      dlls). Try to set it to 6.0.2900.2180 for IE6SP1.]
|  |  |
|  |  +-Windows NT
|  |     |
|  |     +-CurrentVersion
|  |        |
|  |        +->FontSubstitutes
|  |           [Define font substitutes.
|  |            For example: "Tahoma"="Arial" will substitute 'Tahoma' font with 'Arial' font.]
|  +-Wine
|     |
|     +-Drives
|     |
|     +-Crypto
|        |
|        +-RSA
|
|
--System
   |
   +-CurrentControlSet
      |
      +-Control
         |
         +-Session Manager
            |
            +-Environment
               |
               +->ComSpec
               |  [Location of the system console.
               |   Default: c:\windows\system32\wcmd.exe]
               |
               +->PATH
               |  [Path environment variable for searching programs.
               |   Default: c:\windows\system32;c:\windows]
               |
               +->ProgramFiles
               |  [Location of the Program Files directory and ProgramFiles environment variable.
               |   Default for english: C:\Program Files]
               |
               +->SYSTEMROOT
               |  [Location of the windows system root and SYSTEMROOT environment variable.
               |   Default: c:\windows]
               |
               +->TEMP
               |  [Location of the temporary files directory and TEMP environment variable.
               |   Default: c:\windows\temp
               |
               +->TMP
               |  [Location of the temporary files directory and TMP environment variable.
               |   Default: c:\windows\temp
               |
               +->USERPROFILE
               |  [Location of the user's profile directory and USERPROFILE environment variable.
               |   Default: c:\windows\Profiles\]
               |
               +->windir
               |  [Location of the windows system root
               |   Default: c:\windows]
               |
               +->winsysdir
                  [Location of the system libraries directory
                   Default: c:\windows\system32]

=================================END===============================



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15744/showart_99832.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP