NetrShareSetInfo() публичный Метод

The NetrShareSetInfo method sets the parameters of a shared resource in a ShareList.
public NetrShareSetInfo ( string ServerName, string NetName, SHARE_ENUM_STRUCT_LEVEL Level, Microsoft.Protocols.TestTools.StackSdk.Srvs.SHARE_INFO InfoStruct, uint &ParmErr ) : uint
ServerName string A string that identifies the server. If this parameter is NULL, the local computer is used.
NetName string The name of the share to return information for.
Level SHARE_ENUM_STRUCT_LEVEL Specifies the information level of the data. This parameter MUST be one of the following values.
InfoStruct Microsoft.Protocols.TestTools.StackSdk.Srvs.SHARE_INFO Its contents are determined by the value of the Level parameter, as shown in the preceding table. /// This parameter MUST NOT contain a null value.
ParmErr uint An integer value that receives the index of the first member of the share information /// structure that caused the ERROR_INVALID_PARAMETER error, if it occurs
Результат uint
 protected void SetShareInfo(string sharePath, SHARE_INFO_502_I shareInfo)
 {
     using (SrvsClient srvsClient = new SrvsClient(TestConfig.Timeout))
     {
         srvsClient.Bind(TestConfig.SutComputerName, TestConfig.AccountCredential, null);
         SHARE_INFO info = new SHARE_INFO { ShareInfo502 = shareInfo };
         uint? parmErr = 0;
         uint retVal = srvsClient.NetrShareSetInfo(@"\\" + TestConfig.SutComputerName, sharePath, SHARE_ENUM_STRUCT_LEVEL.Level502, info, ref parmErr);
         if (retVal != 0)
         {
             BaseTestSite.Assert.Fail("Fail to get share info through MS-SRVS.");
         }
         srvsClient.UnBind();
     }
 }
        protected void SetShareInfo(string sharePath, SHARE_INFO_502_I shareInfo)
        {
            using (SrvsClient srvsClient = new SrvsClient(TestConfig.Timeout))
            {
                ClientSecurityContext securityContext =
                new SspiClientSecurityContext(
                    TestConfig.DefaultSecurityPackage,
                    TestConfig.AccountCredential,
                    Smb2Utility.GetCifsServicePrincipalName(TestConfig.SutComputerName),
                    ClientSecurityContextAttribute.Connection
                        | ClientSecurityContextAttribute.DceStyle
                        | ClientSecurityContextAttribute.Integrity
                        | ClientSecurityContextAttribute.ReplayDetect
                        | ClientSecurityContextAttribute.SequenceDetect
                        | ClientSecurityContextAttribute.UseSessionKey,
                    SecurityTargetDataRepresentation.SecurityNativeDrep);

                srvsClient.Bind(TestConfig.SutComputerName, TestConfig.AccountCredential, securityContext);
                SHARE_INFO info = new SHARE_INFO { ShareInfo502 = shareInfo };
                uint? parmErr = 0;
                uint retVal = srvsClient.NetrShareSetInfo(@"\\" + TestConfig.SutComputerName, sharePath, SHARE_ENUM_STRUCT_LEVEL.Level502, info, ref parmErr);
                if (retVal != 0)
                {
                    BaseTestSite.Assert.Fail("Fail to get share info through MS-SRVS.");
                }
                srvsClient.UnBind();
            }
        }