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

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

Issue 11778073: Add support for getting the 256x256 app icon on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « base/win/resource_util.h ('k') | chrome/browser/app_icon_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/win/resource_util.h" 6 #include "base/win/resource_util.h"
7 7
8 namespace base { 8 namespace base {
9 namespace win { 9 namespace win {
10 bool GetDataResourceFromModule(HMODULE module, int resource_id, 10
11 void** data, size_t* length) { 11 bool GetResourceFromModule(HMODULE module,
sky 2013/01/11 17:21:49 Change the header to match, by that I mean one par
Alexei Svitkine (slow) 2013/01/11 17:41:18 Done.
12 int resource_id,
13 LPCTSTR resource_type,
14 void** data,
15 size_t* length) {
12 if (!module) 16 if (!module)
13 return false; 17 return false;
14 18
15 if (!IS_INTRESOURCE(resource_id)) { 19 if (!IS_INTRESOURCE(resource_id)) {
16 NOTREACHED(); 20 NOTREACHED();
17 return false; 21 return false;
18 } 22 }
19 23
20 HRSRC hres_info = FindResource(module, MAKEINTRESOURCE(resource_id), 24 HRSRC hres_info = FindResource(module, MAKEINTRESOURCE(resource_id),
21 L"BINDATA"); 25 resource_type);
22 if (NULL == hres_info) 26 if (NULL == hres_info)
23 return false; 27 return false;
24 28
25 DWORD data_size = SizeofResource(module, hres_info); 29 DWORD data_size = SizeofResource(module, hres_info);
26 HGLOBAL hres = LoadResource(module, hres_info); 30 HGLOBAL hres = LoadResource(module, hres_info);
27 if (!hres) 31 if (!hres)
28 return false; 32 return false;
29 33
30 void* resource = LockResource(hres); 34 void* resource = LockResource(hres);
31 if (!resource) 35 if (!resource)
32 return false; 36 return false;
33 37
34 *data = resource; 38 *data = resource;
35 *length = static_cast<size_t>(data_size); 39 *length = static_cast<size_t>(data_size);
36 return true; 40 return true;
37 } 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
38 } // namespace win 50 } // namespace win
39 } // namespace base 51 } // namespace base
OLDNEW
« no previous file with comments | « base/win/resource_util.h ('k') | chrome/browser/app_icon_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698