using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Kernel32
{
/// Flags used by WerGetFlags and WerSetFlags.
[PInvokeData("werapi.h", MSDNShortId = "8c5f08c0-e2d1-448c-9a57-ef19897f64c6")]
[Flags]
public enum WER_FAULT_REPORTING
{
/// Do not collect heap information in the event of an application crash or non-response.
WER_FAULT_REPORTING_FLAG_NOHEAP = 1,
/// Queue critical reports for the specified process. This does not show any UI.
WER_FAULT_REPORTING_FLAG_QUEUE = 2,
/// Do not suspend the process threads before reporting the error.
WER_FAULT_REPORTING_FLAG_DISABLE_THREAD_SUSPENSION = 4,
/// Queue critical reports and upload from the queue.
WER_FAULT_REPORTING_FLAG_QUEUE_UPLOAD = 8,
/// Always show error reporting UI for this process. This is applicable for interactive applications only.
WER_FAULT_REPORTING_ALWAYS_SHOW_UI = 16,
/// Undocumented.
WER_FAULT_REPORTING_NO_UI = 32,
/// Undocumented.
WER_FAULT_REPORTING_FLAG_NO_HEAP_ON_QUEUE = 64,
/// Undocumented.
WER_FAULT_REPORTING_DISABLE_SNAPSHOT_CRASH = 128,
/// Undocumented.
WER_FAULT_REPORTING_DISABLE_SNAPSHOT_HANG = 256,
/// Undocumented.
WER_FAULT_REPORTING_CRITICAL = 512,
/// Undocumented.
WER_FAULT_REPORTING_DURABLE = 1024,
}
/// The type of WER file.
[PInvokeData("werapi.h", MSDNShortId = "4b2c2060-a193-4168-90fc-afb95c160569")]
public enum WER_FILE_TYPE
{
/// A limited minidump that contains only a stack trace.
WerFileTypeMicrodump = 1,
/// A minidump file.
WerFileTypeMinidump = 2,
/// An extended minidump that contains additional data such as the process memory.
WerFileTypeHeapdump = 3,
/// The document in use by the application at the time of the event. The document is added only if the server is asks for this type of document.
WerFileTypeUserDocument = 4,
/// Any other type of file. This file will always get added to the cab (but only if the server asks for a cab).
WerFileTypeOther = 5,
///
WerFileTypeTriagedump = 6,
///
WerFileTypeCustomDump = 7,
///
WerFileTypeAuxiliaryDump = 8,
///
WerFileTypeEtlTrace = 9,
///
WerFileTypeMax
}
/// Flag values for .
[PInvokeData("werapi.h", MSDNShortId = "4b4bb1bb-6782-447a-901f-75702256d907")]
[Flags]
public enum WER_REGISTER_FILE_FLAGS
{
/// Automatically deletes the file after it is added to the report.
WER_FILE_DELETE_WHEN_DONE = 1,
/// The file does not contain personal information that could be used to identify or contact the user.
WER_FILE_ANONYMOUS_DATA = 2,
/// This file has been compressed using SQS.
WER_FILE_COMPRESSED = 4,
}
/// The file type.
[PInvokeData("werapi.h", MSDNShortId = "4b4bb1bb-6782-447a-901f-75702256d907")]
public enum WER_REGISTER_FILE_TYPE
{
///
/// The document in use by the application at the time of the event. This document is only collected if the Watson server asks
/// for it.
///
WerRegFileTypeUserDocument = 1,
/// Any other type of file.
WerRegFileTypeOther = 2,
/// The maximum value for the WER_REGISTER_FILE_TYPE enumeration type.
WerRegFileTypeMax
}
/// The type of report.
[PInvokeData("werapi.h")]
public enum WER_REPORT_TYPE
{
///
/// An error that is not critical has occurred. This type of report shows no UI; the report is silently queued. It may then be
/// sent silently to the server in the background if adequate user consent is available.
///
WerReportNonCritical = 0,
///
/// A critical error, such as a crash or non-response, has occurred. By default, processes that experience a critical error are
/// terminated or restarted.
///
WerReportCritical = 1,
/// An error that has caused the application to stop running has occurred.
WerReportApplicationCrash = 2,
/// An error that has caused the application to stop responding has occurred.
WerReportApplicationHang = 3,
/// An error in the kernel has occurred.
WerReportKernel = 4,
/// An error that has called out a return that is not valid has occurred.
WerReportInvalid
}
/// The user interface element to be customized.
[PInvokeData("werapi.h")]
public enum WER_REPORT_UI
{
/// The instructions for the additional data dialog box.
WerUIAdditionalDataDlgHeader = 1,
/// The icon to be displayed in the consent dialog box.
WerUIIconFilePath = 2,
/// The main instructions for the consent dialog box.
WerUIConsentDlgHeader = 3,
/// The contents of the consent dialog box.
WerUIConsentDlgBody = 4,
/// The text for the link to check for a solution when online.
WerUIOnlineSolutionCheckText = 5,
/// The text for the link to check for a solution when offline.
WerUIOfflineSolutionCheckText = 6,
/// The text for the link to just terminate the application.
WerUICloseText = 7,
/// The main instructions for the close dialog box.
WerUICloseDlgHeader = 8,
/// The wer UI close dialog body
WerUICloseDlgBody = 9,
/// The text for the button in the close dialog box.
WerUICloseDlgButtonText = 10,
///
WerUIMax
}
/// The result of the submission.
[PInvokeData("werapi.h")]
public enum WER_SUBMIT_RESULT
{
/// The report was queued.
WerReportQueued = 1,
/// The report was uploaded.
WerReportUploaded = 2,
/// The Debug button was clicked.
WerReportDebug = 3,
/// The report submission failed.
WerReportFailed = 4,
/// Error reporting was disabled.
WerDisabled = 5,
/// The report was cancelled.
WerReportCancelled = 6,
/// Queuing was disabled.
WerDisabledQueue = 7,
/// The report was asynchronous.
WerReportAsync = 8,
/// Error reporting can be customized.
WerCustomAction = 9,
///
WerThrottled = 10,
///
WerReportUploadedCab = 11,
///
WerStorageLocationNotFound = 12,
///
WerSubmitResultMax
}
///
/// Retrieves the fault reporting settings for the specified process.
///
///
/// A handle to the process. This handle must have the PROCESS_VM_READ or PROCESS_QUERY_INFORMATION access right.
///
///
/// This parameter can contain one or more of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// WER_FAULT_REPORTING_FLAG_DISABLE_THREAD_SUSPENSION
/// Do not suspend the process threads before reporting the error.
///
/// -
/// WER_FAULT_REPORTING_FLAG_NOHEAP
/// Do not collect heap information in the event of an application crash or non-response.
///
/// -
/// WER_FAULT_REPORTING_FLAG_QUEUE
/// Queue critical reports for the specified process. This does not show any UI.
///
/// -
/// WER_FAULT_REPORTING_FLAG_QUEUE_UPLOAD
/// Queue critical reports and upload from the queue.
///
/// -
/// WER_FAULT_REPORTING_ALWAYS_SHOW_UI
/// Always show error reporting UI for this process. This is applicable for interactive applications only.
///
///
///
///
/// This function returns S_OK on success or an error code on failure.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-wergetflags HRESULT WerGetFlags( HANDLE hProcess, PDWORD
// pdwFlags );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "8c5f08c0-e2d1-448c-9a57-ef19897f64c6")]
public static extern HRESULT WerGetFlags(HPROCESS hProcess, out WER_FAULT_REPORTING pdwFlags);
///
/// Registers a process to be included in the error report along with the main application process. Optionally specifies a thread
/// within that registered process to get additional data from.
///
/// The Id of the process to register.
/// The Id of a thread within the registered process from which more information is requested.
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
///
/// Return code
/// Description
///
/// -
/// E_INVALIDARG
/// The value of processId is 0.
///
/// -
/// E_OUTOFMEMORY
/// WER could not allocate a large enough heap for the data.
///
/// -
/// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
///
/// Number of WER registered entries (memory blocks, metadata, files) exceeds max (WER_MAX_REGISTERED_ENTRIES) or number of processes
/// exceeds max (WER_MAX_REGISTERED_DUMPCOLLECTION)
///
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
///
///
///
// HRESULT WINAPI WerRegisterAdditionalProcess( DWORD processId, DWORD captureExtraInfoForThreadId); https://msdn.microsoft.com/en-us/library/windows/desktop/mt492585(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("Werapi.h", MSDNShortId = "mt492585")]
public static extern HRESULT WerRegisterAdditionalProcess(uint processId, uint captureExtraInfoForThreadId);
///
///
/// Registers a path relative to the local app store for the calling application where Windows Error Reporting (WER) should save a
/// copy of the diagnostic memory dump that WER collects when one of the processes for the application stops responding.
///
///
///
///
/// The path relative to the local app store for the calling application where WER should save a copy of the diagnostic memory dump
/// that WER collects when one of the processes for the application stops responding. The maximum length for this relative path in
/// characters is WER_MAX_LOCAL_DUMP_SUBPATH_LENGTH, which has a value of 64. This maximum length includes the
/// null-termination character.
///
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process cannot store the memory dump, or WER cannot create a location to store the memory dump.
///
/// -
/// E_INVALIDARG
/// The localAppDataRelativePath parameter is NULL or is longer than 64 characters.
///
///
///
///
///
/// A packaged application calls WerRegisterAppLocalDump when the application launches to request a copy of the diagnostic
/// memory dump that WER collects if or when one of the processes for the application stops responding.
///
///
/// WER does not manage storage at the location that the relative path specifies or the number of memory dumps that are collected for
/// the application.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werregisterapplocaldump HRESULT WerRegisterAppLocalDump(
// PCWSTR localAppDataRelativePath );
[DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "C57F5758-2BF7-444E-A22C-62C925B899A1")]
public static extern HRESULT WerRegisterAppLocalDump([MarshalAs(UnmanagedType.LPWStr)] string localAppDataRelativePath);
///
/// Registers app-specific metadata to be collected (in the form of key/value strings) when WER creates an error report.
///
///
/// The "key" string for the metadata element being registered.
///
///
/// The value string for the metadata element being registered.
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// E_INVALIDARG
///
/// Strings were NULL, key length was greater than 64 characters or was an invalid xml element name, orvalue length was greater than
/// 128 characters or contained characters that were not ASCII printable characters.
///
///
/// -
/// E_OUTOFMEMORY
/// WER could not allocate a large enough heap for the data
///
/// -
/// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
///
/// The maximum number of registered entries (WER_MAX_REGISTERED_ENTRIES) or maximum amount of registered metadata
/// (WER_MAX_REGISTERED_METADATA) has been reached.
///
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
///
///
///
///
/// This API allows apps to integrate their own app-level telemetry with system-level telemetry (WER) by associating app metadata
/// with crash reports corresponding to their processes.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werregistercustommetadata HRESULT WerRegisterCustomMetadata(
// PCWSTR key, PCWSTR value );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("werapi.h", MSDNShortId = "55FB3110-314A-4327-AA8F-3AF77B7006DD")]
public static extern HRESULT WerRegisterCustomMetadata(string key, string value);
///
/// Marks a memory block (that is normally included by default in error reports) to be excluded from the error report.
///
///
/// The starting address of the memory block.
///
///
/// The size of the memory block, in bytes.
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// E_INVALIDARG
/// address is NULL or size is 0.
///
/// -
/// E_OUTOFMEMORY
/// WER could not allocate a large enough heap for the data
///
/// -
/// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
/// The number of registered entries exceeds the limit (WER_MAX_REGISTERED_ENTRIES).
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
///
///
///
///
/// This mechanism is intended for applications that hold large amounts of data in memory that aren't useful for root cause debugging
/// and increase the size of the dump file unnecessarily. For example, some Xbox One games hold large amounts of texture data in
/// memory that is included in error dumps by default.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werregisterexcludedmemoryblock HRESULT
// WerRegisterExcludedMemoryBlock( const void *address, DWORD size );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "6CDA8EDD-C8A5-471D-9716-3AB29E571133")]
public static extern HRESULT WerRegisterExcludedMemoryBlock(IntPtr address, uint size);
///
/// Registers a file to be collected when WER creates an error report.
///
///
/// The full path to the file. The maximum length of this path is MAX_PATH characters.
///
///
/// The file type. This parameter can be one of the following values from the WER_REGISTER_FILE_TYPE enumeration type.
///
///
/// Value
/// Meaning
///
/// -
/// WerRegFileTypeMax 3
/// The maximum value for the WER_REGISTER_FILE_TYPE enumeration type.
///
/// -
/// WerRegFileTypeOther 2
/// Any other type of file.
///
/// -
/// WerRegFileTypeUserDocument 1
///
/// The document in use by the application at the time of the event. This document is only collected if the Watson server asks for it.
///
///
///
///
///
/// This parameter can be one or more of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// WER_FILE_ANONYMOUS_DATA
/// The file does not contain personal information that could be used to identify or contact the user.
///
/// -
/// WER_FILE_DELETE_WHEN_DONE
/// Automatically deletes the file after it is added to the report.
///
///
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
/// The number of registered memory blocks and files exceeds the limit.
///
///
///
///
/// The registered file is added to the report only when additional data is requested by the server.
///
/// For crashes and non-responses, the operating system automatically provides error reporting (you do not need to provide any error
/// reporting code in your application). If you use this function to register a file, the operating system will add the file to the
/// error report created at the time of a crash or non-response (this file is added in addition to the files the operating system
/// already collects).
///
///
/// For generic event reporting, the application has to use the WerReportAddFile function instead. Alternatively, calling the
/// WerReportSubmit function with the WER_SUBMIT_ADD_REGISTERED_DATA flag will include the files that the WerRegisterFile
/// function added.
///
/// To remove the file from the list, call the WerUnregisterFile function.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werregisterfile HRESULT WerRegisterFile( PCWSTR pwzFile,
// WER_REGISTER_FILE_TYPE regFileType, DWORD dwFlags );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "4b4bb1bb-6782-447a-901f-75702256d907")]
public static extern HRESULT WerRegisterFile([MarshalAs(UnmanagedType.LPWStr)] string pwzFile, WER_REGISTER_FILE_TYPE regFileType, WER_REGISTER_FILE_FLAGS dwFlags);
///
/// Registers a memory block to be collected when WER creates an error report.
///
///
/// The starting address of the memory block.
///
///
/// The size of the memory block, in bytes. The maximum value for this parameter is WER_MAX_MEM_BLOCK_SIZE bytes.
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
/// The number of registered memory blocks and files exceeds the limit.
///
///
///
///
///
/// Memory registered with this function is only added to heap or larger dump files. This memory is never added to mini dumps or
/// smaller dump files.
///
///
/// For crashes and no response, the operating system automatically provides error reporting (you do not need to provide any error
/// reporting code in your application). If you use this function to register a memory block, the operating system will add the
/// memory block information to the dump file at the time of the crash or non-response. The memory block is added to the dump file
/// for the report only when additional data is requested by the server.
///
///
/// For generic event reporting, the application has to call the WER generic event reporting functions directly. To add the memory
/// block to a generic report, call the WerReportAddDump function and then call the WerReportSubmit function and specify the
/// WER_SUBMIT_ADD_REGISTERED_DATA flag.
///
/// To remove the block from this list, call the WerUnregisterMemoryBlock function.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werregistermemoryblock HRESULT WerRegisterMemoryBlock( PVOID
// pvAddress, DWORD dwSize );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "10fa2bf3-ec12-4c7c-b986-9b22cdaa7319")]
public static extern HRESULT WerRegisterMemoryBlock(IntPtr pvAddress, uint dwSize);
///
/// Registers a custom runtime exception handler that is used to provide custom error reporting for crashes.
///
///
/// The name of the exception handler DLL to register.
///
///
/// A pointer to arbitrary context information that is passed to the handler's callback functions.
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
///
/// The number of registered runtime exception modules exceeds the limit. A process can register up to
/// WER_MAX_REGISTERED_RUNTIME_EXCEPTION_MODULES handlers.
///
///
///
///
///
///
/// The exception handler is an out-of-process DLL that the WER service loads when a crash or unhandled exception occurs. The DLL
/// must implement and export the following functions:
///
///
/// -
/// OutOfProcessExceptionEventCallback
///
/// -
/// OutOfProcessExceptionEventSignatureCallback
///
/// -
/// OutOfProcessExceptionEventDebuggerLaunchCallback
///
///
/// (The DLL must also include the DllMain entry point.)
///
/// Using an exception handler is more secure and reliable for reporting crash information than the current, in-process event
/// reporting feature. Also, the current generic event reporting feature is suited only for reporting non-fatal errors.
///
///
/// This function requires that the pwszOutOfProcessCallbackDll DLL be included in the WER exception handler module list in the
/// registry. After registering an exception handler, if the process crashes or raises an unhandled exception, the WER service loads
/// your exception handler and calls the OutOfProcessExceptionEventCallback callback function., which you use to state your claim on
/// the crash and provide the event name and report parameters count. Note that if the process registers more than one exception
/// handler, the service calls each handler until one of the handlers claims the crash. If no handlers claim the crash, WER defaults
/// to native crash reporting.
///
///
/// If an exception handler claims the exception, the WER service calls the OutOfProcessExceptionEventSignatureCallback callback
/// function, which provides the reporting parameters that uniquely define the problem. Then, the WER service calls the
/// OutOfProcessExceptionEventDebuggerLaunchCallback callback to determine whether to offer the user the option of launching a
/// debugger or launching the debugger automatically. The handler can also specify a custom debugger launch string, which will
/// override the default string (the default is the debugger specified in the AeDebug registry key).
///
///
/// After the handler has provided the event name, reporting parameters and debugger launch settings, the rest of the error reporting
/// flow continues in the usual way.
///
///
/// You must call the WerUnregisterRuntimeExceptionModule function to remove the registration before your process exits. A process
/// can register up to WER_MAX_REGISTERED_RUNTIME_EXCEPTION_MODULES handlers.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werregisterruntimeexceptionmodule HRESULT
// WerRegisterRuntimeExceptionModule( PCWSTR pwszOutOfProcessCallbackDll, PVOID pContext );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "b0fb2c0d-cc98-43cc-a508-e80545377b7f")]
public static extern HRESULT WerRegisterRuntimeExceptionModule([MarshalAs(UnmanagedType.LPWStr)] string pwszOutOfProcessCallbackDll, IntPtr pContext);
///
/// Sets the fault reporting settings for the current process.
///
///
/// The fault reporting settings. You can specify one or more of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// WER_FAULT_REPORTING_FLAG_DISABLE_THREAD_SUSPENSION
/// Do not suspend the process threads before reporting the error.
///
/// -
/// WER_FAULT_REPORTING_FLAG_NOHEAP
/// Do not collect heap information in the event of an application crash or non-response.
///
/// -
/// WER_FAULT_REPORTING_FLAG_QUEUE
/// Queue critical reports.
///
/// -
/// WER_FAULT_REPORTING_FLAG_QUEUE_UPLOAD
/// Queue critical reports and upload from the queue.
///
/// -
/// WER_FAULT_REPORTING_ALWAYS_SHOW_UI
/// Always show error reporting UI for this process. This is applicable for interactive applications only.
///
///
///
///
/// This function returns S_OK on success or an error code on failure.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-wersetflags HRESULT WerSetFlags( DWORD dwFlags );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "2a71203f-3a08-461f-a230-e3fee00d9d99")]
public static extern HRESULT WerSetFlags(WER_FAULT_REPORTING dwFlags);
///
/// Removes a process from the list of additional processes to be included in the error report.
///
///
/// The Id of the process to remove. It must have been previously registered with WerRegisterAdditionalProcess.
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// WER_E_NOT_FOUND
/// The list of registered processes does not contain the specified process.
///
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werunregisteradditionalprocess HRESULT
// WerUnregisterAdditionalProcess( DWORD processId );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "CE840EE8-5EB6-4F0F-935E-5DA9097E950F")]
public static extern HRESULT WerUnregisterAdditionalProcess(uint processId);
///
///
/// Cancels the registration that was made by calling the WerRegisterAppLocalDump function to specify that Windows Error Reporting
/// (WER) should save a copy of the diagnostic memory dump that WER collects when one of the processes for the application stops responding.
///
///
///
/// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werunregisterapplocaldump HRESULT WerUnregisterAppLocalDump( );
[DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "A3AD976A-9C44-494C-ABF0-90D151001E30")]
public static extern HRESULT WerUnregisterAppLocalDump();
///
/// Removes an item of app-specific metadata being collected during error reporting for the application.
///
///
///
/// The "key" string for the metadata element being removed. It must have been previously registered with the
/// WerRegisterCustomMetadata function.
///
///
///
/// This function returns S_OK on success or an error code on failure, including the following error codes.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// WER_E_NOT_FOUND
/// WER could not find the metadata item to remove.
///
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werunregistercustommetadata HRESULT
// WerUnregisterCustomMetadata( PCWSTR key );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "29DB2CE5-2A96-450B-96C8-082B786613F9")]
public static extern HRESULT WerUnregisterCustomMetadata([MarshalAs(UnmanagedType.LPWStr)] string key);
///
/// Removes a memory block that was previously marked as excluded (it will again be included in error reports).
///
///
///
/// The starting address of the memory block. This memory block must have been registered using the WerRegisterExcludedMemoryBlock function.
///
///
///
/// This function returns S_OK on success or an error code on failure, including the following error code.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werunregisterexcludedmemoryblock HRESULT
// WerUnregisterExcludedMemoryBlock( const void *address );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "99FF746E-8EFC-47DB-AEE6-EC46F7BC7F0B")]
public static extern HRESULT WerUnregisterExcludedMemoryBlock(IntPtr address);
/// Removes a file from the list of files to be added to reports generated for the current process.
/// The full path to the file. This file must have been registered using the WerRegisterFile function.
///
/// This function returns S_OK on success or an error code on failure, including the following error code.
///
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// WER_E_NOT_FOUND
/// The list of registered files does not contain the specified file.
///
///
///
///
// HRESULT WINAPI WerUnregisterFile( _In_ PCWSTR pwzFilePath); https://msdn.microsoft.com/en-us/library/windows/desktop/bb513630(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("Werapi.h", MSDNShortId = "bb513630")]
public static extern HRESULT WerUnregisterFile([MarshalAs(UnmanagedType.LPWStr)] string pwzFilePath);
///
/// Removes a memory block from the list of data to be collected during error reporting for the application.
///
///
///
/// The starting address of the memory block. This memory block must have been registered using the WerRegisterMemoryBlock function.
///
///
///
/// This function returns S_OK on success or an error code on failure, including the following error code.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// WER_E_NOT_FOUND
/// The list of registered memory blocks does not contain the specified memory block.
///
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werunregistermemoryblock HRESULT WerUnregisterMemoryBlock(
// PVOID pvAddress );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "016800e8-4a03-40f6-9dba-54cd9082eb48")]
public static extern HRESULT WerUnregisterMemoryBlock(IntPtr pvAddress);
///
/// Removes the registration of your WER exception handler.
///
///
/// The name of the exception handler DLL whose registration you want to remove.
///
///
/// A pointer to arbitrary context information that was passed to the callback.
///
///
/// This function returns S_OK on success or an error code on failure, including the following error code.
///
///
/// Return code
/// Description
///
/// -
/// WER_E_INVALID_STATE
/// The process state is not valid. For example, the process is in application recovery mode.
///
/// -
/// WER_E_NOT_FOUND
/// The list of registered runtime exception handlers does not contain the specified exception handler.
///
///
///
///
/// To register your runtime exception handler, call the WerRegisterRuntimeExceptionModule function.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/werapi/nf-werapi-werunregisterruntimeexceptionmodule HRESULT
// WerUnregisterRuntimeExceptionModule( PCWSTR pwszOutOfProcessCallbackDll, PVOID pContext );
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("werapi.h", MSDNShortId = "1a315923-b554-4363-a607-076690fc76a1")]
public static extern HRESULT WerUnregisterRuntimeExceptionModule([MarshalAs(UnmanagedType.LPWStr)] string pwszOutOfProcessCallbackDll, IntPtr pContext);
}
}