Exemple #1
0
/*
 * Enumerates all of the values at the supplied HKEY.
 *
 * TLVs:
 *
 * req: TLV_TYPE_HKEY - The HKEY that will have its values enumerated.
 */
DWORD request_registry_enum_value(Remote *remote, Packet *packet)
{
	HKEY hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY);
	enum_value(remote, packet, hkey);

	return ERROR_SUCCESS;
}
Exemple #2
0
    //--------------------------------------------------------------------------
    void rule_definitions(cref value) {
        auto const defs = json::require_array(value[jc::field_definitions]);
        cur_loc_.reserve(enum_value(message_type::enum_size));

        for (auto const& def : defs.array_items()) {
            rule_definition(def);
        }

        locales_.emplace(cur_lang_, std::move(cur_loc_));
    }
Exemple #3
0
/*
 * Enumerates all of the values at the supplied HKEY.
 *
 * TLVs:
 *
 * req: TLV_TYPE_ROOT_KEY   - The root key
 * req: TLV_TYPE_BASE_KEY   - The base key
 * opt: TLV_TYPE_PERMISSION - Permissions with which to open the key
 */
DWORD request_registry_enum_value_direct(Remote *remote, Packet *packet)
{
	HKEY rootkey, hkey = NULL;

	open_key(packet, &rootkey, &hkey);
	enum_value(remote, packet, hkey);
	if (hkey)
		RegCloseKey(hkey);

	return ERROR_SUCCESS;
}
int main(int argc, char* argv[])
{
    std::uint16_t msg1 = enum_value(MsgCode::MSG1);
    MsgCode  msg2 = MsgCode::MSG2;

    std::cout << "size of MsgCode is " << sizeof(MsgCode) << "\n";
    std::cout << "msg1 = " << strmsgcode(msg1) << "\n";
    std::cout << "msg2 = " << strmsgcode(msg2) << "\n";

    MsgCode mc = to_enum<MsgCode>(msg1);
    assert(mc == MsgCode::MSG1);

    // static assertion failure.
#if 0
    std::uint32_t val = 0;
    mc = to_enum<MsgCode>(val);
#endif

    return 0;
}