| 47 | static CStringW storage[LICENSES_COUNT]; |
| 48 | |
| 49 | void LoadLicensesFromResource() { |
| 50 | static bool loaded = false; |
| 51 | if (loaded) return; |
| 52 | |
| 53 | UINT startId = IDR_LICENSE_CPPCRYPTFS; |
| 54 | |
| 55 | for (int i = 0; i < LICENSES_COUNT; i++) { |
| 56 | UINT currentId = startId + i; |
| 57 | licenses[i] = L""; |
| 58 | |
| 59 | HRSRC hRes = FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(currentId), RT_RCDATA); |
| 60 | if (!hRes) continue; |
| 61 | |
| 62 | HGLOBAL hData = LoadResource(AfxGetResourceHandle(), hRes); |
| 63 | DWORD size = SizeofResource(AfxGetResourceHandle(), hRes); |
| 64 | const void* pData = LockResource(hData); |
| 65 | |
| 66 | if (pData && size >= sizeof(WCHAR) && (size % sizeof(WCHAR)) == 0) { |
| 67 | const WCHAR* pSrc = static_cast<const WCHAR*>(pData); |
| 68 | int charCount = static_cast<int>(size / sizeof(WCHAR)); |
| 69 | |
| 70 | if (charCount > 0 && pSrc[0] == 0xFEFF) { |
| 71 | ++pSrc; |
| 72 | --charCount; |
| 73 | } |
| 74 | |
| 75 | if (charCount > 0 && pSrc[charCount - 1] == L'\0') |
| 76 | --charCount; |
| 77 | |
| 78 | storage[i].SetString(pSrc, charCount); |
| 79 | licenses[i] = (const WCHAR*)storage[i]; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | licenses[LICENSES_COUNT] = NULL; |
| 84 | loaded = true; |
| 85 | } |
| 86 | |
| 87 | // CCryptAboutPropertyPage dialog |
| 88 |
no outgoing calls
no test coverage detected