unable to register 32-bit dll with Win 7 or Win 8/8.1

I have a 32-bit VB 6 dll that runs as a COM add-in to a Microsoft Office application. It's been running for years, including on Win 7 and 8 systems and with all versions of Office since 2003. However, on some systems the dll cannot be registered.

When my installer attempts to register the dll, it fails with this message:
Module xyz.dll failed to register. HRESULT -2147467259. Contact your support personnel.

When I try to register the dll from the command line by running regsvr32, I receive this message:
The module "xyz.dll" was loaded but the call to DllRegisterServer failed with error code 0x80004005.

I've researched both error codes and have tried all of the following with no change:
1) Run regsvr32 from C:\Windows\SysWOW64 instead of from C:\Windows\System32
2) Run regsvr32 from an elevated command prompt
3) Turn off UAC
4) Recompile dll after updating references to a newer version of Office (I updated to Office 2010)

LVL 31
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Davis McCarnOwnerCommented:
From this: https://social.msdn.microsoft.com/Forums/en-US/b7d1a35f-3759-4217-91ba-e4416ac19d78/how-do-you-fix-error-code-0x80004005?forum=jscript

1) download SubInAcl at  http://www.microsoft.com/downloads/details.aspx?FamilyId=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&displaylang=en

 2) Go to  C:\Program Files\Windows Resource Kits\Tools (you can paste this into your browser to go there) and create a notepad file called reset. Paste this into the file:

 subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f
 subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f
 subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f
 subinacl /subdirectories %SystemDrive% /grant=administrators=f
 subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=system=f
 subinacl /subkeyreg HKEY_CURRENT_USER /grant=system=f
 subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=system=f
 subinacl /subdirectories %SystemDrive% /grant=system=f

 3) save the file as reset.cmd Remember to change the file type to "all files" and not just "Text"
 4) a reset command should show up, run it.

 After you let the command finish running, the 0x80004005 error should be taken care of
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperAuthor Commented:
I found this article also, David. Do you have experience with this technique? It seems a rather broad-brush approach rather than solving the actual problem.
Davis McCarnOwnerCommented:
Its Davis, BTW....
Yes, I have had to repair the permissions on both workstations and servers, hundreds of times.
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Scott HelmersVisio Consultant, Trainer, Author, and DeveloperAuthor Commented:
Sorry about the final letter of your name -- my fingers automatically typed the 'd'.

I will give this a try then, when I have a chance.

I realize now, on rereading my initial question, that I didn't express one thing very well: The bigger issue for me is to find out what is causing the problem in the first place. Assuming your suggestion above solves the problem, I can't expect my customers to use this procedure on their systems after they run my installer. Consequently, I need help figuring out the root cause so I can fix the underlying issue. But first things first, let me see whether this solution solves the local problem.
Davis McCarnOwnerCommented:
IMHO, one of the stupidest things M$ implemented were explicit permissions on every single file and registry key, especially since, to this day, they have never provided a utility that really fixes either.  

I have a PC here, right now, for example, where the owner let his daughter try to find free TV on the internet and, while the resultant virus/adware was pretty easy to vanquish, the residual damage to Windoze, which now completely refuses to install any updates, may result in a wipe-and-reload being the only possible fix for the PC.

I have seen permissions get gescrewdefay by creating a new user, a defective Windows update, losing the internet in mid-page, a failing hard disk drive, forcing the PC to turn off by holding down the power button, and, of course, any one of the plethora of adware/malware which sometimes accounts for 80+% of my business.

So, determining what caused the problem may not be a productive use of your time.....
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperAuthor Commented:
Unfortunately, my problem is a bit different than what your last comment suggests -- I am distributing an installer that causes this problem so I can't ignore it.  :-)

Since posting the question, I've been working back on the installer end of the things and have eliminated the HRESULT error by changing the way the installer registers the dll during the installation. If anyone else who is building an installer should read this, I changed from "Self register native library" to "Extract registration info from native library" for the dll in question. BTW, I'm using Advanced Installer 12.4 -- the wording in a different installation package generator might be different, but that's what did the trick for me.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperAuthor Commented:
Good suggestions from Davis for the question I asked, but as I investigated, I realized that they attacked the symptom and not the root problem.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.