| 589 | } |
| 590 | |
| 591 | BOOL GetStringTableValue(void *pBlock, LangAndCodePage *plcp, UINT nItems, |
| 592 | const TCHAR *szVersionInfo, TCHAR *szVersionBuffer, UINT cchMax) |
| 593 | { |
| 594 | BOOL bSuccess = FALSE; |
| 595 | LANGID userLangId = GetUserDefaultLangID(); |
| 596 | |
| 597 | for(UINT i = 0; i < nItems; i++) |
| 598 | { |
| 599 | /* If the bottom eight bits of the language id's match, use this |
| 600 | version information (since this means that the version information |
| 601 | and the users default language are the same). Also use this version |
| 602 | information if the language is not specified (i.e. wLanguage is 0). */ |
| 603 | if((plcp[i].wLanguage & 0xFF) == (userLangId & 0xFF) || |
| 604 | plcp[i].wLanguage == 0) |
| 605 | { |
| 606 | TCHAR szSubBlock[64]; |
| 607 | StringCchPrintf(szSubBlock, SIZEOF_ARRAY(szSubBlock), |
| 608 | _T("\\StringFileInfo\\%04X%04X\\%s"), plcp[i].wLanguage, |
| 609 | plcp[i].wCodePage, szVersionInfo); |
| 610 | |
| 611 | TCHAR *szBuffer; |
| 612 | UINT uLen; |
| 613 | BOOL bRet = VerQueryValue(pBlock, szSubBlock, reinterpret_cast<LPVOID *>(&szBuffer), &uLen); |
| 614 | |
| 615 | if(bRet && (uLen > 0)) |
| 616 | { |
| 617 | StringCchCopy(szVersionBuffer, cchMax, szBuffer); |
| 618 | bSuccess = TRUE; |
| 619 | break; |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | return bSuccess; |
| 625 | } |
| 626 | |
| 627 | void GetCPUBrandString(char *pszCPUBrand,UINT cchBuf) |
| 628 | { |
no outgoing calls
no test coverage detected