Create/show reparse point (junction)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Does anybody know how to create and show a reparse point in c#? I'm able to determine if a folder is a reparse point or not by looking at the file attributes, but how do I get the reparse info

/Mathias
 
Hi!

Does anybody know how to create and show a reparse point in c#? I'm able
to determine if a folder is a reparse point or not by looking at the file
attributes, but how do I get the reparse info?

Hello,

you should use the DeviceIoControl function (using interop)

[DllImport("kernel32.dll")]
public static extern bool DeviceIoControl(IntPtr hDevice, uint
dwIoControlCode, byte [] lpInBuffer, uint nInBufferSize, [Out] byte []
lpOutBuffer, uint nOutBufferSize, IntPtr lpBytesReturned, IntPtr
lpOverlapped);

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/deviceiocontrol.asp
 
Thanks for your reply

I have been looking at this solution, bu I havn't gotten it to work. My problem was that it needed a struct which I wasn't able to convert to c#. Do you know how to do it

/Mathia

----- Francois Beaussier wrote: ----

to determine if a folder is a reparse point or not by looking at the fil
attributes, but how do I get the reparse info

Hello

you should use the DeviceIoControl function (using interop

[DllImport("kernel32.dll")
public static extern bool DeviceIoControl(IntPtr hDevice, uin
dwIoControlCode, byte [] lpInBuffer, uint nInBufferSize, [Out] byte [
lpOutBuffer, uint nOutBufferSize, IntPtr lpBytesReturned, IntPt
lpOverlapped)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/deviceiocontrol.as
 
:
I have been looking at this solution, bu I havn't gotten it to work. My
problem was that it needed a struct which I wasn't able to convert to c#. Do
you know how to do it?

Hello,

I'd try the following :

public struct OVERLAPPED
{
IntPtr Internal;
IntPtr InternalHigh;
int Offset;
int OffsetHigh;
IntPtr hEvent;
};

with

[DllImport("kernel32.dll")]
public static extern bool DeviceIoControl(IntPtr hDevice, uint
dwIoControlCode,
byte [] lpInBuffer, uint nInBufferSize, [Out] byte [] lpOutBuffer,
uint nOutBufferSize, IntPtr lpBytesReturned, ref OVERLAPPED lpOverlapped);
 
Back
Top