Skip to content

What is the format of reparseData for junctions? #525

Answered by hach-que
hach-que asked this question in Q&A
Discussion options

You must be logged in to vote

It turns out the resulting data was missing a few null bytes at the end. The following code works to return junctions:

public override int GetReparsePointByName(string fileName, bool isDirectory, ref byte[] reparseData)
{
    var junctions = _additionalJunctions;
    if (junctions.ContainsKey(fileName))
    {
        var target = junctions[fileName];
        var targetByteLength = (ushort)(target.Length * 2);

        using (var memory = new MemoryStream())
        {
            memory.Write(BitConverter.GetBytes((uint)2684354563U));
            memory.Write(BitConverter.GetBytes((ushort)(targetByteLength + 12)));
            memory.Write(BitConverter.GetBytes((ushort)0));
            memory

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@billziss-gh
Comment options

Answer selected by hach-que
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants