Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: base/win/resource_util.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/win/resource_util.h ('k') | base/win/scoped_bstr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "base/logging.h"
6 #include "base/win/resource_util.h"
7
8 namespace base {
9 namespace win {
10
11 bool GetResourceFromModule(HMODULE module,
12 int resource_id,
13 LPCTSTR resource_type,
14 void** data,
15 size_t* length) {
16 if (!module)
17 return false;
18
19 if (!IS_INTRESOURCE(resource_id)) {
20 NOTREACHED();
21 return false;
22 }
23
24 HRSRC hres_info = FindResource(module, MAKEINTRESOURCE(resource_id),
25 resource_type);
26 if (NULL == hres_info)
27 return false;
28
29 DWORD data_size = SizeofResource(module, hres_info);
30 HGLOBAL hres = LoadResource(module, hres_info);
31 if (!hres)
32 return false;
33
34 void* resource = LockResource(hres);
35 if (!resource)
36 return false;
37
38 *data = resource;
39 *length = static_cast<size_t>(data_size);
40 return true;
41 }
42
43 bool GetDataResourceFromModule(HMODULE module,
44 int resource_id,
45 void** data,
46 size_t* length) {
47 return GetResourceFromModule(module, resource_id, L"BINDATA", data, length);
48 }
49
50 } // namespace win
51 } // namespace base
OLDNEW
« no previous file with comments | « base/win/resource_util.h ('k') | base/win/scoped_bstr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698