- printf("Major Version: %"PRIu64"\n",
- windows_version->major);
- printf("Minor Version: %"PRIu64"\n",
- windows_version->minor);
- printf("Build: %"PRIu64"\n",
- windows_version->build);
- printf("Service Pack Build: %"PRIu64"\n",
- windows_version->sp_build);
- printf("Service Pack Level: %"PRIu64"\n",
- windows_version->sp_level);
+ tprintf(T("Major Version: %"PRIu64"\n"),
+ windows_version->major);
+ tprintf(T("Minor Version: %"PRIu64"\n"),
+ windows_version->minor);
+ tprintf(T("Build: %"PRIu64"\n"),
+ windows_version->build);
+ tprintf(T("Service Pack Build: %"PRIu64"\n"),
+ windows_version->sp_build);
+ tprintf(T("Service Pack Level: %"PRIu64"\n"),
+ windows_version->sp_level);
+ }
+}
+
+static int
+xml_write_string(xmlTextWriter *writer, const char *name,
+ const tchar *tstr)
+{
+ if (tstr) {
+ char *utf8_str;
+ int rc = tstr_to_utf8_simple(tstr, &utf8_str);
+ if (rc)
+ return rc;
+ rc = xmlTextWriterWriteElement(writer, name, utf8_str);
+ FREE(utf8_str);
+ if (rc < 0)
+ return rc;
+ }
+ return 0;
+}
+
+static int
+xml_write_strings_from_specs(xmlTextWriter *writer,
+ const void *struct_with_strings,
+ const struct xml_string_spec specs[],
+ size_t num_specs)
+{
+ for (size_t i = 0; i < num_specs; i++) {
+ int rc = xml_write_string(writer, specs[i].name,
+ *(const tchar * const *)
+ (struct_with_strings + specs[i].offset));
+ if (rc)
+ return rc;