分类: Win故知新

TONT 34283 为什么会有 WSASetLastError 这个函数?

原文链接:https://devblogs.microsoft.com/oldnewthing/20050908-19/?p=34283

Why does the function WSASetLastError exist when there is already the perfectly good function SetLastError?

为什么在已经有了 SetLastError 这么好的一个函数的情况下,还要再有一个 WSASetLastError 呢?

Actually, you know the answer too, if you sit down and think about it.

实际上,如果坐下来思考一番的话,你也已经知道答案了。

Winsock was originally developed to run on both 16-bit Windows and 32-bit Windows. Notice how the classic Winsock functions are based on window messages for asynchronous notifications. In the 16-bit world, there was no SetLastError function. Therefore, Winsock had to provide its own version for the 16-bit implementation. And since source code compatibility is important, there was a 32-bit version as well. Of course, the 32-bit version looks kind of stupid in retrospect if you aren’t aware of the 16-bit version.

Winsock 原本是设计同时运行在 16 位和 32 位的 Windows 上的,需要注意的是,传统的 Winsock 函数的运行依赖窗口消息来获取异步通知。在 16 位的世界里,并没有 SetLastError 这么个东西,因此,Winsock 需要为 16 位环境提供它自己版本的 SetLastError。同时,由于源代码兼容性是一件很重要的事情,也就有了 32 位的 WSASetLastError。当然了,如果你不了解有 16 位环境下的需求这件事的话,32 位版本下的它看上去就有那么点多余了。

TONT 34403 为什么默认的控制台代码页叫OEM?

原文链接:https://devblogs.microsoft.com/oldnewthing/20050829-00/?p=34403

Last year, we learned that the ANSI code page isn’t actually ANSI. Indeed, the OEM code page isn’t actually OEM either.

去年的时候,我们了解了一下 ANSI 代码页为什么实际上并不是 ANSI。实际上,OEM 代码页也并非 OEM。

Back in the days of MS-DOS, there was only one code page, namely, the code page that was provided by the original equipment manufacturer in the form of glyphs embedded in the character generator on the video card. When Windows came along, the so-called ANSI code page was introduced and the name “OEM” was used to refer to the MS-DOS code page. Michael Kaplan went into more detail earlier this year on the ANSI/OEM split.

在 MS-DOS 那个年代,实际上只有一个代码页,由原始设备制造商(original equipment manufacturer,OEM)以符号形式潜入在显示适配器的字符生成器中。后来有了 Windows 之后,就引入了所谓的 ANSI 代码页,而从 MS-DOS 继承而来的代码页就被叫做是 OEM 代码页了。Michael Kaplan 在其今年早些时候的博文中深入挖掘了一下这一分离过程(译注:链接已失效)。

Over the years, Windows has relied less and less on the character generator embedded in the video card, to the point where the term “OEM character set” no longer has anything to do with the original equipment manufacturer. It is just a convenient term to refer to “the character set used by MS-DOS and console programs.” Indeed, if you take a machine running US-English Windows (OEM code page 437) and install, say, Japanese Windows, then when you boot into Japanese Windows, you’ll find that you now have an OEM code page of 932.

多年过去,Windows 已经越来越少地依赖于潜入在显示适配器的字符生成器了,以至于『OEM字符集』这个概念也跟原始设备制造商越来越没什么关系了,而只是一种指代『由 MS-DOS 和控制台应用程序使用的字符集』的一种方便的称呼而已。实际上,如果你在一台运行美国英语版本 Windows(OEM代码页437)的机器上安装一个,比如说,日文版的 Windows,等你进入系统之后,就会发现系统当前的字符集是 OEM 932了。

TONT 34433 Windows 95 把收款机搞崩溃了

原文链接:https://devblogs.microsoft.com/oldnewthing/20050825-30/?p=34433

Not everything related to the Windows 95 launch went well. The St. Louis Post-Dispatch reported that a local CompUSA store found that their cash registers crashed at midnight, forcing eager customers to wait ninety minutes before the problem could be resolved. The cause: A bug in the cash register software which had lain undiscovered because the store had never stayed open past midnight before!

并不是所有与 Windows 95 发布的事情都进展顺利。据《圣路易斯邮报》所载,当地的一家 CompUSA 门店发现他们的收款机在午夜时分崩溃了,硬是让急不可耐的顾客们等了一个半小时才把问题解决。至于原因,则是因为收款机软件中的一个未被发现的bug,因为这家门店从来没有在午夜之后营业过,所以也就从来没有被发现!

(译注:以下两句因原文链接已失效,译来意义不大,仅作原文保留)

And there was the the launch of Mindows 95 in Hong Kong.

Not one to sit by and miss out on all the attention, Apple responded with its absolutely brilliant counter-advertisement.

TONT 34463 买下整间Egghead软件商城

原文链接:https://devblogs.microsoft.com/oldnewthing/20050824-11/?p=34463

During the development of Windows 95 (which released to the public ten years ago today), application compatibility was of course a very high priority. To make sure that coverage was as broad as possible, the development manager for Windows 95 took his pick-up truck, drove down to the local Egghead Software store (back when Egghead still existed), and bought one copy of every single PC program in the store.

在 Windows 95 开发期间(正好是十年前的今天(译注:本文成文时间2005年8月24日)向公众发布),应用程序兼容性自然是优先级非常高的一项事务。为了保证(Windows 95 的软件兼容性)覆盖面尽可能广泛,开发团队的经理开上了他的皮卡,到了本地的一家 Egghead 软件商城(当时还存在)(译注:Egghead Software 是美国的一家软件分销商,1984年至2001年间存续),把里面的每一种PC软件都买了一份。

He then returned to Microsoft, unloaded all the software onto tables in the cafeteria, and invited every member of the Windows 95 team to come in and take responsibility for up to two programs. The ground rules were that you had to install and run the program, use it like a normal end user, and file a bug against everything that doesn’t work right, even the minor stuff. (Of course, you had to provide the program to the person investigating the bug upon request.) In exchange for taking responsibility for ensuring that Windows 95 was compatible with your adopted programs, you got to keep them after Windows 95 shipped. If you did a good job with your two, you could come back for more.

然后他回到公司,把买来的所有软件倒在餐厅的桌子上,并邀请 Windows 95 团队的每个成员都来取走最多2种软件并对此负责。基本的原则是,成员应当安装并运行所拿到的软件,像一名普通的最终用户那样使用软件,并对所遇到的每一个不太对劲的问题提交一份bug报告,即便是最细微的地方也需要(当然,当提出要求时,同样也需要将程序本身提交给负责调查这个bug的人)。作为对确保成员所负责的应用程序最终能与 Windows 95 相兼容的努力的交换,等 Windows 95 发布后,成员可以将软件本体据为己有。如果搞定了手里的2个软件,还可以再来取走更多的副本。

The cafeteria was filled with Windows 95 team members, browsing through the boxes upon boxes of software like bargain-hunters at a flea market. And there were the inevitable “What’d you get?” comparisons afterwards.

餐厅里挤满了 Windows 95 团队的成员,如同在跳蚤市场里捡便宜的人那样在一大堆软件盒子里挑来拣去,并且不可避免地讨论着『你拿到啥了』这样的对话。

I picked up only one program, an English/German automatic translator. It ran fine but produced pretty bad translations. (Not that the quality of the translations was in any way the fault of Windows!)

我只拿到了一个软件,是一个英德自动翻译软件,它运行起来没什么问题,就是翻译的质量太糟糕了。(这软件翻译成那样可跟 Windows 一毛钱关系都没有!)

TONT 34513 Windows 95 的安装程序用了多少张软盘才装下?

原文链接:https://devblogs.microsoft.com/oldnewthing/20050819-10/?p=34513

Thirteen.

13张。

In case you were wondering.

如果你真那么想知道的话。

And those were thirteen of those special Distribution Media Format floppies, which are specially formatted to hold more data than a normal 1.44MB floppy disc. The high-capacity floppies reduced the floppy count by two, which resulted in a tremendous savings in cost of manufacturing and shipping.

并且这13张软盘都是所谓的『分发媒体格式』(Distribution Media Format)的软盘,经过特殊的格式化,可以存储比普通的1.44MB软盘更多的数据。这些高容量软盘让(一套Windows 95安装程序)所需的软盘数量减少了2张,从而在制造和运输的过程中减少了海量的成本。

(I’m sure there are the conspiracy-minded folks who think that DMF was invented as an anti-piracy measure. It wasn’t; it was a way to reduce the number of floppy disks. That the disks were difficult to copy was a side-effect, not a design goal.)

(我觉得肯定有些阴谋论者认为DMF软盘是某种反盗版措施,然而实际上并非如此,它只是一种减少软盘数量的方式而已。这些磁盘难以复制只是副作用,而不是设计目的。)

(For comparison, Windows 3.1 came on six floppies. Windows NT 3.1 came on twenty-two. And yesterday, one of my colleagues reminded me that Windows NT setup asked for the floppy disks out of order! I guess it never occurred to them that they could renumber the disks.)

(作为对比,Windows 3.1 用了6张软盘,Windows NT 3.1 用了22张。并且昨天,有个同事还告诉我 Windows NT 安装程序要求用户提供软盘的时候是不按顺序的!我觉得这个问题他们应该从来没有遇到过,因为他们可以给磁盘重新标号。)