-
Notifications
You must be signed in to change notification settings - Fork 0
/
DLLPropertySheet.cs
38 lines (36 loc) · 1.07 KB
/
DLLPropertySheet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using SharpShell.Attributes;
using SharpShell.SharpPropertySheet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
namespace DLLTab
{
[ComVisible(true)]
[COMServerAssociation(AssociationType.ClassOfExtension, ".dll")]
public class DLLPropertySheet : SharpPropertySheet
{
protected override bool CanShowSheet()
{
return SelectedItemPaths.Count() == 1;
}
protected override IEnumerable<SharpPropertyPage> CreatePages()
{
var dllPath = SelectedItemPaths.First();
try
{
var peFile = new PeNet.PeFile(dllPath);
return new SharpPropertyPage[]
{
new ExportsPropertyPage(peFile.ExportedFunctions),
new ImportsPropertyPage(peFile.ImportedFunctions)
};
}
catch (Exception ex)
{
LogError($"{dllPath} is not a valid PE DLL", ex);
throw;
}
}
}
}