Mobile Compact Framework 2.0 Install unsuccessful

2019-08-31 22:43发布

问题:

I recently upgraded a VS2005 solution for a WinMobile5 app to VS2008. The solution also contains a CAB builder project plus an MSI Desktop Installer project. A custom DLL from the installer takes care of deploying the app plus supporting CABs, like Compact Framework 2.0, scanner libraries, etc to the actual device.

I used this article as a guide for MSI installation:
http://msdn.microsoft.com/en-us/library/aa446504.aspx

Problem is, the CF2 CAB won't install successfully to a WM5 device from Win7 when running the Setup.exe / MSI file. However, installing from XP works fine.

Summary:

-Windows7 32-bit machine - VS2008 / WM6 SDK (includes WM5 support)
-Symbol WM5 Device - MC70
-Windows Mobile Device Center
-Created Desktop MSI to install CF2 CAB plus my app's CAB thru Custom DLL
-During install (running as admin) my app's CAB install successfully, the CF2 CAB says "Installation was unsuccessful"
-However running/debugging the app from VS2008 will deploy CF2 correctly, so it CAN work.

Interesting tidbit:
I pulled back the funky CF2 CAB from the device to compare with source, located here:

C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\wce500\armv4i\NETCFv2.wm.armv4i.cab

To my surprise, the device CAB had two HEX bytes different than the source. From beginning:

4D 53 43 46 00 00 00 00 68 48 (from Pullback) rest is same
4D 53 43 46 00 00 00 00 50 22 (from Source) rest is same

When I replace the "68 48" CAB with the "50 22" CAB and launch manually on the device, it installs nicely. So my question, is: Why is the source cab slightly altered once it reaches the destination device? Other than that, the files are identical.

Other things I've tried:
From scratch creating a small App targeting WM5/CF2. Adding a CAB project, adding a Setup & Deploy project. Run Setup from XP, great! Run Setup from Win7, BOOM!

/Device root does not contain a CF2 Install Log. Doesn't get that far.
VOLATILE/Setup.log contains no "error".

I've also tried the UberCab approach (bundling multiple CABs into one CAB). However, when unbundling on the device: BOOM fail. It somehow knows.

I'm at my wit's end. The CF2 piece should just work.

-Tom

回答1:

Looking back at my source code for the CAB installer SDK, I see that the start of the CAB is a fixed-size header. The first DWORD is a CAB signature (0x4643534d little-endian) like you see. The second DWORD is a reserved set, which in your case is all zeros. The next DWORD is the size of the CAB - you're only showing the lower word, but the difference is nearly 10k (0x4868 - 0x2250 = 0x2618). That is likely causing the CAB decompressor to fail because it's looking for data past the end of the file.

Now why that's changing I don't know. You've verified the source for the CAB in the MSI? Have you openened the MSI in another tool and pulled out the CAB to see if it's right in there? Basically is the CAB wrong at the source side (most likely I think), or is it getting modified when moved?