Example #1
0
def create_patchers_from_file(file):
    """Create patchers from a file."""
    raw_data = GameConfigObj(file)

    binary = raw_data.pop(Key.BINARY, None)
    if binary is not None:
        binary = Key.as_str(manager, binary)

    srv_check = Key.as_bool(manager, raw_data.pop(Key.SRV_CHECK, "True"))

    # Parse patcher data
    patcher_data = parse_data(manager, raw_data, (
        (Key.BINARY, Key.as_str, binary if binary is not None else NO_DEFAULT),
        (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
        (Key.OFFSET, Key.as_int, 0),
        (Key.LEVEL, Key.as_int, 0),
        (Key.SRV_CHECK, Key.as_bool, srv_check),
        (Key.SIZE, Key.as_int, NO_DEFAULT),
        ("op_codes", Key.as_identifier, None),
    ))

    # Create the patchers
    return Patchers({
        name: Patcher(get_pointer(*data[:5]), *data[5:])
        for name, data in patcher_data
    })
Example #2
0
    def create_function_typedefs_from_file(self, f):
        """Create function typedefs from a file."""
        # Read the data
        raw_data = ConfigObj(f, file_error=True)

        # Prepare typedefs
        typedefs = parse_data(
            raw_data, ((Key.ARGS, Key.as_args_tuple, ()),
                       (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
                       (Key.CONVENTION, Key.as_convention, Convention.CDECL),
                       (Key.DOC, str, None)))

        # Create the typedefs
        for name, data in typedefs:
            self.function_typedef(name, *data)
Example #3
0
def get_pointer_from_dict(raw_data, manager=manager):
    pointer_dict = dict()

    binary = raw_data.pop(Key.BINARY, None)
    if binary is not None:
        binary = Key.as_str(manager, binary)

    srv_check = Key.as_bool(manager, raw_data.pop(Key.SRV_CHECK, "True"))

    # Prepare binary pointers
    ptrs = parse_data(manager, raw_data.pop("binary_pointer", {}),
                      ((Key.BINARY, Key.as_str,
                        binary if binary is not None else NO_DEFAULT),
                       (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                       (Key.OFFSET, Key.as_int, NO_DEFAULT),
                       (Key.LEVEL, Key.as_int, 0),
                       (Key.SRV_CHECK, Key.as_bool, srv_check)))

    # Create the pointers
    for name, data in ptrs:
        pointer_dict[name] = get_pointer(*data)

    # Prepare pointers
    ptrs = parse_data(manager, raw_data,
                      ((Key.BINARY, Key.as_str,
                        binary if binary is not None else NO_DEFAULT),
                       (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                       (Key.OFFSET, Key.as_int, NO_DEFAULT),
                       (Key.LEVEL, Key.as_int, 0),
                       (Key.SRV_CHECK, Key.as_bool, srv_check)))

    # Create the pointers
    for name, data in ptrs:
        pointer_dict[name] = get_pointer(*data)

    return pointer_dict
Example #4
0
    def create_global_pointers_from_file(self, f):
        """Create global pointers from a file."""
        # Parse pointer data
        pointers = parse_data(self, GameConfigObj(f), (
            (Key.BINARY, Key.as_str, NO_DEFAULT),
            (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
            (Key.OFFSET, Key.as_int, 0),
            (Key.LEVEL, Key.as_int, 0),
            (Key.SRV_CHECK, Key.as_bool, True),
        ))

        # Create the global pointer objects
        for name, data in pointers:
            cls = self.get_class(name)
            if cls is None:
                raise NameError('Unknown class "{0}".'.format(name))

            self.global_pointer(cls, *data)
Example #5
0
    def create_pipe_from_dict(self, raw_data):
        """Create a pipe from a dictionary."""
        # Prepare functions
        funcs = parse_data(
            self, raw_data,
            ((Key.BINARY, Key.as_str, NO_DEFAULT),
             (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
             (Key.ARGS, Key.as_args_tuple,
              ()), (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
             (Key.CONVENTION, Key.as_convention, Convention.CDECL),
             (Key.SRV_CHECK, Key.as_bool, True), (Key.DOC, Key.as_str, None)))

        # Create the functions
        cls_dict = {}
        for name, data in funcs:
            cls_dict[name] = self.pipe_function(*data)

        return self.create_pipe(cls_dict)
Example #6
0
    def create_function_typedefs_from_file(self, f):
        """Create function typedefs from a file."""
        # Read the data
        raw_data = ConfigObj(f, file_error=True)

        # Prepare typedefs
        typedefs = parse_data(
            raw_data,
            (
                (Key.ARGS, Key.as_args_tuple, ()),
                (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
                (Key.CONVENTION, Key.as_convention, Convention.CDECL),
                (Key.DOC, str, None)
            )
        )

        # Create the typedefs
        for name, data in typedefs:
            self.function_typedef(name, *data)
Example #7
0
    def create_global_pointers_from_file(self, f):
        """Create global pointers from a file."""
        # Parse pointer data
        pointers = parse_data(
            ConfigObj(f, file_error=True),
            (
                (Key.BINARY, str, NO_DEFAULT),
                (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                (Key.OFFSET, int, 0),
                (Key.LEVEL, int, 0),
                (Key.SRV_CHECK, Key.as_bool, True),
            )
        )

        # Create the global pointer objects
        for name, data in pointers:
            cls = self.get_class(name)
            if cls is None:
                raise NameError('Unknown class "{0}".'.format(name))

            self.global_pointer(cls, *data)
Example #8
0
    def create_pipe_from_dict(self, raw_data):
        """Create a pipe from a dictionary."""
        # Prepare functions
        funcs = parse_data(
            raw_data,
            (
                (Key.BINARY, str, NO_DEFAULT),
                (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                (Key.ARGS, Key.as_args_tuple, ()),
                (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
                (Key.CONVENTION, Key.as_convention, Convention.CDECL),
                (Key.SRV_CHECK, Key.as_bool, True),
                (Key.DOC, str, None)
            )
        )

        # Create the functions
        cls_dict = {}
        for name, data in funcs:
            cls_dict[name] = self.pipe_function(*data)

        return self.create_pipe(cls_dict)
Example #9
0
    def create_type_from_dict(self, type_name, raw_data, bases=(CustomType,)):
        """Create and registers a new type from a dictionary."""
        # Prepare general type information
        data = tuple(parse_data(
            # Discard all subkeys and add the new dict to a another dict to
            # make it work with parse_data(). Okay, this can be improved...
            {0: dict((k, v) for k, v in raw_data.items() if not isinstance(
                v, dict))},
            (
                (Key.BINARY, str, CustomType._binary),
                (Key.SRV_CHECK, Key.as_bool, CustomType._srv_check),
                (Key.SIZE, int, CustomType._size)
            )
        ))[0][1]

        cls_dict = dict(zip(('_binary', '_srv_check', '_size'), data))

        # Prepare pointer and instance attributes
        for method in (self.instance_attribute, self.pointer_attribute):
            attributes = parse_data(
                raw_data.get(method.__name__, {}),
                (
                    (Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
                    (Key.OFFSET, int, NO_DEFAULT),
                    (Key.DOC, str, None)
                )
            )

            # Create the attributes
            for name, data in attributes:
                cls_dict[name] = method(*data)

        # Prepare arrays
        for method in (
                self.static_instance_array,
                self.dynamic_instance_array,
                self.static_pointer_array,
                self.dynamic_pointer_array):
            arrays = parse_data(
                raw_data.get(method.__name__, {}),
                (
                    (Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
                    (Key.OFFSET, int, NO_DEFAULT),
                    (Key.LENGTH, int, None),
                    (Key.DOC, str, None)
                )
            )

            # Create the arrays
            for name, data in arrays:
                cls_dict[name] = method(*data)

        # Prepare virtual functions
        vfuncs = parse_data(
            raw_data.get('virtual_function', {}),
            (
                (Key.OFFSET, int, NO_DEFAULT),
                (Key.ARGS, Key.as_args_tuple, ()),
                (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
                (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
                (Key.DOC, str, None)
            )
        )

        # Create the virtual functions
        for name, data in vfuncs:
            cls_dict[name] = self.virtual_function(*data)

        # Prepare functions
        funcs = parse_data(
            raw_data.get('function', {}),
            (
                (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                (Key.ARGS, Key.as_args_tuple, ()),
                (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
                (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
                (Key.DOC, str, None)
            )
        )

        # Create the functions
        for name, data in funcs:
            cls_dict[name] = self.function(*data)

        # Now create and register the type
        return self(type_name, bases, cls_dict)
Example #10
0
    def create_type_from_dict(self, type_name, raw_data, bases=(CustomType, )):
        """Create and registers a new type from a dictionary."""
        # Prepare general type information
        data = tuple(
            parse_data(
                self,
                # Discard all subkeys and add the new dict to a another dict to
                # make it work with parse_data(). Okay, this can be improved...
                {
                    0:
                    dict((k, v) for k, v in raw_data.items()
                         if not isinstance(v, dict))
                },
                ((Key.BINARY, Key.as_str, CustomType._binary),
                 (Key.SRV_CHECK, Key.as_bool, CustomType._srv_check),
                 (Key.SIZE, Key.as_int, CustomType._size))))[0][1]

        cls_dict = dict(zip(('_binary', '_srv_check', '_size'), data))

        # Prepare pointer and instance attributes
        for method in (self.instance_attribute, self.pointer_attribute):
            attributes = parse_data(
                self, raw_data.get(method.__name__, {}),
                ((Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
                 (Key.OFFSET, Key.as_int, NO_DEFAULT),
                 (Key.DOC, Key.as_str, None)))

            # Create the attributes
            for name, data in attributes:
                cls_dict[name] = method(*data)

        # Prepare arrays
        for method in (self.static_instance_array, self.dynamic_instance_array,
                       self.static_pointer_array, self.dynamic_pointer_array):
            arrays = parse_data(
                self, raw_data.get(method.__name__, {}),
                ((Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
                 (Key.OFFSET, Key.as_int, NO_DEFAULT),
                 (Key.LENGTH, Key.as_int, None), (Key.DOC, Key.as_str, None)))

            # Create the arrays
            for name, data in arrays:
                cls_dict[name] = method(*data)

        # Prepare virtual functions
        vfuncs = parse_data(
            self, raw_data.get('virtual_function', {}),
            ((Key.OFFSET, Key.as_int, NO_DEFAULT),
             (Key.ARGS, Key.as_args_tuple,
              ()), (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
             (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
             (Key.DOC, Key.as_str, None)))

        # Create the virtual functions
        for name, data in vfuncs:
            cls_dict[name] = self.virtual_function(*data)

        # Prepare functions
        funcs = parse_data(
            self, raw_data.get('function', {}),
            ((Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
             (Key.ARGS, Key.as_args_tuple,
              ()), (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
             (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
             (Key.DOC, Key.as_str, None)))

        # Create the functions
        for name, data in funcs:
            cls_dict[name] = self.function(*data)

        # Now create and register the type
        return self(type_name, bases, cls_dict)
Example #11
0
def get_data_from_dict(raw_data):
    data_dict = dict()

    binary = raw_data.get(Key.BINARY, None)
    if binary is not None:
        binary = Key.as_str(manager, binary)

    srv_check = Key.as_bool(manager, raw_data.get(Key.SRV_CHECK, "True"))

    for method_name in ("instance_attribute", "pointer_attribute",
                        "static_instance_array", "dynamic_instance_array",
                        "static_pointer_array", "dynamic_pointer_array",
                        "virtual_function"):
        offsets_data = parse_data(manager, raw_data.get(method_name, {}),
                                  ((Key.OFFSET, Key.as_int, NO_DEFAULT), ))

        for name, data in offsets_data:
            data_dict[name] = data[0]

    pointers_data = parse_data(manager, raw_data.get(
        "function", {}), ((Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                          (Key.BINARY, Key.as_str,
                           binary if binary is not None else NO_DEFAULT),
                          (Key.SRV_CHECK, Key.as_bool, srv_check)))

    for name, data in pointers_data:
        data_dict[name] = find_binary(*data[1:]).find_address(data[0]).address

    for method_name in ("binary_attribute", "binary_array"):
        offsets_data = parse_data(
            manager, raw_data.get(method_name, {}),
            ((Key.BINARY, Key.as_str,
              binary if binary is not None else NO_DEFAULT),
             (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
             (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
             (Key.SRV_CHECK, Key.as_bool, srv_check)))

        for name, data in offsets_data:
            data_dict[name] = get_offset(*data)

    offsets_data = parse_data(manager,
                              raw_data.get("binary_virtual_function", {}),
                              ((Key.BINARY, Key.as_str,
                                binary if binary is not None else NO_DEFAULT),
                               (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                               (Key.OFFSET, Key.as_int, NO_DEFAULT),
                               (Key.SIZE, Key.as_int, 4),
                               (Key.SRV_CHECK, Key.as_bool, srv_check)))

    for name, data in offsets_data:
        data_dict[name] = get_offset(*data) // 4

    pointers_data = parse_data(
        manager, raw_data.get("binary_absolute_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.LEVEL, Key.as_int, 1),
         (Key.SRV_CHECK, Key.as_bool, srv_check)))

    for name, data in pointers_data:
        data_dict[name] = get_pointer(*data).address

    pointers_data = parse_data(
        manager, raw_data.get("binary_relative_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
         (Key.SRV_CHECK, Key.as_bool, srv_check)))

    for name, data in pointers_data:
        data_dict[name] = get_relative_pointer(*data).address

    pointers_data = parse_data(
        manager, raw_data.get("binary_pointer", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.LEVEL, Key.as_int, 0),
         (Key.SRV_CHECK, Key.as_bool, srv_check)))

    for name, data in pointers_data:
        data_dict[name] = get_pointer(*data).address

    return data_dict
Example #12
0
def get_type_from_dict(raw_data, manager=manager):
    type_dict = dict()

    binary = raw_data.get(Key.BINARY, None)
    if binary is not None:
        binary = Key.as_str(manager, binary)
        type_dict["_binary"] = binary

    srv_check = raw_data.get(Key.SRV_CHECK, None)
    if srv_check is not None:
        srv_check = Key.as_bool(manager, srv_check)
        type_dict["_srv_check"] = srv_check
    else:
        srv_check = True

    size = raw_data.get(Key.SIZE, None)
    if size is not None:
        type_dict["_size"] = Key.as_int(manager, size)

    # Prepare pointer and instance attributes
    for method in (manager.instance_attribute, manager.pointer_attribute):
        attributes = parse_data(
            manager, raw_data.get(method.__name__, {}),
            ((Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
             (Key.OFFSET, Key.as_int, NO_DEFAULT),
             (Key.DOC, Key.as_str, None)))

        # Create the attributes
        for name, data in attributes:
            type_dict[name] = method(*data)

    # Prepare arrays
    for method in (manager.static_instance_array,
                   manager.dynamic_instance_array,
                   manager.static_pointer_array,
                   manager.dynamic_pointer_array):
        arrays = parse_data(
            manager, raw_data.get(method.__name__, {}),
            ((Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
             (Key.OFFSET, Key.as_int, NO_DEFAULT),
             (Key.LENGTH, Key.as_int, None), (Key.DOC, Key.as_str, None)))

        # Create the arrays
        for name, data in arrays:
            type_dict[name] = method(*data)

    # Prepare virtual functions
    vfuncs = parse_data(
        manager, raw_data.get("virtual_function", {}),
        ((Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.ARGS, Key.as_args_tuple,
                                                ()),
         (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
         (Key.DOC, Key.as_str, None)))

    # Create the virtual functions
    for name, data in vfuncs:
        type_dict[name] = manager.virtual_function(*data)

    # Prepare functions
    funcs = parse_data(
        manager, raw_data.get("function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.SRV_CHECK, Key.as_bool, srv_check),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.ARGS, Key.as_args_tuple,
          ()), (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
         (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        ptr = find_binary(*data[:2]).find_address(data[2])
        type_dict[name] = manager.function_pointer(ptr, *data[3:])

    # Via binary.

    # Prepare binary attributes
    attributes = parse_data(
        manager, raw_data.get("binary_attribute", {}),
        (("method", Key.as_str, "instance_attribute"),
         (Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
         (Key.SRV_CHECK, Key.as_bool, srv_check),
         (Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
         (Key.DOC, Key.as_str, None)))

    # Create the attributes
    for name, data in attributes:
        method = getattr(manager, data[0])
        offset = get_offset(*data[1:6])
        type_dict[name] = method(data[6], offset, data[7])

    # Prepare binary arrays
    arrays = parse_data(
        manager, raw_data.get("binary_array", {}),
        (("method", Key.as_str, "static_instance_array"),
         (Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
         (Key.SRV_CHECK, Key.as_bool, srv_check),
         (Key.TYPE_NAME, Key.as_attribute_type, NO_DEFAULT),
         (Key.LENGTH, Key.as_int, None), (Key.DOC, Key.as_str, None)))

    # Create the arrays
    for name, data in arrays:
        method = getattr(manager, data[0])
        offset = get_offset(*data[1:6])
        type_dict[name] = method(data[6], offset, data[7], data[8])

    # Prepare binary virtual functions
    vfuncs = parse_data(
        manager, raw_data.get("binary_virtual_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.ARGS, Key.as_args_tuple,
                                                   ()),
         (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
         (Key.DOC, Key.as_str, None)))

    # Create the virtual functions
    for name, data in vfuncs:
        index = get_offset(*data[:5]) // 4
        type_dict[name] = manager.virtual_function(index, *data[5:])

    # Prepare binary absolute functions
    funcs = parse_data(
        manager, raw_data.get("binary_absolute_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.LEVEL, Key.as_int, 1),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.ARGS, Key.as_args_tuple,
                                                   ()),
         (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
         (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        ptr = get_pointer(*data[:5])
        type_dict[name] = manager.function_pointer(ptr, *data[5:])

    # Prepare binary relative functions
    funcs = parse_data(
        manager, raw_data.get("binary_relative_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.ARGS, Key.as_args_tuple,
                                                   ()),
         (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.THISCALL),
         (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        ptr = get_relative_pointer(*data[:5])
        type_dict[name] = manager.function_pointer(ptr, *data[5:])

    # Prepare binary pointers
    ptrs = parse_data(manager, raw_data.get("binary_pointer", {}),
                      ((Key.BINARY, Key.as_str,
                        binary if binary is not None else NO_DEFAULT),
                       (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
                       (Key.OFFSET, Key.as_int, NO_DEFAULT),
                       (Key.LEVEL, Key.as_int, 0),
                       (Key.SRV_CHECK, Key.as_bool, srv_check)))

    # Create the pointers
    for name, data in ptrs:
        type_dict[name] = get_pointer(*data)

    return type_dict
Example #13
0
def get_function_from_dict(raw_data, manager=manager):
    function_dict = dict()

    binary = raw_data.pop(Key.BINARY, None)
    if binary is not None:
        binary = Key.as_str(manager, binary)

    srv_check = Key.as_bool(manager, raw_data.pop(Key.SRV_CHECK, "True"))

    # Prepare functions
    funcs = parse_data(
        manager, raw_data.pop("function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.ARGS, Key.as_args_tuple,
          ()), (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.CDECL),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        function_dict[name] = manager.pipe_function(*data)

    # Prepare binary absolute functions
    funcs = parse_data(
        manager, raw_data.pop("binary_absolute_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.LEVEL, Key.as_int, 1),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.ARGS, Key.as_args_tuple,
                                                   ()),
         (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.CDECL),
         (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        ptr = get_pointer(*data[:5])
        function_dict[name] = manager.pipe_function_pointer(ptr, *data[5:])

    # Prepare binary relative functions
    funcs = parse_data(
        manager, raw_data.pop("binary_relative_function", {}),
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.OFFSET, Key.as_int, NO_DEFAULT), (Key.SIZE, Key.as_int, 4),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.ARGS, Key.as_args_tuple,
                                                   ()),
         (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.CDECL),
         (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        ptr = get_relative_pointer(*data[:5])
        function_dict[name] = manager.pipe_function_pointer(ptr, *data[5:])

    # Prepare functions
    funcs = parse_data(
        manager, raw_data,
        ((Key.BINARY, Key.as_str,
          binary if binary is not None else NO_DEFAULT),
         (Key.IDENTIFIER, Key.as_identifier, NO_DEFAULT),
         (Key.ARGS, Key.as_args_tuple,
          ()), (Key.RETURN_TYPE, Key.as_return_type, DataType.VOID),
         (Key.CONVENTION, Key.as_convention, Convention.CDECL),
         (Key.SRV_CHECK, Key.as_bool, srv_check), (Key.DOC, Key.as_str, None)))

    # Create the functions
    for name, data in funcs:
        function_dict[name] = manager.pipe_function(*data)

    return function_dict