"Unable to register the DLL/OCX: RegSvr32 failed with exit code 0x5"

Started by KoujiBEAR76, December 18, 2020, 06:21:17 AM

Previous topic - Next topic

KoujiBEAR76

I can't seem to install the latest version of CopyHandler. This is a pretty new Windows 10 installation. I'm aware "0x5" is some sort of access/permission issue, but I'm running the installer as administrator and I'm using the main/only Windows account which has admin rights. So... any thoughts?


Xallde

this happens woth copy handler 1.45 (chext64.dll is the origin of failure) tried 1.44: no problem

KryziK

Can confirm there's an issue on Win10-x64 with running regsvr32 on the chext dll.

Attempted with the following:
* Running as admin
* Any/all antivirus disabled

However, when I first installed v1.44, and then immediately after installed v1.45, it appears to have worked. There might be a bug in anything it's expecting to already exist when v1.45 is the FIRST version the user has ever installed. It could possibly be DllRegistration.RemoveLegacyEntries crashing if those entries don't exist?

Quote from: Xallde on December 19, 2020, 06:33:38 PM
this happens woth copy handler 1.45 (chext64.dll is the origin of failure) tried 1.44: no problem

Try installing v1.45 now, without uninstalling v1.44. Does it work?

Ixen

What is the exact version of Win10 that you've used?
Looks like some dependency problem, but I'll have to try reproducing it on some clean Win10 vm.

KryziK

Quote from: Ixen on December 21, 2020, 08:11:28 PM
What is the exact version of Win10 that you've used?
Looks like some dependency problem, but I'll have to try reproducing it on some clean Win10 vm.

OS Name   Microsoft Windows 10 Pro
Version   10.0.19041 Build 19041

Ixen

Thanks. I can reproduce problem with fresh install of Win10 2004.
I've filed a bug for further tracking: https://dev.copyhandler.com/browse/CH-369

I'll try to take a look at it tomorrow.

KryziK

Quote from: Ixen on December 21, 2020, 10:00:08 PM
Thanks. I can reproduce problem with fresh install of Win10 2004.
I've filed a bug for further tracking: https://dev.copyhandler.com/browse/CH-369

I'll try to take a look at it tomorrow.

Command
C:\Windows\System32\regsvr32.exe C:\Users\Test\Desktop\ch-portable-1.45\64bit\chext64.dll

Working Directory
C:\Users\Test\Desktop\ch-portable-1.45\64bit

Module
chext64.dll

API
RegOpenKeyExW ( HKEY_CLASSES_ROOT, "Directory\Shellex\DragDropHandlers", 0, KEY_ALL_ACCESS, 0x0000000000b3e198 )

Return Value
ERROR_FILE_NOT_FOUND

Error
2 = The system cannot find the file specified.

Notes
void DllRegistration::RegisterDropMenuExt()
{
std::wstring strClsID = CLSID2String(CLSID_DropMenuExt);
RegisterClass(strClsID, L"DropMenuExt Class", L"Apartment");

CreateNodes(HKEY_CLASSES_ROOT, L"CLSID", strClsID + L"\\shellex\\MayChangeDefaultMenu");

CreateNodeWithDefaultValue(HKEY_CLASSES_ROOT, L"Directory\\Shellex\\DragDropHandlers", L"chext", strClsID.c_str());
CreateNodeWithDefaultValue(HKEY_CLASSES_ROOT, L"Drive\\Shellex\\DragDropHandlers", L"chext", strClsID.c_str());
CreateNodeWithDefaultValue(HKEY_CLASSES_ROOT, L"Folder\\Shellex\\DragDropHandlers", L"chext", strClsID.c_str());

CreateSingleValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", strClsID.c_str(), L"chext");
}

KryziK

Sorry for double-post.

void TRegistry::ReOpen(HKEY key, const wchar_t* pszKey, bool bReadOnly /*= true*/)
{
if (!pszKey)
throw std::invalid_argument("pszKey");

if (m_hKey)
RegCloseKey(m_hKey);

LSTATUS lStatus = RegOpenKeyEx(key, pszKey, 0, bReadOnly ? KEY_QUERY_VALUE : KEY_ALL_ACCESS, &m_hKey);
if (lStatus != ERROR_SUCCESS || m_hKey == nullptr)
throw std::runtime_error("Cannot open registry key");
}


Can confirm that throw std::runtime_error("Cannot open registry key"); is getting hit.

Xallde


Ixen

@KryziK: thanks for pinpointing the specific part of code - that sped things up.

Fix has been committed to git repo. I'll release 1.46 in a day or two after fixing one more problem with shell extension. If anyone would like to test the fix - please pm me.

KryziK

Not a problem! Glad it helped.

If you want me to test the fix on one of my VMs, I can. Just tell me what specifics you want me to verify (other than the error going away during install, obviously).

Ixen


KryziK

Quote from: Ixen on December 22, 2020, 08:05:20 PM
I've sent you a PM on this forum with link. Thanks!

Responded. Overall things are looking good. Replying here because I don't see any of my replies in sent messages, and want to make sure you got them.

SMF spam blocked by CleanTalk