FesfUtil2UpdateHeaderUnsafe Function

Replaces the existing Solution Header on the file indicated by FileToUpdate with the Solution Header provided in NewHeader. Opens the file "shared" and thus presents a risk of other programs simultaneously accessing (and possibly updating) the file's header directly via a call to FesfUtil2 or via other ordinary operations by FESF.  When possible, we strongly urge using the function FesfUtil2UpdateHeaderExclusive in preference to this function.

Syntax (C++)

void

FesfUtil2UpdateHeaderUnsafe(std::wstring_view FileToUpdate,

                            const FESF_UTIL2_SOLUTION_HEADER &NewHeader);

Syntax (C)

DWORD

FesfUtil2UpdateHeaderUnsafe_C(

     [in] LPCWSTR FileToUpdate,

     [in] PVOID HeaderBuffer,

     [in] DWORD HeaderLength);

Parameters

FileToUpdate

Fully qualified path of file to operate on.

NewHeader

Header to be substituted for the existing header.

Throws

Throws an FEU2Exception if an error is encountered.

Remarks

Requires the caller to have SeRestorePrivilege.  If the privilege is not already activated, it will be activated by the function and deactivated before return.

NewHeader must fit in the existing Solution Header space.  That is, it must not be larger than the MaxLength size returned when the existing Solution Header is read. To write a header that is larger than the existing maximum size, use FesfUtil2UpdateHeaderExclusiveWithExtension.

This function only supports local files. It can NOT be used to read the header of a file that is accessed via the network.

Replaces

IFesfUtil2:: UpdateHeaderUnsafe and IFesfUtil2:: UpdateHeaderUnsafeFQP