wxWidgets wxWinCE 挂起-恢复崩溃 (VC++)

发布于 2024-12-21 23:53:33 字数 1417 浏览 7 评论 0原文

我遇到了一些 Windows CE 5.0 设备的问题,这些设备从待机(挂起)状态恢复后几乎立即崩溃。我已将问题压缩为大约 15 行 C++,以便简单地让 wxWidgets 显示消息框,如果我执行以下操作,问题就会出现:

  1. 启动应用程序
  2. 挂起设备(我的意思是短暂按下红色电源按钮)
  3. 恢复设备
  4. 按消息框标题中的“确定”按钮。
  5. BOOM

在我将其浓缩之前,这个问题以许多其他方式表现出来 - 加载位图、扫描条形码、所有这些都被暂停然后恢复。

我使用的是:

  1. Windows CE 5.0 Professional(Motorola MC3090 设备) (还有 WM 6.5 (MC55)、CE 6.0 (MC3190))
  2. Visual Studio 2005 SP2
  3. wxWidgets 2.8.10
  4. Microsoft Windows CE 5.0 Standard SDK

显示的实际错误是零星的且范围广泛,但主要是访问冲突,通常在开始附近函数调用的地址(通过挂起设备、恢复然后在设备上附加 VS 调试器来发现这一点)。在对此进行了大量的功课之后,我读到了一些建议,这可能是发生了某种堆损坏。只要应用程序不挂起,它就始终可以在所有正确的 SDK 和设备组合上正常运行。

我还尝试了以下 SDK:

  1. MS Pocket PC 2003 SDK
  2. 适用于 MC3000c50a 的符号平台 SDK
  3. 适用于 MC3000c50b 的符号平台
  4. SDK Windows Mobile 5.0 SDK
  5. Windows Mobile 6.0 SDK

我测试了以下设备:

  1. MC3090 (Windows CE 5.0) - 同样的问题
  2. MC55 (Windows移动版 6.5) - 同样的问题
  3. MC3190 (Windows CE 6.0) - 使用 StandardSDK 构建的设备上不会出现问题

我对 wxWidgets 的设置进行了过度的尝试,总是确保我将应用程序与正确的相应 SDK 链接起来。

这是导致此问题的代码:

#include "wx/wxprec.h"
class Application : public wxApp {
public:
    virtual bool OnInit();
};

bool Application::OnInit() {
    wxMessageBox(L"Test");
    return true;
}

IMPLEMENT_APP(Application)

任何人提供一些建议,我将永远感激不已!如果我遗漏了任何重要细节,也请告诉我。

I have an issue with a few Windows CE 5.0 devices which are crashing virtually as soon as they resume from standby (suspend). I have condensed the issue down to about 15 lines of C++ to simply get wxWidgets to display a message box, and the problem will hit if I:

  1. Start the app
  2. Suspend the device (by this I mean pressing the red power button briefly)
  3. Resume the device
  4. Pressing the OK button in the message box title.
  5. BOOM

This problem manifested itself in many other ways before I condensed it down - on loading a bitmap, on scanning a barcode, all once it has been suspended, then resumed.

I am using the following:

  1. Windows CE 5.0 Professional (Motorola MC3090 device)
    (also WM 6.5 (MC55), CE 6.0 (MC3190))
  2. Visual Studio 2005 SP2
  3. wxWidgets 2.8.10
  4. Microsoft Windows CE 5.0 Standard SDK

The actual error that is displayed is sporadic and wide ranging, but mostly an access violation, typically near the start address of a function call (discovered this by suspending the device, resuming then attaching VS debugger on the device). Having done extensive homework on this, I've read some suggestions it may be some kind of heap corruption occurring. As long as the app doesn't suspend, it always works correctly across all correct combinations of SDKs and devices.

I have also tried the following SDKs:

  1. MS Pocket PC 2003 SDK
  2. Symbol Platform SDK for MC3000c50a
  3. Symbol Platform SDK for MC3000c50b
  4. Windows Mobile 5.0 SDK
  5. Windows Mobile 6.0 SDK

I have tested the following devices:

  1. MC3090 (Windows CE 5.0) - Same Problem
  2. MC55 (Windows Mobile 6.5) - Same Problem
  3. MC3190 (Windows CE 6.0) - Problem does not occur on this device with StandardSDK build

I have played excessively with the setup of wxWidgets, always making sure that I link the app with the correct corresponding SDK.

Here is the code that causes this problem:

#include "wx/wxprec.h"
class Application : public wxApp {
public:
    virtual bool OnInit();
};

bool Application::OnInit() {
    wxMessageBox(L"Test");
    return true;
}

IMPLEMENT_APP(Application)

Anyone with some advice out there, I would be eternally grateful! Please also let me know if I have left out any important details.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫竹語嫣☆ 2024-12-28 23:53:33

您是否从 SD 卡运行该应用程序?至少,MC3090(我认为 MC55 也是如此)默认情况下符合附加总线的 Windows CE 标准(最初为 PCMCIA 卡定义):当您挂起和恢复设备时,所有总线都会重置。这会导致卡暂时消失,并且卡上打开的所有文件句柄都将失效。这实际上是为了让设备能够在设备挂起的情况下处理用户换卡的情况。

Windows CE 是一个按需分页操作系统。您的程序在启动时并未全部加载到 RAM 中:相反,页面仅在程序引用时从可执行文件和 DLL 加载。任何只读或未修改的页面都可以随时被操作系统丢弃,因为它可以从原始程序文件中重新读取它们(这就是为什么在程序运行时你的程序文件不能被覆盖)。如果 EXE 或 DLL 的句柄无效,并且引用尚未加载(或已丢弃)的页面,则操作系统页面错误处理程序无法读取该页面,并会生成访问冲突异常。

对于 MC3090,您可以将 SD 卡驱动程序配置为在从睡眠状态恢复时不“删除”该卡。请参阅 Symbol 的知识库文章 MC30xx CE5.0 - 应用程序中止使用SD卡时随机了解详情。我找不到有关如何在 MC55 上执行此操作的详细信息。在MC70上,系统控制面板中有一个“SDSwitch”小程序,其主要功能是在存储卡和SDIO模式之间切换,但它也有一个复选框来控制此选项。其他一些设备在 \Windows 文件夹中有一个“密封的 SD 插槽”CAB 文件 - 我似乎在 MC65 或 ES400 上记得这个。

Are you running the application from an SD card? The MC3090, at least, and I think also the MC55, conform by default to the Windows CE standard for add-on buses (defined originally for PCMCIA cards): that when you suspend and resume the device, all buses are reset. This causes the card to momentarily disappear, and all handles to files opened on the card to be invalidated. This is actually so that the device can deal with the user changing the card while the device is suspended.

Windows CE is a demand-paged operating system. Your program is not all loaded into RAM when started: instead, pages are only loaded from the executable and DLLs as they are referenced by the program. Any read-only or unmodified pages can be discarded by the OS at any time, because it can re-read them from the original program file (this is why your program file can't be overwritten if the program is running). If the handle to the EXE or DLL is invalidated, and you reference a page that hasn't been loaded (or has been discarded), the OS page fault handler can't read the page and it generates an Access Violation exception.

For the MC3090, you can configure the SD card driver not to 'remove' the card on resuming from sleep. See Symbol's KB article MC30xx CE5.0 - Application aborting randomly when using SD Card for details. I can't find details of how to do this on the MC55. On the MC70, there was an 'SDSwitch' applet in the System control panel, whose main function was to switch between memory card and SDIO mode, but which also had a checkbox to control this option. Some other devices have had a 'sealed SD slot' CAB file in the \Windows folder - I seem to recall this on the MC65 or ES400.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文