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"
10 bool GetDataResourceFromModule(HMODULE module
, int resource_id
,
11 void** data
, size_t* length
) {
15 if (!IS_INTRESOURCE(resource_id
)) {
20 HRSRC hres_info
= FindResource(module
, MAKEINTRESOURCE(resource_id
),
22 if (NULL
== hres_info
)
25 DWORD data_size
= SizeofResource(module
, hres_info
);
26 HGLOBAL hres
= LoadResource(module
, hres_info
);
30 void* resource
= LockResource(hres
);
35 *length
= static_cast<size_t>(data_size
);