Load C# (COM) in a Credential Provider : working with winlogon, but problem when explorer loads it


I created a custom Credential Provider for Windows. The base DLL is in C++ and it loads a C# DLL trought a COM interface.

    if (CoInitialize(NULL) != S_OK) {

        hr = _authenticationManager.CreateInstance("{BAF984BD-0D41-42D1-AA49-4BC98EE6C4A1}");

        std::stringstream stream;
        stream << std::hex << (int)hr;
        MessageBoxA(NULL, stream.str().c_str(), "", 0);

The class is registered like that :


"Assembly"="AuthenticationManager, Version=, Culture=neutral, PublicKeyToken=null"




"Assembly"="AuthenticationManager, Version=, Culture=neutral, PublicKeyToken=null"

"Assembly"="AuthenticationManager, Version=, Culture=neutral, PublicKeyToken=null"


[HKEY_CLASSES_ROOT\CLSID\{BAF984BD-0D41-42D1-AA49-4BC98EE6C4A1}\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]

The C# DLL delcaration looks like this :

public class AuthenticationManager : IAuthenticationManager

It works perfectly when using winlogon to log to the computer, when i log off, the provider loads, and the C# too, all is good

But, when i use it for an other purpose, it fails to load the COM component : CreateInstance returns 0x80040154 (REGDB_E_CLASSNOTREG).

Example of usage that does not works : SHIFT+RIGHT CLICK on a exe -> Execute as other user The provider is loaded, and the class is not found...

I heard on forums that 32 and 64 bits mixing can be the source of the problem, but both process (winlogon & explorer) are x64, and all my dlls (credential + authenticationManager) are x64 too.

Can you please help me, i have been stuck for 3 days....

Thank you very much.

asked on Stack Overflow Nov 5, 2020 by Tom • edited Nov 5, 2020 by Tom

1 Answer


Anymore, COM is a bad idea! Alternativelly, you can use Visual C++ CLI. CLI support is a bridge between native C++ and managed C#.NET libraries.

User contributions licensed under CC BY-SA 3.0