aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi/resource.hpp
blob: 8b6e41b17a4b31f0837c6870630d95472f778b23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
// This file is part of the "winapi-common" project.
// For details, see https://github.com/egor-tensin/winapi-common.
// Distributed under the MIT License.

#pragma once

#include "buffer.hpp"

#include <cstddef>

namespace winapi {

/** @brief Resources embedded in a PE (Portable Executable). */
struct Resource {
    // This is just a pointer to static data.

    Resource() = default;

    Resource(const void* data, std::size_t nb) : data{data}, nb{nb} {}

    /** Extract resource data into a Buffer instance. */
    Buffer copy() const { return {data, nb}; }

    const void* data = nullptr;
    std::size_t nb = 0;
};

} // namespace winapi