mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Fixed some errors, removed obsolete code, removed some anonymous delegates and added some additional disposing code in the CaptureHelper.cs
This commit is contained in:
parent
15253ef295
commit
be36a3f42b
11 changed files with 211 additions and 1791 deletions
|
@ -76,6 +76,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
/// A hbitmap SafeHandle implementation
|
||||
/// </summary>
|
||||
public class SafeHBitmapHandle : SafeObjectHandle {
|
||||
[SecurityCritical]
|
||||
private SafeHBitmapHandle() : base(true) {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public SafeHBitmapHandle(IntPtr preexistingHandle) : base(true) {
|
||||
SetHandle(preexistingHandle);
|
||||
|
@ -86,6 +90,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
/// A hRegion SafeHandle implementation
|
||||
/// </summary>
|
||||
public class SafeRegionHandle : SafeObjectHandle {
|
||||
[SecurityCritical]
|
||||
private SafeRegionHandle() : base(true) {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public SafeRegionHandle(IntPtr preexistingHandle) : base(true) {
|
||||
SetHandle(preexistingHandle);
|
||||
|
@ -96,6 +104,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
/// A dibsection SafeHandle implementation
|
||||
/// </summary>
|
||||
public class SafeDibSectionHandle : SafeObjectHandle {
|
||||
[SecurityCritical]
|
||||
private SafeDibSectionHandle() : base(true) {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public SafeDibSectionHandle(IntPtr preexistingHandle) : base(true) {
|
||||
SetHandle(preexistingHandle);
|
||||
|
@ -112,6 +124,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
|
||||
private SafeHandle hdc;
|
||||
|
||||
[SecurityCritical]
|
||||
private SafeSelectObjectHandle() : base(true) {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public SafeSelectObjectHandle(SafeDCHandle hdc, SafeHandle newHandle) : base(true) {
|
||||
this.hdc = hdc;
|
||||
|
@ -135,6 +151,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
[DllImport("gdi32", SetLastError = true)]
|
||||
private static extern bool DeleteDC(IntPtr hDC);
|
||||
|
||||
[SecurityCritical]
|
||||
private SafeCompatibleDCHandle() : base(true) {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public SafeCompatibleDCHandle(IntPtr preexistingHandle) : base(true) {
|
||||
SetHandle(preexistingHandle);
|
||||
|
@ -154,6 +174,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
/// </summary>
|
||||
public class SafeDeviceContextHandle : SafeDCHandle {
|
||||
private Graphics graphics = null;
|
||||
|
||||
[SecurityCritical]
|
||||
private SafeDeviceContextHandle() : base(true) {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public SafeDeviceContextHandle(Graphics graphics, IntPtr preexistingHandle) : base(true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue