ErrLib
Classes | Macros | Typedefs | Functions
ErrLib.h File Reference

Go to the source code of this file.

Classes

struct  structERRLIB_STACK_FRAME
 
struct  structERRLIB_STACK_TRACE
 

Macros

#define ErrLib_MessageLen   1024
 
#define ErrLib_StackLen   10000
 
#define MSG_ERROR   ((DWORD)0xC0020100L)
 
#define MSG_WARNING   ((DWORD)0x80020101L)
 
#define MSG_INFORMATION   ((DWORD)0x40020102L)
 
#define ERRLIB_OUTPUT_LOGFILE   1
 
#define ERRLIB_OUTPUT_STDERR   2
 
#define ERRLIB_OUTPUT_MBOX   3
 
#define ERRLIB_OUTPUT_EVENT_LOG   4
 
#define ERRLIB_OUTPUT_CUSTOM   5
 
#define ERRLIB_SYMBOL_NAME   1
 
#define ERRLIB_SYMBOL_MODULE   2
 
#define ERRLIB_SYMBOL_SOURCE   3
 
#define ERRLIB_THROW(mes)
 
#define ERRLIB_THROW_IF_EQUAL(var, value, func)
 
#define ERRLIB_THROW_IF_FAILED(var, func)
 
#define ERRLIB_INVOKEAPI(func, ...)
 
#define ERRLIB_CATCH_ALL   __except(ErrLib_CatchAll(GetExceptionInformation()))
 
#define ERRLIB_CATCH(code)   __except(ErrLib_CatchCode(GetExceptionInformation(),code))
 

Typedefs

typedef struct structERRLIB_STACK_FRAME ERRLIB_STACK_FRAME
 
typedef struct structERRLIB_STACK_TRACE ERRLIB_STACK_TRACE
 

Functions

ERRLIB_API void __stdcall ErrLib_ErrorMes (LPTSTR lpszFunction, DWORD dw, WCHAR *buf)
 
ERRLIB_API void __stdcall ErrLib_SetLoggingCallback (ERRLIB_LOGGING_CALLBACK pCallback)
 
ERRLIB_API void __stdcall ErrLib_SetExceptionCallback (ERRLIB_EXCEPTION_CALLBACK pCallback)
 
ERRLIB_API void __stdcall ErrLib_SetLogFilePath (LPCWSTR path)
 
ERRLIB_API BOOL __stdcall ErrLib_SetParameter (UINT param, UINT_PTR value)
 
BOOL ERRLIB_INLINE ErrLib_Initialize ()
 
ERRLIB_API BOOL __stdcall ErrLib_RegisterEventSource ()
 
ERRLIB_API BOOL __stdcall ErrLib_UnregisterEventSource ()
 
ERRLIB_API ERRLIB_STACK_TRACE __stdcall ErrLib_GetStackTrace (CONTEXT *ctx)
 
ERRLIB_API int __stdcall ErrLib_ST_GetFramesCount (const ERRLIB_STACK_TRACE *pStack)
 
ERRLIB_API const ERRLIB_STACK_FRAME *__stdcall ErrLib_ST_GetFrame (const ERRLIB_STACK_TRACE *pStack, int n)
 
ERRLIB_API uint64_t __stdcall ErrLib_ST_GetAddress (const ERRLIB_STACK_FRAME *pFrame)
 
ERRLIB_API uint64_t __stdcall ErrLib_ST_GetDisplacement (const ERRLIB_STACK_FRAME *pFrame)
 
ERRLIB_API const WCHAR *__stdcall ErrLib_ST_GetStringProperty (const ERRLIB_STACK_FRAME *pFrame, int propId)
 
ERRLIB_API DWORD __stdcall ErrLib_ST_GetSymLine (const ERRLIB_STACK_FRAME *pFrame)
 
ERRLIB_API void __stdcall ErrLib_FreeStackTrace (ERRLIB_STACK_TRACE *pStack)
 
ERRLIB_API void __stdcall ErrLib_PrintStack (CONTEXT *ctx, WCHAR *dest, size_t cch)
 
ERRLIB_API void __stdcall ErrLib_GetExceptionMessage (struct _EXCEPTION_POINTERS *ExceptionInfo, LPWSTR dest, size_t cch)
 
ERRLIB_API void __stdcall ErrLib_LogExceptionInfo (DWORD dwExcCode, LPCWSTR lpwsMessage, LPCWSTR lpwsStackTrace, BOOL visible)
 
ERRLIB_API void __stdcall ErrLib_LogMessage (LPCWSTR lpwsMessage, BOOL visible, DWORD type, BOOL bIncludeStack)
 
ERRLIB_API DWORD __stdcall ErrLib_Except_GetCode ()
 
ERRLIB_API LPWSTR __stdcall ErrLib_Except_GetMessage ()
 
ERRLIB_API LPWSTR __stdcall ErrLib_Except_GetStackTrace ()
 
ERRLIB_API ERRLIB_STACK_TRACE __stdcall ErrLib_Except_GetStackTraceData ()
 

Detailed Description

ErrLib public API

Macro Definition Documentation

◆ ERRLIB_CATCH

#define ERRLIB_CATCH (   code)    __except(ErrLib_CatchCode(GetExceptionInformation(),code))

SEH custom _except block that executes handler for exceptions with specified code

◆ ERRLIB_CATCH_ALL

#define ERRLIB_CATCH_ALL   __except(ErrLib_CatchAll(GetExceptionInformation()))

SEH custom _except block that executes handler for all exceptions

◆ ERRLIB_INVOKEAPI

#define ERRLIB_INVOKEAPI (   func,
  ... 
)
Value:
if(FALSE == func( ##__VA_ARGS__ )){DWORD ErrLibLocal_LastError=GetLastError();\
ErrLib_ErrorMes((L#func),ErrLibLocal_LastError,(WCHAR*)ErrLib_StrBuf_GetPointer());\
((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[0]=(ULONG_PTR)ErrLibLocal_LastError;((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[1]=(ULONG_PTR)ErrLib_StrBuf_GetPointer();\
RaiseException(ERRLIB_WIN32_EXCEPTION,0,2,((ULONG_PTR*)ErrLib_ExArgs_GetPointer()));}

Calls WINAPI function and raises Win32 exception if it fails. This only works for ones that return BOOL value indicating success/failure.

Parameters
functhe name of WINAPI function to be called

This macro is useful to convert a WINAPI function's error code into exception to make it harder to ignore errors.

Note
This macro takes a variable length list of arguments to be passed into the invoked function
If the function return anything else rather then BOOL value, use ERRLIB_THROW_IF_EQUAL instead. The exception code is ERRLIB_WIN32_EXCEPTION (0xC0400000).

◆ ErrLib_MessageLen

#define ErrLib_MessageLen   1024

Specifies the maximum message length supported by the ErrLib_GetExceptionMessage function

◆ ERRLIB_OUTPUT_CUSTOM

#define ERRLIB_OUTPUT_CUSTOM   5

Specifies that logging functions should write information into the custom logging target

Note
This configuration parameter is used with ErrLib_SetParameter function (type: BOOL).
To set the custom logging target callback, use ErrLib_SetLoggingCallback.

◆ ERRLIB_OUTPUT_EVENT_LOG

#define ERRLIB_OUTPUT_EVENT_LOG   4

Specifies that logging functions should write information into Windows Event Log

Note
This configuration parameter is used with ErrLib_SetParameter function (type: BOOL).

◆ ERRLIB_OUTPUT_LOGFILE

#define ERRLIB_OUTPUT_LOGFILE   1

Specifies that logging functions should write information into the log file

Note
This configuration parameter is used with ErrLib_SetParameter function (type: BOOL).

◆ ERRLIB_OUTPUT_MBOX

#define ERRLIB_OUTPUT_MBOX   3

Specifies that logging functions should display information as a message box

Note
This configuration parameter is used with ErrLib_SetParameter function (type: BOOL).

◆ ERRLIB_OUTPUT_STDERR

#define ERRLIB_OUTPUT_STDERR   2

Specifies that logging functions should write information into the stderr stream

Note
This configuration parameter is used with ErrLib_SetParameter function (type: BOOL).

◆ ErrLib_StackLen

#define ErrLib_StackLen   10000

Specifies the maximum stack trace length supported by the ErrLib_PrintStack function

◆ ERRLIB_SYMBOL_MODULE

#define ERRLIB_SYMBOL_MODULE   2

Stack frame property: Module file path

◆ ERRLIB_SYMBOL_NAME

#define ERRLIB_SYMBOL_NAME   1

Stack frame property: Symbol name

◆ ERRLIB_SYMBOL_SOURCE

#define ERRLIB_SYMBOL_SOURCE   3

Stack frame property: Symbol source file path

◆ ERRLIB_THROW

#define ERRLIB_THROW (   mes)
Value:
{((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[0]=(ULONG_PTR)mes;\
RaiseException(ERRLIB_APP_EXCEPTION,0,1,((ULONG_PTR*)ErrLib_ExArgs_GetPointer()));}

Raises SEH exception with user-defined error message

Note
The exception code is ERRLIB_APP_EXCEPTION (0xC0400002)

◆ ERRLIB_THROW_IF_EQUAL

#define ERRLIB_THROW_IF_EQUAL (   var,
  value,
  func 
)
Value:
if((var)==(value)){DWORD ErrLibLocal_LastError=GetLastError();\
ErrLib_ErrorMes(L#func,ErrLibLocal_LastError,(WCHAR*)ErrLib_StrBuf_GetPointer());((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[0]=(ULONG_PTR)ErrLibLocal_LastError;\
((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[1]=(ULONG_PTR)ErrLib_StrBuf_GetPointer();RaiseException(ERRLIB_WIN32_EXCEPTION,0,2,(ULONG_PTR*)ErrLib_ExArgs_GetPointer());}

Raises Win32 exception if variable is equal to the passed value

Parameters
varVariable to be compared
valueA value for the variable to be compared against
funcThe name of WINAPI function to be included in error message

This macro is useful to convert a WINAPI function's error code into exception to make it harder to ignore errors.

Note
The exception code is ERRLIB_WIN32_EXCEPTION (0xC0400000)

◆ ERRLIB_THROW_IF_FAILED

#define ERRLIB_THROW_IF_FAILED (   var,
  func 
)
Value:
if(FAILED(var)){ErrLib_HResultToString((DWORD)var,L#func,(WCHAR*)ErrLib_StrBuf_GetPointer());\
((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[0]=(ULONG_PTR)var;((ULONG_PTR*)ErrLib_ExArgs_GetPointer())[1]=(ULONG_PTR)ErrLib_StrBuf_GetPointer();RaiseException(ERRLIB_COM_EXCEPTION,0,2,((ULONG_PTR*)ErrLib_ExArgs_GetPointer()));}

Raises COM exception if passed HRESULT indicates failure

Parameters
varHRESULT variable to be tested for failure
funcThe name of WINAPI/COM function to be included in error message

This macro is useful to convert a WINAPI/COM function's error code into exception to make it harder to ignore errors.

Note
The exception code is ERRLIB_COM_EXCEPTION (0xC0400001)

◆ MSG_ERROR

#define MSG_ERROR   ((DWORD)0xC0020100L)

Message type: Error (used with ErrLib_LogMessage)

◆ MSG_INFORMATION

#define MSG_INFORMATION   ((DWORD)0x40020102L)

Message type: Information (used with ErrLib_LogMessage)

◆ MSG_WARNING

#define MSG_WARNING   ((DWORD)0x80020101L)

Message type: Warning (used with ErrLib_LogMessage)

Typedef Documentation

◆ ERRLIB_STACK_FRAME

Represents a stack frame, an object that contains information about an individual call in stack trace

Note
Do not access the fields of this structure directly, they are considered private implementation details.
Use ErrLib_ST_... functions instead to get stack frame properties.

◆ ERRLIB_STACK_TRACE

Represents a stack trace, a chain of function calls at the particular point of thread's execution

Note
Do not access the fields of this structure directly, they are considered private implementation details.
Use ErrLib_ST_... functions instead to get stack trace properties.

Function Documentation

◆ ErrLib_ErrorMes()

ERRLIB_API void __stdcall ErrLib_ErrorMes ( LPTSTR  lpszFunction,
DWORD  dw,
WCHAR *  buf 
)

Gets Win32 error message for the specified function name and error code. The message depends on the OS locale.

Parameters
lpszFunctionThe name of the function which might have caused the error
dwError code returned by GetLastError()
bufPointer to character array to store the result string

◆ ErrLib_Except_GetCode()

ERRLIB_API DWORD __stdcall ErrLib_Except_GetCode ( )

Gets the exception code for the current exception in ERRLIB_CATCH/ERRLIB_CATCH_ALL block

Note
When used outside of the exception handler block, the behaviour is undefined

◆ ErrLib_Except_GetMessage()

ERRLIB_API LPWSTR __stdcall ErrLib_Except_GetMessage ( )

Gets the error message for the current exception in ERRLIB_CATCH/ERRLIB_CATCH_ALL block

Note
When used outside of the exception handler block, the behaviour is undefined

◆ ErrLib_Except_GetStackTrace()

ERRLIB_API LPWSTR __stdcall ErrLib_Except_GetStackTrace ( )

Gets the stack trace text for the current exception in ERRLIB_CATCH/ERRLIB_CATCH_ALL block

Note
When used outside of the exception handler block, the behaviour is undefined.

◆ ErrLib_Except_GetStackTraceData()

ERRLIB_API ERRLIB_STACK_TRACE __stdcall ErrLib_Except_GetStackTraceData ( )

Gets the stack trace information for the current exception in ERRLIB_CATCH/ERRLIB_CATCH_ALL block

Returns
The structure that contains stack trace information
Note
When you no longer need the stack trace information, free resources associated with it by calling ErrLib_FreeStackTrace.
When used outside of the exception handler block, the behaviour is undefined.

◆ ErrLib_FreeStackTrace()

ERRLIB_API void __stdcall ErrLib_FreeStackTrace ( ERRLIB_STACK_TRACE pStack)

Releases resources associated with the specified stack trace structure

Parameters
pStackThe pointer to a ERRLIB_STACK_TRACE structure
Note
Do not pass the stack trace into any other functions after it has been freed by this function.

◆ ErrLib_GetExceptionMessage()

ERRLIB_API void __stdcall ErrLib_GetExceptionMessage ( struct _EXCEPTION_POINTERS *  ExceptionInfo,
LPWSTR  dest,
size_t  cch 
)

Prints error message for specified exception

Parameters
ExceptionInfoA pointer to the exception information structure
destThe pointer to the caller-allocated character array that will be filled with error message text on output. Make sure to allocate a large enough block of memory, otherwise the text will be trimmed. The maximum supported message length is indicated by ErrLib_MessageLen constant.
cchThe maximum amount of characters that can be put into the array pointed by dest parameter

◆ ErrLib_GetStackTrace()

ERRLIB_API ERRLIB_STACK_TRACE __stdcall ErrLib_GetStackTrace ( CONTEXT *  ctx)

Gets the stack trace information for the specified context record

Parameters
ctxThe pointer to a CONTEXT structure, containing valid context record on input
Returns
The structure that contains stack trace information
Note
You can obtain a context record via RtlCaptureContext function or from the exception data.
When you no longer need the stack trace information, free resources associated with it by calling ErrLib_FreeStackTrace.

◆ ErrLib_Initialize()

BOOL ERRLIB_INLINE ErrLib_Initialize ( )

Initializes the library. Must be called before any other functionality is used.

Returns
Non-zero value if operation succeeded, zero if error occured
Note
If you call any of the library functions without a prior call to ErrLib_Initialize, the behaviour is undefined.

◆ ErrLib_LogExceptionInfo()

ERRLIB_API void __stdcall ErrLib_LogExceptionInfo ( DWORD  dwExcCode,
LPCWSTR  lpwsMessage,
LPCWSTR  lpwsStackTrace,
BOOL  visible 
)

Outputs the exception information into configured log targets

Parameters
dwExcCodeSEH Exception code. Use ErrLib_Except_GetCode to obtain it in exception handler block.
lpwsMessageA pointer to the wide character string containing error message. Use ErrLib_Except_GetMessage to obtain it in exception handler block.
lpwsStackTraceA pointer to the wide character string containing stack trace text. Use ErrLib_Except_GetStackTrace to obtain it in exception handler block.
visiblePass TRUE if you want to use ERRLIB_OUTPUT_STDERR/ERRLIB_OUTPUT_MBOX logging targets (if they are enabled by configuration flags), FALSE otherwise

This function outputs information into one or more logging targets, configured using ErrLib_SetParameter function. It only outputs information into the stderr stream and message box if the visible parameter is TRUE (and if respective flags are enabled). By default, the enabled logging targets are log file and stderr stream.

Note
When outputting information in message box, stack trace is not included.

◆ ErrLib_LogMessage()

ERRLIB_API void __stdcall ErrLib_LogMessage ( LPCWSTR  lpwsMessage,
BOOL  visible,
DWORD  type,
BOOL  bIncludeStack 
)

Outputs arbitrary string into configured log targets

Parameters
lpwsMessageA pointer to the wide character string containing message being written
visiblePass TRUE if you want to use ERRLIB_OUTPUT_STDERR/ERRLIB_OUTPUT_MBOX logging targets (if they are enabled by configuration flags), FALSE otherwise
typeCan be: MSG_ERROR, MSG_WARNING or MSG_INFORMATION
bIncludeStackPass TRUE if you want to include stack trace into the logged information

This function outputs information into one or more logging targets, configured using ErrLib_SetParameter function. It only outputs information into the stderr stream and message box if the visible parameter is TRUE (and if respective flags are enabled). By default, the enabled logging targets are log file and stderr stream.

Note
The type parameter affects message box or Windows Event Log entry appearance. For other targets, it has no effect.
When outputting information in message box, stack trace is not included, even if bIncludeStack parameter is TRUE.

◆ ErrLib_PrintStack()

ERRLIB_API void __stdcall ErrLib_PrintStack ( CONTEXT *  ctx,
WCHAR *  dest,
size_t  cch 
)

Prints stack trace for the specified context record

Parameters
ctxThe pointer to a CONTEXT structure, containing valid context record on input.
destThe pointer to the caller-allocated character array that will be filled with stack trace text on output. Make sure to allocate a large enough block of memory, otherwise the text will be trimmed. The maximum supported stack trace length is indicated by ErrLib_StackLen constant.
cchThe maximum amount of characters that can be put into the array pointed by dest parameter
Note
You can obtain a context record via RtlCaptureContext function or from the exception data.

◆ ErrLib_RegisterEventSource()

ERRLIB_API BOOL __stdcall ErrLib_RegisterEventSource ( )

Creates registry data for Windows Event Log. Requires elevated priveleges.

Returns
Non-zero value if operation succeeded, zero if error occured
Note
This function fails if the program runs without elevated priveleges, but it sufficient to only call it once (for example, when application is installed).

◆ ErrLib_SetExceptionCallback()

ERRLIB_API void __stdcall ErrLib_SetExceptionCallback ( ERRLIB_EXCEPTION_CALLBACK  pCallback)

Sets current exception callback - the user-defined function which will be called in case of unhandled SEH exception when there's no debugger attahed to the process. Specify NULL to call default callback.

Parameters
pCallbackThe pointer to callback function

The callback function must be defined as follows: LONG WINAPI MyExceptionCallback (struct _EXCEPTION_POINTERS* ex, LPCWSTR mes, LPCWSTR stack) {...}

The ex parameter of the callback function points to the exception information structure. The mes and stack parameters point to strings containing human-readable error message and stack trace respectively.

Return EXCEPTION_EXECUTE_HANDLER from callback function to execute default handler (in most cases it will crash application, invoking default Windows Error Reporting dialog window). Call exit function without returning anything, if you want to avoid this behaviour and terminate application normally.

The default callback writes exception information into configured logging targets and then crashes application.

◆ ErrLib_SetLogFilePath()

ERRLIB_API void __stdcall ErrLib_SetLogFilePath ( LPCWSTR  path)

Sets current log file path. The default is [MyDocuments]\[ExeFileName].log

Note
Only has any effect if ERRLIB_OUTPUT_LOGFILE configuration parameter is set to TRUE.

◆ ErrLib_SetLoggingCallback()

ERRLIB_API void __stdcall ErrLib_SetLoggingCallback ( ERRLIB_LOGGING_CALLBACK  pCallback)

Sets current logging callback - the user-defined function which will be used as a custom logging target

Parameters
pCallbackThe pointer to callback function

The callback function must be defined as follows: void WINAPI MyLoggingCallback(LPCWSTR pStr, void* pExtraInfo) {...}

The pStr parameter of the callback function points to the logged message. The pExtraInfo parameter is currently unused.

Note
The logging callback is only used when ERRLIB_OUTPUT_CUSTOM parameter is set to TRUE

◆ ErrLib_SetParameter()

ERRLIB_API BOOL __stdcall ErrLib_SetParameter ( UINT  param,
UINT_PTR  value 
)

Sets a value for the specified configuration parameter

Parameters
paramParamater ID
valueThe new value for the parameter being set. Use TRUE/FALSE constants cast to UINT_PTR for boolean parameters.
Returns
Non-zero value if operation succeeded, zero if parameter ID is not recognized or error occured.

The paramater ID can be one of the following values:

  • ERRLIB_OUTPUT_LOGFILE (1). Specifies that logging functions should write information into the log file. Type: BOOL.
  • ERRLIB_OUTPUT_STDERR (2). Specifies that logging functions should write information into stderr stream (usually console). Type: BOOL.
  • ERRLIB_OUTPUT_MBOX (3). Specifies that logging functions should display information as message box. Type: BOOL.
  • ERRLIB_OUTPUT_EVENT_LOG (4). Specifies that logging functions should write information into Windows Event Log. Type: BOOL.
  • ERRLIB_OUTPUT_CUSTOM (5). Specifies that logging functions should write information into the custom logging target. Type: BOOL.

◆ ErrLib_ST_GetAddress()

ERRLIB_API uint64_t __stdcall ErrLib_ST_GetAddress ( const ERRLIB_STACK_FRAME pFrame)

Gets the symbol address from the specified stack frame

Parameters
pFrameThe pointer to a ERRLIB_STACK_FRAME structure
Returns
The 64-bit unsigned integer the represents the symbol address

◆ ErrLib_ST_GetDisplacement()

ERRLIB_API uint64_t __stdcall ErrLib_ST_GetDisplacement ( const ERRLIB_STACK_FRAME pFrame)

Gets the stack frame displacement from the symbol address (the difference between the instruction pointer value and the starting address of the function)

Parameters
pFrameThe pointer to a ERRLIB_STACK_FRAME structure
Returns
The 64-bit unsigned integer the represents the stack frame displacement

◆ ErrLib_ST_GetFrame()

ERRLIB_API const ERRLIB_STACK_FRAME *__stdcall ErrLib_ST_GetFrame ( const ERRLIB_STACK_TRACE pStack,
int  n 
)

Gets the frame with the specified number from a stack trace

Parameters
pStackThe pointer to a ERRLIB_STACK_TRACE structure
nThe frame number to get
Returns
The pointer to a ERRLIB_STACK_FRAME structure that contains the stack frame data
Note
The returned structure is stored in a memory allocated as part of the stack trace data and is freed when you call ErrLib_FreeStackTrace.

◆ ErrLib_ST_GetFramesCount()

ERRLIB_API int __stdcall ErrLib_ST_GetFramesCount ( const ERRLIB_STACK_TRACE pStack)

Gets the number of stack frames in the specified stack trace

Parameters
pStackThe pointer to a ERRLIB_STACK_TRACE structure
Returns
The integer number of stack frames

◆ ErrLib_ST_GetStringProperty()

ERRLIB_API const WCHAR *__stdcall ErrLib_ST_GetStringProperty ( const ERRLIB_STACK_FRAME pFrame,
int  propId 
)

Gets the value of the string property associated with this stack frame

Parameters
pFrameThe pointer to a ERRLIB_STACK_FRAME structure
propIdThe integer value that identifies the property to get
Returns
A pointer to the null-terminated wide character string that contains the property value, or NULL if the property value is not set.
Note
Supported property ids are: ERRLIB_SYMBOL_NAME, ERRLIB_SYMBOL_MODULE and ERRLIB_SYMBOL_SOURCE.
The returned string is stored in a memory allocated as part of the stack trace data and is freed when you call ErrLib_FreeStackTrace.

◆ ErrLib_ST_GetSymLine()

ERRLIB_API DWORD __stdcall ErrLib_ST_GetSymLine ( const ERRLIB_STACK_FRAME pFrame)

Gets the source line number from the specified stack frame

Parameters
pFrameThe pointer to a ERRLIB_STACK_FRAME structure
Returns
The unsigned integer the represents the source line number
Note
This function only returns a valid line number if the ERRLIB_SYMBOL_SOURCE property is set on the stack frame.

◆ ErrLib_UnregisterEventSource()

ERRLIB_API BOOL __stdcall ErrLib_UnregisterEventSource ( )

Deletes Windows Event Log registry data. Requires elevated priveleges.

Returns
Non-zero value if operation succeeded, zero if error occured
Note
The registry data is required not so much for writing into Event Log, but in order for the Event Viewer application to correctly display them. Therefore, do not call this function on every application exit; instead only do so when its events are no longer needed (i.e., when application is uninstalled).