private string GetShare(ShareFlags_Values shareFlags, Share_Capabilities_Values shareCap = Share_Capabilities_Values.NONE)
 {
     if (detectionInfo.shareInfo != null)
     {
         foreach (var item in detectionInfo.shareInfo)
         {
             ShareFlags_Values itemshareFlags = item.ShareFlags & shareFlags;
             Share_Capabilities_Values itemshareCap = item.ShareCapabilities & shareCap;
             if (item.ShareType == ShareType_Values.SHARE_TYPE_DISK && itemshareFlags == shareFlags && itemshareCap == shareCap)
                 return item.ShareName;
         }
     }
     return string.Empty;
 }
        public Smb2TreeConnectResponsePacket CreateTreeConnectResponse(
            Smb2Endpoint endpoint,
            ulong messageId,
            uint treeId,
            ShareType_Values shareType,
            ShareFlags_Values shareFlags,
            Capabilities_Values capabilities,
            _ACCESS_MASK maximalAccess
            )
        {
            Smb2TreeConnectResponsePacket packet = new Smb2TreeConnectResponsePacket();

            SetHeader(packet, endpoint, messageId);

            packet.Header.TreeId = treeId;
            packet.PayLoad.Capabilities = capabilities;
            packet.PayLoad.MaximalAccess = maximalAccess;
            packet.PayLoad.Reserved = Reserved_Values.V1;
            packet.PayLoad.ShareFlags = shareFlags;
            packet.PayLoad.ShareType = shareType;
            packet.PayLoad.StructureSize = StructureSize_Values.V1;

            packet.Sign();

            return packet;
        }