【发布时间】:2011-12-16 12:37:44
【问题描述】:
我无法从 USBSTOR 注册表项中获取 REG_DWORD 数据,但我可以获取 REG_SZ 类型的“DisplayName”数据
ManagementScope myScope = new ManagementScope("\\\\" + strComputer + "\\root\\default");
ManagementPath mypath = new ManagementPath("StdRegProv");
ManagementClass mc = new ManagementClass(myScope, mypath, null);
ManagementBaseObject inParams = mc.GetMethodParameters("GetStringValue");
inParams["sSubKeyName"] = @"SYSTEM\CurrentControlSet\services\USBSTOR";
inParams["sValueName"] = "DisplayName";
ManagementBaseObject outParams = mc.InvokeMethod("GetStringValue", inParams, null);
Console.WriteLine(outParams["Type"].ToString());
【问题讨论】: