X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fresource.c;h=db9c635bc4ce4f125ed4281da17cec6b7461be29;hb=8c26ca707e56d9848e52076ad3f7c26ea7fa338d;hp=f6497f153923bcf41d13c788a97963fadac09323;hpb=10a87017a0a82d34ed3981e1f5e586b5b8613e3f;p=wimlib diff --git a/src/resource.c b/src/resource.c index f6497f15..db9c635b 100644 --- a/src/resource.c +++ b/src/resource.c @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2012, 2013 Biggers + * Copyright (C) 2012, 2013 Eric Biggers * * This file is part of wimlib, a library for working with WIM files. * @@ -30,16 +30,20 @@ #include "xpress.h" #include "sha1.h" +#ifdef __WIN32__ +# include "win32.h" +#endif + #include #include #include #include #ifdef WITH_NTFS_3G -#include -#include -#include -#include +# include +# include +# include +# include #endif /* @@ -279,9 +283,9 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size, bool is_partial_chunk = (partial_chunk_size != uncompressed_chunk_size); - DEBUG2("start_offset = %u, end_offset = %u", start_offset, - end_offset); - DEBUG2("partial_chunk_size = %u", partial_chunk_size); + DEBUG2("start_offset = %"PRIu64", end_offset = %"PRIu64"", + start_offset, end_offset); + DEBUG2("partial_chunk_size = %"PRIu64"", partial_chunk_size); /* This is undocumented, but chunks can be uncompressed. This * appears to always be the case when the compressed chunk size @@ -539,8 +543,8 @@ int read_wim_resource(const struct wim_lookup_table_entry *lte, u8 buf[], case RESOURCE_IN_FILE_ON_DISK: /* The resource is in some file on the external filesystem and * needs to be read uncompressed */ - wimlib_assert(lte->file_on_disk); - wimlib_assert(<e->file_on_disk == <e->staging_file_name); + wimlib_assert(lte->file_on_disk != NULL); + BUILD_BUG_ON(<e->file_on_disk != <e->staging_file_name); /* Use existing file pointer if available; otherwise open one * temporarily */ if (lte->file_on_disk_fp) { @@ -558,6 +562,13 @@ int read_wim_resource(const struct wim_lookup_table_entry *lte, u8 buf[], if (fp != lte->file_on_disk_fp) fclose(fp); break; +#ifdef __WIN32__ + case RESOURCE_WIN32: + wimlib_assert(lte->file_on_disk_fp != NULL); + ret = win32_read_file(lte->file_on_disk, lte->file_on_disk_fp, + offset, size, buf); + break; +#endif case RESOURCE_IN_ATTACHED_BUFFER: /* The resource is directly attached uncompressed in an * in-memory buffer. */