Remove Program Plugin dll (ShObjldITIb.dll) (#2952)

* Deleted the dll

* Added Shell Link helper class

* Add activation manager helper

* Use helper shell link and remove shell namespace

* removed using shell and added Activation helper namespace

* Removed the dll from the installer

* formatting

* nit formatting
This commit is contained in:
Alekhya
2020-05-13 11:43:56 -07:00
committed by GitHub
parent d178fa5bdb
commit ea9c0b919f
6 changed files with 186 additions and 21 deletions

View File

@@ -8,7 +8,6 @@ using System.Security;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using Shell;
using Wox.Infrastructure;
using Microsoft.Plugin.Program.Logger;
using Wox.Plugin;
@@ -16,6 +15,7 @@ using System.Reflection;
namespace Microsoft.Plugin.Program.Programs
{
[Serializable]
public class Win32 : IProgram
{
@@ -177,19 +177,11 @@ namespace Microsoft.Plugin.Program.Programs
var program = Win32Program(path);
try
{
var link = new ShellLink();
const uint STGM_READ = 0;
((IPersistFile)link).Load(path, STGM_READ);
var hwnd = new _RemotableHandle();
link.Resolve(ref hwnd, 0);
const int MAX_PATH = 260;
StringBuilder buffer = new StringBuilder(MAX_PATH);
ShellLinkHelper _helper = new ShellLinkHelper();
string target = _helper.retrieveTargetPath(path);
var data = new _WIN32_FIND_DATAW();
const uint SLGP_SHORTPATH = 1;
link.GetPath(buffer, buffer.Capacity, ref data, SLGP_SHORTPATH);
var target = buffer.ToString();
if (!string.IsNullOrEmpty(target))
{
var extension = Extension(target);
@@ -199,9 +191,7 @@ namespace Microsoft.Plugin.Program.Programs
program.FullPath = Path.GetFullPath(target).ToLower();
program.ExecutableName = Path.GetFileName(target);
buffer = new StringBuilder(MAX_PATH);
link.GetDescription(buffer, MAX_PATH);
var description = buffer.ToString();
var description = _helper.description;
if (!string.IsNullOrEmpty(description))
{
program.Description = description;
@@ -270,9 +260,9 @@ namespace Microsoft.Plugin.Program.Programs
}
var files = new List<string>();
var folderQueue = new Queue<string>();
folderQueue.Enqueue(directory);
var folderQueue = new Queue<string>();
folderQueue.Enqueue(directory);
do
{
var currentDirectory = folderQueue.Dequeue();