mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
be8ab499fa
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2099 21ef857c-d57f-4fe0-8362-d861dc6d29cd
51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace ProcessHackerRestartRecovery
|
|
{
|
|
/// <summary>
|
|
/// The Delegate that represents the callback method invoked by the system when an application has registered for application recovery.
|
|
/// </summary>
|
|
/// <param name="state">An application-defined state object that is passed to the callback method.</param>
|
|
/// <remarks>The callback method will be invoked prior to the application being terminated by Windows Error Reporting (WER).
|
|
/// To keep WER from terminating the application before the callback method completes, the callback method must
|
|
/// periodically call the ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress method.</remarks>
|
|
public delegate int RecoveryCallback(object state);
|
|
|
|
/// <summary>
|
|
/// Defines a class that contains a callback delegate and properties of the application as defined by the user.
|
|
/// </summary>
|
|
public class RecoveryData
|
|
{
|
|
/// <summary>
|
|
/// Initializes a recovery data wrapper with a callback method and the current state of the application.
|
|
/// </summary>
|
|
/// <param name="callback">The callback delegate.</param>
|
|
/// <param name="state">The current state of the application.</param>
|
|
public RecoveryData(RecoveryCallback callback, object state)
|
|
{
|
|
Callback = callback;
|
|
State = state;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value that determines the recovery callback function.
|
|
/// </summary>
|
|
public RecoveryCallback Callback { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value that determines the application state.
|
|
/// </summary>
|
|
public object State { get; set; }
|
|
|
|
/// <summary>
|
|
/// Invokes the recovery callback function.
|
|
/// </summary>
|
|
public void Invoke()
|
|
{
|
|
if(Callback != null)
|
|
Callback(State);
|
|
}
|
|
}
|
|
}
|