Export (0) Print
Expand All

FILE_LINK_INFORMATION structure

The FILE_LINK_INFORMATION structure is used to create an NTFS hard link to an existing file.

Syntax


typedef struct _FILE_LINK_INFORMATION {
  BOOLEAN ReplaceIfExists;
  HANDLE  RootDirectory;
  ULONG   FileNameLength;
  WCHAR   FileName[1];
} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;

Members

ReplaceIfExists

Set to TRUE to specify that if the link already exists, it should be replaced with the new link. Set to FALSE if the link creation operation should fail if the link already exists.

RootDirectory

If the link is to be created in the same directory as the file that is being linked to, or if the FileName member contains the full pathname for the link to be created, this is NULL. Otherwise it is a handle for the directory where the link is to be created.

FileNameLength

Length, in bytes, of the file name string.

FileName

The first character of the name to be assigned to the newly created link. This is followed in memory by the remainder of the string. If the RootDirectory member is NULL and the link is to be created in a different directory from the file that is being linked to, this member specifies the full pathname for the link to be created. Otherwise, it specifies only the file name. (See the Remarks section for ZwQueryInformationFile for details on the syntax of this file name string.)

Remarks

The FILE_LINK_INFORMATION structure is used to create an NTFS hard link to an existing file. This operation can be performed in either of the following ways:

  • Call FltSetInformationFile or ZwSetInformationFile, passing FileLinkInformation as the value of FileInformationClass and passing a caller-allocated, FILE_LINK_INFORMATION-structured buffer as the value of FileInformation. The FileHandle parameter specifies the existing file to which the hard link should point.

  • Create an IRP with major function code IRP_MJ_SET_INFORMATION.

No specific access rights are required to set this information.

File system minifilters must use FltSetInformationFile, not ZwSetInformationFile, to set this information for a file.

For more information about NTFS hard links, see the Microsoft Windows SDK documentation for the Win32 CreateHardLink function.

The size of the FileInformation buffer passed to FltSetInformationFile or ZwSetInformationFile must be at least sizeof(FILE_LINK_INFORMATION).

This structure must be aligned on a LONG (4-byte) boundary.

Requirements

Header

Ntifs.h (include Ntifs.h or Fltkernel.h)

See also

FltSetInformationFile
IRP_MJ_SET_INFORMATION
ZwQueryInformationFile
ZwSetInformationFile

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft