【Hacker News搬运】Windows资源编译器(rc.exe)的每个错误/怪癖,可能
-
Title: Every bug/quirk of the Windows resource compiler (rc.exe), probably
Windows资源编译器(rc.exe)的每个错误/怪癖,可能
Text:
Url: https://www.ryanliptak.com/blog/every-rc-exe-bug-quirk-probably/
由于我无法直接访问互联网来抓取和分析网页内容,我将提供一个基于假设的分析过程,如果你使用 JinaReader 或类似的工具来抓取和分析上述链接的内容,以下是你可能会采取的步骤: 1. **抓取网页内容**: 使用 JinaReader 或类似的工具,首先你需要抓取上述链接的网页内容。这通常包括HTML、CSS和JavaScript代码。 2. **解析HTML**: 解析抓取到的HTML内容,提取出网页中的文本、标题、链接、图像等信息。 3. **内容分析**: 对提取出的文本进行初步分析,确定内容的主要部分,比如标题、副标题、段落等。 4. **翻译非中文内容**: 如果网页中包含非中文内容,你需要使用翻译服务将这部分内容翻译成中文。可以使用JinaReader集成的翻译API,或者调用外部翻译服务如Google Translate API。 5. **总结内容**: 根据抓取和翻译后的内容,进行总结。以下是一个假设的总结过程: - **标题**:抓取标题并翻译成中文。 - **段落**:选择几个关键段落,提取主要观点,并翻译成中文。 - **总结**:根据以上信息,撰写一个简短的总结,概括文章的主要内容和观点。 由于我无法访问具体的网页内容,以下是一个假设的总结示例: **标题**:每个RC.exe的bug、怪癖可能是什么? **总结**: 这篇文章讨论了与RC.exe相关的各种bug和怪癖。作者通过分析多个案例,揭示了这些问题的常见原因和解决方法。文章强调了在开发过程中进行充分的测试和错误检查的重要性,以避免这些问题影响软件的稳定性和性能。通过阅读这篇文章,读者可以了解RC.exe的一些常见问题,并学习如何避免或解决它们。 请注意,这只是一个基于假设的总结示例,实际内容可能会有所不同。如果你真的需要总结上述链接的内容,请使用JinaReader或类似工具进行实际的抓取和分析。
Post by: nektro
Comments:
Arnavion: I was thinking
NOT (1|2)
andNOT () 2
could make sense if the parser just has anot_in_effect
flag that gets set to true when aNOT
is encountered and then applies to the next integer as soon as one is parsed. SoNOT (1|2)
sets the flag, then starts parsing(1|2)
. Once it's parsed the1
, it notices a NOT is in effect so it applies it to the 1 as if it had just parsedNOT 1
(which leaves 0 unchanged), then parses| 2
, so the result is 2.<p>NOT () 2
would be the same logic.)
signifies the end of an expression and thus evaluates to the current integral result, which is 0 (for the same reason that unary - is zero), and a NOT is in effect so it's treated asNOT 0
which is a no-op ("unset no bits"). Then the next2
makes the result2
. This assumes thatx y
is parsed the same asx | y
(maybe only if aNOT
has been parsed at any point first) or asy
(the same stack-like "the last number that was parsed becomes the result" behavior described in other items).<p>This doesn't explain the7 NOT NOT 4 NOT 2 NOT NOT 1 = 2
case though. If the parser just sets thenot_in_effect
flag when it encounters aNOT
(instead of toggling it), then this would be7 | NOT 4 | NOT 2 | NOT 1
which would be 0. If the parser does toggle the flag, this would be7 | 4 | NOT 2 | 1
which would be 1 or 5. If the parser treats aNOT
as ending the previous expression (if any), this would be7 | NOT 0 | NOT 4 | NOT 2 | NOT 0 | NOT 1
which would be 0.Arnavion: 我在想“NOT(1|2)”和“NOT()2”是有意义的,如果解析器只有一个“NOT_in_effect”标志,当遇到“NOT”时,该标志设置为true,然后在解析后立即应用于下一个整数。因此,'NOT(1|2)'设置标志,然后开始解析'(1|2')'。一旦它;如果解析了'1',它会注意到一个NOT有效,因此它将其应用于1,就像它刚刚解析了'NOT 1'一样(0不变),然后解析'|2',因此结果为2。'NOT()2'的逻辑相同表示表达式的结束,因此计算为当前积分结果,即0(与一元-为零的原因相同),NOT有效,因此它=;s被视为'NOT 0',这是一个无操作(“unset no bits”)。然后下一个“2”得到结果“2”。这假设
x y
被解析为与x|y
相同(可能只有在任何时候首先解析了NOT’的情况下)或与
y’相同(与其他项目中描述的“最后一个解析的数字成为结果”行为相同的堆栈)<p> 这不是;不过,不要解释“7不4不2不1=2”的情况。如果解析器在遇到“not”时只设置“not_in_effect”标志(而不是切换它),那么这将是“7|not 4|not 2|not 1”,即0。如果解析器确实切换了标志,那么这将是“7|4|不是2|1”,即1或5。如果解析器将“NOT”视为前一个表达式的结尾(如果有的话),则这将是“7|NOT 0|NOT 4|NOT 2|NOT 0| NOT 1”,即0。squeek502: I'm the author if anyone has questions
squeek502: 我;如果有人有问题,我是作者
immibis: That's a crazy amount of work and a crazy amount of quirks indeed. Very much illustrates a mindset where the user is at fault if they provide bad input - and development effort for everything was multiplied compared to today. In 1985, of course, nobody cared about things like security from untrusted inputs, and reproducible builds.<p>My favourite bug from this list is that the compiler expands tabs to spaces in string literals and puts them at tab stops based on the string literal's horizontal position in the source file.<p>I think that being able to directly define resource type 6 is not a bug. You got exactly what you asked for - an invalid resource. Crashing when loading it isn't a bug, either.<p>I suppose that style flag arguments are parsed as |-separated lists of numeric or NOT expressions, rather than single expressions where | serves as bitwise-or.<p>> If the truncated value is >= 0x80, add 0xFF00 and write the result as a little-endian u32. If the truncated value is < 0x80 but not zero, write the value as a little-endian u32.<p>This is sign-extension: s8 -> s16 -> u16 -> u32. The examples below this also seem to have reversed the order of the input byte and the FF.<p>Visual C++ 6, at least, includes a toolbar resource editor. IIRC it shows the toolbar metadata and the bitmap together in one editor, and you edit each button's image individually even though they are concatenated into one bitmap in the resource file.<p>"GROUPBOX can only be used in DIALOGEX" might refer to some limitation other than the resource compiler. For example, perhaps Windows versions that don't support DIALOGEX also don't support GROUPBOX.<p>A lot of them could be caused by memory safety errors. For example the fact that "1 ICON {" treats "ICON" as the filename is probably because the tokenizer doesn't set the Microsoft equivalent of yytext for tokens where it's not supposed to be relevant. Maybe it would even crash (null pointer) if { could be the first token (which it can't).
immibis: 那;这确实是一项疯狂的工作和疯狂的怪癖。这很好地说明了一种心态,即如果用户提供了糟糕的输入,那么他们就是有错的——与今天相比,所有事情的开发工作都成倍增加。当然,在1985年,没有人关心不可信输入的安全性和可复制的构建<p> 这个列表中我最喜欢的错误是编译器将制表符扩展为字符串文字中的空格,并根据字符串文字将它们放在制表符位置;s在源文件中的水平位置<p> 我认为能够直接定义资源类型6并不是一个bug。你得到了你想要的东西——一个无效的资源。装载时碰撞不是;也不是虫子<p> 我假设样式标志参数被解析为以|分隔的数字或NOT表达式列表,而不是以|作为位或的单个表达式<p> >;如果截断值>;=0x80,加上0xFF00,将结果写成小端u32。如果截断值<;0x80但不是零,将值写为小字节序u32。<p>这是符号扩展:s8->;s16->;u16->;u32.下面的例子似乎也颠倒了输入字节和FF的顺序。至少Visual C++6包含一个工具栏资源编辑器。IIRC在一个编辑器中同时显示工具栏元数据和位图,您可以编辑每个按钮;s图像,即使它们在资源文件中连接成一个位图<p> ";GROUPBOX只能用于对话";可能指的是资源编译器之外的一些限制。例如,也许Windows版本不支持;不支持DIALOGEX,也不支持;t支持GROUPBOX。<p>其中很多可能是由内存安全错误引起的。例如,";1 ICON{将“ICON”视为文件名,这可能是因为标记器没有为不应该相关的标记设置微软等效的yytext。如果{可能是第一个标记(它可能不会),它甚至可能会崩溃(空指针)。