Skip to content

Commit 0163e64

Browse files
committed
Added: Properties contextmenu item
Added: Properties language item Added: ShellExecuteEx function in nativemethods (Properties dialog)
1 parent ce68b18 commit 0163e64

File tree

13 files changed

+85
-3
lines changed

13 files changed

+85
-3
lines changed

DeadLock/Classes/Language.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public class Language
9292
//Main Form - ContextMenu Details:
9393
public string CmiKill;
9494
public string CmiOpenFileLocation;
95+
public string CmiProperties;
9596

9697
public string MsgSuccessfullyKilled;
9798

DeadLock/Classes/NativeMethods.cs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private enum RmAppType
4242
RmCritical = 1000
4343
}
4444

45-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
45+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
4646
private struct RmProcessInfo
4747
{
4848
internal RmUniqueProcess Process;
@@ -59,6 +59,32 @@ private struct RmProcessInfo
5959
[MarshalAs(UnmanagedType.Bool)]
6060
private readonly bool bRestartable;
6161
}
62+
63+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
64+
private struct Shellexecuteinfo
65+
{
66+
public int cbSize;
67+
public uint fMask;
68+
private readonly IntPtr hwnd;
69+
[MarshalAs(UnmanagedType.LPTStr)]
70+
public string lpVerb;
71+
[MarshalAs(UnmanagedType.LPTStr)]
72+
public string lpFile;
73+
[MarshalAs(UnmanagedType.LPTStr)]
74+
private readonly string lpParameters;
75+
[MarshalAs(UnmanagedType.LPTStr)]
76+
private readonly string lpDirectory;
77+
public int nShow;
78+
private readonly IntPtr hInstApp;
79+
private readonly IntPtr lpIDList;
80+
[MarshalAs(UnmanagedType.LPTStr)]
81+
private readonly string lpClass;
82+
83+
private readonly IntPtr hkeyClass;
84+
private readonly uint dwHotKey;
85+
private readonly IntPtr hIcon;
86+
private readonly IntPtr hProcess;
87+
}
6288
#endregion
6389

6490
#region DllImport
@@ -73,6 +99,9 @@ private struct RmProcessInfo
7399

74100
[DllImport("rstrtmgr.dll")]
75101
private static extern int RmGetList(uint dwSessionHandle, out uint pnProcInfoNeeded, ref uint pnProcInfo, [In, Out] RmProcessInfo[] rgAffectedApps, ref uint lpdwRebootReasons);
102+
103+
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
104+
private static extern bool ShellExecuteEx(ref Shellexecuteinfo lpExecInfo);
76105
#endregion
77106

78107
/// <summary>
@@ -132,5 +161,21 @@ internal static IEnumerable<Process> FindLockingProcesses(string path, Language
132161
}
133162
return processes;
134163
}
164+
165+
/// <summary>
166+
/// Show the properties dialog of a file.
167+
/// </summary>
168+
/// <param name="path">The path of the file.</param>
169+
/// <returns></returns>
170+
internal static bool ShowFileProperties(string path)
171+
{
172+
Shellexecuteinfo info = new Shellexecuteinfo();
173+
info.cbSize = Marshal.SizeOf(info);
174+
info.lpVerb = "properties";
175+
info.lpFile = path;
176+
info.nShow = 5;
177+
info.fMask = 12;
178+
return ShellExecuteEx(ref info);
179+
}
135180
}
136181
}

DeadLock/Forms/FrmMain.Designer.cs

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DeadLock/Forms/FrmMain.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,5 +923,14 @@ private void FrmMain_DragDrop(object sender, DragEventArgs e)
923923
OpenPath(f);
924924
}
925925
}
926+
927+
private void lsvDetails_DoubleClick(object sender, EventArgs e)
928+
{
929+
if (lsvDetails.SelectedItems.Count == 0) return;
930+
foreach (ListViewItem lvi in lsvDetails.SelectedItems)
931+
{
932+
NativeMethods.ShowFileProperties(lvi.SubItems[1].Text);
933+
}
934+
}
926935
}
927936
}

DeadLock/Forms/FrmUpdater.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public partial class FrmUpdater : MetroForm
2121
private readonly Update _update;
2222
private readonly WebClient _webClient;
2323
private readonly Language _language;
24-
2524
private readonly string _extension;
2625
#endregion
2726

DeadLock/Resources/Languages/eng.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<CmiOpenInVirusTotal>Open in VirusTotal</CmiOpenInVirusTotal>
5252
<CmiKill>Kill</CmiKill>
5353
<CmiOpenFileLocation>Open file location</CmiOpenFileLocation>
54+
<CmiProperties>Properties</CmiProperties>
5455
<MsgSuccessfullyKilled>Successfully killed the selected process(es)!</MsgSuccessfullyKilled>
5556
<CmiHideShow>Hide / Show</CmiHideShow>
5657
<MsgAdministrator>DeadLock might not function correctly without administrative rights!</MsgAdministrator>

DeadLock/Resources/Languages/fr.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<CmiOpenInVirusTotal>Ouvert en VirusTotal</CmiOpenInVirusTotal>
5252
<CmiKill>Tuer</CmiKill>
5353
<CmiOpenFileLocation>Ouvrir l'endroit du fichier</CmiOpenFileLocation>
54+
<CmiProperties>Propriétés</CmiProperties>
5455
<MsgSuccessfullyKilled>Processus sélectionné enrayé avec succès!</MsgSuccessfullyKilled>
5556
<CmiHideShow>Hide / Show</CmiHideShow>
5657
<MsgAdministrator>DeadLock ne fonctionnera pas correctement sans les droits administrateur!</MsgAdministrator>

DeadLock/Resources/Languages/ita.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<CmiOpenInVirusTotal>Apri in VirusTotal</CmiOpenInVirusTotal>
5252
<CmiKill>Arresta</CmiKill>
5353
<CmiOpenFileLocation>Apri posizione del File</CmiOpenFileLocation>
54+
<CmiProperties>Proprietà</CmiProperties>
5455
<MsgSuccessfullyKilled>Processo/i selezionato/i arrestato/i con successo!</MsgSuccessfullyKilled>
5556
<CmiHideShow>Nascondi / Mostra</CmiHideShow>
5657
<MsgAdministrator>DeadLock potrebbe non funzionare correttamente senza i diritti d´amministratore!</MsgAdministrator>

DeadLock/Resources/Languages/kor.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<CmiOpenInVirusTotal>VirusTotal에서 열기</CmiOpenInVirusTotal>
5252
<CmiKill>종료</CmiKill>
5353
<CmiOpenFileLocation>파일 위치 열기</CmiOpenFileLocation>
54+
<CmiProperties>등록</CmiProperties>
5455
<MsgSuccessfullyKilled>선택한 프로세스가 성공적으로 종료되었습니다!</MsgSuccessfullyKilled>
5556
<CmiHideShow>숨김 / 표시</CmiHideShow>
5657
<MsgAdministrator>DeadLock는 관리자 권한이 없으면 제대로 작동되지 않을 수 있습니다!</MsgAdministrator>

DeadLock/Resources/Languages/nl.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<CmiOpenInVirusTotal>Openen in VirusTotal</CmiOpenInVirusTotal>
5252
<CmiKill>Sluiten</CmiKill>
5353
<CmiOpenFileLocation>Open bestandslocatie</CmiOpenFileLocation>
54+
<CmiProperties>Eigenschappen</CmiProperties>
5455
<MsgSuccessfullyKilled>De geselecteerde processen zijn met success gesloten!</MsgSuccessfullyKilled>
5556
<CmiHideShow>Verberg / Toon</CmiHideShow>
5657
<MsgAdministrator>DeadLock zal mogelijk niet correct functioneren zonder administratieve rechten!</MsgAdministrator>

0 commit comments

Comments
 (0)