【发布时间】:2018-03-01 03:28:14
【问题描述】:
我正在尝试使用以下代码在计算机管理共享中创建共享文件夹
ManagementClass managementClass = new ManagementClass("Win32_Share");
ManagementBaseObject inParams = managementClass.GetMethodParameters("Create");
ManagementBaseObject outParams;
inParams["Description"] = Description;
inParams["Name"] = ShareName;
inParams["Path"] = FolderPath;
inParams["Type"] = 0x0; // Disk Drive
outParams = managementClass.InvokeMethod("Create", inParams, null);
var res = (uint)(outParams.Properties["ReturnValue"].Value);
res 总是返回 2。
任何人都可以在这方面提供帮助吗? 它 2 是什么意思,所有其他输出参数是什么?
【问题讨论】:
-
"2" 表示访问被拒绝。 Win32_Share