summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-30 23:00:33 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-30 23:00:33 +0000
commit160977987f8e3922cebcdaaeb36fa69f92dc7587 (patch)
tree8b4a6ac1d613eaa1d786a79d178e44b753f84ae3
parentf5ae46dca79511cf2d4762ca4ef07b59bd647309 (diff)
downloadlibguestfs-master.tar.gz
libguestfs-master.tar.xz
libguestfs-master.zip
inspection: Temporary logo for Windows 8.HEADmaster
See the comment from the code: NB about Windows 8: No location we've found so far contains a suitable icon for Win8. In particular, explorer.exe definitely does *not* contain any Windows logo as a resource (I checked). Therefore the "basket icon" that this produces is just a stand-in until we have a better idea for solving this problem. and: https://bugzilla.redhat.com/show_bug.cgi?id=801117
-rw-r--r--src/inspect-icon.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/inspect-icon.c b/src/inspect-icon.c
index 4b7f43a2..19f93003 100644
--- a/src/inspect-icon.c
+++ b/src/inspect-icon.c
@@ -513,6 +513,52 @@ icon_windows_7 (guestfs_h *g, struct inspect_fs *fs, const char *explorer,
return NOT_FOUND;
}
+/* NB about Windows 8: No location we've found so far contains a
+ * suitable icon for Win8. In particular, explorer.exe definitely
+ * does *not* contain any Windows logo as a resource (I checked).
+ * Therefore the "basket icon" that this produces is just a stand-in
+ * until we have a better idea for solving this problem.
+ * XXX RHBZ#801117
+ */
+static char *
+icon_windows_8 (guestfs_h *g, struct inspect_fs *fs, const char *explorer,
+ size_t *size_r)
+{
+ char *ret;
+ char *pngfile = NULL;
+ struct command *cmd;
+ int r;
+
+ pngfile = safe_asprintf (g, "%s/windows-8-icon.png", g->tmpdir);
+
+ cmd = guestfs___new_command (g);
+ guestfs___cmd_add_string_unquoted (cmd, WRESTOOL " -x --type=3 --name=125 --raw ");
+ guestfs___cmd_add_string_quoted (cmd, explorer);
+ guestfs___cmd_add_string_unquoted (cmd, " > ");
+ guestfs___cmd_add_string_quoted (cmd, pngfile);
+ r = guestfs___cmd_run (cmd);
+ guestfs___cmd_close (cmd);
+ if (r == -1)
+ goto error;
+ if (!WIFEXITED (r) || WEXITSTATUS (r) != 0)
+ goto not_found;
+
+ if (read_whole_file (g, pngfile, &ret, size_r) == -1)
+ goto error;
+
+ free (pngfile);
+
+ return ret;
+
+ error:
+ free (pngfile);
+ return NULL;
+
+ not_found:
+ free (pngfile);
+ return NOT_FOUND;
+}
+
static char *
icon_windows (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
{
@@ -529,6 +575,10 @@ icon_windows (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
else if (fs->major_version == 6 && fs->minor_version == 1)
fn = icon_windows_7;
+ /* Windows 8. */
+ else if (fs->major_version == 6 && fs->minor_version == 2)
+ fn = icon_windows_8;
+
/* Not (yet) a supported version of Windows. */
else return NOT_FOUND;