TONT 32703 『诱饵』控制面板

原文链接:https://devblogs.microsoft.com/oldnewthing/20060110-17/?p=32703

译注:原文第一段超级长,为方便阅读,进行了手工拆分。

Last time, we saw one example of a “decoy” used in the service of application compatibility with respect to the Printers Control Panel. Today we’ll look at another decoy, this time for the Display Control Panel.

在上一篇博文中,我们了解了一个与打印机控制面板相关的、用于服务应用程序兼容性的『诱饵』。今天我们来看另一个『诱饵』,这次是关于显示控制面板的。

When support for multiple monitors was being developed, a major obstacle was that a large number of display drivers hacked the Display Control Panel directly instead of using the documented extension mechanism. For example, instead of adding a separate page to the Display Control Panel’s property sheet for, say, virtual desktops, they would just hack into the “Settings” page and add their button there. Some drivers were so adventuresome as to do what seemed like a total rewrite of the “Settings” page. They would take all the controls, move them around, resize them, hide some, show others, add new buttons of their own, and generally speaking treat the page as a lump of clay waiting to be molded into their own image. (Here’s a handy rule of thumb: If your technique works only if the user speaks English, you probably should consider the possibility that what you’re doing is relying on an implementation detail rather than something that will be officially supported going forward.)

在开发多显示器支持的过程中,一个主要的障碍是有相当多的显卡驱动会对显示控制面板直接下手进行修改,而不是使用文档中载明的扩展机制。例如,这些驱动不采取向显示控制面板中增加一个单独的选项卡、来展示诸如虚拟桌面之类的功能的方式,而是直接对『设置』页面横加出手,把它们的按钮直接塞进去。有些驱动极富冒险精神,甚至把『设置』选项卡整个重写了一遍。这些驱动抄起选项卡里的控件来挪东挪西、变大变小、藏这显那,还加了些他们自己的按钮进去,总的来说就是将这个选项卡当成了一块粘土,想做成什么形状就做成什么形状。(这里有一条简明的经验法则:如果你的做法只对说英语的用户有效,那么你应该考虑一下你所做的事情正在依赖部署细节,而不是受官方支持、可以持续下去的东西。)

In order to support multiple monitors, the Settings page on the Display Control Panel underwent a major overhaul. But when you tried to open the Display Control Panel on a system that had one of these aggressive drivers installed, it would crash because the driver ran around rearranging things like it always did, even though the things it was manipulating weren’t what the developers of the driver intended!

为了实现对多显示器的支持,显示控制面板的『设置』页面做出了重大改动。然而,当你在某台安装了上述野心勃勃的显卡驱动的机器上打开显示控制面板的时候,程序会崩溃,因为驱动还在按照旧有的方式对控制面板里的控件大改一通,即便是如今它出手修改的东西已经与驱动的开发者所想的已经完全不同了!

The solution was to create a “decoy” Settings page that looked exactly like the classic Windows 95 Settings page. The decoy page’s purpose in life was to act as bait for these aggressive display drivers and allow itself to be abused mercilessly, letting the driver have its way. Meanwhile, the real Settings page (which is the one that was shown to the user), by virtue of having been overlooked, remained safe and unharmed.

解决方案,则是创建一个『诱饵』设置页面,这个页面看上去与旧式的 Windows 95(显示控制面板的)设置页面完全一样,而它的一切目的就是为了诱使那个野心勃勃的显卡驱动对它毫无怜悯之心地一通乱改,让驱动能心满意足。而与此同时,真正的『设置』页面(展示给用户的),由于被(驱动)忽视掉了,得以岁月静好。

There was no attempt to make this decoy Settings page do anything interesting at all. Its sole job was to soak up mistreatment without complaining. As a result, those drivers lost whatever nifty features their shenanigans were trying to accomplish, but at least the Display Control Panel stayed alive and allowed the user to do what they were trying to do in the first place: Adjust their display settings.

这个『诱饵』设置页面并没有任何有趣的目的,其全部职责就是毫无怨言地迎击驱动的乱搞。最后,这些驱动要展示的那些花哨的功能一个也没能显示出来,但至少显示控制面板安然度过了这一切,使得用户能做他们一开始便想要做的事情:调整显示设置。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

 剩余字数 ( Characters available )

Your comment will be available after auditing.
您的评论将在通过审核后显示。

Please DO NOT add any links in your comment, otherwise it would be identified as SPAM automatically and never be audited.
请不要在评论中插入任何链接,否则将被自动归类为垃圾评论,且永远不会被提交给博主进行复审。

*