COleObjectFactory::UpdateRegistryAll() and Windows Vista
Our MFC applications have boilerplate initialisation code of the form:
Code:
// Parse the command line to see if launched as OLE server
if (RunEmbedded() || RunAutomated())
{
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleTemplateServer::RegisterAll();
}
else
{
// When a server application is launched stand-alone, it is a good idea
// to update the system registry in case it has been damaged.
COleObjectFactory::UpdateRegistryAll();
}
When this code is run on Windows XP, the program tries to register its COM interfaces. If the user is running unprivileged, it fails silently; this doesn't normally matter because the registry is set up when the programs are installed. However, I understand that Windows Vista throws up warning dialogs when programs attempt administrative actions, and wish to avoid that. Should we therefore get rid of this code?