Added lower memory footprint expert setting and created a PsAPI.cs file for the Process API invokes.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1866 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-05-17 14:19:56 +00:00
parent ffb9502015
commit d0ff4fbed6
8 changed files with 95 additions and 41 deletions

View file

@ -1179,6 +1179,10 @@ namespace Greenshot {
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void BackgroundWorkerTimerTick(object sender, EventArgs e) { private void BackgroundWorkerTimerTick(object sender, EventArgs e) {
if (conf.MinimizeWorkingSetSize) {
LOG.Info("Calling EmptyWorkingSet");
PsAPI.EmptyWorkingSet(Process.GetCurrentProcess().Handle);
}
if (UpdateHelper.IsUpdateCheckNeeded()) { if (UpdateHelper.IsUpdateCheckNeeded()) {
LOG.Debug("BackgroundWorkerTimerTick checking for update"); LOG.Debug("BackgroundWorkerTimerTick checking for update");
// Start update check in the background // Start update check in the background

View file

@ -73,7 +73,7 @@ namespace Greenshot {
this.groupbox_destination = new GreenshotPlugin.Controls.GreenshotGroupBox(); this.groupbox_destination = new GreenshotPlugin.Controls.GreenshotGroupBox();
this.checkbox_picker = new GreenshotPlugin.Controls.GreenshotCheckBox(); this.checkbox_picker = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.listview_destinations = new System.Windows.Forms.ListView(); this.listview_destinations = new System.Windows.Forms.ListView();
this.destination = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.destination = new System.Windows.Forms.ColumnHeader();
this.tabcontrol = new System.Windows.Forms.TabControl(); this.tabcontrol = new System.Windows.Forms.TabControl();
this.tab_general = new GreenshotPlugin.Controls.GreenshotTabPage(); this.tab_general = new GreenshotPlugin.Controls.GreenshotTabPage();
this.groupbox_network = new GreenshotPlugin.Controls.GreenshotGroupBox(); this.groupbox_network = new GreenshotPlugin.Controls.GreenshotGroupBox();
@ -124,6 +124,7 @@ namespace Greenshot {
this.button_pluginconfigure = new GreenshotPlugin.Controls.GreenshotButton(); this.button_pluginconfigure = new GreenshotPlugin.Controls.GreenshotButton();
this.tab_expert = new GreenshotPlugin.Controls.GreenshotTabPage(); this.tab_expert = new GreenshotPlugin.Controls.GreenshotTabPage();
this.groupbox_expert = new GreenshotPlugin.Controls.GreenshotGroupBox(); this.groupbox_expert = new GreenshotPlugin.Controls.GreenshotGroupBox();
this.checkbox_checkunstableupdates = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.checkbox_suppresssavedialogatclose = new GreenshotPlugin.Controls.GreenshotCheckBox(); this.checkbox_suppresssavedialogatclose = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.label_counter = new GreenshotPlugin.Controls.GreenshotLabel(); this.label_counter = new GreenshotPlugin.Controls.GreenshotLabel();
this.textbox_counter = new GreenshotPlugin.Controls.GreenshotTextBox(); this.textbox_counter = new GreenshotPlugin.Controls.GreenshotTextBox();
@ -135,8 +136,8 @@ namespace Greenshot {
this.label_clipboardformats = new GreenshotPlugin.Controls.GreenshotLabel(); this.label_clipboardformats = new GreenshotPlugin.Controls.GreenshotLabel();
this.checkbox_enableexpert = new GreenshotPlugin.Controls.GreenshotCheckBox(); this.checkbox_enableexpert = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.listview_clipboardformats = new System.Windows.Forms.ListView(); this.listview_clipboardformats = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.checkbox_checkunstableupdates = new GreenshotPlugin.Controls.GreenshotCheckBox(); this.checkbox_minimizememoryfootprint = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.groupbox_preferredfilesettings.SuspendLayout(); this.groupbox_preferredfilesettings.SuspendLayout();
this.groupbox_applicationsettings.SuspendLayout(); this.groupbox_applicationsettings.SuspendLayout();
this.groupbox_qualitysettings.SuspendLayout(); this.groupbox_qualitysettings.SuspendLayout();
@ -424,7 +425,7 @@ namespace Greenshot {
this.listview_destinations.AutoArrange = false; this.listview_destinations.AutoArrange = false;
this.listview_destinations.CheckBoxes = true; this.listview_destinations.CheckBoxes = true;
this.listview_destinations.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.listview_destinations.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.destination}); this.destination});
this.listview_destinations.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.listview_destinations.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listview_destinations.LabelWrap = false; this.listview_destinations.LabelWrap = false;
this.listview_destinations.Location = new System.Drawing.Point(6, 38); this.listview_destinations.Location = new System.Drawing.Point(6, 38);
@ -786,16 +787,16 @@ namespace Greenshot {
// numericUpDownWaitTime // numericUpDownWaitTime
// //
this.numericUpDownWaitTime.Increment = new decimal(new int[] { this.numericUpDownWaitTime.Increment = new decimal(new int[] {
100, 100,
0, 0,
0, 0,
0}); 0});
this.numericUpDownWaitTime.Location = new System.Drawing.Point(11, 69); this.numericUpDownWaitTime.Location = new System.Drawing.Point(11, 69);
this.numericUpDownWaitTime.Maximum = new decimal(new int[] { this.numericUpDownWaitTime.Maximum = new decimal(new int[] {
10000, 10000,
0, 0,
0, 0,
0}); 0});
this.numericUpDownWaitTime.Name = "numericUpDownWaitTime"; this.numericUpDownWaitTime.Name = "numericUpDownWaitTime";
this.numericUpDownWaitTime.Size = new System.Drawing.Size(57, 20); this.numericUpDownWaitTime.Size = new System.Drawing.Size(57, 20);
this.numericUpDownWaitTime.TabIndex = 24; this.numericUpDownWaitTime.TabIndex = 24;
@ -984,9 +985,9 @@ namespace Greenshot {
// //
// groupbox_plugins // groupbox_plugins
// //
this.groupbox_plugins.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupbox_plugins.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupbox_plugins.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.groupbox_plugins.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.groupbox_plugins.Controls.Add(this.listview_plugins); this.groupbox_plugins.Controls.Add(this.listview_plugins);
this.groupbox_plugins.Controls.Add(this.button_pluginconfigure); this.groupbox_plugins.Controls.Add(this.button_pluginconfigure);
@ -1038,6 +1039,7 @@ namespace Greenshot {
// //
// groupbox_expert // groupbox_expert
// //
this.groupbox_expert.Controls.Add(this.checkbox_minimizememoryfootprint);
this.groupbox_expert.Controls.Add(this.checkbox_checkunstableupdates); this.groupbox_expert.Controls.Add(this.checkbox_checkunstableupdates);
this.groupbox_expert.Controls.Add(this.checkbox_suppresssavedialogatclose); this.groupbox_expert.Controls.Add(this.checkbox_suppresssavedialogatclose);
this.groupbox_expert.Controls.Add(this.label_counter); this.groupbox_expert.Controls.Add(this.label_counter);
@ -1058,10 +1060,20 @@ namespace Greenshot {
this.groupbox_expert.TabStop = false; this.groupbox_expert.TabStop = false;
this.groupbox_expert.Text = "Expert"; this.groupbox_expert.Text = "Expert";
// //
// checkbox_checkunstableupdates
//
this.checkbox_checkunstableupdates.LanguageKey = "expertsettings_checkunstableupdates";
this.checkbox_checkunstableupdates.Location = new System.Drawing.Point(10, 191);
this.checkbox_checkunstableupdates.Name = "checkbox_checkunstableupdates";
this.checkbox_checkunstableupdates.PropertyName = "CheckUnstable";
this.checkbox_checkunstableupdates.Size = new System.Drawing.Size(394, 19);
this.checkbox_checkunstableupdates.TabIndex = 29;
this.checkbox_checkunstableupdates.UseVisualStyleBackColor = true;
//
// checkbox_suppresssavedialogatclose // checkbox_suppresssavedialogatclose
// //
this.checkbox_suppresssavedialogatclose.LanguageKey = "expertsettings_suppresssavedialogatclose"; this.checkbox_suppresssavedialogatclose.LanguageKey = "expertsettings_suppresssavedialogatclose";
this.checkbox_suppresssavedialogatclose.Location = new System.Drawing.Point(10, 182); this.checkbox_suppresssavedialogatclose.Location = new System.Drawing.Point(10, 168);
this.checkbox_suppresssavedialogatclose.Name = "checkbox_suppresssavedialogatclose"; this.checkbox_suppresssavedialogatclose.Name = "checkbox_suppresssavedialogatclose";
this.checkbox_suppresssavedialogatclose.PropertyName = "SuppressSaveDialogAtClose"; this.checkbox_suppresssavedialogatclose.PropertyName = "SuppressSaveDialogAtClose";
this.checkbox_suppresssavedialogatclose.SectionName = "Editor"; this.checkbox_suppresssavedialogatclose.SectionName = "Editor";
@ -1108,7 +1120,7 @@ namespace Greenshot {
// checkbox_thumbnailpreview // checkbox_thumbnailpreview
// //
this.checkbox_thumbnailpreview.LanguageKey = "expertsettings_thumbnailpreview"; this.checkbox_thumbnailpreview.LanguageKey = "expertsettings_thumbnailpreview";
this.checkbox_thumbnailpreview.Location = new System.Drawing.Point(10, 163); this.checkbox_thumbnailpreview.Location = new System.Drawing.Point(10, 149);
this.checkbox_thumbnailpreview.Name = "checkbox_thumbnailpreview"; this.checkbox_thumbnailpreview.Name = "checkbox_thumbnailpreview";
this.checkbox_thumbnailpreview.PropertyName = "ThumnailPreview"; this.checkbox_thumbnailpreview.PropertyName = "ThumnailPreview";
this.checkbox_thumbnailpreview.Size = new System.Drawing.Size(394, 24); this.checkbox_thumbnailpreview.Size = new System.Drawing.Size(394, 24);
@ -1119,7 +1131,7 @@ namespace Greenshot {
// checkbox_optimizeforrdp // checkbox_optimizeforrdp
// //
this.checkbox_optimizeforrdp.LanguageKey = "expertsettings_optimizeforrdp"; this.checkbox_optimizeforrdp.LanguageKey = "expertsettings_optimizeforrdp";
this.checkbox_optimizeforrdp.Location = new System.Drawing.Point(10, 144); this.checkbox_optimizeforrdp.Location = new System.Drawing.Point(10, 130);
this.checkbox_optimizeforrdp.Name = "checkbox_optimizeforrdp"; this.checkbox_optimizeforrdp.Name = "checkbox_optimizeforrdp";
this.checkbox_optimizeforrdp.PropertyName = "OptimizeForRDP"; this.checkbox_optimizeforrdp.PropertyName = "OptimizeForRDP";
this.checkbox_optimizeforrdp.Size = new System.Drawing.Size(394, 24); this.checkbox_optimizeforrdp.Size = new System.Drawing.Size(394, 24);
@ -1130,7 +1142,7 @@ namespace Greenshot {
// checkbox_autoreducecolors // checkbox_autoreducecolors
// //
this.checkbox_autoreducecolors.LanguageKey = "expertsettings_autoreducecolors"; this.checkbox_autoreducecolors.LanguageKey = "expertsettings_autoreducecolors";
this.checkbox_autoreducecolors.Location = new System.Drawing.Point(10, 125); this.checkbox_autoreducecolors.Location = new System.Drawing.Point(10, 111);
this.checkbox_autoreducecolors.Name = "checkbox_autoreducecolors"; this.checkbox_autoreducecolors.Name = "checkbox_autoreducecolors";
this.checkbox_autoreducecolors.PropertyName = "OutputFileAutoReduceColors"; this.checkbox_autoreducecolors.PropertyName = "OutputFileAutoReduceColors";
this.checkbox_autoreducecolors.Size = new System.Drawing.Size(394, 24); this.checkbox_autoreducecolors.Size = new System.Drawing.Size(394, 24);
@ -1142,7 +1154,7 @@ namespace Greenshot {
// //
this.label_clipboardformats.AutoSize = true; this.label_clipboardformats.AutoSize = true;
this.label_clipboardformats.LanguageKey = "expertsettings_clipboardformats"; this.label_clipboardformats.LanguageKey = "expertsettings_clipboardformats";
this.label_clipboardformats.Location = new System.Drawing.Point(7, 45); this.label_clipboardformats.Location = new System.Drawing.Point(7, 39);
this.label_clipboardformats.Name = "label_clipboardformats"; this.label_clipboardformats.Name = "label_clipboardformats";
this.label_clipboardformats.Size = new System.Drawing.Size(88, 13); this.label_clipboardformats.Size = new System.Drawing.Size(88, 13);
this.label_clipboardformats.TabIndex = 20; this.label_clipboardformats.TabIndex = 20;
@ -1165,13 +1177,13 @@ namespace Greenshot {
this.listview_clipboardformats.AutoArrange = false; this.listview_clipboardformats.AutoArrange = false;
this.listview_clipboardformats.CheckBoxes = true; this.listview_clipboardformats.CheckBoxes = true;
this.listview_clipboardformats.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.listview_clipboardformats.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1}); this.columnHeader1});
this.listview_clipboardformats.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.listview_clipboardformats.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listview_clipboardformats.LabelWrap = false; this.listview_clipboardformats.LabelWrap = false;
this.listview_clipboardformats.Location = new System.Drawing.Point(109, 44); this.listview_clipboardformats.Location = new System.Drawing.Point(109, 38);
this.listview_clipboardformats.Name = "listview_clipboardformats"; this.listview_clipboardformats.Name = "listview_clipboardformats";
this.listview_clipboardformats.ShowGroups = false; this.listview_clipboardformats.ShowGroups = false;
this.listview_clipboardformats.Size = new System.Drawing.Size(291, 80); this.listview_clipboardformats.Size = new System.Drawing.Size(291, 72);
this.listview_clipboardformats.Sorting = System.Windows.Forms.SortOrder.Ascending; this.listview_clipboardformats.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listview_clipboardformats.TabIndex = 0; this.listview_clipboardformats.TabIndex = 0;
this.listview_clipboardformats.UseCompatibleStateImageBehavior = false; this.listview_clipboardformats.UseCompatibleStateImageBehavior = false;
@ -1182,15 +1194,15 @@ namespace Greenshot {
this.columnHeader1.Text = "Destination"; this.columnHeader1.Text = "Destination";
this.columnHeader1.Width = 280; this.columnHeader1.Width = 280;
// //
// checkbox_checkunstableupdates // checkbox_minimizememoryfootprint
// //
this.checkbox_checkunstableupdates.LanguageKey = "expertsettings_checkunstableupdates"; this.checkbox_minimizememoryfootprint.LanguageKey = "expertsettings_minimizememoryfootprint";
this.checkbox_checkunstableupdates.Location = new System.Drawing.Point(10, 201); this.checkbox_minimizememoryfootprint.Location = new System.Drawing.Point(10, 211);
this.checkbox_checkunstableupdates.Name = "checkbox_checkunstableupdates"; this.checkbox_minimizememoryfootprint.Name = "checkbox_minimizememoryfootprint";
this.checkbox_checkunstableupdates.PropertyName = "CheckUnstable"; this.checkbox_minimizememoryfootprint.PropertyName = "MinimizeWorkingSetSize";
this.checkbox_checkunstableupdates.Size = new System.Drawing.Size(394, 24); this.checkbox_minimizememoryfootprint.Size = new System.Drawing.Size(394, 19);
this.checkbox_checkunstableupdates.TabIndex = 29; this.checkbox_minimizememoryfootprint.TabIndex = 30;
this.checkbox_checkunstableupdates.UseVisualStyleBackColor = true; this.checkbox_minimizememoryfootprint.UseVisualStyleBackColor = true;
// //
// SettingsForm // SettingsForm
// //
@ -1205,7 +1217,6 @@ namespace Greenshot {
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "SettingsForm"; this.Name = "SettingsForm";
this.Text = "Settings";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsFormFormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsFormFormClosing);
this.Shown += new System.EventHandler(this.SettingsFormShown); this.Shown += new System.EventHandler(this.SettingsFormShown);
this.groupbox_preferredfilesettings.ResumeLayout(false); this.groupbox_preferredfilesettings.ResumeLayout(false);
@ -1239,8 +1250,8 @@ namespace Greenshot {
this.groupbox_expert.ResumeLayout(false); this.groupbox_expert.ResumeLayout(false);
this.groupbox_expert.PerformLayout(); this.groupbox_expert.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_minimizememoryfootprint;
private System.Windows.Forms.ColumnHeader destination; private System.Windows.Forms.ColumnHeader destination;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_picker; private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_picker;
private System.Windows.Forms.ListView listview_destinations; private System.Windows.Forms.ListView listview_destinations;

View file

@ -488,6 +488,7 @@ namespace Greenshot {
textbox_counter.Enabled = state; textbox_counter.Enabled = state;
checkbox_suppresssavedialogatclose.Enabled = state; checkbox_suppresssavedialogatclose.Enabled = state;
checkbox_checkunstableupdates.Enabled = state; checkbox_checkunstableupdates.Enabled = state;
checkbox_minimizememoryfootprint.Enabled = state;
} }
/// <summary> /// <summary>

View file

@ -673,6 +673,9 @@ time, e.g. 11_58_32 (plus extension defined in the settings)
<resource name="expertsettings_suppresssavedialogatclose"> <resource name="expertsettings_suppresssavedialogatclose">
Suppress the save dialog when closing the editor Suppress the save dialog when closing the editor
</resource> </resource>
<resource name="expertsettings_minimizememoryfootprint">
Minimize memory footprint, but with a performance penalty (not adviced).
</resource>
<resource name="WindowCaptureMode.Screen"> <resource name="WindowCaptureMode.Screen">
As displayed As displayed
</resource> </resource>

View file

@ -171,6 +171,8 @@ namespace GreenshotPlugin.Core {
[IniProperty("OptimizeForRDP", Description="Make some optimizations for usage with remote desktop", DefaultValue="False")] [IniProperty("OptimizeForRDP", Description="Make some optimizations for usage with remote desktop", DefaultValue="False")]
public bool OptimizeForRDP; public bool OptimizeForRDP;
[IniProperty("MinimizeWorkingSetSize", Description="Optimize memory footprint, but with a performance penalty!", DefaultValue="False")]
public bool MinimizeWorkingSetSize;
// change to false for releases // change to false for releases

View file

@ -265,6 +265,7 @@
<Compile Include="UnmanagedHelpers\Enumerations.cs" /> <Compile Include="UnmanagedHelpers\Enumerations.cs" />
<Compile Include="UnmanagedHelpers\GDI32.cs" /> <Compile Include="UnmanagedHelpers\GDI32.cs" />
<Compile Include="UnmanagedHelpers\Kernel32.cs" /> <Compile Include="UnmanagedHelpers\Kernel32.cs" />
<Compile Include="UnmanagedHelpers\PsAPI.cs" />
<Compile Include="UnmanagedHelpers\Shell32.cs" /> <Compile Include="UnmanagedHelpers\Shell32.cs" />
<Compile Include="UnmanagedHelpers\Structs.cs" /> <Compile Include="UnmanagedHelpers\Structs.cs" />
<Compile Include="UnmanagedHelpers\User32.cs" /> <Compile Include="UnmanagedHelpers\User32.cs" />

View file

@ -66,12 +66,6 @@ namespace GreenshotPlugin.UnmanagedHelpers {
[DllImport("kernel32", SetLastError = true)] [DllImport("kernel32", SetLastError = true)]
public static extern bool CloseHandle(IntPtr hObject); public static extern bool CloseHandle(IntPtr hObject);
// TODO: Move to PSAPI.cs ??
[DllImport("psapi", SetLastError = true)]
public static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, uint nSize);
[DllImport("psapi", SetLastError = true)]
public static extern uint GetProcessImageFileName(IntPtr hProcess, StringBuilder lpImageFileName, uint nSize);
/// <summary> /// <summary>
/// Method to get the process path /// Method to get the process path
/// </summary> /// </summary>
@ -85,7 +79,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
IntPtr hprocess = Kernel32.OpenProcess(ProcessAccessFlags.QueryInformation | ProcessAccessFlags.VMRead, false, processid); IntPtr hprocess = Kernel32.OpenProcess(ProcessAccessFlags.QueryInformation | ProcessAccessFlags.VMRead, false, processid);
if (hprocess != IntPtr.Zero) { if (hprocess != IntPtr.Zero) {
try { try {
if (Kernel32.GetModuleFileNameEx(hprocess, IntPtr.Zero, _PathBuffer, (uint)_PathBuffer.Capacity) > 0) { if (PsAPI.GetModuleFileNameEx(hprocess, IntPtr.Zero, _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {
return _PathBuffer.ToString(); return _PathBuffer.ToString();
} }
} finally { } finally {
@ -103,7 +97,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
} }
// Try the GetProcessImageFileName method // Try the GetProcessImageFileName method
if (Kernel32.GetProcessImageFileName(hprocess, _PathBuffer, (uint)_PathBuffer.Capacity) > 0) { if (PsAPI.GetProcessImageFileName(hprocess, _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {
string dospath = _PathBuffer.ToString(); string dospath = _PathBuffer.ToString();
foreach (string drive in Environment.GetLogicalDrives()) { foreach (string drive in Environment.GetLogicalDrives()) {
if (Kernel32.QueryDosDevice(drive.TrimEnd('\\'), _PathBuffer, (uint)_PathBuffer.Capacity) > 0) { if (Kernel32.QueryDosDevice(drive.TrimEnd('\\'), _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {

View file

@ -0,0 +1,38 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace GreenshotPlugin.UnmanagedHelpers {
/// <summary>
/// Description of PsAPI.
/// </summary>
public class PsAPI {
[DllImport("psapi", SetLastError = true)]
public static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, uint nSize);
[DllImport("psapi", SetLastError = true)]
public static extern uint GetProcessImageFileName(IntPtr hProcess, StringBuilder lpImageFileName, uint nSize);
[DllImport("psapi")]
public static extern int EmptyWorkingSet(IntPtr hwProc);
}
}