| [17] | 1 | /* | 
|---|
|  | 2 | * Miscellaneous definitions | 
|---|
|  | 3 | * Debug prototypes and macros | 
|---|
|  | 4 | */ | 
|---|
|  | 5 |  | 
|---|
|  | 6 |  | 
|---|
| [4] | 7 | #ifndef __MISC_H__ | 
|---|
|  | 8 | #define __MISC_H__ | 
|---|
|  | 9 |  | 
|---|
| [2341] | 10 | #if !defined(_OS2WIN_H) && !defined(__INCLUDE_WINUSER_H) && !defined(__WINE_WINBASE_H) && !defined(__WINE_WINDEF_H) | 
|---|
| [780] | 11 | #include <win32type.h> | 
|---|
|  | 12 | #endif | 
|---|
|  | 13 |  | 
|---|
| [4] | 14 | #ifdef __cplusplus | 
|---|
|  | 15 | extern "C" { | 
|---|
|  | 16 | #endif | 
|---|
|  | 17 |  | 
|---|
| [4075] | 18 | #ifdef DEBUG | 
|---|
| [2061] | 19 | #ifdef PRIVATE_LOGGING | 
|---|
|  | 20 | //To use private dll logging, define PRIVATE_LOGGING and | 
|---|
|  | 21 | //add Open/ClosePrivateLogFiles (see below) functions to the dll | 
|---|
|  | 22 | //to open close the private logfile. The logfile handle should | 
|---|
|  | 23 | //be stored in the _privateLogFile variable | 
|---|
|  | 24 | //dprintf can be called like this: | 
|---|
|  | 25 | //dprintf((LOG, "PE file           : %s", szFileName)); | 
|---|
|  | 26 | #define LOG             (void*)_privateLogFile | 
|---|
|  | 27 | #define dprintf(a)      WritePrivateLog a | 
|---|
|  | 28 | #define dprintfGlobal(a)      WriteLog a | 
|---|
|  | 29 | #else | 
|---|
| [13] | 30 | #define dprintf(a)      WriteLog a | 
|---|
| [4263] | 31 | #define dprintfNoEOL(a)      WriteLogNoEOL a | 
|---|
| [2061] | 32 | #endif | 
|---|
| [13] | 33 | #define eprintf(a)      WriteLog a ; WriteLogError a | 
|---|
|  | 34 | #define dassert(a, b)   if(!(a)) WriteLogError b | 
|---|
|  | 35 | #define dbgCheckObj(a)        a->checkObject() | 
|---|
| [5427] | 36 | #define DisableLogging()  DecreaseLogCount() | 
|---|
|  | 37 | #define EnableLogging()   IncreaseLogCount() | 
|---|
| [1669] | 38 |  | 
|---|
|  | 39 | #ifdef DEBUG_ENABLELOG_LEVEL2 | 
|---|
| [2061] | 40 | #ifdef PRIVATE_LOGGING | 
|---|
|  | 41 | #define dprintf2(a)      WritePrivateLog a | 
|---|
| [4] | 42 | #else | 
|---|
| [2061] | 43 | #define dprintf2(a)      WriteLog a | 
|---|
|  | 44 | #endif | 
|---|
|  | 45 | #else | 
|---|
| [1669] | 46 | #define dprintf2(a) | 
|---|
|  | 47 | #endif | 
|---|
|  | 48 |  | 
|---|
|  | 49 | #else | 
|---|
| [2061] | 50 | #define dprintfGlobal(a) | 
|---|
| [13] | 51 | #define dprintf(a) | 
|---|
| [1953] | 52 | #define dprintf2(a) | 
|---|
| [4263] | 53 | #define dprintfNoEOL(a) | 
|---|
| [13] | 54 | #define eprintf(a) | 
|---|
|  | 55 | #define dassert(a, b) | 
|---|
|  | 56 | #define dbgCheckObj(a) | 
|---|
| [5427] | 57 | #define DisableLogging() | 
|---|
|  | 58 | #define EnableLogging() | 
|---|
| [4] | 59 | #endif | 
|---|
|  | 60 |  | 
|---|
| [17] | 61 |  | 
|---|
| [780] | 62 | // necessary types | 
|---|
| [2341] | 63 | #ifndef __WINE_WINDEF_H | 
|---|
| [780] | 64 | #ifdef ULONG | 
|---|
|  | 65 | #error ULONG definition is bad. | 
|---|
|  | 66 | #define ULONG nope. | 
|---|
| [17] | 67 | #endif | 
|---|
| [1616] | 68 | #ifndef NO_ULONG | 
|---|
|  | 69 | typedef unsigned long ULONG; | 
|---|
|  | 70 | typedef unsigned long HMODULE; | 
|---|
|  | 71 | #endif | 
|---|
| [2341] | 72 | #endif //!__WINE_WINDEF_H | 
|---|
| [17] | 73 |  | 
|---|
|  | 74 | #ifndef SYSTEM | 
|---|
|  | 75 | #  define SYSTEM _System | 
|---|
|  | 76 | #endif | 
|---|
|  | 77 |  | 
|---|
|  | 78 |  | 
|---|
| [13] | 79 | int  SYSTEM WriteLog(char *tekst, ...); | 
|---|
| [4263] | 80 | int  SYSTEM WriteLogNoEOL(char *tekst, ...); | 
|---|
| [2061] | 81 | int  SYSTEM WritePrivateLog(void *logfile, char *tekst, ...); | 
|---|
| [924] | 82 |  | 
|---|
| [13] | 83 | int  SYSTEM WriteLogError(char *tekst, ...); | 
|---|
| [924] | 84 |  | 
|---|
| [2431] | 85 | void SYSTEM DecreaseLogCount(); | 
|---|
|  | 86 | void SYSTEM IncreaseLogCount(); | 
|---|
|  | 87 |  | 
|---|
| [4] | 88 | void SYSTEM CheckVersion(ULONG version, char *modname); | 
|---|
| [924] | 89 |  | 
|---|
| [4] | 90 | void SYSTEM CheckVersionFromHMOD(ULONG version, HMODULE hModule); | 
|---|
|  | 91 |  | 
|---|
| [924] | 92 | int  SYSTEM DebugErrorBox(ULONG  iErrorCode, | 
|---|
|  | 93 | char*  pszFormat, | 
|---|
|  | 94 | ...); | 
|---|
|  | 95 |  | 
|---|
| [2061] | 96 | //To use private logfiles for dlls, you must have these functions and call | 
|---|
|  | 97 | //them when the dll is loaded (open) and the exitlist handler is called (close) | 
|---|
|  | 98 | void OpenPrivateLogFiles(); | 
|---|
|  | 99 | void ClosePrivateLogFiles(); | 
|---|
| [924] | 100 |  | 
|---|
| [5127] | 101 | /* enable support for the _interrupt() statement */ | 
|---|
|  | 102 | #if (defined(__IBMCPP__) || defined(__IBMC__)) | 
|---|
|  | 103 | #  include <builtin.h> | 
|---|
|  | 104 | #ifdef DEBUG | 
|---|
| [4] | 105 | #ifdef __cplusplus | 
|---|
| [5127] | 106 | void inline BreakPoint(char *szFile, char *szFunction) | 
|---|
|  | 107 | { | 
|---|
|  | 108 | dprintf(("BREAKPOINT %s %s", szFile, szFunction)); | 
|---|
|  | 109 | _interrupt(3); | 
|---|
|  | 110 | } | 
|---|
|  | 111 | #define DebugInt3()   BreakPoint(__FILE__, __FUNCTION__) | 
|---|
|  | 112 |  | 
|---|
|  | 113 | #else | 
|---|
|  | 114 | #define DebugInt3()   _interrupt(3) | 
|---|
|  | 115 | #endif | 
|---|
|  | 116 | #else | 
|---|
|  | 117 | #define DebugInt3() | 
|---|
|  | 118 | #endif | 
|---|
|  | 119 |  | 
|---|
|  | 120 | #else | 
|---|
|  | 121 | #ifdef DEBUG | 
|---|
|  | 122 | #define DebugInt3()   _asm int 3; | 
|---|
|  | 123 | #else | 
|---|
|  | 124 | #define DebugInt3() | 
|---|
|  | 125 | #endif | 
|---|
|  | 126 |  | 
|---|
|  | 127 | #endif | 
|---|
|  | 128 |  | 
|---|
|  | 129 | #ifdef __cplusplus | 
|---|
| [4] | 130 | } | 
|---|
|  | 131 | #endif | 
|---|
|  | 132 |  | 
|---|
| [13] | 133 |  | 
|---|
| [4] | 134 | #endif | 
|---|