# Possible to register NET 6 plugin as normal user?

**URL:** https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387
**Category:** Hydra
**Tags:** net
**Created:** [March 18, 2022, 12:47pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387 "2022-03-18T12:47:09Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sebastian.may](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sebastian.may](https://talk.remobjects.com/u/sebastian.may)
#### Post date: [March 18, 2022, 12:47pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/1 "2022-03-18T12:47:09Z")

</div>

Hello,

I have been pleasantly surprised that according to [WPF Visual Plugins (.NET 5+)](https://docs.hydra4.com/Plugins/VisualPlugin_NETCore_WPF/) Hydra allows to build .NET core / 5+ plugins.  
However the last entry indicates that I need to run `regsvr32 .\PluginSample_WinForms.comhost.dll` in order to register the plugin.  
My application relies on xcopy deployment and doesn’t need escalated privileges. Is it possible to register the plugin at runtime in a non elevated context?

Thank you

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [March 18, 2022, 7:40pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/3 "2022-03-18T19:40:42Z")

</div>

> [@sebastian.may](#):
>
> I have been pleasantly surprised that according to [WPF Visual Plugins (.NET 5+)](https://docs.hydra4.com/Plugins/VisualPlugin_NETCore_WPF/) Hydra allows to build .NET core / 5+ plugins.  
> However the last entry indicates that I need to run `regsvr32 .\PluginSample_WinForms.comhost.dll` in order to register the plugin.  
> My application relies on xcopy deployment and doesn’t need escalated privileges. Is it possible to register the plugin at runtime in a non elevated context?

Good question. i’m afraid i’ll have to leave this for my colleague to answer, early next week. I agree that ideally this shuold be possible.

---

<div class="post-metadata">

### Author: ![antonk](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@antonk](https://talk.remobjects.com/u/antonk)
#### Post date: [March 20, 2022, 12:53pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/4 "2022-03-20T12:53:31Z")

</div>

Hello

By default escalated privileges are required to register COM component related to your plugin.

Theoretically you could take a look at this topic to register COM component without admin rights:

> <https://stackoverflow.com/questions/37193356/registering-net-com-dlls-without-admin-rights-regasm>

It is possible to check and modify registry at runtime.

However please note that this approach is not officially supported, so I suggest you to retest your application after the changes.

Hope that helps

---

<div class="post-metadata">

### Author: ![sebastian.may](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sebastian.may](https://talk.remobjects.com/u/sebastian.may)
#### Post date: [March 25, 2022, 2:44pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/6 "2022-03-25T14:44:44Z")

</div>

Thank you.  
I wanted to try the approach outlined on stackoverflow, but I have failed in getting a simple example (Delphi Host, NET 6 WPF plugin) to run (even as admin).  
Could you please provide me with an example for this ( I could not find any project that targets this scenario in the examples folder)?

Thank you

---

<div class="post-metadata">

### Author: ![antonk](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@antonk](https://talk.remobjects.com/u/antonk)
#### Post date: [March 27, 2022, 10:29am UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/8 "2022-03-27T10:29:32Z")

</div>

Hello

> [@antonk](#):
>
> However please note that this approach is not officially supported,

This approach is not officially supported. So there is no samples for it.

This approach works for COM-based .NET Framework plugins.  
However if fails for new .NET COM components (apparently its registration code does more than just writing registry issues).

Seems the only solution would be to override registry path and then run the component registration procedure (again, it is NOT officially supported):

```auto
  // not a real code !!!
LoadLibrary("Oleaut32.dll")
    GetProcAddress("OaEnablePerUserTLibRegistration")
    Marshal.GetDelegateForFunctionPointer()
    Call OaEnablePerUserTLibRegistration()

    key = RegOpenKey(RegistryHive.CurrentUser, @"Software\Classes")
        RegOverridePredefKey(RegistryHive.ClassesRoot, key)
    RegCloseKey(key)

        LoadLibrary("YourLibrary.comhost.dll")
            GetProcAddress("DllRegisterServer")
            Marshal.GetDelegateForFunctionPointer()
            Call DllRegisterServer()
        FreeLibrary()

    RegOverridePredefKey(RegistryHive.ClassesRoot, null)
FreeLibrary()

```

---

<div class="post-metadata">

### Author: ![sebastian.may](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sebastian.may](https://talk.remobjects.com/u/sebastian.may)
#### Post date: [April 4, 2022, 11:36am UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/11 "2022-04-04T11:36:05Z")

</div>

Thank you for your suggestion, we made it work using registration-free activation as described here: [How to: Configure .NET Framework-Based COM Components for Registration-Free Activation - .NET Framework | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/framework/interop/configure-net-framework-based-com-components-for-reg)

A quick summary can be found here:

> **[InQuest - Join the Hunt.](https://inquest.net/blog/2019/5/30/abusing-registration-free-com)**
>
> InQuest provides Deep File Inspection (DFI) for real-time protection and RetroHunting to leverage hindsight and apply today's intelligence to yesterday's data.

This approach does not require any hacks, prior external registration or elevated privileges, all configuration is done in a custom manifest.  
If you think this is something that could provide value to other users of hydra, I can upload a working sample project (Delphi host, NET 6 wpf plugin)

---

<div class="post-metadata">

### Author: ![antonk](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@antonk](https://talk.remobjects.com/u/antonk)
#### Post date: [April 10, 2022, 12:33pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/12 "2022-04-10T12:33:13Z")

</div>

Hello

Yes, a sample app would be great.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [April 10, 2022, 12:33pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/13 "2022-04-10T12:33:44Z")

</div>

Logged as [bugs://H1022](https://www.remobjects.com/portal/bugs/?id=H1022).

---

<div class="post-metadata">

### Author: ![sebastian.may](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@sebastian.may](https://talk.remobjects.com/u/sebastian.may)
#### Post date: [May 5, 2022, 8:46pm UTC](https://talk.remobjects.com/t/possible-to-register-net-6-plugin-as-normal-user/26387/14 "2022-05-05T20:46:45Z")

</div>

My apologies, I have been incapacitated for a bit. You will find a working example here: [Storage Share](https://storage.tripunkt.net/s/8gSrwBZyQTs8Pys)  
I managed to get it running using the approach above in x86, but did not manage in x64
