add: TRACE(("register_preloaded_module_image(image = \"%s\")\n", image->name));
context: register_preloaded_module_image(struct preloaded_image *image){	module_image *moduleImage;	struct module_info **info;	status_t status;	int32 index = 0;	if (image->id < 0)		return B_BAD_VALUE;	moduleImage = (module_image *)malloc(sizeof(module_image));	if (moduleImage == NULL)		return B_NO_MEMORY;	if (get_image_symbol(image->id, "modules", B_SYMBOL_TYPE_DATA,			(void **)&moduleImage->info) != B_OK) {		status = B_BAD_TYPE;		goto error;	}	moduleImage->dependencies = NULL;	get_image_symbol(image->id, "module_dependencies", B_SYMBOL_TYPE_DATA,		(void **)&moduleImage->dependencies);		// this is allowed to be NULL	// Try to recreate the full module path, so that we don't try to load the	// image again when asked for a module it does not export (would only be	// problematic if it had got replaced and the new file actually exports	// that module). Also helpful for recurse_directory().	{		// ToDo: this is kind of a hack to have the full path in the hash		//	(it always assumes the preloaded add-ons to be in the system directory)		char path[B_FILE_NAME_LENGTH];		const char *name, *suffix;		if (moduleImage->info[0]			&& (suffix = strstr(name = moduleImage->info[0]->name, image->name)) != NULL) {			// even if strlcpy() is used here, it's by no means safe against buffer overflows			size_t length = strlcpy(path, "/boot/beos/system/add-ons/kernel/", sizeof(path));			strlcpy(path + length, name, strlen(image->name) + 1 + (suffix - name));			moduleImage->path = strdup(path);		} else			moduleImage->path = strdup(image->name);	}	if (moduleImage->path == NULL) {		status = B_NO_MEMORY;		goto error;	}	moduleImage->image = image->id;	moduleImage->ref_count = 0;	moduleImage->keep_loaded = false;	hash_insert(sModuleImagesHash, moduleImage);	for (info = moduleImage->info; *info; info++) {		create_module(*info, moduleImage->path, index++, NULL);	}	return B_OK;error:	free(moduleImage);		// we don't need this image anymore	unload_kernel_add_on(image->id);	return status;}