I can get text data from the registry, but I cannot get data in byte format.

const long HKLM = 0x80000002;//HKEY_LOCAL_MACHINE String strKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall"; ManagementScope scope = fc.connect2((String)computerName); try { scope.Connect(); ManagementClass registry = new ManagementClass(scope, new ManagementPath("StdRegProv"), null); ManagementBaseObject inParams = registry.GetMethodParameters("EnumKey"); inParams["hDefKey"] = HKLM; inParams["sSubKeyName"] = strKey; ManagementBaseObject outParams = registry.InvokeMethod("EnumKey", inParams, null); string[] programGuids = outParams["sNames"] as string[]; foreach (string subKeyName in programGuids) { inParams = registry.GetMethodParameters("GetStringValue"); inParams["hDefKey"] = HKLM;//HKEY_LOCAL_MACHINE inParams["sSubKeyName"] = strKey + @"\" + subKeyName; inParams["sValueName"] = "DisplayName";//Получить имя компа // Read Registry Value outParams = registry.InvokeMethod("GetStringValue", inParams, null); if (outParams.Properties["sValue"].Value != null) { string softwareName = outParams.Properties["sValue"].Value.ToString(); programs.Add(softwareName+":"+(String)computerName); } } } catch (Exception e2) { Action act1 = () => { listBox1.Items.Add("Не доступен: " + computerName); }; Invoke(act1); } Action action = () => { kolvoPC++; progressBar1.Value = kolvoPC; }; Invoke(action); 

This is where I get the DisplayName. I can get any string data, but how can I get, for example, Language or SystemComponent, which have data in byte format?

  • Need a code that does not work. - Vladimir Martyanov
  • If I change inParams ["sValueName"] = "DisplayName" to inParams ["sValueName"] = "SystemComponent", then it simply finds nothing. Need to somehow get the binary data from the registry - AlexSirk
  • In the question you need the code with which you understand. Well, look carefully what you are pulling for binary (!!!) data: GetStringValue - Vladimir Martyanov
  • I use Delphi instead of "GetDWORDValue". If still relevant. For binary "GetBinaryValue". "GetStringValue" - only for strings ... - Albert Fomin

0