static int bin_pe_init_resource(RBinPEObj* pe) {
	PE_(image_data_directory) * resource_dir = &pe->data_directory[PE_IMAGE_DIRECTORY_ENTRY_RESOURCE];
	PE_DWord resource_dir_paddr = PE_(va2pa) (pe, resource_dir->VirtualAddress);
	if (!resource_dir_paddr) {
		return false;
	}

	pe->resources = r_list_newf ((RListFree)_free_resource);
	if (!pe->resources) {
		return false;
	}
	if (!(pe->resource_directory = malloc (sizeof (*pe->resource_directory)))) {
		r_sys_perror ("malloc (resource directory)");
		return false;
	}
	if (read_image_resource_directory (pe->b, resource_dir_paddr, pe->resource_directory) < 0) {
		pe_printf ("Warning: read (resource directory)\n");
		R_FREE (pe->resource_directory);
		return false;
	}
	pe->resource_directory_offset = resource_dir_paddr;
	return true;
}
static int bin_pe_init_resource(RBinPEObj* pe) {
	PE_(image_data_directory) * resource_dir = &pe->data_directory[PE_IMAGE_DIRECTORY_ENTRY_RESOURCE];
	PE_DWord resource_dir_paddr = PE_(va2pa) (pe, resource_dir->VirtualAddress);
	if (!resource_dir_paddr) {
		return false;
	}

	pe->resources = r_list_newf ((RListFree)_free_resource);
	if (!pe->resources) {
		return false;
	}
	if (!(pe->resource_directory = malloc (sizeof (*pe->resource_directory)))) {
		r_sys_perror ("malloc (resource directory)");
		return false;
	}
	if (read_image_resource_directory (pe->b, resource_dir_paddr, pe->resource_directory) < 0) {
		pe_printf ("Warning: read (resource directory)\n");
		R_FREE (pe->resource_directory);
		return false;
	}
	pe->resource_directory_offset = resource_dir_paddr;
	return true;
}