CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId) { DWORD dwSize; LPBYTE pBytes; if(LoadBinaryResource(binaryId, dwSize, pBytes)) { return CefStreamReader::CreateForHandler( new CefByteReadHandler(pBytes, dwSize, NULL)); } return NULL; }
CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId) { DWORD dwSize; LPBYTE pBytes; if (LoadBinaryResource(binaryId, dwSize, pBytes)) { return CefStreamReader::CreateForHandler( new CefByteReadHandler(pBytes, dwSize, NULL)); } DCHECK(FALSE); // The resource should be found. return NULL; }
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) { int resource_id = GetResourceId(resource_name); if (resource_id == 0) return NULL; DWORD dwSize; LPBYTE pBytes; if (LoadBinaryResource(resource_id, dwSize, pBytes)) { return CefStreamReader::CreateForHandler( new CefByteReadHandler(pBytes, dwSize, NULL)); } ASSERT(FALSE); // The resource should be found. return NULL; }
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) { int resource_id = GetResourceId(resource_name); if (resource_id == 0) return false; DWORD dwSize; LPBYTE pBytes; if (LoadBinaryResource(resource_id, dwSize, pBytes)) { resource_data = std::string(reinterpret_cast<char*>(pBytes), dwSize); return true; } ASSERT(FALSE); // The resource should be found. return false; }