From d482ed88724b9dc84ee5f2b70252d4aab6b837d9 Mon Sep 17 00:00:00 2001 From: Debulois Date: Wed, 19 Oct 2022 12:43:49 +0200 Subject: Initial commit --- WinKeyRecover/KeyChecker/GetProductDescription.cs | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 WinKeyRecover/KeyChecker/GetProductDescription.cs (limited to 'WinKeyRecover/KeyChecker/GetProductDescription.cs') diff --git a/WinKeyRecover/KeyChecker/GetProductDescription.cs b/WinKeyRecover/KeyChecker/GetProductDescription.cs new file mode 100644 index 0000000..3a42418 --- /dev/null +++ b/WinKeyRecover/KeyChecker/GetProductDescription.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace WinKeyRecover +{ + internal class GetProductDescription + { + public string Get(string aid, string fileXml) + { + XmlDocument xmlDocument = new XmlDocument(); + xmlDocument.Load(fileXml); + Stream inStream = new MemoryStream(Convert.FromBase64String(xmlDocument.GetElementsByTagName("tm:infoBin")[0].InnerText)); + xmlDocument.Load(inStream); + XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDocument.NameTable); + xmlNamespaceManager.AddNamespace("pkc", "http://www.microsoft.com/DRM/PKEY/Configuration/2.0"); + XmlNode xmlNode = xmlDocument.SelectSingleNode("/pkc:ProductKeyConfiguration/pkc:Configurations/pkc:Configuration[pkc:ActConfigId='" + aid + "']", xmlNamespaceManager); + if (xmlNode == null) + { + xmlNode = xmlDocument.SelectSingleNode("/pkc:ProductKeyConfiguration/pkc:Configurations/pkc:Configuration[pkc:ActConfigId='" + aid.ToUpper() + "']", xmlNamespaceManager); + } + return xmlNode.ChildNodes.Item(3).InnerText; + } + } +} -- cgit v1.2.3