TONT 30923 为什么控制面板中的「添加/删除程序」会尝试猜测所有信息?

原文链接:https://devblogs.microsoft.com/oldnewthing/20060609-07/?p=30923

As we saw earlier, the “Add or Remove Programs” control panel used several heuristics to attempt to determine things like program size and frequency of user. Why did it bother doing this at all?

正如早先讨论过的,控制面板中的「添加/删除程序」使用了多种启发式的方式来判断应用程序的大小和使用频率。为什么它要做这种吃力不讨好的事情呢?

At the time the feature was added, disk space was not cheap like it is today. One of the problems users were having was running out of disk space and not knowing what they could safely delete. Thus was born the Disk Cleanup utility, which attempted to guide the user through various things that could be deleted in order to make disk space available.

这个功能最初上线的时候,磁盘空间不像如今这样廉价。用户需要面对的问题之一是磁盘空间不够用了,而又不知道可以放心地删掉什么东西。由此,「磁盘清理工具」诞生了,它会引导用户执行一系列操作来判断可以删掉哪些东西来释放磁盘空间。

In addition to cleaning up temporary files, you could also remove programs that weren’t being used. But how do you know which programs you weren’t using? (Maybe you were using a program without realizing it because it ran automatically.) And how do you know how much disk space would be recovered if you removed a program?

在删除临时空间之外,用户还可以删除不再使用的应用程序(来释放磁盘空间)。然而,用户如何判断有哪些应用是用不到的呢?(有些应用是自动运行的,所以用户可能根本没有意识到它的存在。)此外,用户又怎么能知道移除掉某个应用后能释放多少磁盘空间呢?

That’s where the program size and frequency of use heuristics came in. By providing this information (or at least trying to), the “Add or Remove Programs” control panel could help users decide which programs to remove.

这就是(「添加/删除程序」控制面板项中)应用程序大小和使用频率估算起作用的时候了。通过提供这些信息(至少是试着提供了),「添加/删除程序」得以帮助用户判断要删除哪个应用。

Of course, nowadays, with hard drives in the hundreds-of-gigabytes range, disk space has become so cheap as to be nearly free. The need to remove programs to make more disk space available is largely gone, but the feature remains as a vestigial organ.

当然,如今硬盘容量已按数百 GB 为单位计算,磁盘空间也(相对地)便宜到跟不要钱一样。通过删除应用程序来腾出更多磁盘空间的需求基本已经不存在了,但这个功能就像退化了的器官一样保留了下来。

TONT 31073 在 x86 系统上使用尤达大师(Yoda)可能对您系统的健康有害

原文地址:https://devblogs.microsoft.com/oldnewthing/20060525-04/?p=31073

In former times very cross-platform NTVDM was. If you view NTVDM.EXE in a hex editor, you’ll find the message “Using Yoda on an x86 may be hazardous to your systems’ health” buried inside it.

很久以前,NTVDM 的跨平台程度是非常高的。如果你在十六进制编辑器里查看 NTVDM.EXE 的内容,你会看到里面藏着这么一句话:“在 x86 系统上使用尤达大师可能对您系统的健康有害”。

Yoda was the name of the internal debugger that was used to debug the MS-DOS emulator, also known as the Virtual DOS Machine or VDM. (Buried inside the Yoda source code are such wonderful variables as “luke” and “chewy”.)

Yoda 是用来调试 MS-DOS 模拟器的内部调试器的名字,MS-DOS 模拟器又称作 DOS 虚拟机(VDM)。(在 Yoda 的源代码里还深藏着其它妙妙的变量名,比如 luke 和 chewy(译注:都是《星球大战》梗))。

The Intel 80386 has a mode known as “Virtual-8086 mode” or just “V86 mode” wherein the CPU ran as if it were an 8086, except that if the program did anything interesting like issue a privileged instruction, call a software interrupt, or fault, control would return to the protected-mode supervisor for handling. (Win386 used this same CPU mode to support multiple MS-DOS sessions.)

Intel 80386 处理器有个“虚拟 8086 模式”(或者简称为 V86 模式),在此模式下,CPU 将按照 8086(实模式)的方式运行,不过只要有程序试图执行如特权指令、软件中断或出错之类的行为,就会返回到保护模式的管理之下来处理这一切。(Win386 也使用这一 CPU 模式来支援多个 MS-DOS 会话。)

When running on an 80386-class processor, NTVDM used this mode to do its emulation, making the CPU do the heavy lifting of decoding instructions and emulating them, which took place at very close to full speed. On the other hand, NTVDM on the non-x86 processors (Alpha, PPC, MIPS, etc.) had to implement an entire 8086 emulator, with all the decoding and execution performed in software. Yoda was the debugger you used if you needed to debug the emulator.

当运行在 80386 级的处理器上时,NTVDM 使用虚拟 8086 模式来进行模拟工作,让 CPU 来承担解码指令、模拟行为之类的繁重工作,并且基本上可以全速运行。但另一方面,在非 x86 处理器上(如 Alpha、PPC、MIPS 等等)就要实现一整个 8086 模拟器,对指令的解码和执行工作完全依赖软件模拟。Yoda 就是那个用来调试这个模拟器的调试器。

And that’s why NTVDM has a message warning you not to use Yoda on an x86. Because on an x86, there is no instruction emulator. There is nothing to debug.

这就是为什么 NTVDM 里有一条警告不要在 x86 系统上使用 Yoda 的原因——在 x86 系统上并没有一个 x86 指令模拟器的存在,么得调试工作可做。

(My thanks to Andrew McLaren and Tony Gaston for providing historical background.)

(感谢 Andrew McLaren 和 Tony Gaston 提供历史背景信息。)

Day 7104 在 Windows 10 下使用 LPD 打印服务共享打印机

自从 2021 年的 KB5005565 开始,微软就在玩坏 Windows 内置的打印机共享功能的道路上越走越远,虽然知道微软是为了修复 Windows 共享中的漏洞而做出的修改,但你要不要首先确保用户的功能可以继续正常使用?

时至今日,微软的出品质量越来越差,每一次的 Windows Update 都可能引入新的严重 bug,尤其是共享打印机功能,以前通常只需要考虑跨大版本不易解决(如 Win10 去连接 Win7 的共享打印机、XP 去连接 Win11 的打印机等等),而现在甚至同代系统之间都可以昨天还能用、今天就全炸锅了。

前一段时间因各种原因,给某公司组装了几十台办公电脑,由于并非常驻对方公司,无法像在供职公司一样出问题随时上门,在被 Windows 10 优秀的共享打印机功能教训过后(前一天同一个办公室还能用,第二天就全体报错,并且无法重新添加),终于在检索维护方案时,找到一种不需要额外投入成本的方法,即使用 Windows 目前还内置的 LPD 打印服务。

以下操作方式以 Windows 10 为例,Windows 11 操作相近,可自行摸索。

一、安装  LPD 打印服务

在拟用作打印服务器(直连打印机)的电脑上打开“启用或关闭 Windows 功能”,启用“打印和文件服务”下的“LPD 打印服务”(无需勾选“LPR 端口监视器”,但选上也没有什么问题),点击确定安装此功能。

二、启用共享

为接下来要共享的打印机启用共享,此时需要记下共享名,稍后在其他机器添加打印机时会用到。

为达到最佳兼容性,共享名最好遵循以下规则:(1)全小写(录入时比较方便);(2)不要有空格;(3)限制在31个(含)字符内。

三、安装 LPR 打印端口

在打印客户端(其他电脑)上打开“启用或关闭 Windows 功能”,这次启用的是“打印和文件服务”下的“LPR 端口监视器”,点击确定安装此功能。

四、在客户机上添加打印机

(一)在“添加设备”对话框中直接点击“我所需的打印机未列出”,在下一步中选择“通过手动设置添加本地打印机或网络打印机”。

(二)选择“创建新端口”,端口类型选择“LPR Port”。

(三)在“添加 LPR 兼容打印机”对话框中,在“提供 LPD 的服务器的名称或地址”中输入打印服务器的 IP 地址,“服务器上的打印机名称或打印队列名称”中输入第二部中记下的共享名。

(四)在下一步中安装打印机驱动,可去厂商网站下载。

五、额外设置

安装完毕后,打开新增打印机的“打印机属性”,在“端口”中取消勾选“启用双向支持”,否则打印机可能没有反应,对于佳能 CAPT 协议的打印机而言,则可能报错“不支持打印机连接的端口”。

不过该方法也不是万能的,目前有观察到以下两种特殊情况:

一、HP Laserjet 1020 打印机的共享

作为一款经典型号,1020 打印机至今仍在生产新品,迄今已有 20 年的历史,其在官网上提供的“全功能软件和驱动程序”截止至 2016 年,安装程序也有很明显的 XP 年代的痕迹。

但是,如果用官方驱动进行 LPD 共享的话,无论如何无法成功,甚至连 Windows 自带的共享有时也困难重重,表现为可以成功添加打印机,可以成功发送打印任务,但打印机实际上不会有任何反应。

临时解决方案为:去 HP 官网下载官方的通用驱动(HP Universal Print Driver Series for Windows),将已添加的打印机驱动替换为这个通用驱动即可。

此外,如果需要在 macOS 上添加此型号打印机的 LPD 共享连接,驱动程序选择 macOS 自带的 HP Laserjet 1022 即可(HP 官方没有提供 1020 的 macOS 驱动)。

二、LPD 服务报错找不到打印机

出现此错误时,其表象与上一个问题类似,即 LPD 共享可以正常添加,打印任务可以正常下达,但打印机不会有任何反应。

不同的是此时去客户机的事件查看器中,展开 Windows 日志-应用程序,会看到有级别为警告、来源为 Spooler-LPRSVC、事件 ID 为 2004 的记录,内容为:

行式打印机远程工具(LPR)服务无法将打印作业提交到主机(打印服务器 IP 地址)上的 Line Printer Daemon (LPD)打印机(打印机共享名),因为远程主机或打印机上的 LPD 服务正在拒绝打印作业。如果 LPD 服务正在处理其他打印作业则会发生这种情况。LPR 服务将重试打印,直到作业打印成功或用户取消打印作业为止。

在打印服务器上,可以看到级别为错误、来源为 Spooler-LPDSVC、事件 ID 为 4008 的记录,内容为(没有拍照所以为大致内容,来自对英语事件内容的翻译):

行式打印机远程工具(LPR)服务拒绝了来自(打印服务器 IP 地址)提供给(打印机共享名)的打印任务,因为指定的打印机不存在。请从客户端以正确的打印机名称重新发起打印任务。

此问题即便在客户机上添加 LPD 打印机时填写的共享名完全正确也可能发生(添加打印机时只校验服务是否可以连接,并不校验打印队列名称是否正确,所以请优先检查共享名称是否录入有误),临时解决方法为在服务器上给打印机换一个共享名,然后在客户机上重新添加 LPD 打印机,但也可能无效,具体原因仍有待探究。

TONT 31543 Microsoft Access 的名字是怎么来的?

原文链接:https://devblogs.microsoft.com/oldnewthing/20060413-09/?p=31543

We’ve seen how the names for some Microsoft products had to be changed due to a name conflict. I’m told that the people who had to come up with the name for the database product avoided this pitfall in a clever way: Instead of trying to avoid a name that was already taken, they intentionally used a name that was already taken: By Microsoft itself.

我们已经见识过一些微软产品的名字因为命名冲突而不得不改名的情况。据说要给一款数据库产品的员工巧妙地避开了这一大坑:没有选择不使用已经被占用的名字,而是恰恰相反选择了一款已经被占用的,(而占用它的不是别人,)正是微软自己。

They discovered that Microsoft had a long-forgotten terminal emulator product called Microsoft Access. “Access” sounded like an appropriate name for a database product, so they blew the dust off it and gave the name a new life.

这些人发现微软有一款被尘封许久的终端模拟器产品叫 Microsoft Access。「Access」一听就是个适合数据库产品的好名字,于是他们就为它掸去尘土,并为这个名字赋予了新生。

TONT 31563 为什么微软防护服务的服务名叫 msmpsvc?

原文链接:https://devblogs.microsoft.com/oldnewthing/20060412-09/?p=31563

(This is the first in a series of short posts on where Microsoft products got their names.)

(本文是一系列有关微软产品如何起名的小故事的第一篇。)

The original name for the malware protection service was “mpsvc” the “Microsoft Protection Service”, but it was discovered later that that filename was already used by malware! As a result, the name of the service had to be changed by sticking an “ms” in front, making it “msmpsvc.exe”. Therefore, technically, its name is the “Microsoft Microsoft Protection Service”. (This is, of course, not to be confused with “mpssvc.exe”, which is, I guess, the “Microsoft Protection Service Service”.)

恶意软件防护服务原来的服务名叫 mpsvc,是 Microsoft Protection Service 的缩写,结果后来我们发现,那个文件名居然已经被一款恶意软件给占掉了!于是乎,服务名称就得作出修改,而修改的方式就是在前面加上一个「ms」,使其变成了「msmpsvc.exe」。故而,技术上而言,msmpsvc 代表的是「微软微软防护服务」。(当然还是不要与 mpssvc.exe 混淆了,后者我估计是「微软防护服务服务」的缩写。)

Fortunately, the Marketing folks can attempt to recover by deciding that “msmpsvc” stands for “Microsoft Malware Protection Service”. But you and I will know what it really stands for.

幸运的是,营销人员们通过让「msmpsvc」代表「微软恶意软件防护服务」尝试挽回了损失,不过你我现在都知道它的本来含义了。

TONT 37203 「诱饵」显示控制面板

原文链接:https://devblogs.microsoft.com/oldnewthing/20060410-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.

作诱饵的那个设置页面,除了默默承受驱动的胡搅蛮缠之外什么用处也没有。最后的结果是,驱动们想要通过诡计实现的那些花哨功能一个也没有展现出来,但至少(真正的)显示控制面板好好地活了下来,使用户得以实现它们本来的愿望:修改显示设置。

Day 7033 雪花

已经记不清是什么时候留存下来的网络歌曲,正确的创建和修改日期已在多次数据迁移中消失殆尽,留下的唯一信息是演唱者为裔天,词、曲作者已不可考。

在本文之前,这首歌在互联网上唯一剩下的记忆可能只剩下一个老式的 LRC 下载页面,以及一篇百度知道提问。

愿它的美丽从今天起能继续流传下去。

(Soundcloud 播放器所需梯子请自理)


作为 Blog 重建工作的一部分,顺手将原来「筱林乐音」这个分类下中的条目里原来的 Flash 播放器们更新为了 Youtube 或 Soundcloud 来源,只有一篇暂时无法立即找到可用源,就那样吧。

2025 年了,会搬梯子是基础技能。

Day 7032 洒水扬尘,抑或是喃喃自语

长久以来第一次正经写博文。

也不知道是否还会有访客意识到本博客的界面发生了变动,我想是没有的,毕竟除了基本上与原来没什么变化之外,还因为更新频次已经低于一年 10 篇文章,所以不指望会有多少访客,也就不指望会有人记得之前这里长什么样子。但不论如何,这个 WordPress 是从头重新安装的(当然数据还是恢复了的),甚至整台 VPS 都是格掉重来的。

新系统装完,不发点东西表示一下好像有点不好,于是以下是一大堆零零碎碎,权当我在记流水账。 继续阅读 “Day 7032 洒水扬尘,抑或是喃喃自语”

Day 6887 为 Photoshop 的“图像处理器”增加 CR2 格式打开支持

由于工作的缘故,需要快速将一批 RAW 图片转换为 JPEG 格式,该批文件的格式较新,手里现有的 AcdSee 和 XnView 无法打开,并且已经没有时间安装 Lightroom 等软件,经查找 Photoshop 的“图像处理器”(文件-脚本-图像处理器)可以完成这一操作。

然而,在操作过程中,发现文件夹中的 CR2 格式文件被尽数跳过。经搜索,原因为 Photoshop 自带的“图像处理器”脚本在判断需要用  CameraRaw 打开的文件时并不包含 CR2 扩展名,幸好这一插件的文件是纯文本,只需对其进行修改即可。

以 Photoshop 2020 为例,用文本编辑器打开下列文件:

C:\Program Files\Adobe\Adobe Photoshop 2020\Presets\Scripts\Image Processor.jsx

在大约115行的位置找到:

gFilesForCameraRaw = Array( “TIF”, “CRW”, “NEF”, “RAF”, “ORF”, “MRW”, “DCR”, “MOS”, “SRF”, “PEF”, “DCR”, “DNG”, “ERF”, “X3F”, “RAW”);

在末尾添加 CR2 扩展名(注意保持大写),使其变成:

gFilesForCameraRaw = Array( “TIF”, “CRW”, “NEF”, “RAF”, “ORF”, “MRW”, “DCR”, “MOS”, “SRF”, “PEF”, “DCR”, “DNG”, “ERF”, “X3F”, “RAW”, “CR2”);

保存后重新调用图像处理器即可。