PC Review


Reply
Thread Tools Rate Thread

Autimation - Is MS recommended fix for "Failed to update the system registry..." flawed?

 
 
Al Koch
Guest
Posts: n/a
 
      19th Mar 2004
Hello,
I have an automation server that, when run under W2000 and XP as a User
without Admin privileges, causes the error message "Failed to update the
system registry. Please try using REGEDIT." I discovered KB 254957 that
explains that this is a bug in W2000 (and apparently is still in XP!) and
provides a workaround. This error is generated in a VC++ 6 AppWizard
generated app with Automation support in which in the app's InitInstance()
makes the following call which was automatically generated by the Wizard:

m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);

Here is an excerpt from KB 254957:

This error occurs because each time an MFC OLE executable server runs, it
calls the UpdateRegistry function in the COleTemplateServer class. The MFC
UpdateRegistry function updates the registry entries in HKEY_CLASSES_ROOT
for both the application and its document types. This update either creates
the entries when the program is executed for the first time, or updates the
entries to repair any damage that may have occurred. In Windows 2000, access
to HKEY_CLASSES_ROOT is restricted to administrators and power users

and the recommended workaround is simply:

HKEY hTestKey = NULL;

LONG lResult = ::RegCreateKeyEx(HKEY_CLASSES_ROOT,

"MFCOServ.Document", 0, "",

REG_OPTION_NON_VOLATILE,

KEY_ALL_ACCESS, NULL,

&hTestKey, NULL);

if ((ERROR_SUCCESS == lResult) && (hTestKey != NULL))

{

// It's ok to call UpdateRegistry

}

This workaround just allows the code to avoid doing the call to
m_server.UpdateRegistry(OAT_DISPATCH_OBJECT); which does eliminate the error
message. However, it raises the question of what happens if an application
is installed (by an Admin) but the 1st User to run it is not an Admin. In
this case we won't do the UpdateRegistry() that, as I understand it,
*Registers the automation server*! Is the workaround flawed or is there
something that allows this to work in this circumstance?

Thank you.

Al Koch



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Needed __ Registry update failed for key "HPC Filename" john Microsoft Windows 2000 4 9th Mar 2008 06:41 PM
Flawed NVIDIA ATA update now "Important"??? =?Utf-8?B?amFtZXln?= Windows Vista Hardware 1 17th Jul 2007 01:46 AM
Autimation - Is MS recommended fix for "Failed to update the system registry..." flawed? Al Koch Microsoft Windows 2000 Registry 0 19th Mar 2004 01:39 AM
Autimation - Is MS recommended fix for "Failed to update the system registry..." flawed? Al Koch Microsoft Windows 2000 Registry Archive 0 19th Mar 2004 01:39 AM
Autimation - Is MS recommended fix for "Failed to update the system registry..." flawed? Al Koch Microsoft Windows 2000 Registry Archive 0 19th Mar 2004 01:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:43 AM.