extract_wim_resource() refactor