1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "base/win/resource_util.h"
11 bool GetResourceFromModule(HMODULE module,
13 LPCTSTR resource_type,
19 if (!IS_INTRESOURCE(resource_id)) {
24 HRSRC hres_info = FindResource(module, MAKEINTRESOURCE(resource_id),
26 if (NULL == hres_info)
29 DWORD data_size = SizeofResource(module, hres_info);
30 HGLOBAL hres = LoadResource(module, hres_info);
34 void* resource = LockResource(hres);
39 *length = static_cast<size_t>(data_size);
43 bool GetDataResourceFromModule(HMODULE module,
47 return GetResourceFromModule(module, resource_id, L"BINDATA", data, length);