Thursday, 31 January 2008

Cab Installation Debugging Issues

Having problems with CAB files installing on devices; remember a detailed XML log of the installation process can be found on the device under:

\Application Data\Volatile\setup.log

Unfortunately this doesn't include information about available memory and file system usage on the device at the time of installation but it can be useful for debugging purposes especially for registration of DLLs and read only files failing to be copied over.

Thursday, 24 January 2008

Using custom DShow filters without registering DLLs

If you are creating a media application or utility that requires a DMO or DShow filter but instead of having clunky separate dlls that may need code signing and/or registring with DShow, did you know that you can embed the filter within your main application.

For example for a source filter you can specify a new class and base it on the DShow components you require:

class MySourceFilter : public CSourceStream
MySourceFilter( HRESULT* phr, LPCWSTR pName);
virtual ~MySourceFilter(void);


When you create your filtergraph you can use AddFilter to add an instance of your class:

// Create and add new source filter
m_source = new MySourceFilter(NULL, &hr);
hr = m_pGraph->AddFilter((IBaseFilter*)m_source, L"Source");

Simple as that!

You don't need to support the registration or have registry files to allow DShow to find your filter as you've explictly added it yourself.

Thursday, 10 January 2008

Configuring MSI installers for Vista

When creating an MSI installable project (could be for your new Windows Mobile / Windows CE CAB project), you may encounter a problem with security on Vista, the error :

"The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2869."

To get around this I use the following in a PostBuildEvent on my PC installer project in visual studio 2005:

cscript.exe "$(ProjectDir)..\..\scripts\CustomAction_NoImpersonate.js" "$(BuiltOuputPath)"cscript.exe "$(ProjectDir)..\..\scripts\WiRunSQL.vbs" "$(BuiltOuputPath)" "INSERT INTO `Error` (`Error`, `Message`) VALUES (1001, 'Error [1]: [2]')"

You will need

- cscript.exe (provided in Windows XP)
- CustomAction_NoImpersonate.js (see Aaron Stebner's site for more information )
- WiRunSQL.vbs (Windows Installer Software Development Kit SDK)

Thursday, 3 January 2008

Making an MSI to install PPC/SP Cab files

Want to install your mobile application from your PC with your PDA connected via active sync but not sure how to do it?

Visual Studio 2005 includes all the tools to be able to create an installable CAB file for your PocketPC device but making the link between a PC MSI file and this CAB file isn't obvious.

It can be done by creating a PC installer that first installs your .CAB file on the PC, then afterwards launches small VB/C# app which invokes the Windos CE App Manager. This pushs the CAB file down onto the device either now or on next connection.

The basics of this and the VB/C# launcher can be found on MSDN:

Note this is for VS2003 which didn't include as rich a set of project types, check out which is written for VS2005, very handy!

Note for Vista you will need to alter the security properties of the MSI file as it will not have the correct permissions to launch the Windows CE App Manager (or Vista Mobile Device Center as its known). This is a command line operation, i'll detail this in a later post!