Welcome to mirror list, hosted at ThFree Co, Russian Federation.

win_trace.h « src - github.com/windirstat/lua-winreg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d2e21147cfe0695d331a6dc93c2672a1d99f8bf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __WINTRACE_H__
#define __WINTRACE_H__
#pragma once

#ifndef NOP_FUNCTION
	#if (_MSC_VER >= 1210)
		#define NOP_FUNCTION __noop
	#else
		#pragma warning(disable:4505) // unreferenced local function has been removed.
		static void nullfunc(const void * x, ...){FatalAppExit(0,(LPCTSTR)x);}
		#define NOP_FUNCTION 1?((void)0):nullfunc
	#endif
#endif

#ifdef  __cplusplus
extern "C" {
#endif

#include <windows.h>
#ifdef NDEBUG
	#define WIN_TRACET NOP_FUNCTION
	#define WIN_TRACEA NOP_FUNCTION
	#define WIN_TRACEW NOP_FUNCTION
	#define WIN_TRACEA_FT NOP_FUNCTION
	#define WIN_TRACEA_ST NOP_FUNCTION
#else
	void win_traceA(const char *pszFmt, ...);
	void win_traceW(const WCHAR *pszFmt, ...);

	#define WIN_TRACEA win_traceA
	#define WIN_TRACEW win_traceW
	#ifdef UNICODE
		#define WIN_TRACET win_traceW
	#else
		#define WIN_TRACET win_traceA
	#endif

	// trace a FILE_TIME
	#define WIN_TRACEA_FT(msg,pft) if(pft){SYSTEMTIME st;FileTimeToSystemTime(pft, &st); \
		WIN_TRACEA(msg " %s %0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.3d", #pft, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);}

	// trace a SYSTEMTIME
	#define WIN_TRACEA_ST(msg,pst) if(pst){ \
		WIN_TRACEA(msg " %s %0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.3d", #pst, pst->wYear, pst->wMonth, pst->wDay, pst->wHour, pst->wMinute, pst->wSecond, pst->wMilliseconds);}

#endif

#ifdef  __cplusplus
}
#endif

#endif //__WINTRACE_H__