def replace_source(self, source, name, modules, prefix):
        needs_windll = False
        def _func_replacer(match, modules, windll):
            matched = match.group(0)
            if matched in self.BLACKLIST:
                return matched
            module = self.database.query_func_module(matched)
            if module:
                try:
                    modules[module[0]] += [module[1]]
                except KeyError:
                    modules[module[0]] = [module[1]]
                if windll:
                    return '{}->{}.{}'.format(windll, *module)
                return '{}->{}'.format(*module)
            return matched
        replacer = partial(
            _func_replacer, modules=modules, windll='windll')
        replaced = re.sub(r'[_\w][_\w\d]*(?=\s*\()',
                          replacer, source)
        if source != replaced:
            needs_windll = True
        str_table = {}
        def _string_replacer(match):
            matched = match.group()[1:-1]
            try:
                number = str_table[matched]
            except KeyError:
                number = len(str_table) + 1
                str_table.update({matched: number})
            return '{}{}'.format(prefix, number)
        replaced = re.sub(r'".+?"', _string_replacer, replaced)
        strings, relocs = self.build_strings(str_table, prefix)
        strings = ''.join(strings).strip()
        windll32 = reloc_var('windll', 'reloc_delta', True,
                             'windll_t')
        if needs_windll:
            relocs += [windll32]
        if strings:
            strings = '\n' + strings
            if not needs_windll:
                relocs += [windll32]
                needs_windll = True
        windll64 = ''
        if needs_windll:
            windll64 = '{0} *{1} = &_{1};\n'.format('windll_t',
                                                    'windll')
        relocs = reloc_both(''.join(relocs), windll64)
        if name in ['main']:
            replaced = '\ninit();' + replaced
        return strings + relocs + replaced