0X800F0213

Fix SPAPI_E_DEVINFO_DATA_LOCKED (0X800F0213) in Windows

This error means a device driver package is locked. You'll need to clean up leftover driver files or use the Windows Driver Kit to unlock it.

Quick answer: Run pnputil /enum-drivers to find the locked driver package, then pnputil /delete-driver oemXX.inf /force to remove it, then reinstall the driver.

That error code 0X800F0213 (SPAPI_E_DEVINFO_DATA_LOCKED) is Windows telling you that the driver package you're trying to install is already in use — specifically, the device information element is locked. This usually happens when you've installed a driver before, then tried to update or replace it, but Windows still has a file handle open on the old driver's INF or sys file. It's common after a failed driver update, or when you uninstall a device but Windows keeps the driver package in its store.

I've seen this on Windows 10 and 11, especially with graphics cards and USB devices. The culprit is often a leftover driver package that's been marked as "in use" by the system. You can't just delete it from Device Manager — you have to force Windows to let go.

Here's how to fix it, step by step.

Fix 1: Use pnputil to delete the locked driver package

  1. Open Command Prompt as administrator. Press Win, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Type pnputil /enum-drivers and press Enter. You'll see a list of installed driver packages. Look for the one that matches your device — check the INF name and the driver provider/date.
  3. Once you identify the right package (note the oemXX.inf file name), type this command to delete it: pnputil /delete-driver oemXX.inf /force (replace oemXX.inf with the actual file name). The /force flag is critical — it bypasses the lock.
  4. You should see "Driver package deleted successfully." If you get an error about the driver being in use, try rebooting into Safe Mode (with networking) and repeat steps 1-3.
  5. After deletion, restart your PC. Then reinstall your driver from the manufacturer's website or via Device Manager.

After running the delete command, try reinstalling the driver. The error should be gone.

Fix 2: Clean up the driver store manually (if pnputil fails)

Sometimes pnputil won't let go, even with /force. In that case, you need to clear the driver store cache. This is a bit more invasive, but it works.

  1. Open File Explorer and go to C:\Windows\System32\DriverStore\FileRepository. This is a protected folder, so you may need to copy the INF file to your desktop first if you can't access it directly.
  2. Look for a subfolder that matches your driver (for example, nv_dispi.inf_amd64_xxx for NVIDIA). Note the exact folder name.
  3. Open an elevated Command Prompt and run: takeown /F "C:\Windows\System32\DriverStore\FileRepository\foldername" /R /D Y (replace foldername). This gives you ownership.
  4. Then run: icacls "C:\Windows\System32\DriverStore\FileRepository\foldername" /grant administrators:F /T.
  5. Now delete that folder using File Explorer or rmdir /S /Q path in Command Prompt.

This is a last resort — be careful. Only delete the specific folder associated with the device you're having trouble with. Deleting the whole FileRepository folder will break your system.

Fix 3: Use Device Manager to uninstall and reinstall the device

Sometimes the lock is on the device instance itself, not the package. Here's how to reset that.

  1. Press Win + X and select Device Manager.
  2. Find your device (it may show a yellow warning icon). Right-click and select Uninstall device — check the box "Delete the driver software for this device" if it appears. If it doesn't, that's fine.
  3. Now, click the Action menu and select Scan for hardware changes. Windows will re-detect the device.
  4. If it comes back with the same error, reboot and repeat, but this time skip the uninstall and just do a scan.

This works best if the lock was temporary — for example, if a USB device was disconnected mid-install.

Fix 4: Update the driver using Windows Update (as a workaround)

If you just need the driver working and don't care about the latest version, you can let Windows Update handle it.

  1. Go to Settings > Update & Security (Windows 10) or Windows Update (Windows 11).
  2. Click Check for updates. If Windows finds a compatible driver, it'll install it automatically.
  3. Once it's installed, you can then update to the latest version from the manufacturer, and it won't hit the lock.

This is a good fallback if the manual methods seem too risky.

Prevention tip

The real fix is to never interrupt a driver installation. Wait for the "Successfully installed" message. If you're updating a graphics driver, uninstall the old one first using Display Driver Uninstaller (DDU) in Safe Mode — that clears the driver store cleanly. Also, avoid using third-party driver updater tools that force installs; they're the usual cause of this kind of lock.

If you're a developer testing drivers, you should use the Windows Driver Kit's InfDefaultInstall in a test environment, not on your daily driver.

Related Errors in Windows Errors
0X0000049C Fix ERROR_POTENTIAL_FILE_FOUND (0X0000049C) in Windows 10/11 0XC00D1BDE NS_E_INVALID_SOURCE_WITH_DEVICE_CONTROL (0XC00D1BDE) 0X80110600 COMQC_E_APPLICATION_NOT_QUEUED (0X80110600): Fix Queued Moniker Error 0x0000001A Windows Stop Code Memory Management BSOD Fix

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.