PDA

View Full Version : strange behavior in OnMaintUIBefore



crehbein
04-29-2004, 10:41 AM
I was overriding OnMaintUIBefore to add some extra code when I noticed some strangeness going on.




switch(nType)

case REMOVEALL:

// Ensure that all previously installed features are removed
// for media that supports updating.
MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );

if( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) then
FeatureRemoveAllInMediaAndLog();
else
FeatureRemoveAllInMedia();
endif;

<tons of other custom code>

case REPAIR:
(...)
if( ADDREMOVE ) then
// Reinstall all previously installed features, except
// disk1 features.
FeatureUpdate( "" );
else
// Reinstall all previously installed features.
FeatureReinstall();
endif;

endswitch;



While debugging this block of code, the debugger jumps from FeatureRemoveAllInMediaAndLog() all the way down into the next case block, to the FeatureUpdate() call, bypassing all of my custom code. When I tried putting my custom code above the MediaGetData() call, the debugger goes to each line, but no variables are ever set and no function calls actually occur.

At the end of the function, the process just sits and spins, taking up 99% CPU, and OnMoveData() is never called.

My custom code is creating a list of files that weren't logged for uninstall and removing them. My questions are, is OnMaintUIBefore, and in the REMOVEALL block an appropriate place to delete files? Second, does anyone know why the debugger is acting so oddly, and why the installer just sits and hangs when I customize OnMaintUIBefore?

Thanks for any help,
- Chris

soulMiner
05-05-2004, 03:45 PM
Are you sure that you are compiling with your most recent source-code files? That is: in the "Path Variables" section of the IDE do you have it pointing to some source code that is perhaps a couple of compiles-old. This has happened to me this way. Editing, it looks fine, debug, it will jump around to strange places. - Especially when new code has been added.

-Is that what this could be?

crehbein
05-05-2004, 03:50 PM
That very well could have been the case, but I tried to be careful about that. I got the same behavior running it through the debugger on one machine and by running it without debugging on a separate one.

At any rate, I just moved what I was trying to do out of OnMaintUIBefore and into my On<Component>Uninstalling callback. I didn't need a UI anyway.

Thanks!