/// <summary>Do not restart the process if it terminates due to an unhandled exception.</summary>
RESTART_NO_CRASH=1,
/// <summary>Do not restart the process if it terminates due to the application not responding.</summary>
RESTART_NO_HANG=2,
/// <summary>Do not restart the process if it terminates due to the installation of an update.</summary>
RESTART_NO_PATCH=4,
/// <summary>Do not restart the process if the computer is restarted as the result of an update.</summary>
RESTART_NO_REBOOT=8,
}
[PInvokeData("Winbase.h")]
publicenumDeactivateActCtxFlag
{
/// <summary>
/// If this value is set and the cookie specified in the ulCookie parameter is in the top frame of the activation stack, the activation context is
/// popped from the stack and thereby deactivated.
/// <para>
/// If this value is set and the cookie specified in the ulCookie parameter is not in the top frame of the activation stack, this function searches
/// down the stack for the cookie.
/// </para>
/// <para>If the cookie is found, a STATUS_SXS_EARLY_DEACTIVATION exception is thrown.</para>
/// <para>If the cookie is not found, a STATUS_SXS_INVALID_DEACTIVATION exception is thrown.</para>
/// <para>This value should be specified in most cases.</para>
/// </summary>
None=0,
/// <summary>
/// If this value is set and the cookie specified in the ulCookie parameter is in the top frame of the activation stack, the function returns an
/// ERROR_INVALID_PARAMETER error code. Call GetLastError to obtain this code.
/// <para>If this value is set and the cookie is not on the activation stack, a STATUS_SXS_INVALID_DEACTIVATION exception will be thrown.</para>
/// <para>
/// If this value is set and the cookie is in a lower frame of the activation stack, all of the frames down to and including the frame the cookie is
/// in is popped from the stack.
/// </para>
/// </summary>
DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION=1
}
/// <summary>
/// Application-defined callback function used to save data and application state information in the event the application encounters an unhandled
/// exception or becomes unresponsive.
/// </summary>
/// <param name="pvParameter">Context information specified when you called the RegisterApplicationRecoveryCallback function to register for recovery.</param>
/// <returns>The return value is not used and should be 0.</returns>
/// The ActivateActCtx function activates the specified activation context. It does this by pushing the specified activation context to the top of the
/// activation stack. The specified activation context is thus associated with the current thread and any appropriate side-by-side API functions.
/// </summary>
/// <param name="hActCtx">Handle to an ACTCTX structure that contains information on the activation context that is to be made active.</param>
/// <param name="lpCookie">Pointer to a ULONG_PTR that functions as a cookie, uniquely identifying a specific, activated activation context.</param>
/// <returns>If the function succeeds, it returns TRUE. Otherwise, it returns FALSE. This function sets errors that can be retrieved by calling GetLastError.</returns>
/// <summary>The DeactivateActCtx function deactivates the activation context corresponding to the specified cookie.</summary>
/// <param name="dwFlags">Flags that indicate how the deactivation is to occur.</param>
/// <param name="lpCookie">
/// The ULONG_PTR that was passed into the call to ActivateActCtx. This value is used as a cookie to identify a specific activated activation context.
/// </param>
/// <returns>If the function succeeds, it returns TRUE. Otherwise, it returns FALSE. This function sets errors that can be retrieved by calling GetLastError.</returns>
/// Retrieves a pointer to the callback routine registered for the specified process. The address returned is in the virtual address space of the process.
/// </summary>
/// <param name="hProcess">A handle to the process. This handle must have the PROCESS_VM_READ access right.</param>
/// <param name="pRecoveryCallback">A pointer to the recovery callback function. For more information, see ApplicationRecoveryCallback.</param>
/// <param name="ppvParameter">A pointer to the callback parameter.</param>
/// <param name="pdwPingInterval">The recovery ping interval, in 100-nanosecond intervals.</param>
/// <param name="pdwFlags">Reserved for future use.</param>
/// <returns>This function returns S_OK on success.</returns>
/// <summary>Retrieves the restart information registered for the specified process.</summary>
/// <param name="hProcess">A handle to the process. This handle must have the PROCESS_VM_READ access right.</param>
/// <param name="pwzCommandline">
/// A pointer to a buffer that receives the restart command line specified by the application when it called the RegisterApplicationRestart function. The
/// maximum size of the command line, in characters, is RESTART_MAX_CMD_LINE. Can be NULL if pcchSize is zero.
/// </param>
/// <param name="pcchSize">
/// On input, specifies the size of the pwzCommandLine buffer, in characters.
/// <para>
/// If the buffer is not large enough to receive the command line, the function fails with HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) and sets this
/// parameter to the required buffer size, in characters.
/// </para>
/// <para>On output, specifies the size of the buffer that was used.</para>
/// <para>
/// To determine the required buffer size, set pwzCommandLine to NULL and this parameter to zero. The size includes one for the null-terminator
/// character. Note that the function returns S_OK, not HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) in this case.
/// </para>
/// </param>
/// <param name="pdwFlags">
/// A pointer to a variable that receives the flags specified by the application when it called the RegisterApplicationRestart function.
/// </param>
/// <returns>This function returns S_OK on success</returns>
/// <summary>The GetCurrentActCtx function returns the handle to the active activation context of the calling thread.</summary>
/// <param name="handle">Pointer to the returned ACTCTX structure that contains information on the active activation context.</param>
/// <returns>If the function succeeds, it returns TRUE. Otherwise, it returns FALSE. This function sets errors that can be retrieved by calling GetLastError.</returns>
/// <summary>Registers the active instance of an application for recovery.</summary>
/// <param name="pRecoveryCallback">A pointer to the recovery callback function. For more information, see ApplicationRecoveryCallback.</param>
/// <param name="pvParameter">A pointer to a variable to be passed to the callback function. Can be NULL.</param>
/// <param name="dwPingInterval">
/// The recovery ping interval, in milliseconds. By default, the interval is 5 seconds (RECOVERY_DEFAULT_PING_INTERVAL). The maximum interval is 5
/// minutes. If you specify zero, the default interval is used.
/// <para>
/// You must call the ApplicationRecoveryInProgress function within the specified interval to indicate to ARR that you are still actively recovering;
/// otherwise, WER terminates recovery. Typically, you perform recovery in a loop with each iteration lasting no longer than the ping interval. Each
/// iteration performs a block of recovery work followed by a call to ApplicationRecoveryInProgress. Since you also use ApplicationRecoveryInProgress to
/// determine if the user wants to cancel recovery, you should consider a smaller interval, so you do not perform a lot of work unnecessarily.
/// </para>
/// </param>
/// <param name="dwFlags">Reserved for future use. Set to zero.</param>
/// <returns>This function returns S_OK on success</returns>
/// <summary>Registers the active instance of an application for restart.</summary>
/// <param name="pwzCommandline">
/// A string that specifies the command-line arguments for the application when it is restarted. The maximum size of the command line that you can
/// specify is RESTART_MAX_CMD_LINE characters. Do not include the name of the executable in the command line; this function adds it for you.
/// <para>
/// If this parameter is NULL or an empty string, the previously registered command line is removed. If the argument contains spaces, use quotes around
/// the argument.
/// </para>
/// </param>
/// <param name="dwFlags">Options</param>
/// <returns>This function returns S_OK on success</returns>
/// <summary>Removes the active instance of an application from the recovery list.</summary>
/// <remarks>You do not need to call this function before exiting. You need to remove the registration only if you choose to not recover data.</remarks>
/// <returns>This function returns S_OK on success</returns>
/// <summary>Removes the active instance of an application from the restart list.</summary>
/// <remarks>
/// You do not need to call this function before exiting. You need to remove the registration only if you choose to not restart the application. For
/// example, you could remove the registration if your application entered a corrupted state where a future restart would also fail. You must call this
/// function before the application fails abnormally.
/// </remarks>
/// <returns>This function returns S_OK on success</returns>
/// The name of the current application. If the value of this member is set to null, the name of the executable that launched the current process is used.