in Amazon.KinesisTap.Hosting/FileSystemUtility.cs [151:220]
private static extern SafeFileHandle CreateFile(
string lpFileName,
FileAccessDword dwDesiredAccess,
FileShareDword dwShareMode,
IntPtr lpSecurityAttributes,
CreationDispositionDword dwCreationDisposition,
FileAttributesDword dwFlagsAndAttributes,
IntPtr hTemplateFile);
/// <summary>
/// API binding for DeviceIoControl function (https://docs.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-deviceiocontrol?redirectedfrom=MSDN).
/// </summary>
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode,
IntPtr lpInBuffer, int nInBufferSize,
IntPtr lpOutBuffer, int nOutBufferSize,
out int lpBytesReturned, IntPtr lpOverlapped);
/// <summary>
/// Struct to store reparse data per https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_reparse_data_buffer.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
private struct REPARSE_DATA_BUFFER
{
/// <summary>
/// Reparse point tag. Must be a Microsoft reparse point tag.
/// </summary>
public uint ReparseTag;
/// <summary>
/// Size, in bytes, of the reparse data in the buffer that DataBuffer points to.
/// </summary>
public ushort ReparseDataLength;
/// <summary>
/// Length, in bytes, of the unparsed portion of the file name pointed to by the FileName member of the associated file object.
/// </summary>
public ushort Reserved;
/// <summary>
/// Offset, in bytes, of the substitute name string in the PathBuffer array.
/// </summary>
public ushort SubstituteNameOffset;
/// <summary>
/// Length, in bytes, of the substitute name string. If this string is null-terminated,
/// SubstituteNameLength does not include space for the null character.
/// </summary>
public ushort SubstituteNameLength;
/// <summary>
/// Offset, in bytes, of the print name string in the PathBuffer array.
/// </summary>
public ushort PrintNameOffset;
/// <summary>
/// Length, in bytes, of the print name string. If this string is null-terminated,
/// PrintNameLength does not include space for the null character.
/// </summary>
public ushort PrintNameLength;
/// <summary>
/// A buffer containing the unicode-encoded path string.
/// </summary>
/// <remarks>
/// The size of this buffer is set so that the entire struct has size MAXIMUM_REPARSE_DATA_BUFFER_SIZE (which is 16*1024).
/// </remarks>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3FF0)]
public byte[] PathBuffer;
}