resource_util.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2011 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. // This file contains utility functions for accessing resources in external
  5. // files (DLLs) or embedded in the executable itself.
  6. #ifndef BASE_WIN_RESOURCE_UTIL_H_
  7. #define BASE_WIN_RESOURCE_UTIL_H_
  8. #include <windows.h>
  9. #include <stddef.h>
  10. #include "base/base_export.h"
  11. namespace base {
  12. namespace win {
  13. // Function for getting a data resource of the specified |resource_type| from
  14. // a dll. Some resources are optional, especially in unit tests, so this
  15. // returns false but doesn't raise an error if the resource can't be loaded.
  16. bool BASE_EXPORT GetResourceFromModule(HMODULE module,
  17. int resource_id,
  18. LPCTSTR resource_type,
  19. void** data,
  20. size_t* length);
  21. // Function for getting a data resource (BINDATA) from a dll. Some
  22. // resources are optional, especially in unit tests, so this returns false
  23. // but doesn't raise an error if the resource can't be loaded.
  24. bool BASE_EXPORT GetDataResourceFromModule(HMODULE module,
  25. int resource_id,
  26. void** data,
  27. size_t* length);
  28. } // namespace win
  29. } // namespace base
  30. #endif // BASE_WIN_RESOURCE_UTIL_H_