wxWidgets wxWinCE suspend-resume crash (VC++) - visual-c++

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:
Start the app
Suspend the device (by this I mean pressing the red power button briefly)
Resume the device
Pressing the OK button in the message box title.
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:
Windows CE 5.0 Professional (Motorola MC3090 device)
(also WM 6.5 (MC55), CE 6.0 (MC3190))
Visual Studio 2005 SP2
wxWidgets 2.8.10
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:
MS Pocket PC 2003 SDK
Symbol Platform SDK for MC3000c50a
Symbol Platform SDK for MC3000c50b
Windows Mobile 5.0 SDK
Windows Mobile 6.0 SDK
I have tested the following devices:
MC3090 (Windows CE 5.0) - Same Problem
MC55 (Windows Mobile 6.5) - Same Problem
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.

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.

Related

Why does latest Android Studio emulator crash or get stuck

Since I upgraded my Android Studio installation to Bumblebee, the emulator has become unusable. It either crashes during startup or gets itself stuck so that the UI is unresponsive and the debugger either cannot install or cannot launch an app. The way in which it fails varies from time to time for no reason that I can understand. although different virtual devices seem to behave differently. I tried deleting my old virtual devices and creating new ones, but that didn't help.
I can't debug my code on a real phone because of a different problem, see my recent answer to Source code does not match the bytecode for Android's View.java.
When it crashes I send a crash report to Google, but they don't seem to be fixing it. The problems started with the first official Bumblebee release 2021.1.1, which seemed to have a complete new version of the emulator, and I'm now on the latest stable version 2021.1.1 Patch 2.
My environment is a Dell Precision M4800 with 16GB of RAM and an 8-core Intel processor, using an external 4K monitor and an external full-size keyboard, running Linux openSUSE Leap 15.3 with all recommended patches installed.
Does anyone have any suggestion short of throwing away my entire Android Studio installation and reverting back to Arctic Fox? Has anyone else seen similar problems?
Tintin's answer didn't work for me: Device Frame wasn't enabled anyway because I had noticed that it had caused problems before.
However the following sequence rather surprisingly, at least to me, did fix the problem.
First make sure that the toolbar is visible at the top of the emulator window: if it isn't, click on the gear settings icon at the top right of the emulator window and enable Show Toolbar.
Start up an emulated virtual device, and before it crashes click on the three dots at the right hand end of the toolbar: this will bring up the extended controls window.
Choose Settings from the list at the left of the extended controls list.
Set the OpenGL ES renderer to Desktop native OpenGL, and the OpenGL ES API to Compatibility (OpenGL ES 1.1/2.0).
Close the extended controls window and then close the Android Emulator window.
Check if there are any zombie emulator or qemu processes still running. If there are, kill them: you'll need kill -9 on Linux.
Try to cold boot an emulated virtual device: it will probably crash before it even gets started up properly.
Close the Android Emulator window and repeat step 6
Try to cold boot an emulated virtual device again, but click on the three dots quickly before it crashes.
When the extended controls list comes up, choose Settings from the list at the left.
Set the OpenGL ES renderer back to SwiftShader, and the OpenGL ES API back to Renderer maximum (up to OpenGL ES 3.1).
Repeat steps 5 and 6.
Now try to boot up an emulated virtual device again. It should work: at least it does for me.
If it doesn't work on your configuration, try all possible combinations of the OpenGL ES settings: you may find one that works.
Logically, changing the OpenGL ES settings and then changing them back again shouldn't do anything, but it does. My guess is that perhaps some needed bit of initialisation for the OpenGL isn't being done by the installer, but it gets done when you change the configuration.
I also faced this problem in both updates in 2021.1.1 it was not working at all. Updated to patch 2 again faced problems turned off Enabled Device Frame it is working OK now

Screen capturing based on Windows Magnification API fails on Windows 7 64 bit With Aero theme disabled

I'm trying to capture the desktop screen using Windows Magnification APIs based on code sample given in https://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library?msg=5570528#xx5570528xx.
The program (32bit executable) works pretty good on Windows8 and Windows10 but fails on Windows7 OS. I compiled the program into 64bit and the behavior is same even for the sample program mentioned in the above codeproject thread.
After debugging I figured out that the MagImageScalingCallback function returns image width and height as 4*4 instead of my monitor's size and that causes the program to crash or capture a blank screen on Windows7 machines (reference: https://learn.microsoft.com/en-us/windows/desktop/api/magnification/ns-magnification-tagmagimageheader).
All the API calls (MagInitialize, CreateWindow, MagSetWindowFilterList & MagSetWindowSource) are successful. There are no API call failures or mistakes in the code flow in terms of Initializing creating, setting desktop area & assigning filter list.
DWM (Aero theme) is turned off (as per reference: https://learn.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback)
I couldn't find any resources related to this topic even after researching for about 3 days. I have to use Magnification APIs because I have the need to capture windows that stays behind other windows on the desktop.
Any help would be appreciated.
Update 1:
I figured out that the application is able to capture the screen only when Aero theme is enabled and that contradicts with the statement in https://learn.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback.
I'm not sure how could I make it work on Operating systems with Aero theme disabled or not available by default.

Webcam setup and usage on Windows CE

I am attempting to get a Microsoft HD-3000 webcam working on Windows CE 4.2 and 6.0.
I have given up with 4.2, but 6.0 certainly looks possible with DirectDraw and the DDrawCameraTest.exe app that can be built from the CE 6 dev environment in VS2005.
I have used a codeplex usb webcam driver (https://cewebcam.codeplex.com/) which detects the camera fine (and I checked the entries are added to the registry), but from the debug info when I run the DDrawCameraTest.exe the process aborts at the following step:
hr = g_DShowCaptureGraph.RunGraph();
where hr is an instantiation of CCaptureFramework.
This obviously means I do not have the directdraw video capture component of CE installed on this particular image, but I do not have control of that.
Question - How can I either install directdraw video capture components to CE 6 on the device (CAB installer etc.) OR can I access a webcam without directdraw?
You may access the camera without DD by calling the driver's IOCTLs directly.
Drivers must support some specific IOCTLs to be able to be accessed from DD and those are documented on MSDN (I don't have a link at the moment and MSDN links change so fast that a google search looking for IOCTLs implemented by the webcam driver may be the best way to find the information you need :))

WinMobile emulator input issue in Windows8.1

I'm trying something very different. We have legacy Windows Mobile programs that we need to run on Windows 8.1 tablets with capacitive screens. To do this we've installed the stand alone Windows Mobile 6.1 Emulator which runs without a problem. Doing this, we can load and run our old Windows Mobile programs on the 8.1 Tablet and they run well but we are having problems with the touch or mouse click. The emulator is meant to be used with a mouse button to select and click not a touch screen. When we run our old programs we have to double-tap in order to select anything. This is not a problem until we try to enter text from the emulator keyboard. We have to tap each key twice in order to enter a character. This becomes very tiresome and makes the legacy program useless. Our legacy Win Mobile program was designed to allow our field people to collect large amounts of text and numeric data. Having to tap each key twice will not work.
We've examined the limited mouse and touch option in Windows 8.1 and nothing seems to help. So here are my questions:
Is there third party software that may improve on Windows 8.1 mouse customization? Synaptic maybe?
Is there a command line switch for the emulator we could add that would fix this problem?
Does anyone know of a method to fix this?
Thanks
I have asked this question to MS support.
http://www.microsoft.com/en-us/download/details.aspx?id=17284
System Requirements:
Supported Operating System
Windows Server 2003 Service Pack 2, Windows Vista, Windows XP Service Pack 3
Windows Mobile 6.5 Developer Tool Kit is not supported by Windows 8.x
My Double click test video
http://youtu.be/0QIilCg1kxg
I think the problem is in Windows 8 touchscreen API driver, I have tested this emulator with Win7 tablet, no problems with double click.

Remote Control WinCE 6.0 device from Windows 7

I am trying to find out a tool to remote control a Motorola MC3190 device running Windows CE 6.0 from a Windows 7 machine.
I have already used Mymobiler with Intermec CN3 device so I tried the answers in this question but I am unable to get it to work.
I have tried both remote.exe.40 and remote.exe.50 in the Mymobiler folder
Using Task Manager on CodeProject mentioned in a question on superuser it seems remote.exe completes execution very quickly (or is crashing silently).
My Start/Programs menu has a MyMobiler entry, so somewhere along the line something seems to have got installed
But when I run Mymobiler on desktop it cannot connect, its icon in system trey remains gray and on mouse hover says Not Connected/
In Proof MyMobiler works for WinCE video the processor is ARM920T-PXA270M while my device has a Marevell, PXA32X-P (link to image) processor could that be the reason?
I have also tried ActiveSync Remote Display from Windows Mobile Developer Power Toys. It installs but at start up it shows an error box with message "The OS or CPU of this device is unknown to this application"
How do I get MyMobiler to work with Motorola MC3190 device running Windows CE 6.0?
Is there any other tool, preferably free, to remote control this device?
EDIT: I came across EveryWAN and found an installer. It works out of box, but it is not available for commercial use and the web-site seems defunct.
PS: I realize the tags are not accurate but I wanted to use something that will attract attention of experts in these similar tags.
I want to clarify one answer to the above which is correct. When using the Microsoft PowerToy activesync remote display, there must be an application on both sides - host(the phone) and remote (the pc). The same is true for MyMobiler.
Install the powertoy on the pc.
For the original Poster: This is what your error message means:
In the case of Activecync Remote display, for newer devices (anything above ARM4 cpus - which means, 2008 and up, or over 200mhz cpus - as a very general guide), the display software cannot detect what type of device you have (it's too new, and not in the list).
For the motorola mc3190, your cpu is arm5 compatible,
and should work with software that has arm4 compliant components. ARD does have arm 4 options. see here...
To Fix it:
You must use file explorer on your pc, and navigate into the application folder: c\Programs...\Windows Mobile Developer...\ActiveSync...\Devices\wce400\armv4t and copy the two files.
While still on the pc, you must then navigate to the Windows folder of the device (with activesync running, OR the phone configured to be seen as a hard disc), use explorer on the PC to navigate to the device.
Vaguely, it will look like this:
Explorer. > Device (such as HTC Phone:)
Or, X:\ , where x is a drive letter.
The first subfolder your select should be Windows. Paste the two files there.
The two files are now copied onto the phone.
At that point, you must, using the phone, load it's file explorer and navigate to that Windows folder on internal memory and manually run cerdisp2.exe that you have now copied there.
With activesync running, and the phone connected to the pc,
You can now run the powertoy active remote display on the pc, and it will communicate with the exe that is running on the phone.
ActiveSync on Xp, or Windows Mobile Device Center on Windows Vista/7/8 must be running for this all to work.
Alternately, the app allows for a networking ip connection instead of activesync, but I have not used it.
When you are done using this app, you must run the kill.exe on the phone, in the windows folder (the second file you copied), to unload the dll that is running.
I can verify this setup works on Xp, Win7 and Win8 - with an Xscale ARM11 528mhz cpu phone.
For MyMobiler, visit their site and get the newest version.
It WILL fix connections that fail, if you have the older version. It's free. They don't support it anymore.
My Mobiler must have activesync running and showing the device connected.
My Mobiler is vastly superior to ActiveSyncRD.
* It will automatically install the pc side app, and push the remote app to the phone, via activesync.
*Further, when activesync is running and anytime you connect the phone, the MyMobiler app will autoload on the phone as well.
That way, whenever you run MyMobiler on the desktop, it will connect to the phone and load right up.
*My Mobiler allows full resolution display, while ARD is limited to 320x400 or similar. 640x800 looks much better.
*MyMobiler also allows full mouse gesture sends, and copy and paste. ARD offers very limited mouse gesture compatability.
MyMobiler also allows IP connections, but they indicate this is slower.
I am now using MyMobiler with Win8 and a touchpad w/ multitouch, and the mouse gestures send very well.
For Windows V/7/8, you might need to run compatability mode on the Mymobiler.exe file. Navigate to the MyMobiler folder, which might be on your desktop. Drill down til you find the exe. Right Click and chose properties. Compatability. Run Compatability Mode for this file, and select XP.
More Notes:
These apps are slow, because USB is slow.
If you enable Fast USB on the phone, it will help speed up any Remote Display noticeably - however Fast USB is unstable, and doesnt work on some configurations. For me, it doesnt work on XP, but does on Win8 - though slightly unstable at times.
On the device: Start> Settings Icon>Connections icon >USB to PC icon. Tick box to enable.
Also, MyMobiler on Win8 will sometimes refuse to connect. Fully unload mymobiler, disconnect the phone, reconnect the phone and watch for activesync to confirm connection. Then reload mymobiler. Sometimes full system reboots are needed, but that's rare.
Windows Mobile Remote Controller app on CodeProject - as linked above, looks excellent. It's for Windows Mobile 7 and 8 - which is fantastic. He provides a rapi enabler to allow use with WinMo 6 / 6.5 devices, which also looks promising.
I've never used MyMobiler, so I can't help there, but how about other options?
Did you look at the Windows Mobile Remote Controller app on CodeProject?
I've had good luck in the past with SOTI's Pocket Controller. It once was free, or had a free version anyway. Not sure if they still do.
Windows CE came with a tool called CERDISP (short for CE Remote Display), which could be built with Platform Builder. I've seen it available as a binary download (like here, for example) on the web before, so no need to actually build it yourself.
I've used MyMobiler (remote.exe.50) on my Windows Mobile 6.5 handheld. It sounds like you got it running. Did you run the MyMobiler client on your Windows 7 box and connect to your handheld by IP address? (Right click on the icon in the Notification Area on Windows 7 and choose "Connect IP...".)
It defaults to the ActiveSync address (169.254.2.1?), so if you're not docked and running ActiveSync, it will fail to connect initially (but manually connecting should work). Misread -- you were able to run the client, but not the server.
You can also elect to run a VNC server on your handheld and use a regular VNC client to connect to it. I've built this one for Windows Mobile 2003 without much of a hitch on Visual Studio 2008. You might have similar luck with Windows Mobile 6.5.
EDIT: If you get the message that reads:
'%s' is not a valid Pocket PC application.
when running the MyMobiler client, then that means that your CPU type (or OS) is incompatible with the application -- so I don't think your PXA32X-P is to blame; especially since the MC3190 appears to be able to run Windows Mobile 6.5 (i.e. the CPU should be "fairly" modern, with support for armv4i). But since you haven't mentioned an error that looks like that, I'd suspect that your build of Windows CE 6.0 doesn't contain all the required dependencies.
The first thing I'd check is if all of the dependencies of MyMobiler are present in your build of Windows CE 6. Windows CE is highly customizable; as such, not all software components will be the same across different builds of Windows CE. MyMobiler is built targeting Windows Mobile, not Windows CE, so there's a good chance that your build of Windows CE on the MC3190 doesn't have what's required, while the video you linked does.
With regards to the ActiveSync Remote Display Power Toy, the message that you received sounds like the desktop application didn't know what version to deploy to your device.
Per readme.txt in the ActiveSync Remote Display package:
If you see error message "The OS or CPU of this device is unknown to
this application", it usually means the CPU type of the current
device, typically a Windows CE device, is not recognized by this tool.
The workaround is
1. Find the CPU type of the device (from the manual or the manufacturer).
2. Copy \Devices\wce400\\cerdisp2.exe to the \windows folder of the device.
3. Run "cerhost2.exe -m" on the desktop/laptop.
4. Run cerdisp2.exe on the device.
5. When the remote display is no longer needed, terminate cerdisp2.exe on the device.
You should be able to choose the armv4t version; if not, use the armv4 version.

Resources