Changeset 153 for trunk


Ignore:
Timestamp:
Dec 4, 2012, 3:03:40 AM (11 years ago)
Author:
roman
Message:

Added software licensing HRESULTs

Location:
trunk/Utilities/ShowHresult
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/ShowHresult/NotifyIconWindow.h

    r151 r153  
    2121#include <audioclient.h> // FACILITY_AUDCLNT
    2222#include <p2p.h> // FACILITY_P2P
     23#include <slerror.h> // FACILITY_SL_ITF
    2324
    2425#include <adserr.h>
     
    444445                        #define A(x) { x, #x },
    445446                        #include "P2pIdentifier.inc"
     447                        #undef A
     448                };
     449                for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++)
     450                        if(g_pMap[nIndex].nValue == nValue)
     451                        {
     452                                sIdentifier = CString(g_pMap[nIndex].pszName);
     453                                return TRUE;
     454                        }
     455                return FALSE;
     456        }
     457        static BOOL IsSlResult(HRESULT nResult, CString* psMessage = NULL, CString* psIdentifier = NULL)
     458        {
     459                if(HRESULT_FACILITY(nResult) != FACILITY_SL_ITF)
     460                        return FALSE;
     461                psMessage;
     462                const CString sMessage = AtlFormatSystemMessage(CDataLibraryMap::LoadLibrary(_T("slc.dll")), nResult);
     463                if(psMessage)
     464                        *psMessage = sMessage;
     465                CString sIdentifier;
     466                if(!LookupSlIdentifier(nResult, sIdentifier))
     467                        if(sMessage.IsEmpty())
     468                                return FALSE;
     469                if(psIdentifier)
     470                        *psIdentifier = sIdentifier;
     471                return TRUE;
     472        }
     473        static BOOL LookupSlIdentifier(HRESULT nValue, CString& sIdentifier)
     474        {
     475                static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] =
     476                {
     477                        #define A(x) { x, #x },
     478                        #include "SlIdentifier.inc"
    446479                        #undef A
    447480                };
     
    630663                else if(IsP2pResult(nResult, &sMessage, &sIdentifier) || LookupP2pIdentifier(nResult, sIdentifier))
    631664                        sTitle = _T("P2P");
     665                else if(IsSlResult(nResult, &sMessage, &sIdentifier) || LookupSlIdentifier(nResult, sIdentifier))
     666                        sTitle = _T("Software Licensing");
    632667                else
    633668                {
  • trunk/Utilities/ShowHresult/ShowHresult.vcxproj

    r151 r153  
    306306    <ClInclude Include="Resource.h" />
    307307    <ClInclude Include="ShowHresult_i.h" />
     308    <ClInclude Include="SlIdentifier.inc" />
    308309    <ClInclude Include="stdafx.h" />
    309310    <ClInclude Include="targetver.h" />
  • trunk/Utilities/ShowHresult/ShowHresult.vcxproj.filters

    r151 r153  
    4848    <ClInclude Include="NotifyIconWindow.h">
    4949      <Filter>Header Files</Filter>
     50    </ClInclude>
     51    <ClInclude Include="SlIdentifier.inc">
     52      <Filter>Header Files\Include Files</Filter>
    5053    </ClInclude>
    5154  </ItemGroup>
  • trunk/Utilities/ShowHresult/ShowHresult_i.c

    r151 r153  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Mon Nov 26 13:58:28 2012
     9/* at Tue Dec 04 12:57:03 2012
    1010 */
    1111/* Compiler settings for ShowHresult.idl:
  • trunk/Utilities/ShowHresult/ShowHresult_i.h

    r151 r153  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Mon Nov 26 13:58:28 2012
     7/* at Tue Dec 04 12:57:03 2012
    88 */
    99/* Compiler settings for ShowHresult.idl:
Note: See TracChangeset for help on using the changeset viewer.