Filter Library | Camera | Interface Physics |
Definition in file QAFDebug.cpp.
#include "stdafx.h"
#include "QAFDebug.h"
#include <malloc.h>
#include <shlobj.h>
Go to the source code of this file.
Classes | |
class | CSync |
A simple synchronization class, designed to be used as an automatic variable. More... | |
class | CQAFDebug |
Class to generate debug log. More... | |
class | CPreserveLastError |
Small class that preserves the last error code. More... | |
Defines | |
#define | QAFDEBUG_FMT_SPOS _T("%.250s(%d) : %.600s") |
3 parameters "filename(line) : error message" | |
#define | QAFDEBUG_FMT_PREFIX _T("\r\n\t") |
End of line + tab. | |
#define | QAFDEBUG_FMT_DATE QAFDEBUG_FMT_PREFIX _T("time: ") _T("%04d-%02d-%02d %02d:%02d:%02d:%03d") |
7 parameters - formatting date and time " time: 2003-12-07 15:48:07:507" | |
#define | QAFDEBUG_FMT_PROC QAFDEBUG_FMT_PREFIX _T("process: ") _T("0x%08X") |
1 parameter - formatting process info " process: 0x00000E24" | |
#define | QAFDEBUG_FMT_THRE QAFDEBUG_FMT_PREFIX _T("thread: ") _T("0x%08X") |
1 parameter - formatting thread info " thread: 0x00000E2C" | |
#define | QAFDEBUG_FMT_APPL QAFDEBUG_FMT_PREFIX _T("application: ") _T("%.250s") |
1 parameter - formatting application info " application: C:\Program Files\Microsoft Office\Office10\WINWORD.EXE <1.4.6.7>" | |
#define | QAFDEBUG_FMT_MODU QAFDEBUG_FMT_PREFIX _T("module: ") _T("%.250s") |
1 parameter - formatting module info " module: C:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.4.6.7>" | |
#define | QAFDEBUG_FMT_LERR QAFDEBUG_FMT_PREFIX _T("last error: ") _T("%.250s") |
1 parameter - formatting last error info " last error: 6, The handle is invalid." | |
#define | QAFDEBUG_FMT_EXPR QAFDEBUG_FMT_PREFIX _T("expression: ") _T("%.250s") |
1 parameter - formatting expression info " expression: DuplicateHandle( NULL, NULL, NULL, NULL, 0, FALSE, 0 )" | |
#define | QAFDEBUG_STD_FORMAT |
The resulting format strings 16 parameters. | |
#define | QAFDEBUG_ERROR_MUTEX_CREATE QAFDEBUG_ERROR_PREFIX _T("Mutex is not created\r\n") |
#define | QAFDEBUG_ERROR_MAP_FILE_CREATE QAFDEBUG_ERROR_PREFIX _T("Mapped-memory file is not created\r\n") |
#define | QAFDEBUG_ERROR_LOG_FILE_PATH QAFDEBUG_ERROR_PREFIX _T("Path to the error log file cannot be retrieved\r\n") |
#define | QAFDEBUG_ERROR_POINTER_NOT_MAPPED QAFDEBUG_ERROR_PREFIX _T("Memory pointer is not mapped to the Mapped-memory file\r\n") |
#define | QAFDEBUG_ERROR_NULL QAFDEBUG_ERROR_PREFIX _T("qafOutputDebugString() got an empty error message.\r\n") |
#define | QAFDEBUG_ERROR_STD_NULL QAFDEBUG_ERROR_PREFIX _T("QAFDebug::std pointer is not initialized.\r\n") |
#define | QAFDEBUG_ERROR_OPEN_LOG_FILE QAFDEBUG_ERROR_PREFIX _T("Debug log file cannot be opened.\r\n") |
#define | QAFDEBUG_ERROR_ALLOCATE_BUFFER QAFDEBUG_ERROR_PREFIX _T("Cannot allocate memory for formatting the error message.\r\n") |
#define | QAFDEBUG_ERROR_NULL_ARGS QAFDEBUG_ERROR_PREFIX _T("NULL input parameters for formatting the error message.\r\n") |
#define | QAFDEBUG_ERROR_FORMAT QAFDEBUG_ERROR_PREFIX _T("Cannot format the error message.\r\n") |
#define | QAFDEBUG_ERROR_CLOSE_FILE QAFDEBUG_ERROR_PREFIX _T("Cannot close the debug log file\r\n") |
#define | QAFDEBUG_ERROR_BACKUP QAFDEBUG_ERROR_PREFIX _T("Cannot create a backup copy of the debug log file\r\n") |
#define | CSIDL_COMMON_APPDATA 0x0023 |
#define | CSIDL_FLAG_CREATE 0x8000 |
Typedefs | |
typedef int | nFolder |
typedef int HANDLE | hToken |
typedef int HANDLE DWORD | dwFlags |
typedef int HANDLE DWORD LPTSTR | szPath |
Enumerations | |
enum | Q_SHGFP_TYPE { Q_SHGFP_TYPE_CURRENT = 0, Q_SHGFP_TYPE_DEFAULT = 1 } |
This is an enumeration from MSDN for newer versions of SHxxx functions. More... | |
Functions | |
void | ODS (LPCTSTR szMessage) |
bool | DirExists0 (LPCTSTR dirName) |
Return true if the directory exists. | |
bool | CreateSubFolders0 (LPCTSTR szFolderName) |
Create the full folder path recursively. | |
typedef | HRESULT (__stdcall *PSHGetFolderPath)(HWND hwndOwner |
The folder search function definition (taken from MSDN). | |
HRESULT | SHGetSpecialFolderPathCustom (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPTSTR szPath) |
My wrapper function that tries to load first shell32.dll and then shfolder.dll. | |
void | QAFDebug::SetModule (LPCTSTR szModuleName) |
This function allows setting the module name for additional logging options. | |
bool | QAFDebug::tryEnable (void) |
Try to enable the error log. | |
bool | QAFDebug::tryDisable (void) |
Try to disable the error log. | |
bool | isRN (const TCHAR ch) |
Return true if the character is or . | |
void | QAFDebug::OutputDebugStringEx (LPCTSTR szFilename, const int iLine, LPCTSTR szExpression, LPCTSTR szErrorMessage, const LPDWORD pdwLastError=NULL) |
Reports about critical errors. | |
HRESULT | QAFDebug::qafReportComError (const HRESULT hrStatus, LPCTSTR szFile, const int iLine) |
Reports about critical errors if HRESULT is failed. | |
DWORD | QAFDebug::ReportWinError (const DWORD dwError, LPCTSTR szFile, const int iLine) |
Reports about critical errors if dwError != ERROR_SUCCESS. | |
DWORD | QAFDebug::GetLogDir (LPTSTR lpszDirBuf, const DWORD dwMaxLen) |
Return an accessible directory name for all log files. | |
Variables | |
const DWORD | QDEBUG_SHMEMSIZE = sizeof(DWORD) |
Size of the shared flags stored in the memory-mapped-file. | |
const DWORD | QAFDEBUG_FMT_HRESULT_LEN = 20 |
Buffer length for HRESULT formatting. | |
const LPCTSTR | QAFDEBUG_FMT_HRESULT = _T("FAILED(0x%08X)") |
Format string for HRESULT formatting. | |
const DWORD | QAFDEBUG_FMT_ERROR_SUCCESS_LEN = 30 |
Buffer length for ERROR_SUCCESS formatting. | |
const LPCTSTR | QAFDEBUG_FMT_ERROR_SUCCESS = _T("(ERROR_SUCCESS != 0x%08X)") |
Format string for ERROR_SUCCESS formatting. | |
const size_t | MAX_BUF_SIZE = 2048 |
Maximum size of the debug record. | |
const DWORD | INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF |
const int | LIBRARY_COUNT = 2 |
Count of the libraries with the SHGetFolderPath function. | |
const LPCTSTR | LIBRARY_DLL [LIBRARY_COUNT] = { _T("shell32.dll"), _T("shfolder.dll") } |
The first DLL that is checked for the SHGetFolderPathA(W) function. | |
const LPCSTR | SHGetFolderPathFuncName = "SHGetFolderPathA" |
The name of the function (it differs for ASCII and UNICODE builds). | |
TCHAR | szCurrentModuleName [MAX_PATH] = { 0 } |
The current module name - internal variable. |
#define QAFDEBUG_STD_FORMAT |
Value:
QAFDEBUG_FMT_SPOS \ QAFDEBUG_FMT_DATE \ QAFDEBUG_FMT_PROC \ QAFDEBUG_FMT_THRE \ QAFDEBUG_FMT_APPL \ QAFDEBUG_FMT_MODU \ QAFDEBUG_FMT_LERR \ QAFDEBUG_FMT_EXPR
Definition at line 116 of file QAFDebug.cpp.
Referenced by QAFDebug::OutputDebugStringEx().
enum Q_SHGFP_TYPE |
Renamed to be ported easily between VC 6 and VC 7
Q_SHGFP_TYPE_CURRENT | current value for user, verify it exists |
Q_SHGFP_TYPE_DEFAULT | default value, may not exist |
Definition at line 620 of file QAFDebug.cpp.
bool CreateSubFolders0 | ( | LPCTSTR | szFolderName | ) |
Must get the folder full path without tailing '\'.
Definition at line 530 of file QAFDebug.cpp.
References DirExists0().
Referenced by QAFDebug::GetLogDir().