Beispiel #1
0
        private void DoNetServerEnum2(string domain, uint types, int level,
                                      MarshalBuffer param, MarshalBuffer data)
        {
            int pos = 0;

            pos += param.SetShortAt(pos, NetShareEnum2);
            // parameter descriptor string
            pos += param.SetZtAsciiStringAt(pos, "WrLehDz");

            // the data descriptor string for the (returned) data
            switch (level)
            {
            case 0:
                pos += param.SetZtAsciiStringAt(pos, "B16");
                break;

            case 1:
                pos += param.SetZtAsciiStringAt(pos, "B16BBDz");
                break;

            default:
                Debug.WriteLine(Debug.Error, "Invalid NetServerEnum2 level");
                throw new ApplicationException("doNetServerEnum2");
            }


            // corresponding to the "W": Level 1
            pos += param.SetShortAt(pos, level);

            // buffer size
            pos += param.SetShortAt(pos, fReturnBufferSize);

            if (domain == null)
            {
                types |= CifsServerInfo.SV_TYPE_DOMAIN_ENUM;
            }

            // select types
            pos += param.SetIntAt(pos, (Int32)types);


            // domain
            if (domain != null)
            {
                pos += param.SetZtAsciiStringAt(pos, domain);
            }
            else
            {
                pos += param.SetByteAt(pos, 0);
            }

            param.Size = pos;


            SendTransaction(null, "\\PIPE\\LANMAN", param, null, 0);
            receiveTransaction(param, data);


            int error = param.GetShortAt(0);

            // ignore more data
            if (error != 0 && error != 234)
            {
                throw CifsIoException.getLMException(error);
            }
        }