]> wimlib.net Git - wimlib/blobdiff - src/resource.c
Win32 apply
[wimlib] / src / resource.c
index e8f1114412b5940b07fe8db69caba304772eb6ae..eb79c7498c98a2e0b7d78129dad067c5df3d9643 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2012 Eric Biggers
+ * Copyright (C) 2012, 2013 Eric Biggers
  *
  * This file is part of wimlib, a library for working with WIM files.
  *
@@ -539,8 +539,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(&lte->file_on_disk == &lte->staging_file_name);
+               wimlib_assert(lte->file_on_disk != NULL);
+               BUILD_BUG_ON(&lte->file_on_disk != &lte->staging_file_name);
                /* Use existing file pointer if available; otherwise open one
                 * temporarily */
                if (lte->file_on_disk_fp) {
@@ -558,6 +558,13 @@ int read_wim_resource(const struct wim_lookup_table_entry *lte, u8 buf[],
                if (fp != lte->file_on_disk_fp)
                        fclose(fp);
                break;
+#if defined(__CYGWIN__) || defined(__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. */