mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
Undo of some cleanup which causes issues,
This commit is contained in:
parent
e781bdcd5c
commit
5c04af1684
2 changed files with 63 additions and 1 deletions
|
@ -77,6 +77,16 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// A hbitmap SafeHandle implementation
|
/// A hbitmap SafeHandle implementation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SafeHBitmapHandle : SafeObjectHandle {
|
public class SafeHBitmapHandle : SafeObjectHandle {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
[SecurityCritical]
|
||||||
|
public SafeHBitmapHandle() : base(true)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
public SafeHBitmapHandle(IntPtr preexistingHandle) : base(true) {
|
public SafeHBitmapHandle(IntPtr preexistingHandle) : base(true) {
|
||||||
SetHandle(preexistingHandle);
|
SetHandle(preexistingHandle);
|
||||||
|
@ -87,8 +97,12 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// A hRegion SafeHandle implementation
|
/// A hRegion SafeHandle implementation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SafeRegionHandle : SafeObjectHandle {
|
public class SafeRegionHandle : SafeObjectHandle {
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
private SafeRegionHandle() : base(true) {
|
public SafeRegionHandle() : base(true)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
|
@ -101,6 +115,14 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// A dibsection SafeHandle implementation
|
/// A dibsection SafeHandle implementation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SafeDibSectionHandle : SafeObjectHandle {
|
public class SafeDibSectionHandle : SafeObjectHandle {
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
[SecurityCritical]
|
||||||
|
public SafeDibSectionHandle() : base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
public SafeDibSectionHandle(IntPtr preexistingHandle) : base(true) {
|
public SafeDibSectionHandle(IntPtr preexistingHandle) : base(true) {
|
||||||
SetHandle(preexistingHandle);
|
SetHandle(preexistingHandle);
|
||||||
|
@ -116,6 +138,13 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
private static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
|
private static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
|
||||||
|
|
||||||
private readonly SafeHandle _hdc;
|
private readonly SafeHandle _hdc;
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
[SecurityCritical]
|
||||||
|
public SafeSelectObjectHandle() : base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
public SafeSelectObjectHandle(SafeDCHandle hdc, SafeHandle newHandle) : base(true) {
|
public SafeSelectObjectHandle(SafeDCHandle hdc, SafeHandle newHandle) : base(true) {
|
||||||
|
@ -141,6 +170,14 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
private static extern bool DeleteDC(IntPtr hDC);
|
private static extern bool DeleteDC(IntPtr hDC);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
[SecurityCritical]
|
||||||
|
public SafeCompatibleDCHandle() : base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
public SafeCompatibleDCHandle(IntPtr preexistingHandle) : base(true) {
|
public SafeCompatibleDCHandle(IntPtr preexistingHandle) : base(true) {
|
||||||
SetHandle(preexistingHandle);
|
SetHandle(preexistingHandle);
|
||||||
|
@ -161,6 +198,14 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
public class SafeDeviceContextHandle : SafeDCHandle {
|
public class SafeDeviceContextHandle : SafeDCHandle {
|
||||||
private readonly Graphics _graphics;
|
private readonly Graphics _graphics;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
[SecurityCritical]
|
||||||
|
public SafeDeviceContextHandle() : base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
public SafeDeviceContextHandle(Graphics graphics, IntPtr preexistingHandle) : base(true) {
|
public SafeDeviceContextHandle(Graphics graphics, IntPtr preexistingHandle) : base(true) {
|
||||||
_graphics = graphics;
|
_graphics = graphics;
|
||||||
|
|
|
@ -359,6 +359,16 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// A SafeHandle class implementation for the hIcon
|
/// A SafeHandle class implementation for the hIcon
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SafeIconHandle : SafeHandleZeroOrMinusOneIsInvalid {
|
public class SafeIconHandle : SafeHandleZeroOrMinusOneIsInvalid {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
[SecurityCritical]
|
||||||
|
public SafeIconHandle() : base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public SafeIconHandle(IntPtr hIcon) : base(true) {
|
public SafeIconHandle(IntPtr hIcon) : base(true) {
|
||||||
SetHandle(hIcon);
|
SetHandle(hIcon);
|
||||||
}
|
}
|
||||||
|
@ -380,6 +390,13 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
|
|
||||||
private readonly IntPtr _hWnd;
|
private readonly IntPtr _hWnd;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Needed for marshalling return values
|
||||||
|
/// </summary>
|
||||||
|
public SafeWindowDCHandle() : base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[SecurityCritical]
|
[SecurityCritical]
|
||||||
public SafeWindowDCHandle(IntPtr hWnd, IntPtr preexistingHandle) : base(true) {
|
public SafeWindowDCHandle(IntPtr hWnd, IntPtr preexistingHandle) : base(true) {
|
||||||
_hWnd = hWnd;
|
_hWnd = hWnd;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue