Added a few logging overloads for a few types

Eventually, all logged types need to be covered.
This commit is contained in:
PatrickvL 2016-11-11 00:30:09 +01:00
parent 21ac7bc71d
commit 85b51ab3c4
2 changed files with 58 additions and 16 deletions

View File

@ -35,9 +35,49 @@
#include <Windows.h>
#include "Logging.h"
//#include "EmuNtDll.h"
// For thread_local, see : http://en.cppreference.com/w/cpp/language/storage_duration
thread_local const DWORD _CurrentThreadId = GetCurrentThreadId();
// TODO : Use Boost.Format http://www.boost.org/doc/libs/1_53_0/libs/format/index.html
thread_local std::string _logPrefix;
std::ostream& operator<<(std::ostream& os, const LARGE_INTEGER& value);
{
return os << value.QuadPart;
}
//std::ostream& operator<<(std::ostream& os, const LPCSTR& value);
std::ostream& operator<<(std::ostream& os, const PULONG& value)
{
os << "0x" << (void*)value;
if (value)
os << " (->0x" << (void*)*value << ");
return os;
}
// std::ostream& operator<<(std::ostream& os, const PMM_STATISTICS& value); // ->Length
// std::ostream& operator<<(std::ostream& os, const POBJECT_ATTRIBUTES& value); // ->ObjectName->Buffer
// std::ostream& operator<<(std::ostream& os, const PIO_STATUS_BLOCK& value); // ->u1.Pointer, ->Information
// std::ostream& operator<<(std::ostream& os, const PSTRING& value); // (value != 0) ? value->Buffer : ""
std::ostream& operator<<(std::ostream& os, const PLARGE_INTEGER& value)
{
os << "0x" << (void*)value;
if (value)
os << " (->0x" << value->QuadPart << ");
return os;
}
// std::ostream& operator<<(std::ostream& os, const PUNICODE_STRING& value);
// std::ostream& operator<<(std::ostream& os, const PVOID*& value); // * value, *value
// std::ostream& operator<<(std::ostream& os, const PXDEVICE_PREALLOC_TYPE& value);
// std::ostream& operator<<(std::ostream& os, const PXINPUT_CAPABILITIES& value);
// std::ostream& operator<<(std::ostream& os, const PXINPUT_STATE& value);
// std::ostream& operator<<(std::ostream& os, const PXPP_DEVICE_TYPE& value);
// std::ostream& operator<<(std::ostream& os, const PXTHREAD_NOTIFICATION& value); // -> pfnNotifyRoutine
// std::ostream& operator<<(std::ostream& os, const UCHAR& value);

View File

@ -104,23 +104,25 @@ extern thread_local std::string _logPrefix;
// Log function with one out argument
#define LOG_FUNC_ONE_ARG_OUT(arg) LOG_FUNC_BEGIN LOG_FUNC_ARG_OUT(arg) LOG_FUNC_END
//#include "EmuNtDll.h"
// TODO :
// LPCSTR
// PULONG value, *value
// POBJECT_ATTRIBUTES ->ObjectName->Buffer
// PVOID * value, *value
// PLARGE_INTEGER ->QuadPart
// LARGE_INTEGER.QuadPart
// PXDEVICE_PREALLOC_TYPE
// PXPP_DEVICE_TYPE
// PXINPUT_CAPABILITIES
// PXINPUT_STATE
// PXTHREAD_NOTIFICATION -> pfnNotifyRoutine
// PMM_STATISTICS->Length
// PIO_STATUS_BLOCK ->u1.Pointer, ->Information
// PUNICODE_STRING
// PSTRING (value != 0) ? value->Buffer : ""
// UCHAR
//std::ostream& operator<<(std::ostream&, const LARGE_INTEGER&); // .QuadPart
//std::ostream& operator<<(std::ostream&, const LPCSTR&);
std::ostream& operator<<(std::ostream&, const PLARGE_INTEGER&);
// std::ostream& operator<<(std::ostream&, const PMM_STATISTICS&); // ->Length
// std::ostream& operator<<(std::ostream&, const POBJECT_ATTRIBUTES&); // ->ObjectName->Buffer
// std::ostream& operator<<(std::ostream&, const PIO_STATUS_BLOCK&); // ->u1.Pointer, ->Information
// std::ostream& operator<<(std::ostream&, const PSTRING&); // (value != 0) ? value->Buffer : ""
std::ostream& operator<<(std::ostream&, const PULONG&);
// std::ostream& operator<<(std::ostream&, const PUNICODE_STRING&);
// std::ostream& operator<<(std::ostream&, const PVOID*&); // * value, *value
// std::ostream& operator<<(std::ostream&, const PXDEVICE_PREALLOC_TYPE&);
// std::ostream& operator<<(std::ostream&, const PXINPUT_CAPABILITIES&);
// std::ostream& operator<<(std::ostream&, const PXINPUT_STATE&);
// std::ostream& operator<<(std::ostream&, const PXPP_DEVICE_TYPE&);
// std::ostream& operator<<(std::ostream&, const PXTHREAD_NOTIFICATION&); // -> pfnNotifyRoutine
// std::ostream& operator<<(std::ostream&, const UCHAR&);
#endif _LOGGING_H