Before an application will be accepted into the Windows Marketplace for Mobile catalog, it must be able to perform all primary and secondary functions while the Microsoft Application Verifier Test (AppVerifier) is running. AppVerifier needs to be configured to detect heap corruption and invalid locks usage, including critical section use. The specific conditions that must be met in order for the application to pass the AppVerifier test are:
By the way, passing AppVerifier is only one step towards Windows Marketplace certification. For the current and complete set of guidelines, you will want to carefully read the Windows Marketplace Application Submission Requirements whitepaper.
Now I’ll describe the application itself and steps for getting started! The Application Verifier tool assesses the stability of an application and detects common programming mistakes. The tool can detect and pinpoint memory leaks, handle leaks, and leaks in graphics device interface (GDI) objects. The tool can also detect some forms of heap corruption.
Application Verifier attaches to an application and performs tests while the application runs. With the tool, you may be able to diagnose subtle problems with an application that would otherwise be difficult to diagnose.
Each test that Application Verifier runs is referred to as a shim. The tool inserts the shim into the code path between the calling function and the intended target function. A shim loads into the process space, and the kernel redirects calls from other libraries to the shim. You might find it helpful to run a shim with a debugger attached to the target device. If a debugger is attached to the target device, the debugger points to the location where the exception occurred, which might be close to the source of the problem identified by the shim.
For a specified application, you can select the shims that Application Verifier uses to test the application. Examples of tests performed by shims for the tool include tests for memory leaks, tests for the usage of specific application programming interfaces (APIs), and tests for memory corruption.
Application Verifier Installation Instructions
1. Install the following prerequisites.
2. Install the Application Verifier Tool
3. Run appverifier32.bat (for 32-bit Host) or appverifier64.bat (for 64-bit Host). Run as administrator on Windows Vista or Windows 7
4. When using the desktop application for AppVerifier on Windows Vista and Windows 7, you must set up a Windows Mobile Device Center partnership with any device you are using with Application Verifier. Otherwise, after any initial connection with the device, subsequent connections will not work.
5. Additional step for 64-bit Only, there is a know issue when using a 64-bit Host OS, the issue is that the files to support App Verifier are not automatically copied to the device as part of the initial configuration. There are 2 possible work-arounds for this issue :-
For additional reference material on AppVerifier, check out the following MSDN reference pages. Even though Windows Mobile 5.0 is specified by these topics, much of the content is still relevant for devices running Windows Mobile 6 and later.
Share this post :
I know this blog is a little bit old, but I'm a Windows Mobile Developer and I follow every step described in this post and I cannot connect to "Application Verifier". The error is "Unable to create a stream".
My system-> Windows XP, Visual Studio 2005 (configurating exactly as in "Step by step: ...")
Follow-up on a previous posting:
Running AppVerifier with WinInet causes a number of "Critical Section" leaks!!! Are these normal? What can I ignore?
Is there a list of what we can ignore and what we can't?
Here's an example that I think might be bogus... Please confirm?
# DESCRIPTION BEGIN
Gives the callstack for a handle that leaked
# DESCRIPTION END
| shim_hleak.dll 69 | 2 nk.exe 88037914'Leaked handle values:
| shim_hleak.dll 69 | 2 nk.exe 88037914'CRITSEC Handle = 0x01c8eb48 ''
| shim_hleak.dll 69 | 2 nk.exe 88037914'CALL STACK
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x29805970 shim_hleak.dll!My_TrackerInsertItem2 + cch
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x29805880 shim_hleak.dll!My_TrackerInsertItem + 24h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x29805ee0 shim_hleak.dll!APIHook_InitializeCriticalSection + 38h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x028fd400 dtpt_lsp.dll!(null) + 5400h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x028ff754 dtpt_lsp.dll!(null) + 7754h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x028fa200 dtpt_lsp.dll!(null) + 2200h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02f8963c autobind_lsp.dll!(null) + 763ch
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02f89b98 autobind_lsp.dll!(null) + 7b98h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02f8a574 autobind_lsp.dll!(null) + 8574h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02f8801c autobind_lsp.dll!(null) + 601ch
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02f84258 autobind_lsp.dll!(null) + 2258h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x0267d284 ssllsp.dll!(null) + 4284h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x0267c110 ssllsp.dll!(null) + 3110h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02619288 ws2.dll!(null) + 2288h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x02619360 ws2.dll!(null) + 2360h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x038ed440 wininet.dll!(null) + 2a440h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x038ed844 wininet.dll!(null) + 2a844h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x038edf48 wininet.dll!(null) + 2af48h
| shim_hleak.dll 69 | 2 nk.exe 88037914'PC=0x03f67818 coredll.dll!(null) + 1d818h
# LOGENTRY shim_hleak.dll 70 'Leaked 1 handles that were allocated at this stack
found solution for my environment -
1. reinstall CETK and APPVerifier
2. do _NOT_ launch appverifier32.bat
3. Replace the Application verifier binaries in the processor folder for the device type. For example, replace C:\Program Files\Windows CE platform builder\5.00\CEPB\wcetk\DDTK\ARMV4I with C:\Program Files\Application Verifier for Mobile 5.0\Armv4i.
I've already spent few days but can't run this tool :(
I try with WinXPSP3 + VS2008(SP1) + WinMobile 6.0 Refresh + 6.5 images.
I've installed .NetFramework 1.1 + CETK + APVerifier tool (use links from steps 1 - 3 above), run appverifier32.bat then.
Then I start APVerifier tool from "c:\Program Files\Windows CE Platform Builder\5.00\CEPB\wcetk\DDTK\DESKTOP\appverifce.exe" , Select ActiveSync as transport, Invoke 'Connect', select default device from the list (cradled 6.5 emulator).
It results in "Unable to enable shine engine" popup error and APPVerifier runs into infinite loop (it eats 50% CPU and can be only removed from task manager)
shim_*.dll; shimeng.dll; appverif_client.exe; vlog.dll; symhlp.dll; htracker.dll files are successfully found at device root, so copying was successfull.
I able to run CETK and connect to device image to retrieve device data as described at Step by Step: Monitoring Resource Leaks Using the Application Verifier Tool for Windows Mobile 5.0 link (Exercise 3), so I assume I set up CETK successfully.
What should I do more to run it?
Thanks for sharing the information. Hopefully this would help me in some way while creating mobile application which i am likely to showcase at the upcoming Forum Nokia developer conference in Bangalore, India on 7th December.
Hi padminirav, can you supply more information on what you have tried?
The "Unable to enable shim engine" error has a number of causes and I think I have convered all of the know issues of these here, so can you supply details like, your host environment, device type, can you unlock the device (using the device security manager), are the files present on the device after initial setup etc.
Another point is that during the initial setup on a device with security enabled you should be prompted to whether the files (appverif_client.exe, etc) can be copied and run on the device, if you do not allow this then you will eventually end up with this error.
So simplistically, this error basically means that the appverif_client.exe and shimeng.dll cannot be loaded by the device, the normal causes of this is that the files don't exist on the device (root directory) or the device does not contain the necessary security certificate ("Stinger" or it's parent). With the workarounds being, manually copy the files and/or use the device Security Manager to disable to security.
Please also note that it is important to load and run the seperate App Verifier installation and then run the batch file so that the correct version of these files are used for Win Phone 6.x)
Main blog and 64-bit version of the appverifier64.bat now available
I am also getting "Unable to enable shim engine" error. I have tried all steps as discussed above. Still not able to resolve. Can any one please help to resovle this? Thanks in advance
Sorry for the delay, there are a couple of minor differences that you will need to follow to enable your App Verifier usage here on XP 64. For your Win 7 setup, if it's 32-bit as long as you follow the instructions it should work (i.e. you need to download CETK 5.0 and the separate App Verifier (actually this is true for all installations (x32 and x64)).
Ok, for your XP 64, (actually any 64-bit installation (XP, Vista or Win7)) here are the additional/changed steps
3) Instead of step 3 of the appverifier32.bat you will need to use the new 64-bit version (should be available shortly), basically this is the same as the 32-bit version, but it registers the values in the Wow6432Node version of the registry (as App Verifier is a 32-bit app)).
5) This step is specific to 64-bit and must ALWAYS be done as there is no work around (without using a 32-bit for initial setup of the device), I’ve also mentioned this in my post on July 29, 2009 at 12:57PM to Jaybo_nomad. You will need to copy the files listed in the registry file to the root directory of the device manually (shim_*.dll; shimeng.dll; appverif_client.exe; vlog.dll; symhlp.dll; htracker.dll) as on a 64-bit host this does not work (known issue).
Once you perform these steps all should be fine, you only need to copy the files once (unless you reflash the device which means they get removed :) ), on a 32-bit OS this copy step happens as part of the initialization, so a potential workaround for this would be to perform the initial configuration on a 32-bit host (I've used the Virtual XP Mode on Win7 in the past for this, before I found these manual workarounds) and after this you can use a 64-bit to configure, collect and view the logs.
The magic change to the bat file is to copy the existing reg add lines and change the reg key to include the WOW6432Node.
eg. reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\CETT\WinCE 5.01\Tools\Application Verifier\shimeng.dll"
I am trying to use CETK 5.0 and AppVerifier on two of my systems. One is XP 64 bit where i am not able to make a connection using app verifier. It gives me error "Connect To device: Unable to launch device exe"
On my Win 7 setup i am not able to find any CE Test kit which is supported. CETK5.0 and CETK6.0 both gave incompatibility error.
Can anyone help me in how can i proceed with App verifier on my these two machines?
Can Application Verifier results be trusted? Im seeing some very large leaks on two simple MS API methods? Please reply on my post in the Programming tools forum.
The champagne bottles are uncorked! The new appverifier32.bat fixes most problems, hooray!
I do notice that emulators which failed to work during my earlier attempts (WM6.5 Pro 320x320) still fail even after an emulator hard reset, but other fresh, virgin emulators are working fine. It appears that some state is maintained even after an emulator hard reset (including the ActiveSync name for the emulator) so maybe this is messing me up.
Now, onto understanding the verifier log messages for an MFC app:
1. Is it true that we can ignore Load/Free library mismatches which originate aygshell.dll, TshRes.dll, and ShellRes.dll, (assuming I'm not doing a direct LoadLibrary)?
2. It appears that linking to WinInet.dll triggers around 16 CRITSEC handle leaks, even if my app hasn't activated any connections. Can these all be ignored?
3. Similarly, ComDlg.dll leaks a CRITSEC handle.
4. It looks like MFC doesn't delete the single instance Mutex handle when CWinApp::ExitInstance(), but this handle will be automatically cleaned up by the system when the app exits.
All of these cases (except #4) appear to be out of my control. For the purpose of passing the Application Verifier test, will leaks of this sort be ignored?
Q1. Does a comprehensive list spurious verifier issues exist?
Q2. The list of issues seems to be non-deterministic, almost as if the app shutdown/cleanup code sometimes executes before Verifier terminates, and sometimes it doesn't. Possible?
Updated blog with new file, appverifier32.bat. Thanks Nev!
Point 6, No this is not true you do not need to run the CETK version to copy over the files, thats what the regkeys in the appverifier.bat are for to redirect them to the new directory.
The unable to stream could be because the version of App Verifier that comes with the CETK is incorrect for 6.x (hence the need to download both the CETK and AV for WM5).
Ok, I stuffed up again :)
1) Yes it should be 5.0 (my fault), a new version is coming soon with some additional "md", rather than simply review a previous one, this time it should be the one that I use. Sorry!
2) One Step forward
3a) "Unable to launch device EXE"
Simplistically, this error is because it can't run (Launch) "appverif_client.exe" on the device, I've seen 2 possible reasons for this
a) appverif_client.exe is not on the device, ie. it didn't get copied for some reason (all the potentially issues with the bat file come to mind here :) ).
* Copy the file manually to the root directory of the device (no need to restart App Verifier again)
* Copy the file manually into the 5.01 directory (as specified in the registry)
* I have seen one instance (did it myself on a collegues machine) where I copied the file but it moved instead. Had to grab it again from another computer. The version that comes with App Verifier for WM 5 or the CETK version is fine (they are the same)
b) There is a problem with the communication link via the Platform Manager, only seen this in the following 2 situations
- The device kept disconnecting (faulty device)
- Trying to run on a 64-bit machine, if you can't use a 32-bit host let me know
...So hopefully, its not this one.
3b) Don't see the emulators
This is correct, the process you need to follow is :-
a) Start the Enumlator
b) Start the Device Emulator Manager
c) Change the settings in ActiveSync or Windows Mobile Device Center to allow connection via DMA
d) Cradle the device (using Device Emulator Manager)
e) You should now be connected
f) Use the "ActiveSync" setting just as if it's a real device from the AppVerifier / Platform Manager
3c) I'll have a look at these sites :)
4) I think see the above steps
5) Possibly, but this error message is only reported if the Desktop app can't talk with the Device (communication issues)
Keep the champagne on Ice :)
Day 3, continued:
6. Point of clarification, is the following true: You must first run and connect to the device with the "Windows CE Test Kit" (which copies files and starts "clientside.exe"), and then separately run AppVerifer.exe?
I tried this sequence using the AppVerifier run via the menu in "Windows CE Test Kit" and got a new error: "Unable to create a stream".
Day 3 report:
1. The updated version of AppVerify.bat STILL has errors in lines 3 and 4. The destination directory "...Application Verifier for Mobile 5.01\..." does not exist. There IS a "Application Verifier 5.0" directory, which perhaps you mean to reference. Note that this problem was pointed out earlier by Javier (or are we all downloading the wrong version of Application Verifier?).
On my Server 2K3 machine:
2. After uninstalling all of the items on this page and then reinstalling them, and then directly running "C:\Program Files\Windows CE Platform Builder\5.01\CEPB\wcetk\ddtk\DESKTOP\appverifce.exe" I now no longer get the "EnableShimEngine Error"! Yippee!!! Progress!!! The champagne bottles are moved to the refrigerator in anticipation.
3. Instead, just like Javier, I now get the "Unable to launch device EXE" error. One thing to note is that after pressing the "Connect" button in appverifce.exe, I only see the following: PocketPC 2003 Device, PocketPC 2003 Emulator, Smartphone 2003, Standard SDK, Windows CE default platform", but NOT any Windows Mobile 5, 6, or 6.5 devices or emulators. But all of the WM 5, 6, 6.5 emulators do show up in the Device Emulator Manager when launched from VS2008. Yes, I have established a partnership with the device.
Also, when we arrive at a solution, somebody might wish to update: stackoverflow.com/.../application-verifier-for-mobile-5-0-cannot-connect-to-my-wm-6-0-device
On my Win7 machine:
4. Here the "Connect" button in appverifce.exe only shows "Windows CE Default Platform" and nothing about WM 5, 6, or 6.5.
5. I still get the "EnableShimEngine Error", but I may have leftover junk from trying to fix the batch file, and will confirm once I remove, delete , and reinstall all of the components.
No champagne yet.
appverifier.bat has been updated as of today.
Thanks for your patience!
Hi Jaybo_Nomad, On the AppVerifier.bat lines, yes you are correct the "Application Verifier for Mobile 5.00" should only be "5.0"
For point b on the shortcut pointint to cetest, you don't actually run App Verifier via the CETK, and there are no shortcuts created to run it...
So what you need to do is to use explorer to go to the new directory "C:\Program Files\Windows CE Platform Builder\5.01\CEPB\wcetk\ddtk\DESKTOP" and run the appverifce.exe from there directly (you can make a shortcut yourself).
Sorry for all of the issues you are having, all I can offer in response is that we are investigating our options to make this process a LOT smoother. But for now you will need these "magic" steps
Hi Jaybo_nomad, Ok, here is a short form response
2) Have you established a partnership? The only time I have seen this behaviour is when you don't. Interesteringly, you don't need to do this on XP (including the new Virtual XP on Win7 (Not sure if it's available externally yet!)
3) Which Emulators are you using? I've used both 6.1 and 6.5 without issues (again creating a partnership on Win7).
4) I have the Office Outlook connector installed on all of my PC's (Vista 64-bit and Win 7 32-bit) and it has ot cause any issues, which release of Win7 are you using (Build 7100 (ie RC))
5) Yes, ActiceSync for both
6) Use Sockets, no not needed (unless you run the Appverif_client in with sockets enabled, but thats another discussion)
7) Yes, once we fix up the typos :)
Regarding "EnableShimEngine Error" again:
I agree with Javier, there are problems with AppVerifier.bat and possibly the installer for Application Verifier. Since I don't know the intent of the batch file, I don't know the definite fix, but...
a. Lines 5 and 6 of AppVerifier.bat refer to "Application Verifier for Mobile 5.00", but the actual directory should be "Application Verifier for Mobile 5.0". (note the single "0")
b. The shortcut points to:"C:\Program Files\Windows CE Platform Builder\5.00\CEPB\wcetk\cetest.exe". Should this be 5.01?
Here are few more clues regarding this problem.
1. I have verified that the shim DLLs get copied to the root directory on the device and emulators.
2. On both the Win7 machine and the Server2K3 machine, I have successfully ran ApplicationVerifier ONCE, AND ONCE ONLY. Thereafter, subsequent attempts have resulted in the "EnableShimEngine Error" message, even after rebooting both the PC and device (which is a VX6800 btw).
3. Emulators have NEVER worked. I always get the "EnableShimEngine Error" message despite verifying that all the DLLs are present, WMDC is working fine, I can run my app via VS2008 and everything else seems normal.
4. The Win7 box for a time didn't start up WMDC. I believe this may have been related to "Microsoft Office Outlook Connector". I began to suspect this was a problem after Outlook began crashing and reading somewhere that MOOC may be the culprit. Since removing this, and reinstalling WMDC, WMDC seems to be working fine again.
5. From the documents, it sounds like ActiveSync should be used for both the Transport and Startup Server, correct?
6. Should "Use Sockets for the client/server communication" be checked? (I've tried both ways without success).
7. "AppVerifier.bat" only needs to be run once, correct?
I'm starting on day #3! Whee!
I followed all of your directions and extra ones I found:
I finally followed a Marty Larson's video on the same topic:
I'm getting this error when triying to connect the app verifier to my devices (I tried in WM 6 PRO Emulator & PPC 2003 device both with security off and both show "connection to device stablished" when setting up the connection):
Connect To Device
Unable to launch device EXE
I have been searching a lot and after all I believe it's because some files are not found, so I reviewed your .bat script and I found that maybe some things are wrong:
-In thrid line you make reference to "Windows CE Platform Builder\5.00" and current version is "Windows CE Platform Builder\5.01"
-In the same line you try to copy all files that match this wildcard: "appverif_client.*" but I searched for those ones and they don't exist, so maybe that's why the connection fail.
Thanks a lot!
Javier Andrés Cáceres Alvis
Blog Personal: speechflow.spaces.live.com
Blog Intel: software.intel.com/.../javierandrescaceres
Hi Jaybo_nomad, no the signing issue is seperate toe the 64-bit problem, however, you should not get the signing issue on the emulators (at least for the new 6.5 images).
Did you follow the instructions marty gave in the linked blog entry (this is essentially the appverifier.bat file above)?
For the copying there are a number of things that cause it, so I'll try and keep it simple for here.
- The reg entries in the appverifier.bat are use to identify the current location of the files that will get copied to the device upon connecting (note the final reg delete is important, if you have run a previous version of App Verifier)
- As part of the CETK, the reg entries are use to create a "Package" (on App Verifier (desktop) startup) that is them copied to the device by the CETK Platform Manager.
If you have had a successful connection and copy to the device you should see the following files in the root directory of the device
shim_*.dll; shimeng.dll; appverif_client.exe; vlog.dll; symhlp.dll; htracker.dll (i.e. all of the files listed in the reg entries).
It is possible that the current reg entries point to a location that does not exist and therefore no files are copied over (There are a bunch of potential errors which App Verifier Desktop swallow that would be useful for this).
You could resort to manually copying these files into the root directory of the device (or image) if they are not present.
Let me know.
Regarding "EnableShimEngine Error", no I'm running only 32 bit versions of Server 2003 and Win7, yet the problem happens with both physical devices and emulators. So that rules out signing issues, correct?
What triggers Shimeng.dll to be copied onto the device / emulator, and how can I verify I've got the right version on the device / emulator? This seems to be a common cause of the problem (see: www.pocketpcjunkies.com/.../Unable-to-enable-shim-engine)
Hi Afriza, As part of the connection process when connecting with a Device App Verifier uses the registered "Platform.Manager" COM object. (For reference VS 2005 does not include a Platform Manager you need to install either Platform Builder or the above mentioned CETK (CE Test Kit for Windows Mobile 5)).
In terms of switching to the version mentioned in the article, the easiest approach might be to install the CETK on top of your existing installation (Disclaimer: I have not attempted this) and *hopefully* this will reset the COM registry to the newly installed Platform Manager.
Before trying this, however, have you tried to use the version that comes with eVC++, all the Platform Manager is used for is to establish a communication channel with the device to enable the copying, starting and communication with the device?
There are a number of possible causes for this problem, the normal causes are :-
1) You are using a 64-bit host OS (Win7 / Server 2003 in your case), there is currently a problem with using the available version on a 64-bit Host where the files are not copied to the device as part of initialization.
2) The shimeng.dll is signed with the "Stinger Certificate" and not all Retail / OEM devices come with this certificate installed, disabling Security (by setting to "Security Off"), normally gets around this problem (Using the Device Security Manager that comes with VS 2008 or by downloading it from MSDN).
As your also having issues with a Device Emulator, I suspect it's the first problem? Is this correct?
I've just wasted a day trying unsuccessfully to get Application Verifier running. On two machines, (one with Server 2003 and one with Win7 and a hodgepodge of installed WinMobile SDKs besides WM6 on each machine) I'm getting the same error when trying to connect with Applicaiton Verifier: "EnableShimEngine Error" "Unable to enable shim engine on device". This is happening with both emulators and physical devices. Is there some additional magic incantation I need to perform beyond the instructions listed above?
I have both eVC++ 4 and VS2005 Pro installed in my computer. when I want to connect to a device from AppVerifCE.exe, Platform Manager (a dialog to choose a device) that pops up is the one from eVC++ instead of VS2005. What should I do to change this behaviour to pop up VS2005's Platform Manager instead?