When REGSVR32 claims it can't find a DLL that's visibly present in System32, we're typically dealing with one of these scenarios:
- Dependency hell (missing transitive dependencies)
- Architecture mismatch (32-bit vs 64-bit)
- Path resolution quirks in Windows
- VB5-specific registration requirements
1. Verify actual file visibility:
dir C:\Windows\System32\nameoflibrary.dll /A
2. Check dependencies with Dependency Walker:
depends.exe C:\Windows\System32\nameoflibrary.dll
3. Attempt registration with absolute path:
regsvr32 "C:\Windows\System32\nameoflibrary.dll"
4. Try the SysWOW64 redirector for 32-bit DLLs:
regsvr32 "C:\Windows\SysWOW64\nameoflibrary.dll"
For VB5 components, we need special handling:
regsvr32 /u "C:\Windows\System32\nameoflibrary.dll" // First unregister regsvr32 /i "C:\Windows\System32\nameoflibrary.dll" // Then register with install context
When REGSVR32 fails, try manual registration:
rundll32.exe "C:\Windows\System32\nameoflibrary.dll",DllRegisterServer
Or use PowerShell for better error reporting:
[System.Reflection.Assembly]::LoadFrom("C:\Windows\System32\nameoflibrary.dll")
On Server 2003 specifically:
- Verify DEP settings aren't blocking the DLL
- Check the "Data Execution Prevention" tab in System Properties
- Ensure the VB5 runtime is properly installed in compatibility mode
Confirm successful registration by checking:
reg query HKCR\CLSID /f "nameoflibrary" /s
When deploying legacy VB5 components on Windows Server 2003, you might encounter this perplexing scenario:
regsvr32 c:\windows\system32\vb5library.dll
LoadLibrary("c:\windows\system32\vb5library.dll") failed -
The specified module could not be found.
Dependency Walker is your best friend here. Run this against your DLL to identify missing dependencies:
depends.exe vb5library.dll
Typical findings include:
- Missing VB5 runtime components (MSVBVM50.DLL)
- 32-bit vs 64-bit path redirection issues
- Corrupted manifest files
- Incorrect DLL search paths
On 64-bit Windows versions (even Server 2003 x64), the System32 folder redirects 32-bit applications:
// Actual paths for 32-bit apps:
C:\Windows\SysWOW64 (for 32-bit DLLs)
C:\Windows\Sysnative (temporary bypass for 32-bit apps)
// Check redirection status:
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion" /v ProgramFilesDir
Solution 1: Manual registration with absolute paths
regsvr32 /s /n /i:"/fullpath" C:\path\to\vb5library.dll
Solution 2: Dependency installation
// For VB5 runtime:
msiexec /i vb5runtime.msi /qn
// Verify installation:
reg query "HKLM\Software\Microsoft\VisualBasic\5.0"
Set up a filter in ProcMon to track DLL loading attempts:
Filter: Process Name is regsvr32.exe
Filter: Path contains vb5library.dll
Filter: Result is NAME NOT FOUND
For stubborn cases, try these registry checks:
// Check App Paths:
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths"
// Check KnownDLLs (prevents spoofing):
reg query "HKLM\System\CurrentControlSet\Control\Session Manager\KnownDLLs"