mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Fixed "access denied" exception.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1747 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
cdba70d227
commit
8d26d1538f
1 changed files with 11 additions and 5 deletions
|
@ -576,15 +576,21 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if Process uses PresentationFramework.dll -> meaning it uses WPF
|
/// Check if Process uses PresentationFramework.dll -> meaning it uses WPF
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="process"></param>
|
/// <param name="process">Proces to check for the presentation framework</param>
|
||||||
/// <returns>true if the process uses WPF</returns>
|
/// <returns>true if the process uses WPF</returns>
|
||||||
private static bool isWPF(Process process) {
|
private static bool isWPF(Process process) {
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
foreach(ProcessModule module in process.Modules) {
|
try {
|
||||||
if (module.ModuleName.StartsWith("PresentationFramework")) {
|
foreach (ProcessModule module in process.Modules) {
|
||||||
LOG.InfoFormat("Found that Process {0} uses {1}, assuming it's using WPF", process.ProcessName, module.FileName);
|
if (module.ModuleName.StartsWith("PresentationFramework")) {
|
||||||
return true;
|
LOG.InfoFormat("Found that Process {0} uses {1}, assuming it's using WPF", process.ProcessName, module.FileName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception) {
|
||||||
|
// Access denied on the modules
|
||||||
|
LOG.WarnFormat("No access on the modules from process {0}, assuming WPF is used.", process.ProcessName);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue