180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2011 Google Inc. 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkTypes.h" 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SKHRESULT.h" 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruvoid SkTraceHR(const char* file, unsigned long line, 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru HRESULT hr, const char* msg) { 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkDEBUGCODE(if (NULL != msg) SkDEBUGF(("%s\n", msg))); 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkDEBUGF(("%s(%lu) : error 0x%x: ", file, line, hr)); 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru LPSTR errorText = NULL; 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru FORMAT_MESSAGE_FROM_SYSTEM | 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru FORMAT_MESSAGE_IGNORE_INSERTS, 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru NULL, 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru hr, 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru (LPSTR) &errorText, 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 0, 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru NULL 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ); 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (NULL == errorText) { 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkDEBUGF(("<unknown>\n")); 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 327839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger SkDEBUGF(("%s", errorText)); 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru LocalFree(errorText); 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru errorText = NULL; 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 37