1

我正在编写一个使用第三方 SDK (OCX) 的应用程序。我在 C# 中使用 SDK,它工作得很好。但是,我可以使用 Delphi 2007 中的 SDK 中的相同对象创建最简单的测试应用程序,并且它可以编译,但是当它到达某个点时,在同一台机器上会出现 BSOD。我已经运行了一些其他使用 SDK 的测试应用程序并且它们运行正常,所以我知道 SDK 安装正常并且运行正常。

我从事的其他不使用此特定 SDK 的 Delphi 项目可以正常运行。

有关如何尝试解决此问题的任何想法?我可能需要删除我在 Delphi 中安装的 OCX 并将它们添加回来吗?你是怎样做的?

4

4 回答 4

3

很不寻常的问题。基于 Windows NT 的操作系统通常非常擅长包含用户应用程序内部环 3 处发生的故障。有问题的 SDK 是否通过内核级驱动程序与硬件交互?另外,系统蓝屏时屏幕上会出现什么信息。有时这是关于问题性质的线索(例如,中断处理程序重入问题、硬件故障、中断冲突)。我有时会在 Dialogic 板上看到这种类型的问题。该问题也可能是与驱动程序无关的内核级故障。

如果没有更多细节,除了推测原因之外,很难做更多的事情。我倾向于认为这不是 FPU 控制字问题,但我可能是错的。FPU 控制字问题可能会导致异常,但异常需要发生在关键执行上下文中,例如操作系统不会捕获和处理的驱动程序。

FWIW 我在 Delphi JNI 库中看到了导致 JVM 和主机应用程序崩溃的 FPU 控制字问题。修复方法是使用代码显式包装调用,以更改和恢复 NineBerry 建议的控制字。如果应用程序不是多线程的,则此方法有效。

于 2009-06-02T03:04:34.233 回答
2

It turns out this was caused by Kaspersky antivirus. I tracked it down by running Windbg against the crash dump and it pointed to kl1.dll. After searching around I tracked down this article which identified it as Kaspersky. I disabled Kaspersky and the BSOD no longer occurs.

于 2009-06-02T10:36:23.080 回答
1

浮点异常有可能导致问题。大多数运行时环境禁用浮点异常,但在 Delphi 中,它们是启用的。

禁用浮点异常,使用以下代码:

Set8087CW($133f); 

请注意,这也会改变您自己代码的行为。如果浮点计算出现错误,您将不会再遇到任何异常,而是将结果变量设置为 NaN、Inf+ 或 Inf-。

于 2009-06-02T00:53:19.960 回答
0

Just because you can use the SDK fine from other applications doesn't inherently mean that it doesn't have a problem. It may be reacting badly to certain data items or even to items that shouldn't exist--assuming the contents of memory that doesn't formally contain anything.

I'm sure you've run into bugs caused by uninitialized data items that simply get whatever value was in memory, something like this could be going on with the data area in question being passed in. (Say, a padding byte in a record structure...)

于 2009-06-02T03:49:17.687 回答