Geert van Horrik
Geert van Horrik

Reputation: 5724

Extensibility (plugins) in a UWP app

We are investigating whether UWP can be a suitable replacement for our WPF apps. In our WPF apps, we use extensibility (plugins) to add additional (customer specific) logic to our apps. We currently use NuGet packages to deploy / update these extensions and load them at runtime.

In UWP, is it possible to:

  1. Dynamically load plugins in UWP (I think this is not possible because the sandbox will probably prevent loading dynamic modules)?
  2. Deliver these extensions via the store (but they need to be hidden for any other users)?

Upvotes: 0

Views: 1160

Answers (2)

Marian Dolinský
Marian Dolinský

Reputation: 3492

Starting with the Anniversary Update UWP natively supports app extensions that can be distributed through Windows Store. You can find more info here, here or here.

You can manage the visibility of your UWP apps (and I think it will work the same with app extensions) in the Dev Center Dashboard. Take a look here to get more info.

Upvotes: 4

lindexi
lindexi

Reputation: 4327

LoadPackagedLibrary can dynamically load plugins in UWP .

But it only can load the dll in appx.

How to using LoadPackagedLibrary ,see https://msdn.microsoft.com/en-us/library/mt186162.aspx

If you want to use the win32 dll that in other directory,please get the LoadLibrary that can use it.

You can use

MEMORY_BASIC_INFORMATION info = {};  
if (VirtualQuery(VirtualQuery, &info, sizeof(info)))  
{
    auto kernelAddr = (HMODULE)info.AllocationBase;
    auto loadlibraryPtr = GetProcAddress(kernelAddr, "LoadLibraryExW");
    // load your library here ...
}

to get the loadlibrary and use to loadlibrary the dll.

See https://hjc.im/3-ways-to-bypass-wack/

Ms use the PE and P/Invoke to judge whether uwp use the not allowed dll.

So you can use the loadlibrary to load it.

Upvotes: 1

Related Questions