/* * C/C++ header file for logtext.dll * --------------------------------- * * For versions 1.6.20 and higher only. * * Do not use this file for lower versions. Aquire the header file that * belongs to the used version instead. * * */ #include #include #ifndef _logtext_h__now_included #define _logtext_h__now_included #define DllImport __declspec( dllimport ) #define DllExport __declspec( dllexport ) #define MAX_DATE_TIME_TEXT 26 /* yyyy-mm-dd hh:mi:ss +01:00 */ #define MAX_DATE_WEEK_TEXT 11 /* yyyy-Www-dd */ #define MAX_DATE_NO_BLANKS 8 /* yyyymmdd */ #define MAX_DATE_WEEK 6 /* yyyy-W */ #define MAX_DTMS_TEXT 30 /* yyyy-mm-dd hh:mi:ss.mis +01:00 */ #define MAX_DATE_NO_OFFS 23 /* yyyy-mm-dd hh:mi:ss.mis */ extern DllExport char chCurrentDateTimeText [MAX_DATE_TIME_TEXT + 1]; extern DllExport char chCurrentDateWeekText [MAX_DATE_WEEK_TEXT + 1]; extern DllExport char *chCurrentLogFileName; extern DllExport char chCurrentDateNoBlanks [MAX_DATE_NO_BLANKS + 1]; extern DllExport char chCurrentDateWeek [MAX_DATE_WEEK + 1]; extern DllExport char chCurrentDTMSText [MAX_DTMS_TEXT + 1]; typedef struct sCurrentDateTime { char chCurrentDateTimeText [MAX_DATE_TIME_TEXT + 1]; char chCurrentDateWeekText [MAX_DATE_WEEK_TEXT + 1]; char chCurrentDateNoBlanks [MAX_DATE_NO_BLANKS + 1]; char chCurrentDateWeek [MAX_DATE_WEEK + 1]; char chCurrentDTMSText [MAX_DTMS_TEXT + 1]; } SCURRENTDATETIME; // The structure for LogTextEx (). typedef struct sLogTextEx { DWORD dwOptions; // Simple options. DWORD dwExOptions; // Extended options. unsigned long ul_LO_QUICK_Counter; // Counter for LO_QUICK. unsigned long ul_LO_QUICK_local_Counter; // Counter for LO_QUICK. unsigned long ulMaxLogs; // Maximum amount of log files to keep. unsigned long ulMaxZips; // Maximum amount of zip files to keep. unsigned long ulTimeOut; // Timeout value. SCURRENTDATETIME *scdt; // Formatted date/time structure. char *chLogFileName; // Log file name. char *chMaskLogFile; // Default: *.log (Don't use!) // The functions will fill this in // themselves. char *chExteLogFile; // Default: .log char *chMaskZipFile; // Default: *.zip (Don't use!) // The functions will fill this in // themselves. char *chExteZipFile; // Default: .zip char *chExteBakFile; // Default: .bak char *chConfigFile; // Configuration file name. char *chExtExecutionString; // External packer (executable). char *chExtParameterString; // External packer (parameters). DWORD dwExtCreationFlags; // External packer (creation flags). // New in version 1.5.6. DWORD dwLogBufferLength; // Length (in octets) of buffer to log. DWORD dwLogWidth; // Width for binary logging (default is 16) in octets. size_t stSLOGTEXTINILength; // sizeof (SLOGTEXTINI) } SLOGTEXTINI; // One section of a configuration file in memory. typedef struct sIni { struct sIni *_nextEntry; char *chSection; SLOGTEXTINI *slogtextini; unsigned long ulLines; } SINISECTION; // One queue element for LogTextExQ (). typedef struct sLogTextExQ { struct sLogTextExQ *_nextEntry; char *chApplication; char *chLogText; SLOGTEXTINI *slogtextini; unsigned long ulLostMessages; } SLOGTEXTINIQ; // Logging options. #define LO_ECHO 0x00000001 #define LO_ECHO_ONLY 0x00000002 /* Echo but don't write to log file. */ #define LO_QUICK 0x00000004 /* Quick mode - no log file rotation. */ #define LO_LOGNAME_ONLY 0x00000008 #define LO_INCLUDE_APP 0x00000010 #define LO_NO_DATE 0x00000020 #define LO_DAILY 0x00000040 /* Default. Create a new log file daily. */ #define LO_WEEKLY 0x00000080 /* Create a new log file weekly. */ #define LO_MONTHLY 0x00000100 #define LO_YEARLY 0x00000200 #define LO_LINES 0x00000400 #define LO_SIZE 0x00000800 #define LO_DELETE_ZIPS 0x00001000 #define LO_DELETE_LOGS 0x00002000 #define LO_LOG_DELETION 0 /* Not required: default setting. */ #define LO_DONT_LOG_DELETION 0x00004000 #define LO_DONT_ZIP 0x00008000 #define LO_LOG_ZIPPING 0 /* Not required: default setting. */ #define LO_DONT_LOG_ZIPPING 0x00010000 //#define LO_SET_QUICK 0x00020000 #define LO_NO_BANNER 0x00020000 /* Don't log the startup message */ #define LO_TIME_T 0x00040000 /* Use 'T' to seperate date/time and event text */ #define LO_STDERR 0x00080000 #define LO_USER_ISO_DATE 0x00100000 #define LO_REG_ISO_DATE 0x00200000 #define LO_KEEP_CRLF 0x00400000 #define LO_LOG_REGISTRY 0 /* Not required: default setting. */ #define LO_DONT_LOG_REGISTRY 0x00800000 /* Don't log changes to the registry. */ #define LO_LOGNAME 0x01000000 /* Leave the log file's name for the caller */ #define LO_LOG_ALL 0 #define LO_DONT_LOG_ACTIONS (LO_DONT_LOG_DELETION | LO_DONT_LOG_ZIPPING | LO_DONT_LOG_REGISTRY) // Additional logging options (for LogTextEx and LogTextExQ, dwExOptions). #define LE_NO_CONFIG 0x00000001 /* Don't read the config (ini) file. */ #define LE_LOG_CONFIG 0 /* Always used now, hence no value. */ #define LE_DONT_LOG_CONFIG 0x00000002 #define LE_DONT_LOG 0x00000004 /* Only zip, but don't log anything */ #define LE_SET_DATE_TIME 0x00000008 /* Use date and time provided within * SCURRENTDATETIME of SLOGTEXTINI * structure. */ //#define LE_START_PROCESS 0x00000010 // Start a new process for LogTextExQ () // instead of just a thread. #define LE_FORCE_BINARY 0x00000020 /* Always log in binary mode. */ #define LE_LOG_BINARY LE_FORCE_BINARY // Sort the directory listing for FAT or FAT32. #define LE_SORT_DIR 0x00000040 /* Force the directory listing to be * sorted. Only required for FAT and * FAT32. This option bit does not * need to be set by the caller. */ #define LE_PAUSE_BEFORE_LOG 0x00000080 /* Pause the logging thread for * ulTimeOut milliseconds. */ #define LE_DONT_LOG_MS 0x00000100 /* Don't append milliseconds to time. */ #define LE_NO_MS LE_DONT_LOG_MS #define LE_LOGTEXTEXQ 0x00000200 /* Internal identifier. Don't use. */ #define LE_PAUSE_AFTER_LOG 0x00000400 /* Pause the logging thread for * ulTimeOut milliseconds. */ #define LE_SUSPEND_LOG 0x00001000 /* LogTextExQ: Suspend logging thread. */ #define LE_RESUME_LOG 0x00002000 /* LogTextExQ: Resume logging thread. */ #define LE_IGNORE_EVENT 0x00004000 /* LogTextExQ: Ignore the whole event. */ #define LE_THREE_BLANKS 0x00008000 /* Leave 3 blanks between the date/time * stamp and the text to log instead of * just one. Together with LE_DONT_LOG_SEC * this is compatible with * Inno Setup's (http://www.innosetup.org) * log files. */ #define LE_DONT_LOG_SEC 0x00010000 /* Don't append seconds, milliseconds, * and offset to time. * Only output yyyy-mm-dd hh:mm. */ #define LE_DONT_LOG_SECS LE_DONT_LOG_SEC #define LE_NO_SEC LE_DONT_LOG_SEC #define LE_NO_SECS LE_DONT_LOG_SEC #define LE_DONT_LOG_SECMS LE_DONT_LOG_SEC #define LE_NO_BANNER 0x00020000 /* Don't log the startup message */ #define LE_ADD_DOT 0x00040000 /* Adds a dot ('.') to the logging data * when ASCII. */ #define LE_ADD_FULL_STOP LE_ADD_DOT #define LE_NTFS_COMPRESSION 0x00100000 /* Use standard NTFS compression. */ #define LE_NTFS_COMPRESS LE_NTFS_COMPRESSION #define LE_NO_OFFSET 0x00200000 /* Only output yyyy-mm-dd hh:mm:mis. */ #define LE_NO_OFFS LE_NO_OFFSET // Used default filename extensions. #define _MASK_LOGFILE "*.log" #define _EXTE_LOGFILE ".log" #define _MASK_ZIPFILE "*.gz" #define _EXTE_ZIPFILE ".gz" #define _EXTE_BAKFILE ".~tmp.bak" #ifdef __cplusplus extern "C" { #endif #define CALLCONV __cdecl #define STDCCONV __stdcall // Standard logging function, single threaded. extern DllExport int CALLCONV LogText (const char *chApplication, const char *chLogText, DWORD dwOptions, unsigned long ulMaxLogs, unsigned long ulMaxZips); // Extended logging function, multi-threaded. extern DllExport int CALLCONV LogTextEx (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); // Extended logging function, multi-threaded and queued. extern DllExport int CALLCONV LogTextExQ (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); // The logging functions as stdcall for other programming languages. extern DllExport int STDCCONV sLogText (const char *chApplication, const char *chLogText, DWORD dwOptions, unsigned long ulMaxLogs, unsigned long ulMaxZips); extern DllExport int STDCCONV sLogTextEx (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); extern DllExport int STDCCONV sLogTextExQ (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); // Empty the queue for LogTextExQ before detaching the DLL. extern DllExport BOOL bDequeueOnExit; extern DllExport BOOL bAboutToExit; typedef int (CALLCONV *LPLOGTEXT) (const char *chApplication, const char *chLogText, DWORD dwOptions, unsigned long ulMaxLogs, unsigned long ulMaxZips); typedef int (CALLCONV *LPLOGTEXTEX) (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); typedef int (CALLCONV *LPLOGTEXTEXQ) (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); typedef int (STDCCONV *LPSLOGTEXT) (const char *chApplication, const char *chLogText, DWORD dwOptions, unsigned long ulMaxLogs, unsigned long ulMaxZips); typedef int (STDCCONV *LPSLOGTEXTEX) (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); typedef int (STDCCONV *LPSLOGTEXTEXQ) (const char *chApplication, const char *chLogText, SLOGTEXTINI *sltIni); extern LPLOGTEXT lpLogText; extern LPLOGTEXTEX lpLogTextEx; extern LPLOGTEXTEXQ lpLogTextExQ; extern LPSLOGTEXT lpsLogText; extern LPSLOGTEXTEX lpsLogTextEx; extern LPSLOGTEXTEXQ lpsLogTextExQ; extern HMODULE hLogTextDLL; /* LoadAndInitializeLogText Loads the library logtext.dll and initializes the function pointers. If chLogTextPath is NULL the function searches the standard paths for the DLL. Otherwise chLogTextPath must be the full path including the file name, for instance "C:\program files\MyApp\logtext.dll". Returns 0 if an error occured. Returns 1 if successful. */ int LoadAndInitializeLogText (char *chLogTextPath); #ifdef __cplusplus } #endif #endif