public uint Create(string Path, string Name, uint Type, uint MaximumAllowed, string Description, string Password, Win32SecurityDescriptor Access) { ManagementObjectCollection moc = wmi.GetWSqlFromWMI("select * from Win32_Share where Name='" + this.Name.ToString() + "'"); ManagementObject mop = null; foreach (ManagementObject mo in moc) { mop = mo; } ManagementBaseObject inbo = mop.GetMethodParameters("Create"); inbo["Path"] = Path; inbo["Name"] = Name; inbo["Type"] = Type; inbo["MaximumAllowed"] = MaximumAllowed; inbo["Description"] = Description; inbo["Password"] = Password; inbo["Access"] = Access; ManagementBaseObject outbo = mop.InvokeMethod("Create", inbo, null); uint a = (uint)outbo["ReturnValue"]; return(a); }
public override uint ChangeSecurityPermissions(Win32SecurityDescriptor SecurityDescriptor, uint Option) { ManagementObjectCollection moc = wmi.GetWSqlFromWMI("select * from Win32_Directory where Name='" + this.Name.ToString().Replace(@"\", @"\\") + "'"); ManagementObject mop = null; uint a = 0; foreach (ManagementObject mo in moc) { mop = mo; } a = (uint)mop.InvokeMethod("ChangeSecurityPermissions", new object[] { SecurityDescriptor, Option }); return(a); }
public uint SetSecurityDescriptor(Win32SecurityDescriptor Descriptor) { Descriptor = null; ManagementObjectCollection moc = wmi.GetWSqlFromWMI("select * from Win32_Service where Name='" + this.Name.ToString() + "'"); ManagementObject mop = null; foreach (ManagementObject mo in moc) { mop = mo; } ManagementBaseObject inbo = mop.GetMethodParameters("SetSecurityDescriptor"); inbo["Descriptor"] = Descriptor; ManagementBaseObject outbo = mop.InvokeMethod("SetSecurityDescriptor", inbo, null); uint a = (uint)outbo["ReturnValue"]; return(a); }