Git Product home page Git Product logo

Comments (1)

GuyTe avatar GuyTe commented on July 20, 2024

The C# code we use for something similar is:
(for multi-valued attributes you need to iterate over byte[][] and parse each byte[] to DsName)
`

    public DsName(byte[] binaryVal)
    {
        int currPos = 0;
        StructLength = BitConverter.ToUInt32(binaryVal, currPos);
        currPos = 4;
        _sidLength = BitConverter.ToUInt32(binaryVal.Skip(currPos).Take(4).ToArray(), 0);
        currPos += 4;

        byte[] guidBytes = binaryVal.Skip(currPos).Take(16).ToArray();
        ObjectGuid = new Guid(guidBytes);
        currPos += 16;

        // The size of this field is exactly 28 bytes, regardless of the value of SidLen, 
        // which specifies how many bytes in this field are used.
        byte[] sidBytes = binaryVal.Skip(currPos).Take(28).ToArray();
        Sid = (_sidLength > 0) ? new SecurityIdentifier(sidBytes, 0) : null;
        currPos += 28;

        _nameLength = BitConverter.ToUInt32(binaryVal.Skip(currPos).Take(4).ToArray(), 0);
        currPos += 4;

        DistinguishedName = Encoding.Unicode.GetString(binaryVal.Skip(currPos).Take((int)(_nameLength*2)).ToArray());
    }

`

from dsinternals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.