/// <summary>
 /// Creates a new instance of this class.
 /// </summary>
 /// <param name="callbackDelegate">The callback method that will be invoked by 
 /// the system before Windows Error Reporting (WER) terminates the 
 /// application.</param>
 /// <param name="theParameter">An optional argument for the callback method. </param>
 /// <param name="thePingInterval">The time interval within which the 
 /// callback method must invoke <see cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.ArrManager.ApplicationRecoveryInProgress"/> to 
 /// prevent WER from terminating the application.</param>
 /// <seealso cref="Microsoft.SDK.Samples.VistaBridge.Library.AppRecoveryRestart.ArrManager"/>
 public RecoverySettings(
     RecoveryCallback callbackDelegate,
     RecoveryData theParameter,
     uint thePingInterval)
 {
     this.recoveryCallback = callbackDelegate;
     this.parameter = theParameter;
     this.pingInterval = thePingInterval;
 }
        private static void RegisterForApplicationRecovery(
            RecoveryCallback recoveryCallback,
            RecoveryData parameter,
            uint pingInterval)
        {
            uint returnValue = NativeMethods.RegisterApplicationRecoveryCallback(
                recoveryCallback,
                parameter,
                pingInterval,
                (uint)0);

            if (returnValue == SafeNativeMethods.ResultFalse)
            {
                throw new Win32Exception(
                    "Application failed to register for recovery.");
            }
            if (returnValue == SafeNativeMethods.ResultInvalidArgument)
            {
                throw new ArgumentException(
                    "Application was not registered for recovery due to bad parameters.");
            }
        }
예제 #3
0
        private static void RegisterForApplicationRecovery(
            RecoveryCallback recoveryCallback,
            RecoveryData parameter,
            uint pingInterval)
        {
            uint returnValue = NativeMethods.RegisterApplicationRecoveryCallback(
                recoveryCallback,
                parameter,
                pingInterval,
                (uint)0);

            if (returnValue == SafeNativeMethods.ResultFalse)
            {
                throw new Win32Exception(
                          "Application failed to register for recovery.");
            }
            if (returnValue == SafeNativeMethods.ResultInvalidArgument)
            {
                throw new ArgumentException(
                          "Application was not registered for recovery due to bad parameters.");
            }
        }
예제 #4
0
 internal static extern uint RegisterApplicationRecoveryCallback(
     RecoveryCallback recoveryCallback,
     RecoveryData parameter,
     uint pingInterval,
     uint flags); // Unused.
예제 #5
0
 internal static extern uint GetApplicationRecoveryCallback(
     IntPtr processHandle,
     out RecoveryCallback recoveryCallback,
     out RecoveryData parameter,
     out uint pingInterval,
     out uint flags);
        private static void ApplicationRecoverySettings(
            IntPtr processHandle,
            out RecoveryCallback recoveryCallback,
            out RecoveryData parameter,
            out uint pingInterval)
        {
            uint flags = 0;
            uint returnValue;

            returnValue = NativeMethods.GetApplicationRecoveryCallback(
            processHandle,
            out recoveryCallback,
            out parameter,
            out pingInterval,
            out flags);

            if (returnValue == SafeNativeMethods.ResultFalse || recoveryCallback == null)
            {
                throw new InvalidOperationException(
                    "Application is not registered for recovery.");
            }
            if (returnValue == SafeNativeMethods.ResultInvalidArgument)
            {
                throw new ArgumentException(
                    "Failed to get application recovery settings due to bad parameters.");
            }
        }
 /// <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;
 }
 internal static extern HRESULT GetApplicationRecoveryCallback(
     IntPtr processHandle,
     out RecoveryCallback recoveryCallback,
     out object state,
     out uint pingInterval,
     out uint flags);
예제 #9
0
 /// <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;
 }
예제 #10
0
 internal static extern uint RegisterApplicationRecoveryCallback(
     RecoveryCallback recoveryCallback,
     RecoveryData parameter,
     uint pingInterval,
     uint flags); // Unused.
예제 #11
0
 internal static extern uint GetApplicationRecoveryCallback(
     IntPtr processHandle,
     out RecoveryCallback recoveryCallback,
     out RecoveryData parameter,
     out uint pingInterval,
     out uint flags);
 internal static extern HRESULT GetApplicationRecoveryCallback(
     IntPtr processHandle,
     out RecoveryCallback recoveryCallback,
     out object state,
     out uint pingInterval,
     out uint flags);