Changeset 108 for trunk/Utilities/ShowHresult/NotifyIconWindow.h
- Timestamp:
- Aug 30, 2012, 7:03:42 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/ShowHresult/NotifyIconWindow.h
r101 r108 80 80 return TRUE; 81 81 } 82 static CString LookupQuartzIdentifier(HRESULT nValue) 83 { 82 static BOOL LookupQuartzIdentifier(HRESULT nValue, CString& sIdentifier) 83 { 84 _A(sIdentifier.IsEmpty()); 84 85 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = 85 86 { … … 90 91 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 91 92 if(g_pMap[nIndex].nValue == nValue) 92 return CString(g_pMap[nIndex].pszName); 93 return _T(""); 93 { 94 sIdentifier = CString(g_pMap[nIndex].pszName); 95 return TRUE; 96 } 97 return FALSE; 94 98 } 95 99 static BOOL IsWmResult(HRESULT nResult, CString* psMessage = NULL) … … 122 126 return TRUE; 123 127 } 124 static CString LookupMfIdentifier(HRESULT nValue)128 static BOOL LookupMfIdentifier(HRESULT nValue, CString& sIdentifier) 125 129 { 126 130 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = … … 132 136 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 133 137 if(g_pMap[nIndex].nValue == nValue) 134 return CString(g_pMap[nIndex].pszName); 135 return _T(""); 138 { 139 sIdentifier = CString(g_pMap[nIndex].pszName); 140 return TRUE; 141 } 142 return FALSE; 136 143 } 137 144 static BOOL IsWs2Result(HRESULT nResult, CString* psMessage = NULL) … … 177 184 return TRUE; 178 185 } 179 static CString LookupSystemIdentifier(HRESULT nValue)186 static BOOL LookupSystemIdentifier(HRESULT nValue, CString& sIdentifier) 180 187 { 181 188 if(HRESULT_SEVERITY(nValue) == SEVERITY_ERROR && HRESULT_FACILITY(nValue) == FACILITY_WIN32) 182 189 nValue = HRESULT_CODE(nValue); 183 190 if(nValue < 0 || nValue >= 16384) 184 return _T("");191 return FALSE; 185 192 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = 186 193 { … … 191 198 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 192 199 if(g_pMap[nIndex].nValue == nValue) 193 return CString(g_pMap[nIndex].pszName); 194 return _T(""); 200 { 201 sIdentifier = CString(g_pMap[nIndex].pszName); 202 return TRUE; 203 } 204 return FALSE; 205 } 206 static BOOL LookupHresultSystemIdentifier(HRESULT nValue, CString& sIdentifier) 207 { 208 //if(HRESULT_SEVERITY(nValue) != SEVERITY_ERROR) 209 // return _T(""); 210 if((UINT) HRESULT_FACILITY(nValue) >= 0x40) 211 return FALSE; 212 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = 213 { 214 #define A(x) { x, #x }, 215 #include "SystemHresultIdentifier.inc" 216 #undef A 217 }; 218 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 219 if(g_pMap[nIndex].nValue == nValue) 220 { 221 sIdentifier = CString(g_pMap[nIndex].pszName); 222 return TRUE; 223 } 224 return FALSE; 195 225 } 196 226 static BOOL IsD3dResult(HRESULT nResult, CString* psMessage = NULL) … … 199 229 return FALSE; 200 230 psMessage; 201 return !LookupD3dIdentifier(nResult).IsEmpty(); 202 } 203 static CString LookupD3dIdentifier(HRESULT nValue) 231 CString sIdentifier; 232 return LookupD3dIdentifier(nResult, sIdentifier); 233 } 234 static BOOL LookupD3dIdentifier(HRESULT nValue, CString& sIdentifier) 204 235 { 205 236 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = … … 211 242 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 212 243 if(g_pMap[nIndex].nValue == nValue) 213 return CString(g_pMap[nIndex].pszName); 214 return _T(""); 244 { 245 sIdentifier = CString(g_pMap[nIndex].pszName); 246 return TRUE; 247 } 248 return FALSE; 215 249 } 216 250 static BOOL IsD2dResult(HRESULT nResult, CString* psMessage = NULL) … … 219 253 return FALSE; 220 254 psMessage; 221 return !LookupD2dIdentifier(nResult).IsEmpty(); 222 } 223 static CString LookupD2dIdentifier(HRESULT nValue) 255 CString sIdentifier; 256 return LookupD2dIdentifier(nResult, sIdentifier); 257 } 258 static BOOL LookupD2dIdentifier(HRESULT nValue, CString& sIdentifier) 224 259 { 225 260 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = … … 231 266 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 232 267 if(g_pMap[nIndex].nValue == nValue) 233 return CString(g_pMap[nIndex].pszName); 234 return _T(""); 268 { 269 sIdentifier = CString(g_pMap[nIndex].pszName); 270 return TRUE; 271 } 272 return FALSE; 235 273 } 236 274 static BOOL IsWicResult(HRESULT nResult, CString* psMessage = NULL) … … 239 277 return FALSE; 240 278 psMessage; 241 return !LookupWicIdentifier(nResult).IsEmpty(); 242 } 243 static CString LookupWicIdentifier(HRESULT nValue) 279 CString sIdentifier; 280 return LookupWicIdentifier(nResult, sIdentifier); 281 } 282 static BOOL LookupWicIdentifier(HRESULT nValue, CString& sIdentifier) 244 283 { 245 284 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = … … 251 290 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 252 291 if(g_pMap[nIndex].nValue == nValue) 253 return CString(g_pMap[nIndex].pszName); 254 return _T(""); 292 { 293 sIdentifier = CString(g_pMap[nIndex].pszName); 294 return TRUE; 295 } 296 return FALSE; 255 297 } 256 298 static BOOL IsWiaResult(HRESULT nResult, CString* psMessage = NULL) … … 259 301 return FALSE; 260 302 psMessage; 261 return !LookupWiaIdentifier(nResult).IsEmpty(); 262 } 263 static CString LookupWiaIdentifier(HRESULT nValue) 303 CString sIdentifier; 304 return LookupWiaIdentifier(nResult, sIdentifier); 305 } 306 static BOOL LookupWiaIdentifier(HRESULT nValue, CString& sIdentifier) 264 307 { 265 308 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = … … 271 314 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 272 315 if(g_pMap[nIndex].nValue == nValue) 273 return CString(g_pMap[nIndex].pszName); 274 return _T(""); 316 { 317 sIdentifier = CString(g_pMap[nIndex].pszName); 318 return TRUE; 319 } 320 return FALSE; 275 321 } 276 322 static BOOL IsUrtResult(HRESULT nResult, CString* psMessage = NULL) … … 279 325 return FALSE; 280 326 psMessage; 281 return !LookupUrtIdentifier(nResult).IsEmpty(); 282 } 283 static CString LookupUrtIdentifier(HRESULT nValue) 327 CString sIdentifier; 328 return LookupUrtIdentifier(nResult, sIdentifier); 329 } 330 static BOOL LookupUrtIdentifier(HRESULT nValue, CString& sIdentifier) 284 331 { 285 332 static const struct { HRESULT nValue; LPCSTR pszName; } g_pMap[] = … … 291 338 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) 292 339 if(g_pMap[nIndex].nValue == nValue) 293 return CString(g_pMap[nIndex].pszName); 294 return _T(""); 340 { 341 sIdentifier = CString(g_pMap[nIndex].pszName); 342 return TRUE; 343 } 344 return FALSE; 295 345 } 296 346 … … 373 423 // NOTE: Include file regular expression replacement: ^.+?\#define +([^ ]+?) +MAKE_D3D.+\r?$ -> A($1) 374 424 CString sTitle, sMessage, sIdentifier; 375 if(IsQuartzResult(nResult, &sMessage)) 376 { 425 if(IsQuartzResult(nResult, &sMessage))// || LookupQuartzIdentifier(nResult, sIdentifier)) 426 { 427 LookupQuartzIdentifier(nResult, sIdentifier); 377 428 sTitle = _T("DirectShow"); 378 sIdentifier = LookupQuartzIdentifier(nResult);379 429 } else if(IsWmResult(nResult, &sMessage)) 380 430 sTitle = _T("Windows Media"); 381 else if(IsMfResult(nResult, &sMessage)) 382 { 431 else if(IsMfResult(nResult, &sMessage) || LookupMfIdentifier(nResult, sIdentifier)) 383 432 sTitle = _T("Media Foundation"); 384 sIdentifier = LookupMfIdentifier(nResult); 385 } else if(IsWs2Result(nResult, &sMessage)) 433 //////////////////////////////////////////////////// 434 // NOTE: These are perhaps useless in Windows 7, but I am under impression they are helpful in earlier systems 435 else if(IsWs2Result(nResult, &sMessage)) 386 436 sTitle = _T("Sockets"); 387 437 else if(IsWinHttpResult(nResult, &sMessage)) … … 389 439 else if(IsWinInetResult(nResult, &sMessage)) 390 440 sTitle = _T("WinInet"); 391 else if(IsD3dResult(nResult, &sMessage))392 {441 //////////////////////////////////////////////////// 442 else if(IsD3dResult(nResult, &sMessage) || LookupD3dIdentifier(nResult, sIdentifier)) 393 443 sTitle = _T("DirectDraw/Direct3D"); 394 sIdentifier = LookupD3dIdentifier(nResult); 395 } else if(IsD2dResult(nResult, &sMessage)) 396 { 444 else if(IsD2dResult(nResult, &sMessage) || LookupD2dIdentifier(nResult, sIdentifier)) 397 445 sTitle = _T("Direct2D"); 398 sIdentifier = LookupD2dIdentifier(nResult); 399 } else if(IsWicResult(nResult, &sMessage)) 400 { 446 else if(IsWicResult(nResult, &sMessage) || LookupWicIdentifier(nResult, sIdentifier)) 401 447 sTitle = _T("WinCodec"); 402 sIdentifier = LookupWicIdentifier(nResult); 403 } else if(IsWiaResult(nResult, &sMessage)) 404 { 448 else if(IsWiaResult(nResult, &sMessage) || LookupWiaIdentifier(nResult, sIdentifier)) 405 449 sTitle = _T("WIA"); 406 sIdentifier = LookupWiaIdentifier(nResult); 407 } else if(IsUrtResult(nResult, &sMessage)) 408 { 450 else if(IsUrtResult(nResult, &sMessage) || LookupUrtIdentifier(nResult, sIdentifier)) 409 451 sTitle = _T(".NET"); 410 sIdentifier = LookupUrtIdentifier(nResult); 411 } else 452 else 412 453 { 413 454 sMessage = AtlFormatSystemMessage(nResult); 414 sIdentifier = LookupSystemIdentifier(nResult); 415 if(sIdentifier.IsEmpty()) 416 sIdentifier = LookupHresultSystemIdentifier(nResult); 455 if(!LookupSystemIdentifier(nResult, sIdentifier)) 456 LookupHresultSystemIdentifier(nResult, sIdentifier); 417 457 if(!sMessage.IsEmpty() || !sIdentifier.IsEmpty()) 418 458 sTitle = _T("System"); … … 467 507 #if defined(_DEBUG) 468 508 //Process(AtlFormatString(_T("%d"), 0x80040227)); // VFW_E_WRONG_STATE 469 Process(_T("0xC00D36B9")); // MF_E_NO_MORE_TYPES)509 //Process(_T("0xC00D36B9")); // MF_E_NO_MORE_TYPES) 470 510 //Process(AtlFormatString(_T("0x%x"), HRESULT_FROM_WIN32(WSAEADDRINUSE))); // WSAEADDRINUSE 471 511 //Process(AtlFormatString(_T("0x%x"), HRESULT_FROM_WIN32(ERROR_WINHTTP_AUTODETECTION_FAILED))); // ERROR_WINHTTP_AUTODETECTION_FAILED 472 Process(_T("0x80290208L")); 512 //Process(_T("0x80290208L")); 513 Process(_T("10053")); 473 514 #endif // defined(_DEBUG) 474 515 return TRUE;
Note: See TracChangeset
for help on using the changeset viewer.