When trying to register a DLL specifically (DAO350.DLL) the regsvr fails with exit code 5. Command:
$process = Start-Process "regsvr32" -ArgumentList "/s
"C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL"" -PassThru -Wait; $process.ExitCode
Container images that I have tried to run with:
- mcr.microsoft.com/windows:ltsc2019
- mcr.microsoft.com/windows/server:ltsc2020
I have tried a few things:
Removing the UAC using the following:
Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0
Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorUser -Value 0
Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA -Value 0
Running in isolation using:
--isolation=hyperv
Running using different account, specifically:
--user "NT Authority\System"
Taking ownership to ContainerAdministrator of the registry nodes and subnodes, following this account:
https://rnd-solutions.net/2017/05/09/resolve-dao350-dll-registration-issue/
Checking the dependency using dependency walker.
Not sure what I can try more :/ One weird thing, is that I can see that the registry key entry is added once I run the command to:
HKEY_CLASSES_ROOT\TypeLib{00025E01-0000-0000-C000-000000000046}\4.0
with the correct values, etc. but the process still returns an exit code 5.
When trying to run Add-Type of the said .DLL I have the following errors, so maybe some missing dependencies?
Add-Type : c:\Users\Administrator\AppData\Local\Temp\q1ro04mp\q1ro04mp.0.cs(1) : Unexpected character '' c:\Users\Administrator\AppData\Local\Temp\q1ro04mp\q1ro04mp.0.cs(1) : >>> C:\Program Files (x86)\Common Files\microsoft shared\DAO\DAO350.DLL At line:1 char:1
Another approach:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\> whoami
nt authority\system
# Install Microsoft Data Access Objects - from here https://archive.org/details/microsoft-data-access-objects-dao-3.5
PS C:\> $process = Start-Process ".\DAO\SETUP.EXE" -Wait -PassThru; $process.ExitCode
0
# Confirm that Dao2535.tlb is present
PS C:\> cd 'C:\Program Files (x86)\Common Files\microsoft shared\DAO\'; ls
Directory: C:\Program Files (x86)\Common Files\microsoft shared\DAO
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12/5/1996 12:00 AM 73184 Dao2535.tlb
-a---- 12/2/1996 6:44 PM 582144 dao350.dll
-a---- 9/15/2018 9:29 AM 610304 dao360.dll
# Start CMD
PS C:\Program Files (x86)\Common Files\microsoft shared\DAO> cmd
Microsoft Windows [Version 10.0.17763.5329]
(c) 2018 Microsoft Corporation. All rights reserved.
# Run regsvr in the local folder
C:\Program Files (x86)\Common Files\microsoft shared\DAO>start /wait regsvr32 /s dao350.dll
# Error level
C:\Program Files (x86)\Common Files\microsoft shared\DAO>echo %errorlevel%
5
Using Simon's tool to get the proper error code:
PS C:\Program Files (x86)\Common Files\microsoft shared\DAO> C:\RegsvrCli.exe "C:\Program Files (x86)\Common Files\microsoft shared\DAO\dao350.dll"
RegsvrCli 32-bit - Copyright (C) 2023-2024 Simon Mourier. All rights reserved.
Registering 'C:\Program Files (x86)\Common Files\microsoft shared\DAO\dao350.dll' returned: 0x8002801C (-2147319780)
And the meaning of the error code:
C:\User> .\Err_6.4.5.exe 0x8002801C
# for hex 0x8002801c / decimal -2147319780
TYPE_E_REGISTRYACCESS winerror.h
# Error accessing the OLE registry.
# 1 matches found for "0x8002801C"
The original error:
2024-02-01 21:21:56.444 Spawning 32-bit RegSvr32: "C:\Windows\system32\regsvr32.exe" /s "C:\Program
Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL"
2024-02-01 21:21:56.491 Registration failed:
RegSvr32 failed with exit code 0x5.
2024-02-01 21:21:56.491 Defaulting to Abort for suppressed message box (Abort/Retry/Ignore):
C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL
Unable to register the DLL/OCX: RegSvr32 failed with exit code 0x5.