AudRecordLib
|
00001 00007 #ifndef STDAFX_H 00008 #define STDAFX_H 00009 00010 #pragma once 00011 00012 #define WIN32_LEAN_AND_MEAN 00013 #define _WIN32_WINNT 0x0600 00014 #define NOMINMAX 00015 00016 #include <windows.h> 00017 #include "../macroutils.h" 00018 #include "../exports.h" 00019 #include "../scoped.h" 00020 #include <vcclr.h> 00021 #include "resource.h" 00022 #include <intrin.h> 00023 #include "../ETWEvents.h" 00024 00025 using namespace System; 00026 using namespace System::Collections::Generic; 00027 00029 extern HMODULE g_hModule; 00030 00039 template<class T> 00040 void ThrowOnNullPtrArgument(T^ arg, LPCWSTR argName, DWORD errorTextMessage) 00041 { 00042 if(!arg) 00043 { 00044 String^ message = GetModuleString(errorTextMessage); 00045 throw gcnew System::ArgumentNullException(gcnew String(argName), message); 00046 } 00047 } 00048 00053 #define THROW_ON_NULL_ARG(arg, messageId) ThrowOnNullPtrArgument(arg, L#arg, messageId) 00054 00061 #define LOG_TEXT(Function, string, ...) \ 00062 do \ 00063 { \ 00064 C_ASSERT(sizeof(*string) == sizeof(char)); \ 00065 char buffer[300]; \ 00066 char fnName[] = __FUNCTION__; \ 00067 LogFormat(buffer, __FUNCTION__ " " string "\n", __VA_ARGS__); \ 00068 /* The function name is already in the buffer for the ODPrint buffer */ \ 00069 /* So we skip it when passing it to the 'Function' function */ \ 00070 Function(__FILE__, __LINE__, __FUNCTION__, buffer + ARRAYSIZE(fnName) + 1); \ 00071 OutputDebugStringA(buffer); \ 00072 } \ 00073 while(0) 00074 00081 #define SEVERE_TEXT(string, ...) \ 00082 LOG_TEXT(LogSevereEvent, string, __VA_ARGS__) 00083 00088 #define DBG_TEXT(string, ...) \ 00089 LOG_TEXT(LogDebugEvent, string, __VA_ARGS__) 00090 00096 #define MANAGED_PRAGMA(type) \ 00097 __pragma(managed(push)) \ 00098 __pragma(managed(type)) 00099 00104 #define MANAGED_PRAGMA_RESTORE() \ 00105 __pragma(managed(pop)) 00106 00109 #endif