EXT Resources Library - raw

The res::raw implements direct raw access to PE file resources.


Interface:

class res::raw {
    public:
        raw (unsigned int, unsigned short int = 0, const void * = NULL);
        raw (const char *, unsigned short int = 0, const void * = NULL);
        raw (const wchar_t *, unsigned short int = 0, const void * = NULL);
        raw (const std::string &, unsigned short int = 0, const void * = NULL);
        raw (const std::wstring &, unsigned short int = 0, const void * = NULL);

        ~raw () throw ();

    private:
        raw (const raw &);
        raw & operator = (const raw &);

    public:
        const unsigned int lang_id;

    public:
        const void * operator [] (unsigned short int id);
        const void * operator [] (const std::string & id);
        const void * operator [] (const std::wstring & id);

        unsigned int size (unsigned short int id);
        unsigned int size (const std::string & id);
        unsigned int size (const std::wstring & id);
};

You will need to include "ext/res_bits/raw.cpp" into your project in order to use res::raw.

Examples:

#include <windows.h>
#include <ext/res>

int main () {
    res::raw data (RT_BITMAP);

    std::printf ("%p, %d\n", data [123], data.size (123));
    std::printf ("%p, %d\n", data ["something"], data.size ("something"));

    return 0;
};

Remarks

Use the res::lang facility to determine what localizations of a resource are available to choose from.

The res::raw does not cache or hold any allocated pointer to the resources. It only examines and returns sizes and pointers to resources that are already mapped into the address space of the process. This happened automaticaly when the process has started or when the library has been loaded.


[index]