PolApproveCreateLink callback function

A Policy DLL's PolApproveCreateLink callback function is called to allow the Policy DLL to approve or reject the creation of a hard link on a supported file system.

Syntax

POL_APPROVE_CREATE_LINK PolApproveCreateLink;

 

bool

PolApproveCreateLink(

    _In_  FE_POLICY_PATH_INFORMATION *PolicyPathInfo,

    _In_  DWORD ThreadId,

    _In_  FE_POLICY_PATH_INFORMATION *LinkPolicyPathInfo

)

Parameters

PolicyPathInfo [in]

A pointer to an FESF allocated FE_POLICY_PATH_INFORMATION structure describing the name of the file to which the hard link is being created.

If FESF has determined that the source file is in a “bypass” region, then the FE_POLICY_PATH_NAME_BYPASS flag will be set. A bypass region is one in which file opens are always raw (because of interoperability issues).

If the requested rename is to replace an existing file (if one exists) then the FE_POLICY_PATH_REPLACE_IF_EXISTS flag is set.

ThreadId [in]

The identifier of the thread attempting to create the hard link.

LinkPolicyPathInfo [in]

A pointer to an FESF allocated FE_POLICY_PATH_INFORMATION structure describing the proposed new hard link name.

Note that if Windows has not been able supply the new name then the FE_POLICY_PATH_TARGET_NAME_INVALID flag will be set and the RelativePath will be invalid.

This is often provoked by creating a link “through” a directory symbolic link to a network Share.

If FESF has determined that the new name will be in a “bypass” region then the FE_POLICY_PATH_NAME_BYPASS flag will be set. A bypass region is one in which file opens are always raw (because of interoperability issues).

Return value

To approve the creation of the hard link, the PolApproveCreateLink callback function returns TRUE.  Otherwise, it returns FALSE.

If FALSE is returned, FESF will fail the thread's CreateHardLink operation.   How the requesting thread/process reacts to having this error returned is dependent on the thread/process.

Remarks

A Policy DLL's PolApproveCreateLink callback function is called by FESF to allow the Policy DLL to approve or reject the creation of a hard link on a supported file system.

Implementation of this callback function is optional for a Policy DLL.  If this function is not implemented, FESF uses the behavior specified during initialization in the field OfflineBehavior.ApproveCreateLink.

Solution developers should be VERY cautious about returning FALSE from this callback as a result of what should be non-fatal errors. For example, if you return FALSE (thereby disallowing the requested hardlink operation) as a result of a function such as GetExecutablePathForThreadId or GetSidForThreadId failing due to a system protection issue, important Windows system activities such as Windows Update can fail.  We advise you to use caution and good engineering judgement.

Examples

 

See Also

 

Requirements

Software version

FESF V1 (or later)

Library

FESFPolicy.lib

Header

PolDllApi.h