NetrShareGetInfo() public method

The NetrShareGetInfo method retrieves information about a particular shared resource on the server from the ShareList.
public NetrShareGetInfo ( string ServerName, string NetName, SHARE_ENUM_STRUCT_LEVEL Level, Microsoft.Protocols.TestTools.StackSdk.Srvs.SHARE_INFO &InfoStruct ) : 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.
return uint
コード例 #1
0
        protected SHARE_INFO_502_I GetShareInfo(string sharePath)
        {
            using (SrvsClient srvsClient = new SrvsClient(TestConfig.Timeout))
            {
                srvsClient.Bind(TestConfig.SutComputerName, TestConfig.AccountCredential, null);

                SHARE_INFO? shareInfo;
                uint retVal = srvsClient.NetrShareGetInfo(@"\\" + TestConfig.SutComputerName, sharePath, SHARE_ENUM_STRUCT_LEVEL.Level502, out shareInfo);
                if (retVal != 0 || shareInfo == null || shareInfo.Value.ShareInfo502 == null)
                {
                    BaseTestSite.Assert.Fail("Fail to get share info through MS-SRVS.");
                }
                srvsClient.UnBind();
                return shareInfo.Value.ShareInfo502.Value;
            }
        }
コード例 #2
0
        protected SHARE_INFO_502_I GetShareInfo(string sharePath)
        {
            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? shareInfo;
                uint retVal = srvsClient.NetrShareGetInfo(@"\\" + TestConfig.SutComputerName, sharePath, SHARE_ENUM_STRUCT_LEVEL.Level502, out shareInfo);
                if (retVal != 0 || shareInfo == null || shareInfo.Value.ShareInfo502 == null)
                {
                    BaseTestSite.Assert.Fail("Fail to get share info through MS-SRVS.");
                }
                srvsClient.UnBind();
                return shareInfo.Value.ShareInfo502.Value;
            }
        }