| crashrpt |
A crash reporting system for Windows applications

# Obsolete Functions

## Defines

#define | crAddFile crAddFileA
| Character set-independent mapping of crAddFileW() and crAddFileA() functions.

## Functions

int | crInstallToCurrentThread ()
| Installs exception handlers to the current thread.
int | crAddFileW (LPCWSTR pszFile, LPCWSTR pszDesc)
| Adds a file to crash report.
int | crAddFileA (LPCSTR pszFile, LPCSTR pszDesc)
int | crExceptionFilter (unsigned int code, struct _EXCEPTION_POINTERS *ep)
| Can be used as a SEH exception filter.

## Detailed Description

## Function Documentation

int crAddFileA | ( | LPCSTR | pszFile,
|  | LPCSTR | pszDesc |
| ) |  |  |

Adds a file to crash report.

Returns:
  This function returns zero if succeeded.

Parameters:

  `[in]` | pszFile | Absolute path to the file to add.
  `[in]` | pszDesc | File description (used in Error Report Details dialog).

Note:
  This function is deprecated and will be removed in one of the future releases. It is recommended to use crAddFile2() function instead.

This function can be called anytime after crInstall() to add one or more files to the generated crash report.

When this function is called, the file is marked to be added to the error report, then the function returns control to the caller. When crash occurs, all marked files are added to the report by the CrashSender.exe process. If a file is locked by someone for exclusive access, the file won't be included. Inside of LPGETLOGFILE crash callback, ensure files to be included are acessible for reading.

pszFile should be a valid absolute path of a file to add to crash report.

pszDesc is a description of a file. It can be NULL.

This function fails if pszFile doesn't exist at the moment of function call.

The crAddFileW() and crAddFileA() are wide-character and multibyte-character versions of crAddFile() function. The crAddFile() macro defines character set independent mapping.

See also:
  crAddFileW(), crAddFileA(), crAddFile()

int crAddFileW | ( | LPCWSTR | pszFile,
|  | LPCWSTR | pszDesc |
| ) |  |  |

Adds a file to crash report.

Returns:
  This function returns zero if succeeded.

Parameters:

  `[in]` | pszFile | Absolute path to the file to add.
  `[in]` | pszDesc | File description (used in Error Report Details dialog).

Note:
  This function is deprecated and will be removed in one of the future releases. It is recommended to use crAddFile2() function instead.

This function can be called anytime after crInstall() to add one or more files to the generated crash report.

When this function is called, the file is marked to be added to the error report, then the function returns control to the caller. When crash occurs, all marked files are added to the report by the CrashSender.exe process. If a file is locked by someone for exclusive access, the file won't be included. Inside of LPGETLOGFILE crash callback, ensure files to be included are acessible for reading.

pszFile should be a valid absolute path of a file to add to crash report.

pszDesc is a description of a file. It can be NULL.

This function fails if pszFile doesn't exist at the moment of function call.

The crAddFileW() and crAddFileA() are wide-character and multibyte-character versions of crAddFile() function. The crAddFile() macro defines character set independent mapping.

See also:
  crAddFileW(), crAddFileA(), crAddFile()

int crExceptionFilter | ( | unsigned int | code,
|  | struct _EXCEPTION_POINTERS * | ep |
| ) |  |  |

Can be used as a SEH exception filter.

Returns:
  This function returns `EXCEPTION_EXECUTE_HANDLER` if succeeds, else `EXCEPTION_CONTINUE_SEARCH`.

Parameters:

  `[in]` | code | Exception code.
  `[in]` | ep | Exception pointers.

Remarks:

As of v.1.2.8, this function is declared deprecated. It may be removed in one of the future releases.

This function can be called instead of a SEH exception filter inside of __try{}__except(Expression){} statement. The function generates a error report and returns control to the exception handler block.

The exception code is usually retrieved with GetExceptionCode() intrinsic function and the exception pointers are retrieved with GetExceptionInformation() intrinsic function.

If an error occurs, this function returns `EXCEPTION_CONTINUE_SEARCH`. Use crGetLastErrorMsg() to retrieve the error message on fail.

The following example shows how to use crExceptionFilter().

         int* p = NULL;   // pointer to NULL
         __try
         {
            *p = 13; // causes an access violation exception;
         }
         __except(crExceptionFilter(GetExceptionCode(), GetExceptionInformation()))
         {
           // Terminate program
           ExitProcess(1);
         }

int crInstallToCurrentThread | ( |  | ) |

Installs exception handlers to the current thread.

Returns:
  This function returns zero if succeeded.

Remarks:

This function sets exception handlers for the caller thread. If you have several execution threads, you ought to call the function for each thread, except the main one.

The list of C++ exception/error handlers installed with this function:

- terminate handler [ `set_terminate()` ]
- unexpected handler [ `set_unexpected()` ]
- floating point error handler [ `signal(SIGFPE)` ]
- illegal instruction handler [ `signal(SIGILL)` ]
- illegal storage access handler [ `signal(SIGSEGV)` ]

The crInstall() function automatically installs C++ exception handlers for the main thread, so no need to call crInstallToCurrentThread() for the main thread.

This function fails if calling it twice for the same thread. When this function fails, use crGetLastErrorMsg() to retrieve the error message.

Call crUninstallFromCurrentThread() to uninstall C++ exception handlers from current thread.

This function is deprecatd. The crInstallToCurrentThread2() function gives better control of what exception handlers to install.

See also:
  crInstallToCurrentThread2(), crUninstallFromCurrentThread(), CrThreadAutoInstallHelper