如果我违反了 ProgID 的要求,会发生什么?
这篇 MSDN 文章 指出任何 ProgID 都必须满足一些正式要求,包括长度限制。然而,没有提及如果违反这些规定会发生什么。
我在我们的代码库中发现了几个地方 ProgID 长度超过 39 个字符,但一切似乎都正常工作,包括 ProgIDFromCLSID() 和 CLSIDFromProgID() 。
由于违反这些要求非常容易,因此了解此类违规行为真正可能产生的后果是什么将是非常有趣的?
This MSDN article states that any ProgID must meet several formal requirements, length restriction included. However nothing is said about what happens if those are violated.
I found several places in our codebase where ProgIDs are longer than 39 characters, still everything seems to work allright for them, ProgIDFromCLSID() and CLSIDFromProgID() included.
Since violating those requirements is quite easy it would be very interesting to know what are the real possible consequences of such violations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜你得到的是未定义的行为。这可能包括正常功能到崩溃、小猫被吃掉、长子被牺牲等等。
更重要的是,一些要求可能会告诉您一些事情:
Windows 可能不会立即咬住你,但其他东西可能会。
I guess what you get is undefined behavior. This can range from normal functioning to crashes, kittens being eaten, firstborns sacrificed, &c.
More to the point, some requirements probably tell you a few things:
Windows might not bite you immediately but other things might.
我还没有答案——我自己正在研究这个问题——但我确实遇到了这个:
在 Andrew Whitechapel 的博客 这表明该限制可能不仅仅是程序员使用短缓冲区强制执行的约定。
I don't have an answer yet -- I'm researching this problem, myself -- but I did come across this:
in a blog by Andrew Whitechapel which suggests that the limit may be more than just a convention enforced by programmers using short buffers.