sodcalculator

10 Tech How-To

Fix regsvr32 Error 0x80070005 Access Denied

Guide 10-46650 · Updated · Step by step

If you’re seeing the regsvr32 0x80070005 error (Access Denied) when trying to register a DLL or OCX file on Windows, it usually means the command needs higher privileges or the file is locked by the system. This guide walks you through the most effective fixes, from running the command as administrator to adjusting registry permissions, so you can get your component registered and your software working again.

What You’ll Need

  • A Windows PC (Windows 10 or 11 recommended, but the steps apply to most versions).
  • An account with administrator privileges (you’ll need to confirm a UAC prompt).
  • The exact path to the DLL or OCX file you’re trying to register.
  • Optional: a backup of your registry (for the permission-fix steps).

Step-by-Step

  1. Close any programs that might be using the DLL. Sometimes the file is in use by a running application or background process. Save your work and close all unnecessary apps.
  2. Run the Command Prompt as Administrator. Click the Start button, type cmd, right-click on “Command Prompt” and choose “Run as administrator”. Confirm the User Account Control prompt if it appears.
  3. Navigate to the folder containing the DLL. Use the cd command to change to the directory where the file is located. For example, if it’s in C:\Windows\System32, type cd C:\Windows\System32 and press Enter. If it’s in a custom installation folder, navigate there instead.
  4. Run regsvr32 with the full path. Type regsvr32 filename.dll (replace filename.dll with the actual file name) and press Enter. If the path contains spaces, enclose it in quotes: regsvr32 "C:\Program Files\My App\component.dll".
  5. Check for a success message. If it works, you’ll see a dialog saying “DllRegisterServer in filename.dll succeeded.” Click OK.
  6. If you still get the error, try the 64-bit vs 32-bit mismatch. On 64-bit Windows, 32-bit DLLs must be registered with the 32-bit version of regsvr32 located in C:\Windows\SysWOW64. Run: C:\Windows\SysWOW64\regsvr32.exe "C:\path\to\your.dll".
  7. Check file permissions. Right-click the DLL file, select Properties, go to the Security tab, and ensure your user account has Full Control or at least Read & Execute and Read. If not, click Edit, select your user, and check the appropriate boxes.
  8. If permissions are fine, adjust registry permissions. Press Win + R, type regedit, and press Enter. Navigate to HKEY_CLASSES_ROOT\CLSID. Right-click on the CLSID key and choose Permissions. Make sure Administrators have Full Control. If not, click Advanced, change the owner to Administrators, then grant Full Control.
  9. Re-register the DLL after fixing permissions. Go back to the command prompt and run the regsvr32 command again. It should now succeed.
  10. If it still fails, try registering the DLL in Safe Mode. Restart your PC, hold Shift while clicking Restart, then go to Troubleshoot > Advanced options > Startup Settings > Restart. Press 4 or F4 to boot into Safe Mode, then repeat the regsvr32 command.

Common Mistakes

  • Not running as administrator: The most common cause. Even if you’re logged in as an admin, you must explicitly run the command prompt with elevated privileges.
  • Using the wrong regsvr32 version: Mixing 32-bit and 64-bit DLLs with the wrong regsvr32 will cause errors. Always match the architecture.
  • Typing the path incorrectly: A missing backslash, wrong folder name, or missing quotes around paths with spaces will cause the command to fail.
  • Ignoring file locks: If the DLL is in use by a service or app, Windows will deny access. Close all related programs before trying.
  • Modifying registry permissions without care: Changing ownership of HKEY_CLASSES_ROOT\CLSID can affect system stability. Only do this if you’re comfortable with registry edits, and always back up first.

Tips

  • Use the full path: Always specify the complete path to the DLL, even if you’re already in the folder. This avoids ambiguity.
  • Check if the DLL is actually a COM component: Not all DLLs are meant to be registered. Only files that export DllRegisterServer will work with regsvr32. If you’re unsure, check the documentation of the software that provided the file.
  • Run a system file check: If you suspect corruption, open an elevated command prompt and run sfc /scannow. This can fix system file issues that might cause registration problems.
  • Use the unregister command first: If the DLL was previously registered, try regsvr32 /u filename.dll to unregister it, then register again. This can clear stale registry entries.
  • Consider using a 32-bit command prompt: If you’re on 64-bit Windows and need to register a 32-bit DLL, you can also open a 32-bit command prompt from C:\Windows\SysWOW64\cmd.exe and run regsvr32 directly.

Troubleshooting

If you’ve followed all the steps and still get the error, try these additional checks:

  • Check the Event Viewer: Press Win + R, type eventvwr, and look under Windows Logs > Application for errors related to regsvr32 or the specific DLL. This may give more details.
  • Verify the DLL is not corrupted: Try registering a known-good DLL (like c:\windows\system32\actxprxy.dll) to see if regsvr32 works at all. If that also fails, the issue is with regsvr32 itself.
  • Repair .NET Framework: Some DLLs depend on .NET. Download and run the .NET Framework Repair Tool from Microsoft’s official site.
  • Disable antivirus temporarily: Some security software blocks DLL registration. Temporarily disable your antivirus (not Windows Defender) and try again. Re-enable it after.
  • Check for Group Policy restrictions: In rare cases, IT policies restrict writes to the registry. If you’re on a work computer, contact your system administrator.
  • Boot into Safe Mode with Networking: This loads a minimal set of drivers and services, which can bypass conflicts. Follow the Safe Mode steps above but choose 5 or F5 for Safe Mode with Networking.

Frequently Asked Questions

Why does regsvr32 give “Access Denied” even when I’m an administrator?

Windows UAC (User Account Control) requires you to explicitly run the command prompt as administrator. Simply being logged in as an admin isn’t enough; you must right-click and select “Run as administrator.”

What does the 0x80070005 error code mean?

It translates to E_ACCESSDENIED, which means the process doesn’t have the necessary permissions to write to the registry or access the file. It’s not a problem with the DLL itself but with the security context.

Can I fix this error by changing the DLL’s security permissions?

Yes, sometimes the file’s ACL (Access Control List) is too restrictive. Right-click the DLL, go to Properties > Security, and ensure your account has Full Control. Also check the parent folder’s permissions.

Is it safe to modify registry permissions for HKEY_CLASSES_ROOT\CLSID?

It can be risky if done incorrectly. Always back up the registry first (File > Export) and only change permissions for the specific CLSID key related to your DLL, not the entire CLSID root. If you’re unsure, seek help from a professional.

What if the DLL is 32-bit but I’m on 64-bit Windows?

You must use the 32-bit version of regsvr32 located in C:\Windows\SysWOW64. The 64-bit version in System32 will not work for 32-bit DLLs and may give an access denied or module not found error.

After fixing permissions, the error is gone but the DLL still doesn’t register. What else can I do?

Try registering the DLL in Safe Mode to rule out interference from other software. Also check if the DLL has dependencies (like Visual C++ Redistributables) that are missing. Use a tool like Dependency Walker to analyze the DLL’s dependencies.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →