Friday, January 27, 2006

Changing the dialog bitmap of an MSI setup.exe

Recently i face one problem within the Installshield Developer 10.5 suite from Macrovision.
For MSI project, there is no way to specify the Cool Bitmap that you want to be displayed during the decompression stage when running a self extract setup.exe file.
At this stage the self extract installer decompress the MSI file, optionnaly copy this file in the Windows Installer Cache folder. The left banner image is the default one provide by Macrovision and in many cases this graph is ugly and didn't match the logo of your product or company.

The easyest way is to use existing Resource Editor. The smallest and best one so far is
ResHacker available here

1 Run it and select the setup.exe which is the self extract msi generated by Install shield
2 select GIF -> IDR_GIF1 -> 1033
3 Right click and choose replace resource
4 open file with new resource
5 select installshield\dist\Bitmap\MyNewBitmap.gif with the exact correct size
6 Change Field

resource type:GIF
Resource name:IDR_GIF1
Resource Language:1033

7 Click on Replace
8 Go to File and Save


that's all folks !

Using Event to Intercept Message across process

the CF is paired down due to memory constraints, and a lot of functionality was lopped off because a workaround was typically available. But when dealing with multithreaded code, waiting with a timeout is a fundamental operation.

There is a great class to let you FireEvent between different process and trap them within a c# application. Visit Trey Brain blog at He write his own, properly functioning ManualResetEvent. As describe by MSDN the required api functions: CreateEvent ( creates the event ), SetEvent ( sets the event to signaled ), ResetEvent ( resets the event back to unsignaled ), WaitForSingleObject ( waits for an event to become signaled, with the ability to return after a timeout period ), and CloseHandle ( kills the event ).
Unfortunately it is not possible to wait for multiple object using win32 p/invoke so the cient applciation will have to create a listener thread for each event and use waitforsingle object.
So this class that he wrote provide some p/invoke code, and it worked fine on any Windows Mobile 5 phone running compact framework 2. Autoreset event didn't work properly. After some research ( dumpbin of the exports for coredll.dll ), it turns out that coredll.dll does not export the SetEvent, ResetEvent, or PulseEvent api's. Rather there's a new function called EventModify that takes an event handle, and an operation flag ( Set, Reset, or Pulse ). So he modified the code to use the EventModify api instead of the Set and Reset macros.
And it works great. By doing this you can set event across process. The only issue to follow would be to use WaitForMultiple Object within one thread on the listener C# client instead of using one thread per event.