X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fxml.c;h=142c1a91a6f4d9f20dba78454a56ba66c6e6d906;hp=cafc14f4788cda5722cba8e837d2ce33ce097db5;hb=cd9835b342c9956e1e1563afaf96e045aa39fd44;hpb=5695db8f27535e50a8159a226902687fe32ffe9a diff --git a/src/xml.c b/src/xml.c index cafc14f4..142c1a91 100644 --- a/src/xml.c +++ b/src/xml.c @@ -62,6 +62,7 @@ struct windows_info { tchar *product_name; tchar *edition_id; tchar *installation_type; + tchar *pkeyconfigversion; tchar *hal; tchar *product_type; tchar *product_suite; @@ -258,6 +259,9 @@ node_get_string(const xmlNode *string_node, tchar **tstr_ret) tchar *tstr = NULL; int ret; + if (*tstr_ret) + return 0; + for_node_child(string_node, child) { if (node_is_text(child) && child->content) { ret = utf8_to_tstr_simple(child->content, &tstr); @@ -314,6 +318,7 @@ destroy_windows_info(struct windows_info *windows_info) FREE(windows_info->hal); FREE(windows_info->product_type); FREE(windows_info->product_suite); + FREE(windows_info->pkeyconfigversion); for (size_t i = 0; i < windows_info->num_languages; i++) FREE(windows_info->languages[i]); FREE(windows_info->languages); @@ -449,7 +454,19 @@ xml_read_windows_info(const xmlNode *windows_node, ret = node_get_string(child, &windows_info->system_root); } else if (node_name_is(child, "HAL")) { ret = node_get_string(child, &windows_info->hal); + } else if (node_name_is(child, "SERVICINGDATA")) { + xmlNode *grandchild; + + for_node_child(child, grandchild) { + if (node_is_element(grandchild) && + node_name_is(grandchild, "PKEYCONFIGVERSION")) + { + ret = node_get_string(grandchild, + &windows_info->pkeyconfigversion); + } + } } + if (ret != 0) return ret; } @@ -815,6 +832,21 @@ xml_write_windows_info(xmlTextWriter *writer, return rc; } + if (windows_info->pkeyconfigversion) { + rc = xmlTextWriterStartElement(writer, "SERVICINGDATA"); + if (rc < 0) + return rc; + + rc = xml_write_string(writer, "PKEYCONFIGVERSION", + windows_info->pkeyconfigversion); + if (rc) + return rc; + + rc = xmlTextWriterEndElement(writer); + if (rc < 0) + return rc; + } + if (windows_info->windows_version_exists) { rc = xml_write_windows_version(writer, &windows_info->windows_version); if (rc) @@ -949,6 +981,12 @@ clone_windows_info(const struct windows_info *old, struct windows_info *new) if (ret) return ret; + if (old->pkeyconfigversion) { + new->pkeyconfigversion = TSTRDUP(old->pkeyconfigversion); + if (new->pkeyconfigversion == NULL) + return WIMLIB_ERR_NOMEM; + } + if (old->languages) { new->languages = CALLOC(old->num_languages, sizeof(new->languages[0])); if (!new->languages)